Cantera  2.3.0
Wall.h
Go to the documentation of this file.
1 //! @file Wall.h Header file for class Wall.
2
3 // This file is part of Cantera. See License.txt in the top-level directory or
5
6 #ifndef CT_WALL_H
7 #define CT_WALL_H
8
10 #include "cantera/numerics/Func1.h"
13
14 namespace Cantera
15 {
16
17 class Kinetics;
18 class SurfPhase;
19
20 //! Represents a wall between between two ReactorBase objects.
21 /*!
22  * Walls can move (changing the volume of the adjacent reactors) and allow heat
23  * transfer between reactors.
24  */
25 class Wall
26 {
27 public:
28  Wall();
29
30  virtual ~Wall() {}
31
32  //! Rate of volume change (m^3/s) for the adjacent reactors.
33  /*!
34  * The volume rate of change is given by
35  * \f[
36  * \dot V = K A (P_{left} - P_{right}) + F(t)
37  * \f]
38  * where *K* is the specified expansion rate coefficient, *A* is the wall
39  * area, and *F(t)* is a specified function of time. Positive values for
40  * vdot correspond to increases in the volume of reactor on left, and
41  * decreases in the volume of the reactor on the right.
42  */
43  virtual doublereal vdot(doublereal t);
44
45  //! Heat flow rate through the wall (W).
46  /*!
47  * The heat flux is given by
48  * \f[
49  * Q = h A (T_{left} - T_{right}) + A G(t)
50  * \f]
51  * where *h* is the heat transfer coefficient, *A* is the wall area, and
52  * *G(t)* is a specified function of time. Positive values denote a flux
53  * from left to right.
54  */
55  virtual doublereal Q(doublereal t);
56
57  //! Area in m^2.
58  doublereal area() {
59  return m_area;
60  }
61
62  //! Set the area [m^2].
63  void setArea(doublereal a) {
64  m_area = a;
65  m_surf[0].setArea(a);
66  m_surf[1].setArea(a);
67  }
68
69  //! Get the area [m^2]
70  double getArea() const {
71  return m_area;
72  }
73
74  void setThermalResistance(doublereal Rth) {
75  m_rrth = 1.0/Rth;
76  }
77
78  //! Set the overall heat transfer coefficient [W/m^2/K].
79  void setHeatTransferCoeff(doublereal U) {
80  m_rrth = U;
81  }
82
83  //! Get the overall heat transfer coefficient [W/m^2/K].
84  double getHeatTransferCoeff() const {
85  return m_rrth;
86  }
87
88  //! Set the emissivity.
89  void setEmissivity(doublereal epsilon) {
90  if (epsilon > 1.0 || epsilon < 0.0) {
91  throw CanteraError("Wall::setEmissivity",
92  "emissivity must be between 0.0 and 1.0");
93  }
94  m_emiss = epsilon;
95  }
96
97  double getEmissivity() const {
98  return m_emiss;
99  }
100
101  //! Set the wall velocity to a specified function of time
102  void setVelocity(Func1* f=0) {
103  if (f) {
104  m_vf = f;
105  }
106  }
107
108  //! Set the expansion rate coefficient.
109  void setExpansionRateCoeff(doublereal k) {
110  m_k = k;
111  }
112
113  //! Get the expansion rate coefficient
114  double getExpansionRateCoeff() const {
115  return m_k;
116  }
117
118  //! Specify the heat flux function \f$q_0(t) \f$.
119  void setHeatFlux(Func1* q) {
120  m_qf = q;
121  }
122
123  //! Install the wall between two reactors or reservoirs
124  bool install(ReactorBase& leftReactor, ReactorBase& rightReactor);
125
126  //! Called just before the start of integration
127  virtual void initialize() {}
128
129  //! True if the wall is correctly configured and ready to use.
130  virtual bool ready() {
131  return (m_left != 0 && m_right != 0);
132  }
133
134  //! Return a reference to the Reactor or Reservoir to the left of the wall.
135  ReactorBase& left() const {
136  return *m_left;
137  }
138
139  //! Return a reference to the Reactor or Reservoir to the right of the wall.
140  const ReactorBase& right() {
141  return *m_right;
142  }
143
144  //! Specify the heterogeneous reaction mechanisms for each side of the
145  //! wall. Passing a null pointer indicates that there is no reaction
146  //! mechanism for the corresponding wall surface.
147  //! @deprecated Use class ReactorSurface instead. To be removed after
148  //! Cantera 2.3.
149  void setKinetics(Kinetics* leftMechanism,
150  Kinetics* rightMechanism);
151
152  //! Return a pointer to the surface phase object for the left
153  //! (leftright=0) or right (leftright=1) wall surface.
154  //! @deprecated Use class ReactorSurface instead. To be removed after
155  //! Cantera 2.3.
156  SurfPhase* surface(int leftright) {
157  return m_surf[leftright].thermo();
158  }
159
160  //! @deprecated Use class ReactorSurface instead. To be removed after
161  //! Cantera 2.3.
162  ReactorSurface* reactorSurface(int leftright) {
163  return &m_surf[leftright];
164  }
165
166  //! Return a pointer to the surface kinetics object for the left
167  //! (leftright=0) or right (leftright=1) wall surface.
168  //! @deprecated Use class ReactorSurface instead. To be removed after
169  //! Cantera 2.3.
170  Kinetics* kinetics(int leftright) {
171  return m_surf[leftright].kinetics();
172  }
173
174  //! Set the surface coverages on the left (leftright = 0) or right
175  //! (leftright = 1) surface to the values in array cov.
176  //! @deprecated Use class ReactorSurface instead. To be removed after
177  //! Cantera 2.3.
178  void setCoverages(int leftright, const doublereal* cov);
179
180  //! Set the surface coverages on the left (leftright = 0) or right
181  //! (leftright = 1) surface to the values in array cov.
182  //! @deprecated Use class ReactorSurface instead. To be removed after
183  //! Cantera 2.3.
184  void setCoverages(int leftright, const compositionMap& cov);
185
186  //! Set the surface coverages on the left (leftright = 0) or right
187  //! (leftright = 1) surface to the values in array cov.
188  //! @deprecated Use class ReactorSurface instead. To be removed after
189  //! Cantera 2.3.
190  void setCoverages(int leftright, const std::string& cov);
191
192  //! Write the coverages of the left or right surface into array cov.
193  //! @deprecated Use class ReactorSurface instead. To be removed after
194  //! Cantera 2.3.
195  void getCoverages(int leftright, doublereal* cov);
196
197  //! Set the coverages in the surface phase object to the values for this
198  //! wall surface.
199  //! @deprecated Use class ReactorSurface instead. To be removed after
200  //! Cantera 2.3.
201  void syncCoverages(int leftright);
202
203  //! Number of sensitivity parameters associated with reactions on the left
204  //! (lr = 0) or right (lr = 1) side of the wall.
205  //! @deprecated Use class ReactorSurface instead. To be removed after
206  //! Cantera 2.3.
207  size_t nSensParams(int lr) const {
208  return m_surf[lr].nSensParams();
209  }
210
211  //! @deprecated Use class ReactorSurface instead. To be removed after
212  //! Cantera 2.3.
213  void addSensitivityReaction(int leftright, size_t rxn);
214
215  //! @deprecated Use class ReactorSurface instead. To be removed after
216  //! Cantera 2.3.
217  void setSensitivityParameters(double* params);
218
219  //! @deprecated Use class ReactorSurface instead. To be removed after
220  //! Cantera 2.3.
222
223 protected:
224  ReactorBase* m_left;
225  ReactorBase* m_right;
226
227  std::vector<ReactorSurface> m_surf;
228
229  doublereal m_area, m_k, m_rrth;
230  doublereal m_emiss;
231  Func1* m_vf;
232  Func1* m_qf;
233 };
234
235 }
236
237 #endif
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:149
True if the wall is correctly configured and ready to use.
Definition: Wall.h:130
const ReactorBase & right()
Return a reference to the Reactor or Reservoir to the right of the wall.
Definition: Wall.h:140
void setKinetics(Kinetics *leftMechanism, Kinetics *rightMechanism)
Specify the heterogeneous reaction mechanisms for each side of the wall.
Definition: Wall.cpp:36
void setVelocity(Func1 *f=0)
Set the wall velocity to a specified function of time.
Definition: Wall.h:102
SurfPhase * surface(int leftright)
Return a pointer to the surface phase object for the left (leftright=0) or right (leftright=1) wall s...
Definition: Wall.h:156
virtual doublereal Q(doublereal t)
Heat flow rate through the wall (W).
Definition: Wall.cpp:53
void resetSensitivityParameters()
Definition: Wall.cpp:104
bool install(ReactorBase &leftReactor, ReactorBase &rightReactor)
Install the wall between two reactors or reservoirs.
Definition: Wall.cpp:21
void setHeatTransferCoeff(doublereal U)
Set the overall heat transfer coefficient [W/m^2/K].
Definition: Wall.h:79
void setSensitivityParameters(double *params)
Definition: Wall.cpp:98
doublereal area()
Area in m^2.
Definition: Wall.h:58
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition: SurfPhase.h:143
ReactorSurface * reactorSurface(int leftright)
Definition: Wall.h:162
Represents a wall between between two ReactorBase objects.
Definition: Wall.h:25
void setCoverages(int leftright, const doublereal *cov)
Set the surface coverages on the left (leftright = 0) or right (leftright = 1) surface to the values ...
Definition: Wall.cpp:68
Public interface for kinetics managers.
Definition: Kinetics.h:111
Base class for &#39;functor&#39; classes that evaluate a function of one variable.
Definition: Func1.h:41
double getArea() const
Get the area [m^2].
Definition: Wall.h:70
size_t nSensParams(int lr) const
Number of sensitivity parameters associated with reactions on the left (lr = 0) or right (lr = 1) sid...
Definition: Wall.h:207
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:65
ReactorBase & left() const
Return a reference to the Reactor or Reservoir to the left of the wall.
Definition: Wall.h:135
Base class for stirred reactors.
Definition: ReactorBase.h:44
void setHeatFlux(Func1 *q)
Specify the heat flux function .
Definition: Wall.h:119
void setEmissivity(doublereal epsilon)
Set the emissivity.
Definition: Wall.h:89
virtual void initialize()
Called just before the start of integration.
Definition: Wall.h:127
Header file for class ReactorSurface.
Kinetics * kinetics(int leftright)
Return a pointer to the surface kinetics object for the left (leftright=0) or right (leftright=1) wal...
Definition: Wall.h:170
void syncCoverages(int leftright)
Set the coverages in the surface phase object to the values for this wall surface.
Definition: Wall.cpp:88
double getExpansionRateCoeff() const
Get the expansion rate coefficient.
Definition: Wall.h:114
void addSensitivityReaction(int leftright, size_t rxn)
Definition: Wall.cpp:93
virtual doublereal vdot(doublereal t)
Rate of volume change (m^3/s) for the adjacent reactors.
Definition: Wall.cpp:44
void setExpansionRateCoeff(doublereal k)
Set the expansion rate coefficient.
Definition: Wall.h:109
Namespace for the Cantera kernel.
Definition: application.cpp:29
double getHeatTransferCoeff() const
Get the overall heat transfer coefficient [W/m^2/K].
Definition: Wall.h:84
void getCoverages(int leftright, doublereal *cov)
Write the coverages of the left or right surface into array cov.
Definition: Wall.cpp:83
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
void setArea(doublereal a)
Set the area [m^2].
Definition: Wall.h:63