15 FlowReactor::FlowReactor() :
30 writelog(
"Error: reactor is empty.\n");
55 doublereal* mss = y + 2;
58 doublereal rho = m_rho0 * m_speed0/m_speed;
61 doublereal pmom = m_P0 - rho*m_speed*m_speed;
66 hmom = m_h0 - 0.5*m_speed*m_speed;
75 doublereal* ydot, doublereal* params)
85 for (n = 0; n < npar; n++) {
96 ydot[1] = m_fctr*(m_speed0 - m_thermo->
density()*m_speed/m_rho0);
104 fill(ydot + 2, ydot + 2 +
m_nsp, 0.0);
106 doublereal rrho = 1.0/m_thermo->
density();
107 for (n = 0; n <
m_nsp; n++) {
108 ydot[n+2] *= mw[n]*rrho;
114 for (n = 0; n < npar; n++) {
127 }
else if (nm ==
"X" || nm ==
"distance") {
129 }
else if (nm ==
"U" || nm ==
"velocity") {
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 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.
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 size_t componentIndex(const std::string &nm) const
Return the index in the solution vector for this reactor of the component named nm.
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.
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 setMultiplier(size_t i, doublereal f)
Set the multiplier for reaction i to f.
virtual void initialize(doublereal t0=0.0)
Initialize the reactor.