9 using namespace Cantera;
14 Wall::Wall() : m_left(0), m_right(0),
15 m_area(0.0), m_k(0.0), m_rrth(0.0), m_emiss(0.0),
18 for (
int n = 0; n < 2; n++) {
28 if (m_left || m_right) {
33 m_left->addWall(*
this, 0);
34 m_right->addWall(*
this, 1);
46 size_t ileft = 0, iright = 0;
52 m_leftcov.resize(m_nsp[0]);
53 m_surf[0]->getCoverages(
DATA_PTR(m_leftcov));
61 m_rightcov.resize(m_nsp[1]);
62 m_surf[1]->getCoverages(
DATA_PTR(m_rightcov));
65 if (ileft ==
npos || iright ==
npos) {
67 "specified surface kinetics manager does not "
68 "represent a surface reaction mechanism.");
80 doublereal Wall::vdot(doublereal t)
82 double rate1 = m_k * m_area *
83 (m_left->pressure() - m_right->pressure());
85 rate1 += m_area * m_vf->eval(t);
96 doublereal Wall::Q(doublereal t)
98 double q1 = (m_area * m_rrth) *
99 (m_left->temperature() - m_right->temperature());
101 double tl = m_left->temperature();
102 double tr = m_right->temperature();
103 q1 += m_emiss * m_area *
StefanBoltz * (tl*tl*tl*tl - tr*tr*tr*tr);
106 q1 += m_area * m_qf->eval(t);
111 void Wall::setCoverages(
int leftright,
const doublereal* cov)
113 if (leftright == 0) {
114 copy(cov, cov + m_nsp[0], m_leftcov.begin());
116 copy(cov, cov + m_nsp[1], m_rightcov.begin());
120 void Wall::getCoverages(
int leftright, doublereal* cov)
122 if (leftright == 0) {
123 copy(m_leftcov.begin(), m_leftcov.end(), cov);
125 copy(m_rightcov.begin(), m_rightcov.end(), cov);
129 void Wall::syncCoverages(
int leftright)
131 if (leftright == 0) {
132 m_surf[0]->setCoverages(
DATA_PTR(m_leftcov));
134 m_surf[1]->setCoverages(
DATA_PTR(m_rightcov));
138 void Wall::addSensitivityReaction(
int leftright,
size_t rxn)
140 if (rxn >= m_chem[leftright]->nReactions())
142 "Reaction number out of range ("+
int2str(rxn)+
")");
143 if (leftright == 0) {
144 m_pleft.push_back(rxn);
145 m_leftmult_save.push_back(1.0);
146 m_pname_left.push_back(m_chem[0]->reactionString(rxn));
148 m_pright.push_back(rxn);
149 m_rightmult_save.push_back(1.0);
150 m_pname_right.push_back(m_chem[1]->reactionString(rxn));
154 void Wall::setSensitivityParameters(
int lr,
double* params)
159 npar = m_pleft.size();
160 for (n = 0; n < npar; n++) {
161 m_leftmult_save[n] = m_chem[0]->multiplier(m_pleft[n]);
162 m_chem[0]->setMultiplier(m_pleft[n],
163 m_leftmult_save[n]*params[n]);
166 npar = m_pright.size();
167 for (n = 0; n < npar; n++) {
168 m_rightmult_save[n] = m_chem[1]->multiplier(m_pright[n]);
169 m_chem[1]->setMultiplier(m_pright[n],
170 m_rightmult_save[n]*params[n]);
175 void Wall::resetSensitivityParameters(
int lr)
179 npar = m_pleft.size();
180 for (n = 0; n < npar; n++) {
181 m_chem[0]->setMultiplier(m_pleft[n], m_leftmult_save[n]);
184 npar = m_pright.size();
185 for (n = 0; n < npar; n++) {
186 m_chem[1]->setMultiplier(m_pright[n],
187 m_rightmult_save[n]);