14 FlowReactor::FlowReactor() :
26 writelog(
"Error: reactor is empty.\n");
52 doublereal* mss = y + 2;
56 doublereal rho = m_rho0 * m_speed0/m_speed;
59 doublereal pmom = m_P0 - rho*m_speed*m_speed;
64 hmom = m_h0 - 0.5*m_speed*m_speed;
73 doublereal* ydot, doublereal* params)
83 for (n = 0; n < npar; n++) {
94 ydot[1] = m_fctr*(m_speed0 - m_thermo->
density()*m_speed/m_rho0);
102 fill(ydot + 2, ydot + 2 +
m_nsp, 0.0);
104 doublereal rrho = 1.0/m_thermo->
density();
105 for (n = 0; n <
m_nsp; n++) {
106 ydot[n+2] *= mw[n]*rrho;
112 for (n = 0; n < npar; n++) {
virtual void setState_HP(doublereal h, doublereal p, doublereal tol=1.e-4)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
virtual doublereal density() const
Density (kg/m^3).
void restoreState(const vector_fp &state)
Restore a state saved on a previous call to saveState.
virtual size_t nSensParams()
Number of sensitivity parameters associated with this reactor (including walls)
void getMassFractions(doublereal *const y) const
Get the species mass fractions.
const size_t npos
index returned by functions to indicate "no position"
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
virtual void updateState(doublereal *y)
Set the state of the reactor to correspond to the state vector y.
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 size_t componentIndex(const std::string &nm) const
Return the index in the solution vector for this reactor of the component named nm.
Kinetics * m_kin
Pointer to the homogeneous Kinetics object that handles the reactions.
size_t speciesIndex(const std::string &name) const
Returns the index of a species named 'name' within the Phase object.
virtual void evalEqs(doublereal t, doublereal *y, doublereal *ydot, doublereal *params)
virtual void getInitialConditions(doublereal t0, size_t leny, doublereal *y)
Called by ReactorNet to get the initial conditions.
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
size_t m_nsp
Number of homogeneous species in the mixture.
void saveState(vector_fp &state) const
Save the current internal state of the phase Write to vector 'state' the current internal state...
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
void writelog(const std::string &msg)
Write a message to the screen.
virtual void initialize(doublereal t0=0.0)
Initialize the reactor.