Cantera  3.2.0a4
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 //! @deprecated To be removed after Cantera 3.2. Replaced by constructor where
41 //! contents and adjacent reactors are specified
42 ReactorSurface(shared_ptr<Solution> sol, const string& name="(none)");
43
44 //! @deprecated To be removed after Cantera 3.2. Replaced by constructor where
45 //! contents and adjacent reactors are specified
46 ReactorSurface(shared_ptr<Solution> sol, bool clone, const string& name="(none)");
47
48 //! String indicating the wall model implemented.
49 string type() const override {
50 return "ReactorSurface";
51 }
52
53 //! Returns the surface area [m^2]
54 double area() const;
55
56 //! Set the surface area [m^2]
57 void setArea(double a);
58
59 //! Accessor for the SurfPhase object
61 return m_surf;
62 }
63
64 //! Accessor for the InterfaceKinetics object
66 return m_kinetics;
67 }
68
69 //! Set the InterfaceKinetics object for this surface
70 //! @deprecated To be removed after %Cantera 3.2. Use constructor with
71 //! Solution object instead.
72 void setKinetics(Kinetics* kin);
73
74 void addInlet(FlowDevice& inlet) override {
75 throw NotImplementedError("ReactorSurface::addInlet",
76 "Inlets are undefined for reactors of type '{}'.", type());
77 }
78
79 void addOutlet(FlowDevice& outlet) override {
80 throw NotImplementedError("ReactorSurface::addOutlet",
81 "Outlets are undefined for reactors of type '{}'.", type());
82 }
83
84 void addWall(WallBase& w, int lr) override {
85 throw NotImplementedError("ReactorSurface::addWall");
86 }
87
88 void addSurface(ReactorSurface* surf) override {
89 throw NotImplementedError("ReactorSurface::addSurface");
90 }
91
92 //! Set the reactor that this Surface interacts with
93 //! @deprecated To be removed after %Cantera 3.2. Superseded by constructor taking
94 //! a list of adjacent reactors.
95 void setReactor(ReactorBase* reactor);
96
97 //! Set the surface coverages. Array `cov` has length equal to the number of
98 //! surface species.
99 void setCoverages(const double* cov);
100
101 //! Set the surface coverages by name
102 void setCoverages(const Composition& cov);
103
104 //! Set the surface coverages by name
105 void setCoverages(const string& cov);
106
107 //! Get the surface coverages. Array `cov` should have length equal to the
108 //! number of surface species.
109 void getCoverages(double* cov) const;
110
111 //! Set the coverages and temperature in the surface phase object to the
112 //! values for this surface. The temperature is set to match the bulk phase
113 //! of the attached Reactor.
114 //! @since Prior to %Cantera 3.2, this operation was performed by syncState()
115 void restoreState() override;
116
117 //! Set the coverages for this ReactorSurface based on the attached SurfPhase.
118 //! @since Behavior changed in %Cantera 3.2 for consistency with
119 //! ReactorBase::syncState(). Previously, this method performed the inverse
120 //! operation of setting the ReactorSurface state based on the SurfPhase and
121 //! attached Reactor.
122 void syncState() override;
123
124 void addSensitivityReaction(size_t rxn) override;
125
126 //! Set reaction rate multipliers. `params` is the global vector of
127 //! sensitivity parameters. This function is called within
128 //! ReactorNet::eval() before the reaction rates are evaluated.
129 void setSensitivityParameters(const double* params);
130
131 //! Set reaction rate multipliers back to their initial values. This
132 //! function is called within ReactorNet::eval() after all rates have been
133 //! evaluated.
135
136protected:
137 void setThermo(ThermoPhase& thermo) override {}
138
139 //! Set the InterfaceKinetics object for this surface.
140 //! Method is needed to prevent compiler warnings by disambiguating from the
141 //! non-protected variant.
142 //! @since New in %Cantera 3.2.
143 //! @deprecated To be removed after %Cantera 3.2. Use constructor with
144 //! Solution object instead.
145 void setKinetics(Kinetics& kin) override;
146
147 double m_area = 1.0;
148
149 SurfPhase* m_surf = nullptr;
150 Kinetics* m_kinetics = nullptr;
151 vector<ReactorBase*> m_reactors;
152 vector<double> m_cov;
153};
154
155}
156
157#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:82
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.
void addSurface(ReactorSurface *surf) override
Add a ReactorSurface object to a Reactor object.
double area() const
Returns the surface area [m^2].
void setReactor(ReactorBase *reactor)
Set the reactor that this Surface interacts with.
void addOutlet(FlowDevice &outlet) override
Connect an outlet FlowDevice to this reactor.
void setSensitivityParameters(const double *params)
Set reaction rate multipliers.
string type() const override
String indicating the wall model implemented.
void getCoverages(double *cov) const
Get the surface coverages.
void setArea(double a)
Set the surface area [m^2].
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 setThermo(ThermoPhase &thermo) override
Specify the mixture contained in the reactor.
void syncState() override
Set the coverages for this ReactorSurface based on the attached SurfPhase.
void setCoverages(const double *cov)
Set the surface coverages.
void setKinetics(Kinetics *kin)
Set the InterfaceKinetics object for this surface.
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:98
Base class for a phase with thermodynamic properties.
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