22 "Error: reactor is empty.");
65 double& dmdt = RHS[0];
66 double* mdYdt = RHS + 2;
84 for (
size_t k = 0; k <
m_nsp; k++) {
88 mdYdt[k] -= Y[k] * mdot_surf;
97 for (
auto outlet : m_outlet) {
104 for (
auto inlet : m_inlet) {
107 for (
size_t n = 0; n <
m_nsp; n++) {
110 mdYdt[n] += mdot_spec - mdot * Y[n];
127 }
else if (nm ==
"mass") {
129 }
else if (nm ==
"enthalpy") {
141 }
else if (k >= 2 && k <
neq()) {
143 if (k < m_thermo->nSpecies()) {
148 for (
auto& S : m_surfaces) {
150 if (k < th->nSpecies()) {
157 throw CanteraError(
"ConstPressureReactor::componentName",
158 "Index is out of bounds.");
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Header file for base class WallBase.
Base class for exceptions thrown by Cantera classes.
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 updateState(doublereal *y)
Set the state of the reactor to correspond to the state vector y.
virtual void eval(double t, double *LHS, double *RHS)
Evaluate the reactor governing equations.
virtual void getState(doublereal *y)
Get the the current state of the reactor.
std::string componentName(size_t k)
Return the name of the solution component with index i.
virtual void initialize(doublereal t0=0.0)
Initialize the reactor.
double outletSpeciesMassFlowRate(size_t k)
Mass flow rate (kg/s) of outlet species k.
double enthalpy_mass()
specific enthalpy
double massFlowRate()
Mass flow rate (kg/s).
virtual void getNetProductionRates(doublereal *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
size_t nSpecies() const
Returns the number of species in the phase.
virtual void setMassFractions_NoNorm(const double *const y)
Set the mass fractions to the specified values without normalizing.
const vector_fp & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
virtual void setPressure(double p)
Set the internally stored pressure (Pa) at constant temperature and composition.
std::string speciesName(size_t k) const
Name of the species with index k.
const double * massFractions() const
Return a const pointer to the mass fraction array.
virtual double density() const
Density (kg/m^3).
void restoreState(const vector_fp &state)
Restore a state saved on a previous call to saveState.
void getMassFractions(double *const y) const
Get the species mass fractions.
FlowDevice & outlet(size_t n=0)
Return a reference to the n-th outlet FlowDevice connected to this reactor.
double m_pressure
Current pressure in the reactor [Pa].
FlowDevice & inlet(size_t n=0)
Return a reference to the n-th inlet FlowDevice connected to this reactor.
double m_vol
Current volume of the reactor [m^3].
size_t m_nsp
Number of homogeneous species in the mixture.
double m_enthalpy
Current specific enthalpy of the reactor [J/kg].
virtual void evalSurfaces(double *LHS, double *RHS, double *sdot)
Evaluate terms related to surface reactions.
virtual void updateSurfaceState(double *y)
Update the state of SurfPhase objects attached to this reactor.
Kinetics * m_kin
Pointer to the homogeneous Kinetics object that handles the reactions.
virtual void evalWalls(double t)
Evaluate terms related to Walls.
size_t neq()
Number of equations (state variables) for this reactor.
double m_Qdot
net heat transfer into the reactor, through walls [W]
doublereal m_mass
total mass
vector_fp m_sdot
Production rates of gas phase species on surfaces [kmol/s].
virtual void initialize(doublereal t0=0.0)
Initialize the reactor.
virtual void getSurfaceInitialConditions(double *y)
Get initial conditions for SurfPhase objects attached to this reactor.
virtual size_t speciesIndex(const std::string &nm) const
Return the index in the solution vector for this reactor of the species named nm, in either the homog...
vector_fp m_wdot
Species net molar production rates.
virtual void updateConnected(bool updatePressure)
Update the state information needed by connected reactors and flow devices.
Base class for a phase with thermodynamic properties.
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.
doublereal enthalpy_mass() const
Specific enthalpy. Units: J/kg.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
doublereal dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...