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) {
18 throw CanteraError(
"FlowDevice::FlowDevice",
19 "Reactors must be provided to FlowDevice constructor.");
23 m_in->addOutlet(*
this);
24 m_out->addInlet(*
this);
27 const ThermoPhase& mixin = *m_in->phase()->thermo();
28 const ThermoPhase& mixout = *m_out->phase()->thermo();
30 m_nspin = mixin.nSpecies();
31 m_nspout = mixout.nSpecies();
34 for (ki = 0; ki < m_nspin; ki++) {
35 nm = mixin.speciesName(ki);
36 ko = mixout.speciesIndex(nm,
false);
37 m_in2out.push_back(ko);
39 for (ko = 0; ko < m_nspout; ko++) {
40 nm = mixout.speciesName(ko);
41 ki = mixin.speciesIndex(nm,
false);
42 m_out2in.push_back(ki);
46double FlowDevice::evalPressureFunction()
48 double delta_P = in().pressure() - out().pressure();
50 return m_pfunc->eval(delta_P);
55double FlowDevice::evalTimeFunction()
58 return m_tfunc->eval(m_time);
63double FlowDevice::outletSpeciesMassFlowRate(
size_t k)
68 size_t ki = m_out2in[k];
72 return m_mdot * m_in->massFraction(ki);
75double FlowDevice::enthalpy_mass()
77 return m_in->enthalpy_mass();
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"