16FlowReactor::FlowReactor() :
28void FlowReactor::getState(
double* y)
32 "Error: reactor is empty.");
34 m_thermo->restoreState(m_state);
35 m_thermo->getMassFractions(y+2);
42void FlowReactor::initialize(doublereal t0)
44 m_thermo->restoreState(m_state);
48void FlowReactor::updateState(doublereal* y)
53 doublereal* mss = y + 2;
54 m_thermo->setMassFractions(mss);
55 doublereal rho = m_rho0 * m_speed0/m_speed;
58 doublereal pmom = m_P0 - rho*m_speed*m_speed;
63 hmom = m_h0 - 0.5*m_speed*m_speed;
64 m_thermo->setState_HP(hmom, pmom);
66 m_thermo->setState_TP(m_T, pmom);
68 m_thermo->saveState(m_state);
71void FlowReactor::setMassFlowRate(
double mdot)
73 m_rho0 = m_thermo->density();
74 m_speed = mdot/m_rho0;
76 m_T = m_thermo->temperature();
77 m_P0 = m_thermo->pressure() + m_rho0*m_speed*m_speed;
78 m_h0 = m_thermo->enthalpy_mass() + 0.5*m_speed*m_speed;
81void FlowReactor::eval(
double time,
double* LHS,
double* RHS)
83 m_thermo->restoreState(m_state);
89 RHS[1] = m_fctr * (m_speed0 - m_thermo->density() * m_speed / m_rho0);
92 const vector_fp& mw = m_thermo->molecularWeights();
95 m_kin->getNetProductionRates(RHS + 2);
97 fill(RHS + 2, RHS + 2 + m_nsp, 0.0);
99 double rrho = 1.0 / m_thermo->density();
100 for (
size_t n = 0; n < m_nsp; n++) {
101 RHS[n+2] *= mw[n] * rrho;
105size_t FlowReactor::componentIndex(
const string& nm)
const
108 size_t k = m_thermo->speciesIndex(nm);
111 }
else if (nm ==
"X" || nm ==
"distance") {
113 }
else if (nm ==
"U" || nm ==
"velocity") {
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Base class for exceptions thrown by Cantera classes.
This file contains definitions for utility functions and text for modules, inputfiles,...
Namespace for the Cantera kernel.
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.