14 FlowReactor::FlowReactor() :
30 "Error: reactor is empty.");
51 doublereal* mss = y + 2;
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;
70 doublereal* ydot, doublereal* params)
79 ydot[1] = m_fctr*(m_speed0 - m_thermo->
density()*m_speed/m_rho0);
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;
102 }
else if (nm ==
"X" || nm ==
"distance") {
104 }
else if (nm ==
"U" || nm ==
"velocity") {
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
void restoreState(const vector_fp &state)
Restore a state saved on a previous call to saveState.
void getMassFractions(doublereal *const y) const
Get the species mass fractions.
virtual void getState(doublereal *y)
Get the the current state of the reactor.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
void saveState(vector_fp &state) const
Save the current internal state of the phase.
const size_t npos
index returned by functions to indicate "no position"
virtual void updateState(doublereal *y)
Set the state of the reactor to correspond to the state vector y.
virtual void resetSensitivity(double *params)
Reset the reaction rate multipliers.
virtual doublereal density() const
Density (kg/m^3).
virtual void setState_HP(double h, double p, double tol=1e-9)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, (see Input File Handling, Diagnostic Output, and Writing messages to the screen).
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
Kinetics * m_kin
Pointer to the homogeneous Kinetics object that handles the reactions.
virtual void evalEqs(doublereal t, doublereal *y, doublereal *ydot, doublereal *params)
virtual void applySensitivity(double *params)
Set reaction rate multipliers based on the sensitivity variables in params.
Base class for exceptions thrown by Cantera classes.
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
virtual size_t componentIndex(const std::string &nm) const
Return the index in the solution vector for this reactor of the component named nm.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
size_t m_nsp
Number of homogeneous species in the mixture.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
Namespace for the Cantera kernel.
virtual void initialize(doublereal t0=0.0)
Initialize the reactor.