Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FlowReactor.h
Go to the documentation of this file.
1 /**
2  * @file FlowReactor.h
3  */
4 
5 // Copyright 2001 California Institute of Technology
6 
7 #ifndef CT_FLOWREACTOR_H
8 #define CT_FLOWREACTOR_H
9 
10 #include "Reactor.h"
11 
12 namespace Cantera
13 {
14 
15 /**
16  * Adiabatic flow in a constant-area duct.
17  */
18 class FlowReactor : public Reactor
19 {
20 public:
21  FlowReactor();
22 
23  virtual int type() const {
24  return FlowReactorType;
25  }
26 
27  virtual void getInitialConditions(doublereal t0, size_t leny,
28  doublereal* y);
29 
30  virtual void initialize(doublereal t0 = 0.0);
31  virtual void evalEqs(doublereal t, doublereal* y,
32  doublereal* ydot, doublereal* params);
33  virtual void updateState(doublereal* y);
34 
35  void setMassFlowRate(doublereal mdot) {
36  m_rho0 = m_thermo->density();
37  m_speed = mdot/m_rho0;
38  m_speed0 = m_speed;
39  m_T = m_thermo->temperature();
40  m_P0 = m_thermo->pressure() + m_rho0*m_speed*m_speed;
41  m_h0 = m_thermo->enthalpy_mass() + 0.5*m_speed*m_speed;
42  }
43 
44  void setTimeConstant(doublereal tau) {
45  m_fctr = 1.0/tau;
46  }
47 
48  double speed() const {
49  return m_speed;
50  }
51  double distance() const {
52  return m_dist;
53  }
54 
55  //! Return the index in the solution vector for this reactor of the
56  //! component named *nm*. Possible values for *nm* are "X" (position),
57  //! "U", the name of a homogeneous phase species, or the name of a surface
58  //! species.
59  virtual size_t componentIndex(const std::string& nm) const;
60 
61 protected:
62  doublereal m_speed, m_dist, m_T;
63  doublereal m_fctr;
64  doublereal m_rho0, m_speed0, m_P0, m_h0;
65 };
66 }
67 
68 #endif
virtual doublereal density() const
Density (kg/m^3).
Definition: Phase.h:608
virtual void updateState(doublereal *y)
Set the state of the reactor to correspond to the state vector y.
Definition: FlowReactor.cpp:49
Adiabatic flow in a constant-area duct.
Definition: FlowReactor.h:18
virtual size_t componentIndex(const std::string &nm) const
Return the index in the solution vector for this reactor of the component named nm.
virtual void evalEqs(doublereal t, doublereal *y, doublereal *ydot, doublereal *params)
Definition: FlowReactor.cpp:74
virtual void getInitialConditions(doublereal t0, size_t leny, doublereal *y)
Called by ReactorNet to get the initial conditions.
Definition: FlowReactor.cpp:27
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: ThermoPhase.h:278
doublereal temperature() const
Temperature (K).
Definition: Phase.h:602
doublereal enthalpy_mass() const
Specific enthalpy.
Definition: ThermoPhase.h:892
virtual int type() const
Return a constant indicating the type of this Reactor.
Definition: FlowReactor.h:23
virtual void initialize(doublereal t0=0.0)
Initialize the reactor.
Definition: FlowReactor.cpp:43
Class Reactor is a general-purpose class for stirred reactors.
Definition: Reactor.h:39