Cantera  3.1.0b1
Loading...
Searching...
No Matches
FlowDevice Class Reference

Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors. More...

#include <FlowDevice.h>

Inheritance diagram for FlowDevice:
[legend]

Detailed Description

Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.

Definition at line 23 of file FlowDevice.h.

Public Member Functions

 FlowDevice (const string &name="(none)")
 
 FlowDevice (const FlowDevice &)=delete
 
FlowDeviceoperator= (const FlowDevice &)=delete
 
virtual string type () const
 String indicating the flow device implemented.
 
string name () const
 Retrieve flow device name.
 
void setName (const string &name)
 Set flow device name.
 
bool setDefaultName (map< string, int > &counts)
 Set the default name of a flow device. Returns false if it was previously set.
 
double massFlowRate ()
 Mass flow rate (kg/s).
 
virtual void updateMassFlowRate (double time)
 Update the mass flow rate at time 'time'.
 
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 ()
 
ReactorBasein () const
 Return a reference to the upstream reactor.
 
const ReactorBaseout () const
 Return a const reference to the downstream reactor.
 
ReactorBaseout ()
 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.
 
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.
 
void setSimTime (double time)
 Set current reactor network time.
 

Protected Attributes

string m_name
 Flow device name.
 
bool m_defaultNameSet = false
 true if default name has been previously set.
 
double m_mdot = Undef
 
Func1m_pfunc = nullptr
 Function set by setPressureFunction; used by updateMassFlowRate.
 
Func1m_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.
 

Private Attributes

size_t m_nspin = 0
 
size_t m_nspout = 0
 
ReactorBasem_in = nullptr
 
ReactorBasem_out = nullptr
 
vector< size_t > m_in2out
 
vector< size_t > m_out2in
 

Constructor & Destructor Documentation

◆ FlowDevice()

FlowDevice ( const string &  name = "(none)")
inline

Definition at line 26 of file FlowDevice.h.

Member Function Documentation

◆ type()

virtual string type ( ) const
inlinevirtual

String indicating the flow device implemented.

Usually corresponds to the name of the derived class.

Reimplemented in MassFlowController, PressureController, and Valve.

Definition at line 34 of file FlowDevice.h.

◆ name()

string name ( ) const
inline

Retrieve flow device name.

Definition at line 39 of file FlowDevice.h.

◆ setName()

void setName ( const string &  name)
inline

Set flow device name.

Definition at line 44 of file FlowDevice.h.

◆ setDefaultName()

bool setDefaultName ( map< string, int > &  counts)

Set the default name of a flow device. Returns false if it was previously set.

Definition at line 14 of file FlowDevice.cpp.

◆ massFlowRate()

double massFlowRate ( )
inline

Mass flow rate (kg/s).

Definition at line 52 of file FlowDevice.h.

◆ updateMassFlowRate()

virtual void updateMassFlowRate ( double  time)
inlinevirtual

Update the mass flow rate at time 'time'.

This must be overloaded in subclasses to update m_mdot.

Reimplemented in MassFlowController, PressureController, and Valve.

Definition at line 63 of file FlowDevice.h.

◆ outletSpeciesMassFlowRate()

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 86 of file FlowDevice.cpp.

◆ enthalpy_mass()

double enthalpy_mass ( )

specific enthalpy

Definition at line 98 of file FlowDevice.cpp.

◆ install()

bool install ( ReactorBase in,
ReactorBase out 
)

Install a flow device between two reactors.

Parameters
inUpstream reactor.
outDownstream reactor.

Definition at line 28 of file FlowDevice.cpp.

◆ ready()

virtual bool ready ( )
inlinevirtual

Definition at line 79 of file FlowDevice.h.

◆ in()

ReactorBase & in ( ) const
inline

Return a reference to the upstream reactor.

Definition at line 84 of file FlowDevice.h.

◆ out() [1/2]

const ReactorBase & out ( ) const
inline

Return a const reference to the downstream reactor.

Definition at line 89 of file FlowDevice.h.

◆ out() [2/2]

ReactorBase & out ( )
inline

Return a mutable reference to the downstream reactor.

Definition at line 94 of file FlowDevice.h.

◆ evalPressureFunction()

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.

Since
New in Cantera 3.0.

Definition at line 64 of file FlowDevice.cpp.

◆ setPressureFunction()

void setPressureFunction ( Func1 f)
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 59 of file FlowDevice.cpp.

◆ evalTimeFunction()

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.

Since
New in Cantera 3.0.

Definition at line 78 of file FlowDevice.cpp.

◆ setTimeFunction()

void setTimeFunction ( Func1 g)
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 73 of file FlowDevice.cpp.

◆ setSimTime()

void setSimTime ( double  time)
inline

Set current reactor network time.

Since
New in Cantera 3.0.

Definition at line 131 of file FlowDevice.h.

Member Data Documentation

◆ m_name

string m_name
protected

Flow device name.

Definition at line 136 of file FlowDevice.h.

◆ m_defaultNameSet

bool m_defaultNameSet = false
protected

true if default name has been previously set.

Definition at line 137 of file FlowDevice.h.

◆ m_mdot

double m_mdot = Undef
protected

Definition at line 139 of file FlowDevice.h.

◆ m_pfunc

Func1* m_pfunc = nullptr
protected

Function set by setPressureFunction; used by updateMassFlowRate.

Definition at line 142 of file FlowDevice.h.

◆ m_tfunc

Func1* m_tfunc = nullptr
protected

Function set by setTimeFunction; used by updateMassFlowRate.

Definition at line 145 of file FlowDevice.h.

◆ m_coeff

double m_coeff = 1.0
protected

Coefficient set by derived classes; used by updateMassFlowRate.

Definition at line 148 of file FlowDevice.h.

◆ m_time

double m_time = 0.
protected

Current reactor network time.

Definition at line 151 of file FlowDevice.h.

◆ m_nspin

size_t m_nspin = 0
private

Definition at line 154 of file FlowDevice.h.

◆ m_nspout

size_t m_nspout = 0
private

Definition at line 155 of file FlowDevice.h.

◆ m_in

ReactorBase* m_in = nullptr
private

Definition at line 156 of file FlowDevice.h.

◆ m_out

ReactorBase* m_out = nullptr
private

Definition at line 157 of file FlowDevice.h.

◆ m_in2out

vector<size_t> m_in2out
private

Definition at line 158 of file FlowDevice.h.

◆ m_out2in

vector<size_t> m_out2in
private

Definition at line 158 of file FlowDevice.h.


The documentation for this class was generated from the following files: