A class for flow controllers where the flow rate is equal to the flow rate of a primary mass flow controller plus a correction proportional to the pressure difference between the inlet and outlet. More...
#include <flowControllers.h>
A class for flow controllers where the flow rate is equal to the flow rate of a primary mass flow controller plus a correction proportional to the pressure difference between the inlet and outlet.
The device coefficient c sets the proportionality constant between pressure drop and mass flow rate and has units of kg/s/Pa. The mass flow rate is computed as:
\[\dot{m} = \dot{m}_{primary} + c f(\Delta P) \]
where f is a functions of pressure drop that is set by setPressureFunction. If no functions is specified, the mass flow rate defaults to:
\[\dot{m} = \dot{m}_{primary} + c \Delta P \]
Definition at line 85 of file flowControllers.h.
Public Member Functions | |
| string | type () const override |
| String indicating the connector implemented. | |
| bool | ready () override |
| void | setPrimary (shared_ptr< ConnectorNode > primary) override |
| Set the primary mass flow controller. | |
| void | setTimeFunction (shared_ptr< Func1 > f) override |
| Set a function of time to modulate the mass flow rate. | |
| void | setPressureCoeff (double c) |
| Set the proportionality constant between pressure drop and mass flow rate. | |
| double | getPressureCoeff () |
| Get the pressure coefficient. | |
| void | updateMassFlowRate (double time) override |
| Update the mass flow rate at time 'time'. | |
| double | massFlowRate_ddP () const override |
| Derivative of mass flow rate with respect to pressure difference. | |
| void | addMassFlowRateJacobian (SparseTriplets &trips, size_t row, double coeff, bool includePressureSpecies=true) override |
| Add terms proportional to derivatives of this device's mass flow rate. | |
| FlowDevice (shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name="(none)") | |
Public Member Functions inherited from FlowDevice | |
| 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. | |
| virtual double | massFlowRate_ddP () const |
| Derivative of mass flow rate with respect to pressure difference. | |
| 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. | |
| virtual void | addMassFlowRateJacobian (SparseTriplets &trips, size_t row, double coeff, bool includePressureSpecies=true) |
| Add Jacobian terms proportional to derivatives of the mass flow rate. | |
| void | addOutletSpeciesMassFlowRateJacobian (SparseTriplets &trips, size_t row, size_t k, double coeff, bool includeComposition=true, bool includePressureSpecies=true) |
Add Jacobian terms proportional to derivatives of outletSpeciesMassFlowRate(k). | |
| void | addInletEnthalpyJacobian (SparseTriplets &trips, size_t row, double coeff, bool includeComposition=true) |
| Add Jacobian terms for the inlet enthalpy dependence on upstream state. | |
| double | enthalpy_mass () |
| specific enthalpy | |
| 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 (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 (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 | |
Public Member Functions inherited from ConnectorNode | |
| 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 | |
| FlowDevice * | m_primary = nullptr |
Protected Attributes inherited from FlowDevice | |
| double | m_mdot = Undef |
| shared_ptr< Func1 > | m_pfunc |
| Function set by setPressureFunction; used by updateMassFlowRate. | |
| shared_ptr< Func1 > | m_tfunc |
| 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. | |
Protected Attributes inherited from ConnectorNode | |
| 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. | |
Additional Inherited Members | |
Protected Member Functions inherited from FlowDevice | |
| double | pressureFunction_ddP (double deltaP) const |
Return the derivative of the pressure function at deltaP. | |
|
inlineoverridevirtual |
String indicating the connector implemented.
Usually corresponds to the name of the derived class.
Reimplemented from FlowDevice.
Definition at line 90 of file flowControllers.h.
|
inlineoverridevirtual |
Reimplemented from FlowDevice.
Definition at line 94 of file flowControllers.h.
|
overridevirtual |
Set the primary mass flow controller.
Reimplemented from FlowDevice.
Definition at line 68 of file flowControllers.cpp.
|
inlineoverridevirtual |
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 from FlowDevice.
Definition at line 100 of file flowControllers.h.
|
inline |
Set the proportionality constant between pressure drop and mass flow rate.
Definition at line 105 of file flowControllers.h.
|
inline |
Get the pressure coefficient.
Definition at line 110 of file flowControllers.h.
|
overridevirtual |
Update the mass flow rate at time 'time'.
This must be overloaded in derived classes to update m_mdot.
Reimplemented from FlowDevice.
Definition at line 32 of file flowControllers.cpp.
|
overridevirtual |
Derivative of mass flow rate with respect to pressure difference.
Returns d(mdot)/d(P_in - P_out) for the current state. A return value of zero indicates that pressure coupling does not contribute Jacobian entries.
Reimplemented from FlowDevice.
Definition at line 50 of file flowControllers.cpp.
|
overridevirtual |
Add terms proportional to derivatives of this device's mass flow rate.
Adds both the pressure-correction derivative and the primary flow device's derivative.
Adds entries for coeff * d(mdot)/dy_j to the specified global row of the reactor network Jacobian. The flow device supplies the scalar derivative of mass flow rate with respect to connector variables such as pressure drop while the adjacent reactors supply derivatives of those variables with respect to their state variables.
| [in,out] | trips | Sparse Jacobian entries. Implementations append entries using global row and column indices in the reactor network. |
| row | Global row index receiving these chain-rule terms. | |
| coeff | Multiplicative factor applied to d(mdot)/dy_j. | |
| includePressureSpecies | Include pressure derivatives with respect to species state variables when pressure is a derived quantity. These terms may be dense and are controlled by preconditioner sparsity settings. |
Reimplemented from FlowDevice.
Definition at line 59 of file flowControllers.cpp.
| FlowDevice | ( | shared_ptr< ReactorBase > | r0, |
| shared_ptr< ReactorBase > | r1, | ||
| const string & | name = "(none)" |
||
| ) |
Definition at line 28 of file FlowDevice.cpp.
|
protected |
Definition at line 127 of file flowControllers.h.