10 Wall::Wall() : m_left(0), m_right(0),
11 m_area(1.0), m_k(0.0), m_rrth(0.0), m_emiss(0.0),
14 for (
int n = 0; n < 2; n++) {
24 if (m_left || m_right) {
36 std::sort(m_pleft.begin(), m_pleft.end());
37 std::sort(m_pright.begin(), m_pright.end());
44 size_t ileft = 0, iright = 0;
50 m_leftcov.resize(m_nsp[0]);
59 m_rightcov.resize(m_nsp[1]);
63 if (ileft ==
npos || iright ==
npos) {
65 "specified surface kinetics manager does not "
66 "represent a surface reaction mechanism.");
72 double rate1 = m_k * m_area *
75 rate1 += m_area * m_vf->
eval(t);
82 double q1 = (m_area * m_rrth) *
87 q1 += m_emiss * m_area *
StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
90 q1 += m_area * m_qf->
eval(t);
98 copy(cov, cov + m_nsp[0], m_leftcov.begin());
100 copy(cov, cov + m_nsp[1], m_rightcov.begin());
107 if (leftright == 0) {
117 if (leftright == 0) {
126 if (leftright == 0) {
127 copy(m_leftcov.begin(), m_leftcov.end(), cov);
129 copy(m_rightcov.begin(), m_rightcov.end(), cov);
135 if (leftright == 0) {
142 void Wall::addSensitivityReaction(
int leftright,
size_t rxn)
144 if (rxn >= m_chem[leftright]->nReactions())
146 "Reaction number out of range ("+
int2str(rxn)+
")");
147 if (leftright == 0) {
149 m_chem[0]->reactionString(rxn), leftright);
150 m_pleft.push_back(rxn);
151 m_leftmult_save.push_back(1.0);
154 m_chem[1]->reactionString(rxn), leftright);
155 m_pright.push_back(rxn);
156 m_rightmult_save.push_back(1.0);
160 void Wall::setSensitivityParameters(
int lr,
double* params)
165 npar = m_pleft.size();
166 for (n = 0; n < npar; n++) {
167 m_leftmult_save[n] = m_chem[0]->
multiplier(m_pleft[n]);
169 m_leftmult_save[n]*params[n]);
172 npar = m_pright.size();
173 for (n = 0; n < npar; n++) {
174 m_rightmult_save[n] = m_chem[1]->
multiplier(m_pright[n]);
176 m_rightmult_save[n]*params[n]);
181 void Wall::resetSensitivityParameters(
int lr)
185 npar = m_pleft.size();
186 for (n = 0; n < npar; n++) {
190 npar = m_pright.size();
191 for (n = 0; n < npar; n++) {
193 m_rightmult_save[n]);
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
const ReactorBase & right()
Return a reference to the Reactor or Reservoir to the right of the wall.
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase, assuming an ideal solution model (see Thermodynamic Properties and class SurfPhase).
doublereal pressure() const
Returns the current pressure (Pa) of the reactor.
Header file for class Wall.
const doublereal StefanBoltz
Stefan-Boltzmann constant.
thermo_t & thermo(size_t n=0)
This method returns a reference to the nth ThermoPhase object defined in this kinetics mechanism...
const size_t npos
index returned by functions to indicate "no position"
virtual doublereal Q(doublereal t)
Heat flow rate through the wall (W).
bool install(ReactorBase &leftReactor, ReactorBase &rightReactor)
Install the wall between two reactors or reservoirs.
void setCoveragesByName(const std::string &cov)
Set the coverages from a string of colon-separated name:value pairs.
void setCoverages(const doublereal *theta)
Set the surface site fractions to a specified state.
ReactorNet & network()
The ReactorNet that this reactor belongs to.
void setKinetics(Cantera::Kinetics *leftMechanism, Cantera::Kinetics *rightMechanism)
Specify the heterogeneous reaction mechanisms for each side of the wall.
doublereal multiplier(size_t i) const
The current value of the multiplier for reaction i.
virtual doublereal eval(doublereal t) const
Evaluate the function.
void getCoverages(doublereal *theta) const
Return a vector of surface coverages.
A simple thermodynamic model for a surface phase, assuming an ideal solution model.
size_t surfacePhaseIndex()
This returns the integer index of the phase which has ThermoPhase type cSurf.
void setCoverages(int leftright, const doublereal *cov)
Set the surface coverages on the left (leftright = 0) or right (leftright = 1) surface to the values ...
Public interface for kinetics managers.
Base class for exceptions thrown by Cantera classes.
Base class for stirred reactors.
void addWall(Wall &w, int lr)
Insert a Wall between this reactor and another reactor.
void syncCoverages(int leftright)
Set the coverages in the surface phase object to the values for this wall surface.
void registerSensitivityReaction(void *reactor, size_t reactionIndex, const std::string &name, int leftright=0)
Used by Reactor and Wall objects to register the addition of sensitivity reactions so that the Reacto...
size_t nSpecies() const
Returns the number of species in the phase.
virtual doublereal vdot(doublereal t)
Rate of volume change (m^3/s) for the adjacent reactors.
Contains declarations for string manipulation functions within Cantera.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
virtual void setMultiplier(size_t i, doublereal f)
Set the multiplier for reaction i to f.
ReactorBase & left() const
Return a reference to the Reactor or Reservoir to the left of the wall.
void getCoverages(int leftright, doublereal *cov)
Write the coverages of the left or right surface into array cov.
virtual void initialize()
Called just before the start of integration.
doublereal temperature() const
Returns the current temperature (K) of the reactor's contents.