Cantera  2.4.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
4 // at http://www.cantera.org/license.txt for license and copyright information.
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  Wall(const Wall&) = delete;
32  Wall& operator=(const Wall&) = delete;
33 
34  //! Rate of volume change (m^3/s) for the adjacent reactors.
35  /*!
36  * The volume rate of change is given by
37  * \f[
38  * \dot V = K A (P_{left} - P_{right}) + F(t)
39  * \f]
40  * where *K* is the specified expansion rate coefficient, *A* is the wall
41  * area, and *F(t)* is a specified function of time. Positive values for
42  * `vdot` correspond to increases in the volume of reactor on left, and
43  * decreases in the volume of the reactor on the right.
44  */
45  virtual doublereal vdot(doublereal t);
46 
47  //! Heat flow rate through the wall (W).
48  /*!
49  * The heat flux is given by
50  * \f[
51  * Q = h A (T_{left} - T_{right}) + A G(t)
52  * \f]
53  * where *h* is the heat transfer coefficient, *A* is the wall area, and
54  * *G(t)* is a specified function of time. Positive values denote a flux
55  * from left to right.
56  */
57  virtual doublereal Q(doublereal t);
58 
59  //! Area in m^2.
60  doublereal area() {
61  return m_area;
62  }
63 
64  //! Set the area [m^2].
65  void setArea(doublereal a) {
66  m_area = a;
67  m_surf[0].setArea(a);
68  m_surf[1].setArea(a);
69  }
70 
71  //! Get the area [m^2]
72  double getArea() const {
73  return m_area;
74  }
75 
76  void setThermalResistance(doublereal Rth) {
77  m_rrth = 1.0/Rth;
78  }
79 
80  //! Set the overall heat transfer coefficient [W/m^2/K].
81  void setHeatTransferCoeff(doublereal U) {
82  m_rrth = U;
83  }
84 
85  //! Get the overall heat transfer coefficient [W/m^2/K].
86  double getHeatTransferCoeff() const {
87  return m_rrth;
88  }
89 
90  //! Set the emissivity.
91  void setEmissivity(doublereal epsilon) {
92  if (epsilon > 1.0 || epsilon < 0.0) {
93  throw CanteraError("Wall::setEmissivity",
94  "emissivity must be between 0.0 and 1.0");
95  }
96  m_emiss = epsilon;
97  }
98 
99  double getEmissivity() const {
100  return m_emiss;
101  }
102 
103  //! Set the wall velocity to a specified function of time
104  void setVelocity(Func1* f=0) {
105  if (f) {
106  m_vf = f;
107  }
108  }
109 
110  //! Set the expansion rate coefficient.
111  void setExpansionRateCoeff(doublereal k) {
112  m_k = k;
113  }
114 
115  //! Get the expansion rate coefficient
116  double getExpansionRateCoeff() const {
117  return m_k;
118  }
119 
120  //! Specify the heat flux function \f$ q_0(t) \f$.
121  void setHeatFlux(Func1* q) {
122  m_qf = q;
123  }
124 
125  //! Install the wall between two reactors or reservoirs
126  bool install(ReactorBase& leftReactor, ReactorBase& rightReactor);
127 
128  //! Called just before the start of integration
129  virtual void initialize() {}
130 
131  //! True if the wall is correctly configured and ready to use.
132  virtual bool ready() {
133  return (m_left != 0 && m_right != 0);
134  }
135 
136  //! Return a reference to the Reactor or Reservoir to the left of the wall.
137  ReactorBase& left() const {
138  return *m_left;
139  }
140 
141  //! Return a reference to the Reactor or Reservoir to the right of the wall.
142  const ReactorBase& right() {
143  return *m_right;
144  }
145 
146 protected:
147  ReactorBase* m_left;
148  ReactorBase* m_right;
149 
150  std::vector<ReactorSurface> m_surf;
151 
152  doublereal m_area, m_k, m_rrth;
153  doublereal m_emiss;
154  Func1* m_vf;
155  Func1* m_qf;
156 };
157 
158 }
159 
160 #endif
virtual bool ready()
True if the wall is correctly configured and ready to use.
Definition: Wall.h:132
const ReactorBase & right()
Return a reference to the Reactor or Reservoir to the right of the wall.
Definition: Wall.h:142
void setVelocity(Func1 *f=0)
Set the wall velocity to a specified function of time.
Definition: Wall.h:104
virtual doublereal Q(doublereal t)
Heat flow rate through the wall (W).
Definition: Wall.cpp:45
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:81
doublereal area()
Area in m^2.
Definition: Wall.h:60
Represents a wall between between two ReactorBase objects.
Definition: Wall.h:25
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:72
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:137
Base class for stirred reactors.
Definition: ReactorBase.h:44
void setHeatFlux(Func1 *q)
Specify the heat flux function .
Definition: Wall.h:121
void setEmissivity(doublereal epsilon)
Set the emissivity.
Definition: Wall.h:91
virtual void initialize()
Called just before the start of integration.
Definition: Wall.h:129
Header file for class ReactorSurface.
double getExpansionRateCoeff() const
Get the expansion rate coefficient.
Definition: Wall.h:116
virtual doublereal vdot(doublereal t)
Rate of volume change (m^3/s) for the adjacent reactors.
Definition: Wall.cpp:36
void setExpansionRateCoeff(doublereal k)
Set the expansion rate coefficient.
Definition: Wall.h:111
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
double getHeatTransferCoeff() const
Get the overall heat transfer coefficient [W/m^2/K].
Definition: Wall.h:86
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:65