26 y[2] = m_thermo->temperature();
29 m_thermo->getMassFractions(y.subspan(3,
m_nsp));
45 m_thermo->setMassFractions_NoNorm(y.subspan(3,
m_nsp));
52 double& dmdt = RHS[0];
53 double& mcvdTdt = RHS[2];
54 auto mdYdt = RHS.subspan(3);
58 m_thermo->getPartialMolarIntEnergies_TV(
m_uk);
59 auto mw = m_thermo->molecularWeights();
60 auto Y = m_thermo->massFractions();
73 mcvdTdt += m_thermo->intrinsicHeating() *
m_vol;
76 for (
size_t n = 0; n <
m_nsp; n++) {
83 mdYdt[n] -= Y[n] * mdot_surf;
89 for (
auto outlet : m_outlet) {
90 double mdot =
outlet->massFlowRate();
96 for (
auto inlet : m_inlet) {
97 double mdot =
inlet->massFlowRate();
99 mcvdTdt +=
inlet->enthalpy_mass() * mdot;
100 for (
size_t n = 0; n <
m_nsp; n++) {
101 double mdot_spec =
inlet->outletSpeciesMassFlowRate(n);
103 mdYdt[n] += mdot_spec - mdot * Y[n];
107 mcvdTdt -=
m_uk[n] / mw[n] * mdot_spec;
113 LHS[2] =
m_mass * m_thermo->cv_mass();
144 if (nm ==
"volume") {
147 if (nm ==
"temperature") {
151 return m_thermo->speciesIndex(nm) + 3;
154 "Component '{}' not found", nm);
160 return "temperature";
169 return 1.5 * m_thermo->maxTemp();
178 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 upperBound(size_t k) const override
Get the upper bound on the k-th component of the local state vector.
void eval(double t, span< double > LHS, span< double > RHS) override
Evaluate the reactor governing equations.
void evalSteady(double t, span< double > LHS, span< double > RHS) override
Evaluate the governing equations with modifications for the steady-state solver.
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 at constant T,V.
vector< size_t > initializeSteady() override
Initialize the reactor before solving a steady-state problem.
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 initialize(double t0=0.0) override
Initialize the reactor.
double m_initialTemperature
Initial temperature [K]; used for steady-state calculations.
double m_initialVolume
Initial volume [m³]; used for steady-state calculations.
void updateState(span< const double > y) override
Set the state of the reactor to correspond to the state vector y.
void getState(span< double > y) override
Get the current state of 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].
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 void updateConnected(bool updatePressure)
Update state information needed by connected reactors, flow devices, and walls.
void evalWalls(double t) override
Evaluate terms related to Walls.
double upperBound(size_t k) const override
Get the upper bound on the k-th component of the local state vector.
Kinetics * m_kin
Pointer to the homogeneous Kinetics object that handles the reactions.
vector< double > m_wdot
Species net molar production rates.
bool energyEnabled() const override
Returns true if solution of the energy equation is enabled.
double m_Qdot
net heat transfer into the reactor, through walls [W]
void updateSurfaceProductionRates()
Update m_sdot to reflect current production rates of bulk phase species due to reactions on adjacent ...
double lowerBound(size_t k) const override
Get the lower bound on the k-th component of the local state vector.
vector< double > m_sdot
Total production rate of bulk phase species on surfaces [kmol/s].
string componentName(size_t k) override
Return the name of the solution component with index i.
double m_vdot
net rate of volume change from moving walls [m^3/s]
void initialize(double t0=0.0) override
Initialize the reactor.
double dot(InputIter x_begin, InputIter x_end, InputIter2 y_begin)
Function that calculates a templated inner product.
Namespace for the Cantera kernel.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...