Cantera  2.3.0
Wall.cpp
Go to the documentation of this file.
1 //! @file Wall.cpp
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 #include "cantera/zeroD/Wall.h"
11 
12 namespace Cantera
13 {
14 Wall::Wall() : m_left(0), m_right(0),
15  m_surf(2),
16  m_area(1.0), m_k(0.0), m_rrth(0.0), m_emiss(0.0),
17  m_vf(0), m_qf(0)
18 {
19 }
20 
21 bool Wall::install(ReactorBase& rleft, ReactorBase& rright)
22 {
23  // check if wall is already installed
24  if (m_left || m_right) {
25  return false;
26  }
27  m_left = &rleft;
28  m_right = &rright;
29  m_left->addWall(*this, 0);
30  m_right->addWall(*this, 1);
31  m_surf[0].setReactor(&rleft);
32  m_surf[1].setReactor(&rright);
33  return true;
34 }
35 
36 void Wall::setKinetics(Kinetics* left, Kinetics* right)
37 {
38  warn_deprecated("Wall::setKinetics", "Use class ReactorSurface instead. "
39  "To be removed after Cantera 2.3.");
40  m_surf[0].setKinetics(left);
41  m_surf[1].setKinetics(right);
42 }
43 
44 doublereal Wall::vdot(doublereal t)
45 {
46  double rate1 = m_k * m_area * (m_left->pressure() - m_right->pressure());
47  if (m_vf) {
48  rate1 += m_area * m_vf->eval(t);
49  }
50  return rate1;
51 }
52 
53 doublereal Wall::Q(doublereal t)
54 {
55  double q1 = (m_area * m_rrth) *
56  (m_left->temperature() - m_right->temperature());
57  if (m_emiss > 0.0) {
58  double tl = m_left->temperature();
59  double tr = m_right->temperature();
60  q1 += m_emiss * m_area * StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
61  }
62  if (m_qf) {
63  q1 += m_area * m_qf->eval(t);
64  }
65  return q1;
66 }
67 
68 void Wall::setCoverages(int leftright, const doublereal* cov)
69 {
70  m_surf[leftright].setCoverages(cov);
71 }
72 
73 void Wall::setCoverages(int leftright, const compositionMap& cov)
74 {
75  m_surf[leftright].setCoverages(cov);
76 }
77 
78 void Wall::setCoverages(int leftright, const std::string& cov)
79 {
80  m_surf[leftright].setCoverages(cov);
81 }
82 
83 void Wall::getCoverages(int leftright, doublereal* cov)
84 {
85  m_surf[leftright].getCoverages(cov);
86 }
87 
88 void Wall::syncCoverages(int leftright)
89 {
90  m_surf[leftright].syncCoverages();
91 }
92 
93 void Wall::addSensitivityReaction(int leftright, size_t rxn)
94 {
95  m_surf[leftright].addSensitivityReaction(rxn);
96 }
97 
98 void Wall::setSensitivityParameters(double* params)
99 {
100  m_surf[0].setSensitivityParameters(params);
101  m_surf[1].setSensitivityParameters(params);
102 }
103 
105 {
106  m_surf[0].resetSensitivityParameters();
107  m_surf[1].resetSensitivityParameters();
108 }
109 
110 }
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:149
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
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase, assuming an ideal solution model (see Thermodynamic Properties and class SurfPhase).
Header file for class Wall.
const doublereal StefanBoltz
Stefan-Boltzmann constant.
Definition: ct_defs.h:85
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 warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
virtual doublereal eval(doublereal t) const
Evaluate the function.
Definition: Func1.cpp:60
void setSensitivityParameters(double *params)
Definition: Wall.cpp:98
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
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 addWall(Wall &w, int lr)
Insert a Wall between this reactor and another reactor.
Definition: ReactorBase.cpp:57
void syncCoverages(int leftright)
Set the coverages in the surface phase object to the values for this wall surface.
Definition: Wall.cpp:88
void addSensitivityReaction(int leftright, size_t rxn)
Definition: Wall.cpp:93
doublereal pressure() const
Returns the current pressure (Pa) of the reactor.
Definition: ReactorBase.h:202
virtual doublereal vdot(doublereal t)
Rate of volume change (m^3/s) for the adjacent reactors.
Definition: Wall.cpp:44
Contains declarations for string manipulation functions within Cantera.
doublereal temperature() const
Returns the current temperature (K) of the reactor&#39;s contents.
Definition: ReactorBase.h:187
Namespace for the Cantera kernel.
Definition: application.cpp:29
void getCoverages(int leftright, doublereal *cov)
Write the coverages of the left or right surface into array cov.
Definition: Wall.cpp:83