Cantera  2.2.1
Wall.h
Go to the documentation of this file.
1 /**
2  * @file Wall.h
3  * Header file for class Wall.
4  */
5 // Copyright 2001-2004 California Institute of Technology
6
7 #ifndef CT_WALL_H
8 #define CT_WALL_H
9
11 #include "cantera/numerics/Func1.h"
12
13 namespace Cantera
14 {
15
16 // forward references
17 class ReactorBase;
18 class Kinetics;
19 class SurfPhase;
20
21 //! Represents a wall between between two ReactorBase objects.
22 /*!
23  * Walls can move (changing the volume of the adjacent reactors), allow heat
24  * transfer between reactors, and provide a location for surface reactions to
25  * take place.
26  */
27 class Wall
28 {
29 public:
30  Wall();
31
32  virtual ~Wall() {}
33
34  //! Rate of volume change (m^3/s) for the adjacent reactors.
35  /*! The volume rate of change is given by
36  * \f[ \dot V = K A (P_{left} - P_{right}) + F(t) \f]
37  * where *K* is the specified expansion rate coefficient, *A* is the wall
38  * area, and *F(t)* is a specified function of time. Positive values for
39  * vdot correspond to increases in the volume of reactor on left, and
40  * decreases in the volume of the reactor on the right.
41  */
42  virtual doublereal vdot(doublereal t);
43
44  //! Heat flow rate through the wall (W).
45  /*!
46  * The heat flux is given by
47  * \f[ Q = h A (T_{left} - T_{right}) + A G(t) \f]
48  * where *h* is the heat transfer coefficient, *A* is the wall area, and
49  * *G(t)* is a specified function of time. Positive values denote a flux
50  * from left to right.
51  */
52  virtual doublereal Q(doublereal t);
53
54  //! Area in m^2.
55  doublereal area() {
56  return m_area;
57  }
58
59  //! Set the area [m^2].
60  void setArea(doublereal a) {
61  m_area = a;
62  }
63
64  //! Get the area [m^2]
65  double getArea() const {
66  return m_area;
67  }
68
69  void setThermalResistance(doublereal Rth) {
70  m_rrth = 1.0/Rth;
71  }
72
73  //! Set the overall heat transfer coefficient [W/m^2/K].
74  void setHeatTransferCoeff(doublereal U) {
75  m_rrth = U;
76  }
77
78  //! Get the overall heat transfer coefficient [W/m^2/K].
79  double getHeatTransferCoeff() const {
80  return m_rrth;
81  }
82
83  //! Set the emissivity.
84  void setEmissivity(doublereal epsilon) {
85  if (epsilon > 1.0 || epsilon < 0.0)
86  throw Cantera::CanteraError("Wall::setEmissivity",
87  "emissivity must be between 0.0 and 1.0");
88  m_emiss = epsilon;
89  }
90
91  double getEmissivity() const {
92  return m_emiss;
93  }
94
95  //! Set the wall velocity to a specified function of time
97  if (f) {
98  m_vf = f;
99  }
100  }
101
102  //! Set the expansion rate coefficient.
103  void setExpansionRateCoeff(doublereal k) {
104  m_k = k;
105  }
106
107  //! Get the expansion rate coefficient
108  double getExpansionRateCoeff() const {
109  return m_k;
110  }
111
112  //! Specify the heat flux function \f$q_0(t) \f$.
114  m_qf = q;
115  }
116
117  //! Install the wall between two reactors or reservoirs
118  bool install(ReactorBase& leftReactor, ReactorBase& rightReactor);
119
120  //! Called just before the start of integration
121  virtual void initialize();
122
123  //! True if the wall is correctly configured and ready to use.
125  return (m_left != 0 && m_right != 0);
126  }
127
128  //! Return a reference to the Reactor or Reservoir to the left
129  //! of the wall.
130  ReactorBase& left() const {
131  return *m_left;
132  }
133
134  //! Return a reference to the Reactor or Reservoir to the
135  //! right of the wall.
136  const ReactorBase& right() {
137  return *m_right;
138  }
139
140  //! Specify the heterogeneous reaction mechanisms for each side of the
141  //! wall. Passing a null pointer indicates that there is no reaction
142  //! mechanism for the corresponding wall surface.
143  void setKinetics(Cantera::Kinetics* leftMechanism,
144  Cantera::Kinetics* rightMechanism);
145
146  //! Return a pointer to the surface phase object for the left
147  //! (leftright=0) or right (leftright=1) wall surface.
148  Cantera::SurfPhase* surface(int leftright) {
149  return m_surf[leftright];
150  }
151
152  //! Return a pointer to the surface kinetics object for the left
153  //! (leftright=0) or right (leftright=1) wall surface.
154  Cantera::Kinetics* kinetics(int leftright) {
155  return m_chem[leftright];
156  }
157
158  //! Set the surface coverages on the left (leftright = 0) or right
159  //! (leftright = 1) surface to the values in array cov.
160  void setCoverages(int leftright, const doublereal* cov);
161
162  //! Set the surface coverages on the left (leftright = 0) or right
163  //! (leftright = 1) surface to the values in array cov.
164  void setCoverages(int leftright, const compositionMap& cov);
165
166  //! Set the surface coverages on the left (leftright = 0) or right
167  //! (leftright = 1) surface to the values in array cov.
168  void setCoverages(int leftright, const std::string& cov);
169
170  //! Write the coverages of the left or right surface into array cov.
171  void getCoverages(int leftright, doublereal* cov);
172
173  //! Set the coverages in the surface phase object to the
174  //! values for this wall surface.
175  void syncCoverages(int leftright);
176
177  //! Number of sensitivity parameters associated with reactions on the left
178  //! (lr = 0) or right (lr = 1) side of the wall.
179  size_t nSensParams(int lr) const {
180  if (lr == 0) {
181  return m_pleft.size();
182  } else {
183  return m_pright.size();
184  }
185  }
186  void addSensitivityReaction(int leftright, size_t rxn);
187  void setSensitivityParameters(int lr, double* params);
188  void resetSensitivityParameters(int lr);
189
190 protected:
191  ReactorBase* m_left;
192  ReactorBase* m_right;
193  Cantera::Kinetics* m_chem;
194  Cantera::SurfPhase* m_surf;
195  size_t m_nsp;
196  doublereal m_area, m_k, m_rrth;
197  doublereal m_emiss;
198  Cantera::Func1* m_vf;
199  Cantera::Func1* m_qf;
200  Cantera::vector_fp m_leftcov, m_rightcov;
201
202  std::vector<size_t> m_pleft, m_pright;
203  Cantera::vector_fp m_leftmult_save, m_rightmult_save;
204 };
205
206 }
207
208 #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:124
const ReactorBase & right()
Return a reference to the Reactor or Reservoir to the right of the wall.
Definition: Wall.h:136
Cantera::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:154
virtual doublereal Q(doublereal t)
Heat flow rate through the wall (W).
Definition: Wall.cpp:80
bool install(ReactorBase &leftReactor, ReactorBase &rightReactor)
Install the wall between two reactors or reservoirs.
Definition: Wall.cpp:21
void setKinetics(Cantera::Kinetics *leftMechanism, Cantera::Kinetics *rightMechanism)
Specify the heterogeneous reaction mechanisms for each side of the wall.
Definition: Wall.cpp:40
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:179
void setHeatTransferCoeff(doublereal U)
Set the overall heat transfer coefficient [W/m^2/K].
Definition: Wall.h:74
doublereal area()
Area in m^2.
Definition: Wall.h:55
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
Definition: SurfPhase.h:143
Represents a wall between between two ReactorBase objects.
Definition: Wall.h:27
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:95
Public interface for kinetics managers.
Definition: Kinetics.h:128
Base class for 'functor' classes that evaluate a function of one variable.
Definition: Func1.h:41
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:99
Base class for stirred reactors.
Definition: ReactorBase.h:30
void setEmissivity(doublereal epsilon)
Set the emissivity.
Definition: Wall.h:84
double getHeatTransferCoeff() const
Get the overall heat transfer coefficient [W/m^2/K].
Definition: Wall.h:79
void syncCoverages(int leftright)
Set the coverages in the surface phase object to the values for this wall surface.
Definition: Wall.cpp:133
Cantera::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:148
double getExpansionRateCoeff() const
Get the expansion rate coefficient.
Definition: Wall.h:108
void setVelocity(Cantera::Func1 *f=0)
Set the wall velocity to a specified function of time.
Definition: Wall.h:96
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
virtual doublereal vdot(doublereal t)
Rate of volume change (m^3/s) for the adjacent reactors.
Definition: Wall.cpp:70
double getArea() const
Get the area [m^2].
Definition: Wall.h:65
void setExpansionRateCoeff(doublereal k)
Set the expansion rate coefficient.
Definition: Wall.h:103
ReactorBase & left() const
Return a reference to the Reactor or Reservoir to the left of the wall.
Definition: Wall.h:130
void getCoverages(int leftright, doublereal *cov)
Write the coverages of the left or right surface into array cov.
Definition: Wall.cpp:124
virtual void initialize()
Called just before the start of integration.
Definition: Wall.cpp:34
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
void setHeatFlux(Cantera::Func1 *q)
Specify the heat flux function .
Definition: Wall.h:113
void setArea(doublereal a)
Set the area [m^2].
Definition: Wall.h:60
{"ft_lang_label":"__label__en","ft_lang_prob":0.55156827,"math_prob":0.9362528,"size":3739,"snap":"2020-34-2020-40","text_gpt3_token_len":953,"char_repetition_ratio":0.16278447,"word_repetition_ratio":0.061657034,"special_character_ratio":0.23428725,"punctuation_ratio":0.15326253,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96166646,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-29T01:00:02Z\",\"WARC-Record-ID\":\"<urn:uuid:aef5b3fd-df35-498d-908b-41c8015fc8d0>\",\"Content-Length\":\"55945\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9d81f509-6adc-45de-9c6b-f53c51ee935d>\",\"WARC-Concurrent-To\":\"<urn:uuid:aa23a4c0-5d2b-4744-8a04-c1c3ed4fdeef>\",\"WARC-IP-Address\":\"162.216.17.89\",\"WARC-Target-URI\":\"https://cantera.org/documentation/docs-2.2/doxygen/html/Wall_8h_source.html\",\"WARC-Payload-Digest\":\"sha1:HC44RLUK5ZWKZWSFESCMH5V5DBADDUSG\",\"WARC-Block-Digest\":\"sha1:GMCC3LNGMN6SFQBXBPXOY2FCRQ4HNIWJ\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600401617641.86_warc_CC-MAIN-20200928234043-20200929024043-00328.warc.gz\"}"}