Cantera  2.0
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, reversible flow in a constant-area duct.
17  */
18 class FlowReactor : public Reactor
19 {
20 
21 public:
22 
23  /**
24  * Default constructor.
25  */
26  FlowReactor();
27 
28  /**
29  * Destructor.
30  */
31  virtual ~FlowReactor() {}
32 
33  virtual int type() const {
34  return FlowReactorType;
35  }
36 
37  //-----------------------------------------------------
38 
39  virtual void getInitialConditions(doublereal t0, size_t leny,
40  doublereal* y);
41 
42 
43  //-----------------------------------------------------
44  virtual size_t neq() {
45  return m_nv;
46  }
47 
48  virtual void initialize(doublereal t0 = 0.0);
49  virtual void evalEqs(doublereal t, doublereal* y,
50  doublereal* ydot, doublereal* params);
51  virtual void updateState(doublereal* y);
52 
53  void setMassFlowRate(doublereal mdot) {
54  m_rho0 = m_thermo->density();
55  m_speed = mdot/m_rho0;
56  m_speed0 = m_speed;
57  m_T = m_thermo->temperature();
58  m_P0 = m_thermo->pressure() + m_rho0*m_speed*m_speed;
59  m_h0 = m_thermo->enthalpy_mass() + 0.5*m_speed*m_speed;
60  }
61 
62  void setTimeConstant(doublereal tau) {
63  m_fctr = 1.0/tau;
64  }
65 
66  double speed() const {
67  return m_speed;
68  }
69  double distance() const {
70  return m_dist;
71  }
72  virtual size_t componentIndex(std::string nm) const;
73 
74 protected:
75 
76  doublereal m_speed, m_dist, m_T;
77  doublereal m_fctr;
78  doublereal m_rho0, m_speed0, m_P0, m_h0;
79 
80 private:
81 };
82 }
83 
84 #endif
85