14FlowDevice::FlowDevice(shared_ptr<ReactorBase> r0, shared_ptr<ReactorBase> r1,
15 const string& name) : ConnectorNode(r0, r1, name)
17 if (!m_nodes.first || !m_nodes.second) {
19 "After Cantera 3.1, Reactors must be provided to a FlowDevice "
25 m_in->addOutlet(*
this);
26 m_out->addInlet(*
this);
29 const ThermoPhase& mixin = m_in->contents();
30 const ThermoPhase& mixout = m_out->contents();
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);
39 m_in2out.push_back(ko);
41 for (ko = 0; ko < m_nspout; ko++) {
42 nm = mixout.speciesName(ko);
43 ki = mixin.speciesIndex(nm);
44 m_out2in.push_back(ki);
51 "To be removed after Cantera 3.1. Reactors should be provided to constructor "
54 throw CanteraError(
"FlowDevice::install",
"Already installed");
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);
82void FlowDevice::setPressureFunction(
Func1* f)
87double FlowDevice::evalPressureFunction()
89 double delta_P = in().pressure() - out().pressure();
91 return m_pfunc->
eval(delta_P);
96void FlowDevice::setTimeFunction(
Func1* g)
101double FlowDevice::evalTimeFunction()
104 return m_tfunc->
eval(m_time);
109double FlowDevice::outletSpeciesMassFlowRate(
size_t k)
114 size_t ki = m_out2in[k];
118 return m_mdot * m_in->massFraction(ki);
121double FlowDevice::enthalpy_mass()
123 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 'functor' classes that evaluate a function of one variable.
virtual double eval(double t) const
Evaluate the function.
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 stirred reactors.
void addOutlet(FlowDevice &outlet)
Connect an outlet FlowDevice to this reactor.
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.