14 FlowReactor::FlowReactor() :
26 void FlowReactor::getState(
double* y)
30 "Error: reactor is empty.");
32 m_thermo->restoreState(m_state);
33 m_thermo->getMassFractions(y+2);
40 void FlowReactor::initialize(doublereal t0)
42 m_thermo->restoreState(m_state);
46 void FlowReactor::updateState(doublereal* y)
51 doublereal* mss = y + 2;
52 m_thermo->setMassFractions(mss);
53 doublereal rho = m_rho0 * m_speed0/m_speed;
56 doublereal pmom = m_P0 - rho*m_speed*m_speed;
61 hmom = m_h0 - 0.5*m_speed*m_speed;
62 m_thermo->setState_HP(hmom, pmom);
64 m_thermo->setState_TP(m_T, pmom);
66 m_thermo->saveState(m_state);
69 void FlowReactor::evalEqs(doublereal time, doublereal* y,
70 doublereal* ydot, doublereal* params)
72 m_thermo->restoreState(m_state);
73 applySensitivity(params);
79 ydot[1] = m_fctr*(m_speed0 - m_thermo->density()*m_speed/m_rho0);
82 const vector_fp& mw = m_thermo->molecularWeights();
85 m_kin->getNetProductionRates(ydot+2);
87 fill(ydot + 2, ydot + 2 + m_nsp, 0.0);
89 doublereal rrho = 1.0/m_thermo->density();
90 for (
size_t n = 0; n < m_nsp; n++) {
91 ydot[n+2] *= mw[n]*rrho;
93 resetSensitivity(params);
96 size_t FlowReactor::componentIndex(
const string& nm)
const
99 size_t k = m_thermo->speciesIndex(nm);
102 }
else if (nm ==
"X" || nm ==
"distance") {
104 }
else if (nm ==
"U" || nm ==
"velocity") {
Base class for exceptions thrown by Cantera classes.
This file contains definitions for utility functions and text for modules, inputfiles,...
const size_t npos
index returned by functions to indicate "no position"
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Namespace for the Cantera kernel.