20 if (thermo.
type() !=
"ideal-gas") {
22 "Incompatible phase type provided");
31 "Error: reactor is empty.");
74 double& dmdt = RHS[0];
75 double& mcvdTdt = RHS[2];
76 double* mdYdt = RHS + 3;
95 for (
size_t n = 0; n <
m_nsp; n++) {
102 mdYdt[n] -= Y[n] * mdot_surf;
108 for (
auto outlet : m_outlet) {
115 for (
auto inlet : m_inlet) {
119 for (
size_t n = 0; n <
m_nsp; n++) {
122 mdYdt[n] += mdot_spec - mdot * Y[n];
126 mcvdTdt -=
m_uk[n] / mw[n] * mdot_spec;
141 throw CanteraError(
"IdealGasReactor::steadyConstraints",
142 "Steady state solver cannot currently be used with IdealGasReactor"
143 " when reactor surfaces are present.\n"
144 "See https://github.com/Cantera/enhancements/issues/234");
158 }
else if (nm ==
"mass") {
160 }
else if (nm ==
"volume") {
162 }
else if (nm ==
"temperature") {
171 return "temperature";
180 return 1.5 * m_thermo->
maxTemp();
189 return 0.5 * m_thermo->
minTemp();
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,...
Header file for base class WallBase.
Base class for exceptions thrown by Cantera classes.
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).
double upperBound(size_t k) const override
Get the upper bound on the k-th component of the local state vector.
vector< size_t > steadyConstraints() const override
Get the indices of equations that are algebraic constraints when solving the steady-state problem.
void eval(double t, double *LHS, double *RHS) override
Evaluate the reactor governing equations.
size_t componentIndex(const string &nm) const override
Return the index in the solution vector for this reactor of the component named nm.
vector< double > m_uk
Species molar internal energies.
void getState(double *y) override
Get the the current state of the reactor.
double lowerBound(size_t k) const override
Get the lower bound on the k-th component of the local state vector.
string componentName(size_t k) override
Return the name of the solution component with index i.
void setThermo(ThermoPhase &thermo) override
Specify the mixture contained in the reactor.
void updateState(double *y) override
Set the state of the reactor to correspond to the state vector y.
void initialize(double t0=0.0) override
Initialize the reactor.
virtual void getNetProductionRates(double *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
void restoreState(const vector< double > &state)
Restore a state saved on a previous call to saveState.
virtual void setMassFractions_NoNorm(const double *const y)
Set the mass fractions to the specified values without normalizing.
void setState_TD(double t, double rho)
Set the internally stored temperature (K) and density (kg/m^3)
double temperature() const
Temperature (K).
const double * massFractions() const
Return a const pointer to the mass fraction array.
const vector< double > & molecularWeights() const
Return a const reference to the internal vector of molecular weights.
virtual double density() const
Density (kg/m^3).
void getMassFractions(double *const y) const
Get the species mass fractions.
virtual void setThermo(ThermoPhase &thermo)
Specify the mixture contained in the reactor.
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].
virtual size_t nSurfs() const
Return the number of surfaces in a reactor.
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].
double m_mass
Current mass of the reactor [kg].
size_t m_nsp
Number of homogeneous species in the mixture.
virtual double lowerBound(size_t k) const
Get the lower bound on the k-th component of the local state vector.
virtual string componentName(size_t k)
Return the name of the solution component with index i.
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.
vector< double > m_wdot
Species net molar production rates.
virtual void evalWalls(double t)
Evaluate terms related to Walls.
bool energyEnabled() const
Returns true if solution of the energy equation is enabled.
double m_Qdot
net heat transfer into the reactor, through walls [W]
virtual double upperBound(size_t k) const
Get the upper bound on the k-th component of the local state vector.
vector< double > m_sdot
Production rates of gas phase species on surfaces [kmol/s].
double m_vdot
net rate of volume change from moving walls [m^3/s]
virtual void getSurfaceInitialConditions(double *y)
Get initial conditions for SurfPhase objects attached to this reactor.
void initialize(double t0=0.0) override
Initialize the reactor.
virtual size_t speciesIndex(const string &nm) const
Return the index in the solution vector for this reactor of the species named nm, in either the homog...
virtual void updateConnected(bool updatePressure)
Update the state information needed by connected reactors, flow devices, and reactor walls.
Base class for a phase with thermodynamic properties.
virtual double minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid.
string type() const override
String indicating the thermodynamic model implemented.
virtual void getPartialMolarIntEnergies(double *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual double maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
double cv_mass() const
Specific heat at constant volume. Units: J/kg/K.
double dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...