antioch-0.4.0
elementary_reaction.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 
27 #ifndef ANTIOCH_ELEMENTARY_REACTION_H
28 #define ANTIOCH_ELEMENTARY_REACTION_H
29 
30 // Antioch
31 #include "antioch/reaction.h"
33 
34 //C++
35 #include <string>
36 #include <vector>
37 #include <iostream>
38 
39 namespace Antioch
40 {
42 
63  template<typename CoeffType=double>
64  class ElementaryReaction: public Reaction<CoeffType>
65  {
66  public:
67 
69  ElementaryReaction( const unsigned int n_species,
70  const std::string &equation,
71  const bool &reversible = true,
73 
75 
77  template <typename StateType, typename VectorStateType>
78  StateType compute_forward_rate_coefficient( const VectorStateType& molar_densities,
79  const KineticsConditions<StateType,VectorStateType>& conditions ) const;
80 
82  template <typename StateType, typename VectorStateType>
83  void compute_forward_rate_coefficient_and_derivatives( const VectorStateType& molar_densities,
85  StateType& kfwd,
86  StateType& dkfwd_dT,
87  VectorStateType& dkfwd_dX) const;
88 
89  private:
90 
91  };
92 
93  /* ------------------------- Inline Functions -------------------------*/
94  template<typename CoeffType>
95  inline
97  const std::string &equation,
98  const bool &reversible,
100  :Reaction<CoeffType>(n_species,equation,reversible,ReactionType::ELEMENTARY,kin)
101  {
102  return;
103  }
104 
105 
106  template<typename CoeffType>
107  inline
109  {
110  return;
111  }
112 
113 
114 
115  template<typename CoeffType>
116  template<typename StateType, typename VectorStateType>
117  inline
119  ( const VectorStateType& /* molar_densities */,
120  const KineticsConditions<StateType,VectorStateType>& conditions) const
121  {
123 
124  //k(T,[M]) = alpha(T)
125  return (*this->_forward_rate[0])(conditions);
126  }
127 
128  template<typename CoeffType>
129  template<typename StateType, typename VectorStateType>
130  inline
132  ( const VectorStateType& /* molar_densities */,
134  StateType& kfwd,
135  StateType& dkfwd_dT,
136  VectorStateType& dkfwd_dX) const
137  {
138  //dk_dT = dalpha_dT(T)
139  this->_forward_rate[0]->compute_rate_and_derivative(conditions,kfwd,dkfwd_dT);
140 
141  //dk_dCi = 0.
142  antioch_assert_equal_to(dkfwd_dX.size(),this->n_species());
143  Antioch::set_zero(dkfwd_dX);
144 
145  return;
146  }
147 
148 } // namespace Antioch
149 
150 #endif // ANTIOCH_ELEMENTARY_REACTION_H
A single reaction mechanism.
Definition: reaction.h:108
ElementaryReaction(const unsigned int n_species, const std::string &equation, const bool &reversible=true, const KineticsModel::KineticsModel kin=KineticsModel::KOOIJ)
Construct a single reaction mechanism.
const std::string & equation() const
#define antioch_assert_equal_to(expr1, expr2)
unsigned int n_species() const
StateType compute_forward_rate_coefficient(const VectorStateType &molar_densities, const KineticsConditions< StateType, VectorStateType > &conditions) const
void set_zero(_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a)
Definition: eigen_utils.h:217
A single reaction mechanism.
The parameters are reduced parameters.
void compute_forward_rate_coefficient_and_derivatives(const VectorStateType &molar_densities, const KineticsConditions< StateType, VectorStateType > &conditions, StateType &kfwd, StateType &dkfwd_dT, VectorStateType &dkfwd_dX) const
This class contains the conditions of the chemistry.

Generated on Thu Jul 7 2016 11:09:45 for antioch-0.4.0 by  doxygen 1.8.8