Cantera  2.0
Public Member Functions | Protected Attributes | List of all members
Reactor Class Reference

Class Reactor is a general-purpose class for stirred reactors. More...

#include <Reactor.h>

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

Public Member Functions

 Reactor ()
 Default constructor.
 
virtual ~Reactor ()
 Destructor.
 
virtual int type () const
 
template<class G >
void insert (G &contents)
 Insert something into the reactor.
 
void setKineticsMgr (Kinetics &kin)
 
void disableChemistry ()
 
void enableChemistry ()
 
void setEnergy (int eflag=1)
 Set the energy equation on or off.
 
virtual size_t neq ()
 
virtual void getInitialConditions (doublereal t0, size_t leny, doublereal *y)
 
virtual void initialize (doublereal t0=0.0)
 Initialize the reactor.
 
virtual void evalEqs (doublereal t, doublereal *y, doublereal *ydot, doublereal *params)
 
virtual void updateState (doublereal *y)
 Set the mixture to a state consistent with solution vector y.
 
virtual size_t nSensParams ()
 
virtual void addSensitivityReaction (size_t rxn)
 
virtual std::string sensParamID (int p)
 
virtual size_t componentIndex (std::string nm) const
 
std::string name () const
 
void setName (std::string name)
 
void resetState ()
 
thermo_tcontents ()
 return a reference to the contents.
 
const thermo_tcontents () const
 
doublereal residenceTime ()
 
int error (std::string msg) const
 
Methods to set up a simulation.
void setInitialVolume (doublereal vol)
 Set the initial reactor volume.
 
void setInitialTime (doublereal time)
 Set initial time.
 
void setThermoMgr (thermo_t &thermo)
 Specify the mixture contained in the reactor.
 
void addInlet (FlowDevice &inlet)
 
void addOutlet (FlowDevice &outlet)
 
FlowDeviceinlet (size_t n=0)
 
FlowDeviceoutlet (size_t n=0)
 
size_t nInlets ()
 
size_t nOutlets ()
 
size_t nWalls ()
 
void addWall (Wall &w, int lr)
 
Wall & wall (size_t n)
 
virtual void advance (doublereal time)
 Advance the state of the reactor in time.
 
virtual double step (doublereal time)
 
virtual void start ()
 
Solution components.

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

doublereal time () const
 the current time (s).
 
doublereal volume () const
 Returns the current volume of the reactor.
 
doublereal density () const
 
doublereal temperature () const
 
doublereal enthalpy_mass () const
 
doublereal intEnergy_mass () const
 
doublereal pressure () const
 
doublereal mass () const
 
const doublereal * massFractions () const
 
doublereal massFraction (size_t k) const
 

Protected Attributes

Kineticsm_kin
 Pointer to the homogeneous Kinetics object that handles the reactions.
 
doublereal m_temp_atol
 Tolerance on the temperature.
 
doublereal m_maxstep
 
doublereal m_vdot
 
doublereal m_Q
 
vector_fp m_atol
 
doublereal m_rtol
 
vector_fp m_work
 
vector_fp m_sdot
 
bool m_chem
 
bool m_energy
 
size_t m_nv
 
size_t m_nsens
 
std::vector< size_t > m_pnum
 
std::vector< std::string > m_pname
 
std::vector< size_t > m_nsens_wall
 
vector_fp m_mult_save
 
size_t m_nsp
 Number of homogeneous species in the mixture.
 
thermo_tm_thermo
 
doublereal m_time
 
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
 

Detailed Description

Class Reactor is a general-purpose class for stirred reactors.

The reactor may have an arbitrary number of inlets and outlets, each of which may be connected to a "flow device" such as a mass flow controller, a pressure regulator, etc. Additional reactors may be connected to the other end of the flow device, allowing construction of arbitrary reactor networks.

The reactor class integrates the same governing equations no matter what type of reactor is simulated. The differences among reactor types are completely specified by the attached flow devices and the time-dependent user-specified boundary conditions.

If an instance of class Reactor is used directly, it will simulate an adiabatic, constant volume reactor with gas-phase chemistry but no surface chemistry. Other reactor types may be simulated by deriving a class from Reactor and overloading method getParams. This method allows specifying the following in terms of the instantaneous reactor state:

class Reactor inherits from both ReactorBase and FuncEval. ReactorBase provides the basic reactor-like methods that FlowDevice instances can access to determine their mass flow rate. Class FuncEval is the class used to define a system of ODE's to be integrated.

Definition at line 49 of file Reactor.h.

Constructor & Destructor Documentation

Reactor ( )

Default constructor.

Definition at line 20 of file Reactor.cpp.

virtual ~Reactor ( )
inlinevirtual

Destructor.

Deletes the integrator.

Definition at line 60 of file Reactor.h.

Member Function Documentation

void insert ( G &  contents)
inline

Insert something into the reactor.

The 'something' must belong to a class that is a subclass of both ThermoPhase and Kinetics.

Definition at line 72 of file Reactor.h.

References ReactorBase::setThermoMgr().

void setEnergy ( int  eflag = 1)
inline

Set the energy equation on or off.

Definition at line 92 of file Reactor.h.

void initialize ( doublereal  t0 = 0.0)
virtual

Initialize the reactor.

Must be called after specifying the (and if necessary the inlet mixture) and before calling advance.

Reimplemented from ReactorBase.

Reimplemented in ConstPressureReactor, and FlowReactor.

Definition at line 76 of file Reactor.cpp.

References ThermoPhase::enthalpy_mass(), ThermoPhase::intEnergy_mass(), Reactor::m_kin, ReactorBase::m_nsp, ThermoPhase::pressure(), Phase::restoreState(), and Kinetics::thermo().

void updateState ( doublereal *  y)
virtual
void setInitialVolume ( doublereal  vol)
inlineinherited

Set the initial reactor volume.

By default, the volume is 1.0 m^3.

Definition at line 56 of file ReactorBase.h.

void setInitialTime ( doublereal  time)
inlineinherited

Set initial time.

Default = 0.0 s. Restarts integration from this time using the current mixture state as the initial condition.

Definition at line 66 of file ReactorBase.h.

References ReactorBase::time().

void setThermoMgr ( thermo_t thermo)
inherited

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.

Definition at line 40 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().

virtual void advance ( doublereal  time)
inlinevirtualinherited

Advance the state of the reactor in time.

Parameters
timeTime to advance to (s). Note that this method changes the state of the mixture object.

Definition at line 111 of file ReactorBase.h.

thermo_t& contents ( )
inlineinherited

return a reference to the contents.

Definition at line 125 of file ReactorBase.h.

doublereal time ( ) const
inlineinherited

the current time (s).

Definition at line 144 of file ReactorBase.h.

Referenced by ReactorBase::setInitialTime().

doublereal volume ( ) const
inlineinherited

Returns the current volume of the reactor.

Returns
Return the volume in m**3

Definition at line 153 of file ReactorBase.h.

Member Data Documentation

Kinetics* m_kin
protected

Pointer to the homogeneous Kinetics object that handles the reactions.

Definition at line 130 of file Reactor.h.

Referenced by ConstPressureReactor::initialize(), and Reactor::initialize().

doublereal m_temp_atol
protected

Tolerance on the temperature.

Definition at line 133 of file Reactor.h.

size_t m_nsp
protectedinherited

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