Cantera  3.1.0
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 Kinetics;
15class SurfPhase;
16
17//! A surface where reactions can occur that is in contact with the bulk fluid of a
18//! Reactor.
19//! @ingroup wallGroup
21{
22public:
23 ReactorSurface(const string& name="(none)") : m_name(name) {}
24 virtual ~ReactorSurface() = default;
25 ReactorSurface(const ReactorSurface&) = delete;
26 ReactorSurface& operator=(const ReactorSurface&) = delete;
27
28 //! String indicating the wall model implemented.
29 virtual string type() const {
30 return "ReactorSurface";
31 }
32
33 //! Retrieve reactor surface name.
34 string name() const {
35 return m_name;
36 }
37
38 //! Set reactor surface name.
39 void setName(const string& name) {
40 m_name = name;
41 }
42
43 //! Set the default name of a wall. Returns `false` if it was previously set.
44 bool setDefaultName(map<string, int>& counts);
45
46 //! Returns the surface area [m^2]
47 double area() const;
48
49 //! Set the surface area [m^2]
50 void setArea(double a);
51
52 //! Accessor for the SurfPhase object
54 return m_thermo;
55 }
56
57 //! Accessor for the InterfaceKinetics object
59 return m_kinetics;
60 }
61
62 //! Set the InterfaceKinetics object for this surface
63 void setKinetics(Kinetics* kin);
64
65 //! Set the reactor that this Surface interacts with
66 void setReactor(ReactorBase* reactor);
67
68 //! Number of sensitivity parameters associated with reactions on this
69 //! surface
70 size_t nSensParams() const {
71 return m_params.size();
72 }
73
74 //! Set the surface coverages. Array `cov` has length equal to the number of
75 //! surface species.
76 void setCoverages(const double* cov);
77
78 //! Set the surface coverages by name
79 void setCoverages(const Composition& cov);
80
81 //! Set the surface coverages by name
82 void setCoverages(const string& cov);
83
84 //! Get the surface coverages. Array `cov` should have length equal to the
85 //! number of surface species.
86 void getCoverages(double* cov) const;
87
88 //! Set the coverages and temperature in the surface phase object to the
89 //! values for this surface. The temperature is set to match the bulk phase
90 //! of the attached Reactor.
91 void syncState();
92
93 //! Enable calculation of sensitivities with respect to the rate constant
94 //! for reaction `i`.
95 void addSensitivityReaction(size_t i);
96
97 //! Set reaction rate multipliers. `params` is the global vector of
98 //! sensitivity parameters. This function is called within
99 //! ReactorNet::eval() before the reaction rates are evaluated.
100 void setSensitivityParameters(const double* params);
101
102 //! Set reaction rate multipliers back to their initial values. This
103 //! function is called within ReactorNet::eval() after all rates have been
104 //! evaluated.
106
107protected:
108 string m_name; //!< Reactor surface name.
109 bool m_defaultNameSet = false; //!< `true` if default name has been previously set.
110
111 double m_area = 1.0;
112
113 SurfPhase* m_thermo = nullptr;
114 Kinetics* m_kinetics = nullptr;
115 ReactorBase* m_reactor = nullptr;
116 vector<double> m_cov;
117 vector<SensitivityParameter> m_params;
118};
119
120}
121
122#endif
Public interface for kinetics managers.
Definition Kinetics.h:125
Base class for stirred reactors.
Definition ReactorBase.h:49
A surface where reactions can occur that is in contact with the bulk fluid of a Reactor.
bool m_defaultNameSet
true if default name has been previously set.
double area() const
Returns the surface area [m^2].
void setReactor(ReactorBase *reactor)
Set the reactor that this Surface interacts with.
void setSensitivityParameters(const double *params)
Set reaction rate multipliers.
virtual string type() const
String indicating the wall model implemented.
bool setDefaultName(map< string, int > &counts)
Set the default name of a wall. Returns false if it was previously set.
void setName(const string &name)
Set reactor surface name.
size_t nSensParams() const
Number of sensitivity parameters associated with reactions on this surface.
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 syncState()
Set the coverages and temperature in the surface phase object to the values for this surface.
string m_name
Reactor surface name.
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.
void addSensitivityReaction(size_t i)
Enable calculation of sensitivities with respect to the rate constant for reaction i.
Kinetics * kinetics()
Accessor for the InterfaceKinetics object.
string name() const
Retrieve reactor surface name.
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition SurfPhase.h:98
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
map< string, double > Composition
Map from string names to doubles.
Definition ct_defs.h:177