Cantera  2.3.0
FlowReactor.h
Go to the documentation of this file.
1 //! @file FlowReactor.h
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at http://www.cantera.org/license.txt for license and copyright information.
5 
6 #ifndef CT_FLOWREACTOR_H
7 #define CT_FLOWREACTOR_H
8 
9 #include "Reactor.h"
10 
11 namespace Cantera
12 {
13 
14 //! Adiabatic flow in a constant-area duct.
15 class FlowReactor : public Reactor
16 {
17 public:
18  FlowReactor();
19 
20  virtual int type() const {
21  return FlowReactorType;
22  }
23 
24  //! @deprecated Use getState instead. To be removed after Cantera 2.3.
25  virtual void getInitialConditions(doublereal t0, size_t leny,
26  doublereal* y);
27  virtual void getState(doublereal* y);
28 
29  virtual void initialize(doublereal t0 = 0.0);
30  virtual void evalEqs(doublereal t, doublereal* y,
31  doublereal* ydot, doublereal* params);
32  virtual void updateState(doublereal* y);
33 
34  void setMassFlowRate(doublereal mdot) {
35  m_rho0 = m_thermo->density();
36  m_speed = mdot/m_rho0;
37  m_speed0 = m_speed;
38  m_T = m_thermo->temperature();
39  m_P0 = m_thermo->pressure() + m_rho0*m_speed*m_speed;
40  m_h0 = m_thermo->enthalpy_mass() + 0.5*m_speed*m_speed;
41  }
42 
43  void setTimeConstant(doublereal tau) {
44  m_fctr = 1.0/tau;
45  }
46 
47  double speed() const {
48  return m_speed;
49  }
50  double distance() const {
51  return m_dist;
52  }
53 
54  //! Return the index in the solution vector for this reactor of the
55  //! component named *nm*. Possible values for *nm* are "X" (position),
56  //! "U", the name of a homogeneous phase species, or the name of a surface
57  //! species.
58  virtual size_t componentIndex(const std::string& nm) const;
59 
60 protected:
61  doublereal m_speed, m_dist, m_T;
62  doublereal m_fctr;
63  doublereal m_rho0, m_speed0, m_P0, m_h0;
64 };
65 }
66 
67 #endif
virtual void getState(doublereal *y)
Get the the current state of the reactor.
Definition: FlowReactor.cpp:33
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
virtual void updateState(doublereal *y)
Set the state of the reactor to correspond to the state vector y.
Definition: FlowReactor.cpp:53
Adiabatic flow in a constant-area duct.
Definition: FlowReactor.h:15
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:607
doublereal enthalpy_mass() const
Specific enthalpy. Units: J/kg.
Definition: ThermoPhase.h:764
virtual int type() const
Return a constant indicating the type of this Reactor.
Definition: FlowReactor.h:20
virtual void evalEqs(doublereal t, doublereal *y, doublereal *ydot, doublereal *params)
Definition: FlowReactor.cpp:76
virtual void getInitialConditions(doublereal t0, size_t leny, doublereal *y)
Definition: FlowReactor.cpp:26
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: ThermoPhase.h:278
virtual size_t componentIndex(const std::string &nm) const
Return the index in the solution vector for this reactor of the component named nm.
Namespace for the Cantera kernel.
Definition: application.cpp:29
virtual void initialize(doublereal t0=0.0)
Initialize the reactor.
Definition: FlowReactor.cpp:47
Class Reactor is a general-purpose class for stirred reactors.
Definition: Reactor.h:37