Cantera 2.6.0
Public Member Functions | Protected Attributes | 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)")
 
 ReactorBase (const ReactorBase &)=delete
 
ReactorBaseoperator= (const ReactorBase &)=delete
 
virtual std::string typeStr () const
 String indicating the reactor model implemented. More...
 
virtual std::string type () const
 String indicating the reactor model implemented. 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...
 
virtual void syncState ()
 Set the state of the reactor to correspond to the state of the associated ThermoPhase object. More...
 
ThermoPhasecontents ()
 return a reference to the contents. More...
 
const ThermoPhasecontents () 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...
 
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. By default, the volume is 1.0 m^3. More...
 
virtual void setThermoMgr (ThermoPhase &thermo)
 Specify the mixture contained in the reactor. More...
 
virtual void setKineticsMgr (Kinetics &kin)
 Specify chemical kinetics governing the reactor. More...
 
virtual void setChemistry (bool cflag=true)
 Enable or disable changes in reactor composition due to chemical reactions. More...
 
virtual void setEnergy (int eflag=1)
 Set the energy equation on or off. 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 (WallBase &w, int lr)
 Insert a Wall between this reactor and another reactor. More...
 
WallBasewall (size_t n)
 Return a reference to the n-th Wall connected to this reactor. More...
 
void addSurface (ReactorSurface *surf)
 
ReactorSurfacesurface (size_t n)
 Return a reference to the n-th ReactorSurface connected to this reactor. More...
 
virtual void initialize (doublereal t0=0.0)
 Initialize the reactor. More...
 
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...
 
ThermoPhasem_thermo
 
double m_vol
 Current volume of the reactor [m^3]. More...
 
double m_enthalpy
 Current specific enthalpy of the reactor [J/kg]. More...
 
double m_intEnergy
 Current internal energy of the reactor [J/kg]. More...
 
double m_pressure
 Current pressure in the reactor [Pa]. More...
 
vector_fp m_state
 
std::vector< FlowDevice * > m_inlet
 
std::vector< FlowDevice * > m_outlet
 
std::vector< WallBase * > m_wall
 
std::vector< ReactorSurface * > m_surfaces
 
vector_int m_lr
 Vector of length nWalls(), indicating whether this reactor is on the left (0) or right (1) of each wall. More...
 
std::string m_name
 
ReactorNetm_net
 The ReactorNet that this reactor is part of. More...
 

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 48 of file ReactorBase.h.

Constructor & Destructor Documentation

◆ ReactorBase()

ReactorBase ( const std::string &  name = "(none)")
explicit

Definition at line 16 of file ReactorBase.cpp.

◆ ~ReactorBase()

virtual ~ReactorBase ( )
inlinevirtual

Definition at line 52 of file ReactorBase.h.

Member Function Documentation

◆ typeStr()

virtual std::string typeStr ( ) const
inlinevirtual

String indicating the reactor model implemented.

Usually corresponds to the name of the derived class.

Deprecated:
To be removed after Cantera 2.6. Use type() instead.

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

Definition at line 59 of file ReactorBase.h.

References Cantera::warn_deprecated().

◆ type()

virtual std::string type ( ) const
inlinevirtual

String indicating the reactor model implemented.

Usually corresponds to the name of the derived class.

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

Definition at line 67 of file ReactorBase.h.

◆ name()

std::string name ( ) const
inline

Return the name of this reactor.

Definition at line 72 of file ReactorBase.h.

Referenced by ReactorBase::setName().

◆ setName()

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

Set the name of this reactor.

Definition at line 77 of file ReactorBase.h.

References ReactorBase::name().

◆ setInitialVolume()

void setInitialVolume ( doublereal  vol)
inline

Set the initial reactor volume. By default, the volume is 1.0 m^3.

Definition at line 85 of file ReactorBase.h.

References ReactorBase::m_vol.

◆ setThermoMgr()

void setThermoMgr ( ThermoPhase 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 27 of file ReactorBase.cpp.

References Phase::nSpecies().

Referenced by IdealGasConstPressureReactor::setThermoMgr(), and IdealGasReactor::setThermoMgr().

◆ setKineticsMgr()

virtual void setKineticsMgr ( Kinetics kin)
inlinevirtual

Specify chemical kinetics governing the reactor.

Reimplemented in Reactor.

Definition at line 95 of file ReactorBase.h.

◆ setChemistry()

virtual void setChemistry ( bool  cflag = true)
inlinevirtual

Enable or disable changes in reactor composition due to chemical reactions.

Reimplemented in Reactor.

Definition at line 100 of file ReactorBase.h.

◆ setEnergy()

virtual void setEnergy ( int  eflag = 1)
inlinevirtual

Set the energy equation on or off.

Reimplemented in Reactor.

Definition at line 105 of file ReactorBase.h.

◆ addInlet()

void addInlet ( FlowDevice inlet)

Connect an inlet FlowDevice to this reactor.

Definition at line 48 of file ReactorBase.cpp.

◆ addOutlet()

void addOutlet ( FlowDevice outlet)

Connect an outlet FlowDevice to this reactor.

Definition at line 53 of file ReactorBase.cpp.

Referenced by FlowDevice::install().

◆ inlet()

FlowDevice & inlet ( size_t  n = 0)

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

Definition at line 117 of file ReactorBase.cpp.

Referenced by ConstPressureReactor::eval(), IdealGasConstPressureReactor::eval(), and IdealGasReactor::eval().

◆ outlet()

FlowDevice & outlet ( size_t  n = 0)

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

Definition at line 121 of file ReactorBase.cpp.

Referenced by ConstPressureReactor::eval(), IdealGasConstPressureReactor::eval(), and IdealGasReactor::eval().

◆ nInlets()

size_t nInlets ( )
inline

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

Definition at line 124 of file ReactorBase.h.

◆ nOutlets()

size_t nOutlets ( )
inline

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

Definition at line 130 of file ReactorBase.h.

◆ nWalls()

size_t nWalls ( )
inline

Return the number of Wall objects connected to this reactor.

Definition at line 135 of file ReactorBase.h.

◆ addWall()

void addWall ( WallBase 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 WallBase::install.

Definition at line 58 of file ReactorBase.cpp.

Referenced by WallBase::install().

◆ wall()

WallBase & wall ( size_t  n)

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

Definition at line 68 of file ReactorBase.cpp.

◆ addSurface()

void addSurface ( ReactorSurface surf)

Definition at line 73 of file ReactorBase.cpp.

◆ surface()

ReactorSurface * surface ( size_t  n)

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

Definition at line 81 of file ReactorBase.cpp.

◆ initialize()

virtual void initialize ( doublereal  t0 = 0.0)
inlinevirtual

Initialize the reactor.

Called automatically by ReactorNet::initialize.

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

Definition at line 159 of file ReactorBase.h.

◆ restoreState()

void restoreState ( )

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

Definition at line 86 of file ReactorBase.cpp.

◆ syncState()

void syncState ( )
virtual

Set the state of the reactor to correspond to the state of the associated ThermoPhase object.

This is the inverse of restoreState(). Calling this will trigger integrator reinitialization.

Reimplemented in Reactor.

Definition at line 37 of file ReactorBase.cpp.

◆ contents() [1/2]

ThermoPhase & contents ( )
inline

return a reference to the contents.

Definition at line 175 of file ReactorBase.h.

◆ contents() [2/2]

const ThermoPhase & contents ( ) const
inline

Definition at line 183 of file ReactorBase.h.

◆ residenceTime()

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 108 of file ReactorBase.cpp.

◆ volume()

doublereal volume ( ) const
inline

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

Definition at line 203 of file ReactorBase.h.

References ReactorBase::m_vol.

◆ density()

doublereal density ( ) const
inline

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

Definition at line 208 of file ReactorBase.h.

Referenced by ReactorBase::mass().

◆ temperature()

doublereal temperature ( ) const
inline

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

Definition at line 213 of file ReactorBase.h.

Referenced by Wall::Q().

◆ enthalpy_mass()

doublereal enthalpy_mass ( ) const
inline

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

Definition at line 218 of file ReactorBase.h.

References ReactorBase::m_enthalpy.

◆ intEnergy_mass()

doublereal intEnergy_mass ( ) const
inline

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

Definition at line 223 of file ReactorBase.h.

References ReactorBase::m_intEnergy.

◆ pressure()

doublereal pressure ( ) const
inline

Returns the current pressure (Pa) of the reactor.

Definition at line 228 of file ReactorBase.h.

References ReactorBase::m_pressure.

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

◆ mass()

doublereal mass ( ) const
inline

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

Definition at line 233 of file ReactorBase.h.

References ReactorBase::density(), and ReactorBase::m_vol.

◆ massFractions()

const doublereal * massFractions ( ) const
inline

Return the vector of species mass fractions.

Definition at line 238 of file ReactorBase.h.

◆ massFraction()

doublereal massFraction ( size_t  k) const
inline

Return the mass fraction of the k-th species.

Definition at line 243 of file ReactorBase.h.

◆ network()

ReactorNet & network ( )

The ReactorNet that this reactor belongs to.

Definition at line 93 of file ReactorBase.cpp.

◆ setNetwork()

void setNetwork ( ReactorNet net)

Set the ReactorNet that this reactor belongs to.

Definition at line 103 of file ReactorBase.cpp.

Referenced by ReactorNet::addReactor().

Member Data Documentation

◆ m_nsp

size_t m_nsp
protected

◆ m_thermo

ThermoPhase* m_thermo
protected

Definition at line 259 of file ReactorBase.h.

◆ m_vol

double m_vol
protected

◆ m_enthalpy

double m_enthalpy
protected

Current specific enthalpy of the reactor [J/kg].

Definition at line 261 of file ReactorBase.h.

Referenced by ReactorBase::enthalpy_mass(), and ConstPressureReactor::eval().

◆ m_intEnergy

double m_intEnergy
protected

Current internal energy of the reactor [J/kg].

Definition at line 262 of file ReactorBase.h.

Referenced by ReactorBase::intEnergy_mass().

◆ m_pressure

double m_pressure
protected

Current pressure in the reactor [Pa].

Definition at line 263 of file ReactorBase.h.

Referenced by IdealGasReactor::eval(), ReactorBase::pressure(), ConstPressureReactor::updateState(), and IdealGasConstPressureReactor::updateState().

◆ m_state

vector_fp m_state
protected

Definition at line 264 of file ReactorBase.h.

◆ m_inlet

std::vector<FlowDevice*> m_inlet
protected

Definition at line 265 of file ReactorBase.h.

◆ m_outlet

std::vector<FlowDevice*> m_outlet
protected

Definition at line 265 of file ReactorBase.h.

◆ m_wall

std::vector<WallBase*> m_wall
protected

Definition at line 267 of file ReactorBase.h.

◆ m_surfaces

std::vector<ReactorSurface*> m_surfaces
protected

Definition at line 268 of file ReactorBase.h.

◆ m_lr

vector_int m_lr
protected

Vector of length nWalls(), indicating whether this reactor is on the left (0) or right (1) of each wall.

Definition at line 272 of file ReactorBase.h.

◆ m_name

std::string m_name
protected

Definition at line 273 of file ReactorBase.h.

◆ m_net

ReactorNet* m_net
protected

The ReactorNet that this reactor is part of.

Definition at line 276 of file ReactorBase.h.


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