Cantera  2.1.2
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
ReactorBase Class Reference

Base class for stirred reactors. More...

#include <ReactorBase.h>

Inheritance diagram for ReactorBase:
[legend]
Collaboration diagram for ReactorBase:
[legend]

Public Member Functions

 ReactorBase (const std::string &name="(none)")
 
virtual int type () const
 Return a constant indicating the type of this Reactor. More...
 
std::string name () const
 Return the name of this reactor. More...
 
void setName (const std::string &name)
 Set the name of this reactor. More...
 
void restoreState ()
 Set the state of the Phase object associated with this reactor to the reactor's current state. More...
 
thermo_tcontents ()
 return a reference to the contents. More...
 
const thermo_tcontents () const
 
doublereal residenceTime ()
 Return the residence time (s) of the contents of this reactor, based on the outlet mass flow rates and the mass of the reactor contents. More...
 
int error (const std::string &msg) const
 
ReactorNetnetwork ()
 The ReactorNet that this reactor belongs to. More...
 
void setNetwork (ReactorNet *net)
 Set the ReactorNet that this reactor belongs to. More...
 
Methods to set up a simulation.
void setInitialVolume (doublereal vol)
 Set the initial reactor volume. More...
 
virtual void setThermoMgr (thermo_t &thermo)
 Specify the mixture contained in the reactor. More...
 
void addInlet (FlowDevice &inlet)
 Connect an inlet FlowDevice to this reactor. More...
 
void addOutlet (FlowDevice &outlet)
 Connect an outlet FlowDevice to this reactor. More...
 
FlowDeviceinlet (size_t n=0)
 Return a reference to the n-th inlet FlowDevice connected to this reactor. More...
 
FlowDeviceoutlet (size_t n=0)
 Return a reference to the n-th outlet FlowDevice connected to this reactor. More...
 
size_t nInlets ()
 Return the number of inlet FlowDevice objects connected to this reactor. More...
 
size_t nOutlets ()
 Return the number of outlet FlowDevice objects connected to this reactor. More...
 
size_t nWalls ()
 Return the number of Wall objects connected to this reactor. More...
 
void addWall (Wall &w, int lr)
 Insert a Wall between this reactor and another reactor. More...
 
Wallwall (size_t n)
 Return a reference to the n-th Wall connected to this reactor. More...
 
virtual void initialize (doublereal t0=0.0)
 Initialize the reactor. More...
 
virtual void start ()
 
Solution components.

The values returned are those after the last call to ReactorNet::advance or ReactorNet::step.

doublereal volume () const
 Returns the current volume (m^3) of the reactor. More...
 
doublereal density () const
 Returns the current density (kg/m^3) of the reactor's contents. More...
 
doublereal temperature () const
 Returns the current temperature (K) of the reactor's contents. More...
 
doublereal enthalpy_mass () const
 Returns the current enthalpy (J/kg) of the reactor's contents. More...
 
doublereal intEnergy_mass () const
 Returns the current internal energy (J/kg) of the reactor's contents. More...
 
doublereal pressure () const
 Returns the current pressure (Pa) of the reactor. More...
 
doublereal mass () const
 Returns the mass (kg) of the reactor's contents. More...
 
const doublereal * massFractions () const
 Return the vector of species mass fractions. More...
 
doublereal massFraction (size_t k) const
 Return the mass fraction of the k-th species. More...
 

Protected Attributes

size_t m_nsp
 Number of homogeneous species in the mixture. More...
 
thermo_tm_thermo
 
doublereal m_vol
 
doublereal m_vol0
 
bool m_init
 
size_t m_nInlets
 
size_t m_nOutlets
 
bool m_open
 
doublereal m_enthalpy
 
doublereal m_intEnergy
 
doublereal m_pressure
 
vector_fp m_state
 
std::vector< FlowDevice * > m_inlet
 
std::vector< FlowDevice * > m_outlet
 
std::vector< Wall * > m_wall
 
vector_int m_lr
 
size_t m_nwalls
 
std::string m_name
 
double m_rho0
 
ReactorNetm_net
 The ReactorNet that this reactor is part of. More...
 

Private Member Functions

void tilt (const std::string &method="") const
 

Detailed Description

Base class for stirred reactors.

Allows using any substance model, with arbitrary inflow, outflow, heat loss/gain, surface chemistry, and volume change.

Definition at line 30 of file ReactorBase.h.

Member Function Documentation

virtual int type ( ) const
inlinevirtual

Return a constant indicating the type of this Reactor.

Reimplemented in Reactor, ConstPressureReactor, IdealGasConstPressureReactor, IdealGasReactor, and FlowReactor.

Definition at line 37 of file ReactorBase.h.

Referenced by ReactorNet::addReactor().

std::string name ( ) const
inline

Return the name of this reactor.

Definition at line 42 of file ReactorBase.h.

Referenced by ReactorNet::addReactor(), Reactor::addSensitivityReaction(), and ReactorBase::setName().

void setName ( const std::string &  name)
inline

Set the name of this reactor.

Definition at line 47 of file ReactorBase.h.

References ReactorBase::name().

void setInitialVolume ( doublereal  vol)
inline

Set the initial reactor volume.

By default, the volume is 1.0 m^3.

Definition at line 58 of file ReactorBase.h.

void setThermoMgr ( thermo_t thermo)
virtual

Specify the mixture contained in the reactor.

Note that a pointer to this substance is stored, and as the integration proceeds, the state of the substance is modified.

Reimplemented in IdealGasConstPressureReactor, and IdealGasReactor.

Definition at line 32 of file ReactorBase.cpp.

References ThermoPhase::enthalpy_mass(), ThermoPhase::intEnergy_mass(), ReactorBase::m_nsp, Phase::nSpecies(), ThermoPhase::pressure(), and Phase::saveState().

Referenced by Reactor::insert().

void addInlet ( FlowDevice inlet)

Connect an inlet FlowDevice to this reactor.

Definition at line 42 of file ReactorBase.cpp.

Referenced by FlowDevice::install().

void addOutlet ( FlowDevice outlet)

Connect an outlet FlowDevice to this reactor.

Definition at line 49 of file ReactorBase.cpp.

Referenced by FlowDevice::install().

FlowDevice & inlet ( size_t  n = 0)

Return a reference to the n-th inlet FlowDevice connected to this reactor.

Definition at line 97 of file ReactorBase.cpp.

Referenced by ReactorNet::initialize().

FlowDevice & outlet ( size_t  n = 0)

Return a reference to the n-th outlet FlowDevice connected to this reactor.

Definition at line 101 of file ReactorBase.cpp.

Referenced by ReactorNet::initialize().

size_t nInlets ( )
inline

Return the number of inlet FlowDevice objects connected to this reactor.

Definition at line 86 of file ReactorBase.h.

Referenced by ReactorNet::initialize().

size_t nOutlets ( )
inline

Return the number of outlet FlowDevice objects connected to this reactor.

Definition at line 92 of file ReactorBase.h.

Referenced by ReactorNet::initialize().

size_t nWalls ( )
inline

Return the number of Wall objects connected to this reactor.

Definition at line 97 of file ReactorBase.h.

Referenced by ReactorNet::initialize().

void addWall ( Wall w,
int  lr 
)

Insert a Wall between this reactor and another reactor.

lr = 0 if this reactor is to the left of the wall and lr = 1 if this reactor is to the right of the wall. This method is called automatically for both the left and right reactors by Wall::install.

Definition at line 56 of file ReactorBase.cpp.

Referenced by Wall::install().

Wall & wall ( size_t  n)

Return a reference to the n-th Wall connected to this reactor.

Definition at line 67 of file ReactorBase.cpp.

Referenced by ReactorNet::initialize().

virtual void initialize ( doublereal  t0 = 0.0)
inlinevirtual

Initialize the reactor.

Called automatically by ReactorNet::initialize.

Reimplemented in Reactor, IdealGasConstPressureReactor, ConstPressureReactor, IdealGasReactor, and FlowReactor.

Definition at line 115 of file ReactorBase.h.

virtual void start ( )
inlinevirtual
Deprecated:
Not used in any derived class.

Definition at line 120 of file ReactorBase.h.

void restoreState ( )
inline

Set the state of the Phase object associated with this reactor to the reactor's current state.

Definition at line 126 of file ReactorBase.h.

References Phase::restoreState().

thermo_t& contents ( )
inline

return a reference to the contents.

Definition at line 134 of file ReactorBase.h.

Referenced by FlowDevice::install().

doublereal residenceTime ( )

Return the residence time (s) of the contents of this reactor, based on the outlet mass flow rates and the mass of the reactor contents.

Definition at line 87 of file ReactorBase.cpp.

References ReactorBase::mass().

doublereal volume ( ) const
inline

Returns the current volume (m^3) of the reactor.

Definition at line 154 of file ReactorBase.h.

doublereal density ( ) const
inline

Returns the current density (kg/m^3) of the reactor's contents.

Definition at line 159 of file ReactorBase.h.

Referenced by ReactorBase::mass().

doublereal temperature ( ) const
inline

Returns the current temperature (K) of the reactor's contents.

Definition at line 164 of file ReactorBase.h.

Referenced by Wall::Q(), and Reactor::updateState().

doublereal enthalpy_mass ( ) const
inline

Returns the current enthalpy (J/kg) of the reactor's contents.

Definition at line 169 of file ReactorBase.h.

Referenced by FlowDevice::enthalpy_mass().

doublereal intEnergy_mass ( ) const
inline

Returns the current internal energy (J/kg) of the reactor's contents.

Definition at line 174 of file ReactorBase.h.

doublereal pressure ( ) const
inline

Returns the current pressure (Pa) of the reactor.

Definition at line 179 of file ReactorBase.h.

Referenced by PressureController::updateMassFlowRate(), Valve::updateMassFlowRate(), and Wall::vdot().

doublereal mass ( ) const
inline

Returns the mass (kg) of the reactor's contents.

Definition at line 184 of file ReactorBase.h.

References ReactorBase::density().

Referenced by ReactorBase::residenceTime().

const doublereal* massFractions ( ) const
inline

Return the vector of species mass fractions.

Definition at line 189 of file ReactorBase.h.

References DATA_PTR.

doublereal massFraction ( size_t  k) const
inline

Return the mass fraction of the k-th species.

Definition at line 194 of file ReactorBase.h.

Referenced by FlowDevice::outletSpeciesMassFlowRate().

ReactorNet & network ( )

The ReactorNet that this reactor belongs to.

Definition at line 72 of file ReactorBase.cpp.

References ReactorBase::m_net.

Referenced by Reactor::addSensitivityReaction().

void setNetwork ( ReactorNet net)

Set the ReactorNet that this reactor belongs to.

Definition at line 82 of file ReactorBase.cpp.

References ReactorBase::m_net.

Referenced by ReactorNet::addReactor().

Member Data Documentation

size_t m_nsp
protected
ReactorNet* m_net
protected

The ReactorNet that this reactor is part of.

Definition at line 232 of file ReactorBase.h.

Referenced by ReactorBase::network(), and ReactorBase::setNetwork().


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