14FlowDevice::FlowDevice(shared_ptr<ReactorBase> r0, shared_ptr<ReactorBase> r1,
17 if (!m_nodes.first || !m_nodes.second) {
18 warn_deprecated(
"FlowDevice::FlowDevice",
19 "After Cantera 3.2, Reactors must be provided to a FlowDevice "
25 m_in->addOutlet(*
this);
26 m_out->addInlet(*
this);
29 const ThermoPhase& mixin = *m_in->phase()->thermo();
30 const ThermoPhase& mixout = *m_out->phase()->thermo();
32 m_nspin = mixin.nSpecies();
33 m_nspout = mixout.nSpecies();
36 for (ki = 0; ki < m_nspin; ki++) {
37 nm = mixin.speciesName(ki);
38 ko = mixout.speciesIndex(nm,
false);
39 m_in2out.push_back(ko);
41 for (ko = 0; ko < m_nspout; ko++) {
42 nm = mixout.speciesName(ko);
43 ki = mixin.speciesIndex(nm,
false);
44 m_out2in.push_back(ki);
51 "To be removed after Cantera 3.2. Reactors should be provided to constructor "
54 throw CanteraError(
"FlowDevice::install",
"Already installed");
58 m_in->addOutlet(*
this);
59 m_out->addInlet(*
this);
69 for (ki = 0; ki < m_nspin; ki++) {
72 m_in2out.push_back(ko);
74 for (ko = 0; ko < m_nspout; ko++) {
77 m_out2in.push_back(ki);
85 "To be removed after Cantera 3.2. Replaceable by version using "
92 double delta_P =
in().pressure() -
out().pressure();
102 "To be removed after Cantera 3.2. Replaceable by version using "
120 size_t ki = m_out2in[k];
124 return m_mdot * m_in->massFraction(ki);
129 return m_in->enthalpy_mass();
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Base class for exceptions thrown by Cantera classes.
Base class for walls and flow devices connecting reactors.
double outletSpeciesMassFlowRate(size_t k)
Mass flow rate (kg/s) of outlet species k.
bool install(ReactorBase &in, ReactorBase &out)
Install a flow device between two reactors.
Func1 * m_tfunc
Function set by setTimeFunction; used by updateMassFlowRate.
double m_time
Current reactor network time.
double enthalpy_mass()
specific enthalpy
ReactorBase & in() const
Return a reference to the upstream reactor.
virtual void setPressureFunction(Func1 *f)
Set a function of pressure that is used in determining the mass flow rate through the device.
const ReactorBase & out() const
Return a const reference to the downstream reactor.
double evalTimeFunction()
Return current value of the time function.
virtual void setTimeFunction(Func1 *g)
Set a function of time that is used in determining the mass flow rate through the device.
double evalPressureFunction()
Return current value of the pressure function.
Func1 * m_pfunc
Function set by setPressureFunction; used by updateMassFlowRate.
Base class for 'functor' classes that evaluate a function of one variable.
size_t nSpecies() const
Returns the number of species in the phase.
string speciesName(size_t k) const
Name of the species with index k.
size_t speciesIndex(const string &name) const
Returns the index of a species named 'name' within the Phase object.
Base class for reactor objects.
Base class for a phase with thermodynamic properties.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.