Cantera  3.3.0a1
Loading...
Searching...
No Matches
ReactorSurface.h
Go to the documentation of this file.
1//! @file ReactorSurface.h Header file for class ReactorSurface
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
6#ifndef CT_REACTOR_SURFACE_H
7#define CT_REACTOR_SURFACE_H
8
10
11namespace Cantera
12{
13
14class SurfPhase;
15
16//! A surface where reactions can occur that is in contact with the bulk fluid of a
17//! Reactor.
18//! @ingroup reactorGroup
20{
21public:
22 //! Create a new ReactorSurface
23 //! @param soln Thermodynamic and kinetic model representing species and reactions
24 //! on the surface
25 //! @param clone Determines whether to clone `soln` so that the internal state of
26 //! this reactor surface is independent of the original Solution (Interface)
27 //! object and any Solution objects used by other reactors in the network.
28 //! @param reactors One or more reactors whose phases participate in reactions
29 //! occurring on the surface. For the purpose of rate evaluation, the
30 //! temperature of the surface is set equal to the temperature of the first
31 //! reactor specified.
32 //! @param name Name used to identify the surface
33 //! @since Constructor signature including `reactors` and `clone` arguments
34 //! introduced in %Cantera 3.2.
35 ReactorSurface(shared_ptr<Solution> soln,
36 const vector<shared_ptr<ReactorBase>>& reactors,
37 bool clone,
38 const string& name="(none)");
39
40 //! String indicating the wall model implemented.
41 string type() const override {
42 return "ReactorSurface";
43 }
44
45 //! Returns the surface area [m²]
46 double area() const override;
47
48 //! Set the surface area [m²]
49 void setArea(double a) override;
50
51 //! Accessor for the SurfPhase object
53 return m_surf.get();
54 }
55
56 //! Accessor for the InterfaceKinetics object
58 return m_kinetics.get();
59 }
60
61 void addInlet(FlowDevice& inlet) override {
62 throw NotImplementedError("ReactorSurface::addInlet",
63 "Inlets are undefined for reactors of type '{}'.", type());
64 }
65
66 void addOutlet(FlowDevice& outlet) override {
67 throw NotImplementedError("ReactorSurface::addOutlet",
68 "Outlets are undefined for reactors of type '{}'.", type());
69 }
70
71 void addWall(WallBase& w, int lr) override {
72 throw NotImplementedError("ReactorSurface::addWall");
73 }
74
75 void addSurface(ReactorSurface* surf) override {
76 throw NotImplementedError("ReactorSurface::addSurface");
77 }
78
79 //! Set the surface coverages. Array `cov` has length equal to the number of
80 //! surface species.
81 void setCoverages(const double* cov);
82
83 //! Set the surface coverages by name
84 void setCoverages(const Composition& cov);
85
86 //! Set the surface coverages by name
87 void setCoverages(const string& cov);
88
89 //! Get the surface coverages. Array `cov` should have length equal to the
90 //! number of surface species.
91 void getCoverages(double* cov) const;
92
93 //! Set the coverages and temperature in the surface phase object to the
94 //! values for this surface. The temperature is set to match the bulk phase
95 //! of the attached Reactor.
96 //! @since Prior to %Cantera 3.2, this operation was performed by syncState()
97 void restoreState() override;
98
99 //! Set the coverages for this ReactorSurface based on the attached SurfPhase.
100 //! @since Behavior changed in %Cantera 3.2 for consistency with
101 //! ReactorBase::syncState(). Previously, this method performed the inverse
102 //! operation of setting the ReactorSurface state based on the SurfPhase and
103 //! attached Reactor.
104 void syncState() override;
105
106 void addSensitivityReaction(size_t rxn) override;
107
108 //! Set reaction rate multipliers. `params` is the global vector of
109 //! sensitivity parameters. This function is called within
110 //! ReactorNet::eval() before the reaction rates are evaluated.
111 void setSensitivityParameters(const double* params);
112
113 //! Set reaction rate multipliers back to their initial values. This
114 //! function is called within ReactorNet::eval() after all rates have been
115 //! evaluated.
117
118protected:
119 double m_area = 1.0;
120
121 shared_ptr<SurfPhase> m_surf;
122 shared_ptr<Kinetics> m_kinetics;
123 vector<ReactorBase*> m_reactors;
124 vector<double> m_cov;
125};
126
127}
128
129#endif
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Definition FlowDevice.h:25
Public interface for kinetics managers.
Definition Kinetics.h:126
An error indicating that an unimplemented function has been called.
Base class for reactor objects.
Definition ReactorBase.h:49
FlowDevice & outlet(size_t n=0)
Return a reference to the n-th outlet FlowDevice connected to this reactor.
FlowDevice & inlet(size_t n=0)
Return a reference to the n-th inlet FlowDevice connected to this reactor.
string name() const
Return the name of this reactor.
Definition ReactorBase.h:79
A surface where reactions can occur that is in contact with the bulk fluid of a Reactor.
void restoreState() override
Set the coverages and temperature in the surface phase object to the values for this surface.
double area() const override
Returns the surface area [m²].
void addSurface(ReactorSurface *surf) override
Add a ReactorSurface object to a Reactor object.
void addOutlet(FlowDevice &outlet) override
Connect an outlet FlowDevice to this reactor.
void setSensitivityParameters(const double *params)
Set reaction rate multipliers.
void setArea(double a) override
Set the surface area [m²].
string type() const override
String indicating the wall model implemented.
void getCoverages(double *cov) const
Get the surface coverages.
void resetSensitivityParameters()
Set reaction rate multipliers back to their initial values.
void addSensitivityReaction(size_t rxn) override
Add a sensitivity parameter associated with the reaction number rxn
void syncState() override
Set the coverages for this ReactorSurface based on the attached SurfPhase.
void setCoverages(const double *cov)
Set the surface coverages.
SurfPhase * thermo()
Accessor for the SurfPhase object.
Kinetics * kinetics()
Accessor for the InterfaceKinetics object.
void addInlet(FlowDevice &inlet) override
Connect an inlet FlowDevice to this reactor.
void addWall(WallBase &w, int lr) override
Insert a Wall between this reactor and another reactor.
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition SurfPhase.h:114
Base class for 'walls' (walls, pistons, etc.) connecting reactors.
Definition Wall.h:23
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
map< string, double > Composition
Map from string names to doubles.
Definition ct_defs.h:177