11 Wall::Wall() : m_left(0), m_right(0),
12 m_area(1.0), m_k(0.0), m_rrth(0.0), m_emiss(0.0),
15 for (
int n = 0; n < 2; n++) {
25 if (m_left || m_right) {
37 std::sort(m_pleft.begin(), m_pleft.end());
38 std::sort(m_pright.begin(), m_pright.end());
45 size_t ileft = 0, iright = 0;
51 m_leftcov.resize(m_nsp[0]);
60 m_rightcov.resize(m_nsp[1]);
64 if (ileft ==
npos || iright ==
npos) {
66 "specified surface kinetics manager does not "
67 "represent a surface reaction mechanism.");
73 double rate1 = m_k * m_area *
76 rate1 += m_area * m_vf->
eval(t);
83 double q1 = (m_area * m_rrth) *
88 q1 += m_emiss * m_area *
StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
91 q1 += m_area * m_qf->
eval(t);
99 copy(cov, cov + m_nsp[0], m_leftcov.begin());
101 copy(cov, cov + m_nsp[1], m_rightcov.begin());
107 if (leftright == 0) {
108 copy(m_leftcov.begin(), m_leftcov.end(), cov);
110 copy(m_rightcov.begin(), m_rightcov.end(), cov);
116 if (leftright == 0) {
123 void Wall::addSensitivityReaction(
int leftright,
size_t rxn)
125 if (rxn >= m_chem[leftright]->nReactions())
127 "Reaction number out of range ("+
int2str(rxn)+
")");
128 if (leftright == 0) {
130 m_chem[0]->reactionString(rxn), leftright);
131 m_pleft.push_back(rxn);
132 m_leftmult_save.push_back(1.0);
135 m_chem[1]->reactionString(rxn), leftright);
136 m_pright.push_back(rxn);
137 m_rightmult_save.push_back(1.0);
141 void Wall::setSensitivityParameters(
int lr,
double* params)
146 npar = m_pleft.size();
147 for (n = 0; n < npar; n++) {
148 m_leftmult_save[n] = m_chem[0]->
multiplier(m_pleft[n]);
150 m_leftmult_save[n]*params[n]);
153 npar = m_pright.size();
154 for (n = 0; n < npar; n++) {
155 m_rightmult_save[n] = m_chem[1]->
multiplier(m_pright[n]);
157 m_rightmult_save[n]*params[n]);
162 void Wall::resetSensitivityParameters(
int lr)
166 npar = m_pleft.size();
167 for (n = 0; n < npar; n++) {
171 npar = m_pright.size();
172 for (n = 0; n < npar; n++) {
174 m_rightmult_save[n]);
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 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.
void setMultiplier(size_t i, doublereal f)
Set the multiplier for reaction i to f.
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.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
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.