Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors. More...
#include <FlowDevice.h>
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Definition at line 24 of file FlowDevice.h.
Public Member Functions | |
FlowDevice (shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name="(none)") | |
string | type () const override |
String indicating the connector implemented. | |
double | massFlowRate () |
Mass flow rate (kg/s). | |
virtual void | updateMassFlowRate (double time) |
Update the mass flow rate at time 'time'. | |
virtual void | setMassFlowRate (double mdot) |
Set the fixed mass flow rate (kg/s) through a flow device. | |
double | deviceCoefficient () const |
Get the device coefficient (defined by derived class). | |
void | setDeviceCoefficient (double c) |
Set the device coefficient (defined by derived class). | |
virtual void | setPrimary (shared_ptr< ConnectorNode > primary) |
Set the primary mass flow controller. | |
double | outletSpeciesMassFlowRate (size_t k) |
Mass flow rate (kg/s) of outlet species k. | |
double | enthalpy_mass () |
specific enthalpy | |
bool | install (ReactorBase &in, ReactorBase &out) |
Install a flow device between two reactors. | |
virtual bool | ready () |
ReactorBase & | in () const |
Return a reference to the upstream reactor. | |
const ReactorBase & | out () const |
Return a const reference to the downstream reactor. | |
ReactorBase & | out () |
Return a mutable reference to the downstream reactor. | |
double | evalPressureFunction () |
Return current value of the pressure function. | |
virtual void | setPressureFunction (Func1 *f) |
Set a function of pressure that is used in determining the mass flow rate through the device. | |
virtual void | setPressureFunction (shared_ptr< Func1 > f) |
Set a function of pressure to modify the pressure response. | |
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. | |
virtual void | setTimeFunction (shared_ptr< Func1 > g) |
Set a function of time to modulate the mass flow rate. | |
void | setSimTime (double time) |
Set current reactor network time. | |
ConnectorNode (const string &name="(none)") | |
Transitional constructor. | |
ConnectorNode (shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name="(none)") | |
Instantiate a ConnectorNode object with associated ReactorBase objects. | |
ConnectorNode (const ConnectorNode &)=delete | |
![]() | |
ConnectorNode (const string &name="(none)") | |
Transitional constructor. | |
ConnectorNode (shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name="(none)") | |
Instantiate a ConnectorNode object with associated ReactorBase objects. | |
ConnectorNode (const ConnectorNode &)=delete | |
ConnectorNode & | operator= (const ConnectorNode &)=delete |
virtual string | type () const |
String indicating the connector implemented. | |
string | name () const |
Retrieve connector name. | |
void | setName (const string &name) |
Set connector name. | |
void | setDefaultName (map< string, int > &counts) |
Set the default name of a connector. Returns false if it was previously set. | |
Protected Attributes | |
double | m_mdot = Undef |
Func1 * | m_pfunc = nullptr |
Function set by setPressureFunction; used by updateMassFlowRate. | |
Func1 * | m_tfunc = nullptr |
Function set by setTimeFunction; used by updateMassFlowRate. | |
double | m_coeff = 1.0 |
Coefficient set by derived classes; used by updateMassFlowRate. | |
double | m_time = 0. |
Current reactor network time. | |
![]() | |
pair< shared_ptr< ReactorBase >, shared_ptr< ReactorBase > > | m_nodes |
Pair of reactors forming end points of the connector. | |
string | m_name |
ConnectorNode name. | |
bool | m_defaultNameSet = false |
true if default name has been previously set. | |
Private Attributes | |
size_t | m_nspin = 0 |
size_t | m_nspout = 0 |
ReactorBase * | m_in = nullptr |
ReactorBase * | m_out = nullptr |
vector< size_t > | m_in2out |
vector< size_t > | m_out2in |
FlowDevice | ( | shared_ptr< ReactorBase > | r0, |
shared_ptr< ReactorBase > | r1, | ||
const string & | name = "(none)" |
||
) |
Definition at line 14 of file FlowDevice.cpp.
|
inlineoverridevirtual |
String indicating the connector implemented.
Usually corresponds to the name of the derived class.
Reimplemented from ConnectorNode.
Reimplemented in MassFlowController, PressureController, and Valve.
Definition at line 31 of file FlowDevice.h.
|
inline |
Mass flow rate (kg/s).
Definition at line 36 of file FlowDevice.h.
|
inlinevirtual |
Update the mass flow rate at time 'time'.
This must be overloaded in derived classes to update m_mdot.
Reimplemented in MassFlowController, PressureController, and Valve.
Definition at line 47 of file FlowDevice.h.
|
inlinevirtual |
Set the fixed mass flow rate (kg/s) through a flow device.
Reimplemented in MassFlowController.
Definition at line 50 of file FlowDevice.h.
|
inline |
Get the device coefficient (defined by derived class).
Definition at line 56 of file FlowDevice.h.
|
inline |
Set the device coefficient (defined by derived class).
Definition at line 62 of file FlowDevice.h.
|
inlinevirtual |
Set the primary mass flow controller.
Reimplemented in PressureController.
Definition at line 68 of file FlowDevice.h.
double outletSpeciesMassFlowRate | ( | size_t | k | ) |
Mass flow rate (kg/s) of outlet species k.
Returns zero if this species is not present in the upstream mixture.
Definition at line 115 of file FlowDevice.cpp.
double enthalpy_mass | ( | ) |
specific enthalpy
Definition at line 127 of file FlowDevice.cpp.
bool install | ( | ReactorBase & | in, |
ReactorBase & | out | ||
) |
Install a flow device between two reactors.
in | Upstream reactor. |
out | Downstream reactor. |
Definition at line 48 of file FlowDevice.cpp.
|
inlinevirtual |
Definition at line 88 of file FlowDevice.h.
|
inline |
Return a reference to the upstream reactor.
Definition at line 93 of file FlowDevice.h.
|
inline |
Return a const reference to the downstream reactor.
Definition at line 98 of file FlowDevice.h.
|
inline |
Return a mutable reference to the downstream reactor.
Definition at line 103 of file FlowDevice.h.
double evalPressureFunction | ( | ) |
Return current value of the pressure function.
The mass flow rate [kg/s] is calculated given the pressure drop [Pa] and a coefficient set by a flow device specific function; unless a user-defined pressure function is set, this is the pressure difference across the device. The calculation of mass flow rate depends to the flow device.
Definition at line 90 of file FlowDevice.cpp.
|
virtual |
Set a function of pressure that is used in determining the mass flow rate through the device.
The evaluation of mass flow depends on the derived flow device class.
Reimplemented in MassFlowController.
Definition at line 82 of file FlowDevice.cpp.
|
inlinevirtual |
Set a function of pressure to modify the pressure response.
Set a function of pressure that is used in determining the mass flow rate through the device. The evaluation of mass flow depends on the derived flow device class.
Reimplemented in MassFlowController.
Definition at line 129 of file FlowDevice.h.
double evalTimeFunction | ( | ) |
Return current value of the time function.
The mass flow rate [kg/s] is calculated for a Flow device, and multiplied by a function of time, which returns 1.0 unless a user-defined function is provided. The calculation of mass flow rate depends on the flow device.
Definition at line 107 of file FlowDevice.cpp.
|
virtual |
Set a function of time that is used in determining the mass flow rate through the device.
The evaluation of mass flow depends on the derived flow device class.
Reimplemented in PressureController.
Definition at line 99 of file FlowDevice.cpp.
|
inlinevirtual |
Set a function of time to modulate the mass flow rate.
Set a function of time that is used in determining the mass flow rate through the device. The evaluation of mass flow depends on the derived flow device class.
Reimplemented in PressureController.
Definition at line 154 of file FlowDevice.h.
|
inline |
Set current reactor network time.
Definition at line 162 of file FlowDevice.h.
|
inline |
Transitional constructor.
Definition at line 32 of file ConnectorNode.h.
|
inline |
Instantiate a ConnectorNode object with associated ReactorBase objects.
r0 | First reactor. |
r1 | Second reactor. |
name | Name of the connector. |
Definition at line 38 of file ConnectorNode.h.
|
protected |
Definition at line 167 of file FlowDevice.h.
|
protected |
Function set by setPressureFunction; used by updateMassFlowRate.
Definition at line 170 of file FlowDevice.h.
|
protected |
Function set by setTimeFunction; used by updateMassFlowRate.
Definition at line 173 of file FlowDevice.h.
|
protected |
Coefficient set by derived classes; used by updateMassFlowRate.
Definition at line 176 of file FlowDevice.h.
|
protected |
Current reactor network time.
Definition at line 179 of file FlowDevice.h.
|
private |
Definition at line 182 of file FlowDevice.h.
|
private |
Definition at line 183 of file FlowDevice.h.
|
private |
Definition at line 184 of file FlowDevice.h.
|
private |
Definition at line 185 of file FlowDevice.h.
|
private |
Definition at line 186 of file FlowDevice.h.
|
private |
Definition at line 186 of file FlowDevice.h.