antioch-0.4.0
List of all members | Public Member Functions | Public Attributes | Private Attributes
Antioch::ArrheniusRate< CoeffType > Class Template Reference

Arrhenius rate equation. More...

#include <arrhenius_rate.h>

Inheritance diagram for Antioch::ArrheniusRate< CoeffType >:
Antioch::KineticsType< CoeffType >

Public Member Functions

 ArrheniusRate (const CoeffType Cf=0., const CoeffType Ea=0., const CoeffType rscale=Constants::R_universal< CoeffType >())
 
 ~ArrheniusRate ()
 
void set_Cf (const CoeffType Cf)
 
void set_Ea (const CoeffType Ea)
 set Ea, rescale the value, unit is known More...
 
void reset_Ea (const CoeffType Ea)
 set Ea, no rescaling, unit is K More...
 
void set_rscale (const CoeffType rscale)
 
void set_parameter (KineticsModel::Parameters parameter, CoeffType new_value)
 set one parameter, characterized by enum More...
 
CoeffType get_parameter (KineticsModel::Parameters parameter) const
 get one parameter, characterized by enum More...
 
template<typename VectorCoeffType >
void set_parameter (KineticsModel::Parameters parameter, VectorCoeffType new_value)
 for compatibility purpose with photochemistry (particle flux reactions) More...
 
template<typename VectorCoeffType >
void reset_coefs (const VectorCoeffType &coefficients)
 reset the coeffs More...
 
CoeffType Cf () const
 
CoeffType Ea () const
 
CoeffType Ea_K () const
 
CoeffType rscale () const
 
template<typename StateType >
 rate (const StateType &T) const ANTIOCH_AUTOFUNC(StateType
 
_Cfant_exp (-_Ea/T))) template< typename StateType > operator()(const StateType &T) const template< typename StateType > derivative(const StateType &T) const ANTIOCH_AUTOFUNC(StateType
 
template<typename StateType , typename VectorStateType >
 rate (const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType
 
_Cfant_exp (-_Ea/T.T())) template< typename StateType
 
_Cf VectorStateType operator() (const KineticsConditions< StateType, VectorStateType > &T) const template< typename StateType
 
_Cf VectorStateType VectorStateType derivative (const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType
 
const std::string numeric () const
 print equation More...
 
KineticsModel::KineticsModel type () const
 
StateType operator() (const StateType &temp) const
 
StateType derivative (const StateType &conditions) const
 
CoeffType get_parameter (KineticsModel::Parameters parameter, int l) const
 get one parameter, characterized by enum, for vectorized parameter More...
 
void compute_rate_and_derivative (const KineticsConditions< StateType, VectorStateType > &conditions, StateType &rate, StateType &drate_dT) const
 
void compute_rate_and_derivative (const StateType &temp, StateType &rate, StateType &drate_dT) const
 
void set_index (unsigned int nr)
 
void print (std::ostream &os=std::cout) const
 Formatted print, by default to std::cout. More...
 

Public Attributes

_Cf(* this )(T)*(_Ea/(T *T))) template< typename StateType > void rate_and_derivative(const StateType &T
 Simultaneously evaluate the rate and its derivative at T. More...
 
_Cf(*) StateType rate )
 
_Cf(*) StateType StateType &drate_d const )
 
_Cf VectorStateType
VectorStateType(* 
this )(T)*(_Ea/T.temp_cache().T2)) template< typename StateType
 Simultaneously evaluate the rate and its derivative at T. More...
 
_Cf VectorStateType
VectorStateType(*)
VectorStateType voi 
rate_and_derivative )(const KineticsConditions< StateType, VectorStateType > &T, StateType &rate, StateType &drate_dT) const
 

Private Attributes

CoeffType _Cf
 
CoeffType _raw_Ea
 
CoeffType _Ea
 
CoeffType _rscale
 

Detailed Description

template<typename CoeffType = double>
class Antioch::ArrheniusRate< CoeffType >

Arrhenius rate equation.

The Arrhenius kinetics model is of the form:

\[ \alpha(T) = A \exp\left(-\frac{E_a}{\mathrm{R}T}\right) \]

with $\mathrm{R}$ the ideal gas constant. We have:

\[ \frac{\partial\alpha(T)}{\partial T} = \alpha(T) \frac{E_a}{\mathrm{R}T^2} \]

Internally, we use the reduced activation energy $e = \frac{E_a}{\mathrm{R}}$

Definition at line 59 of file arrhenius_rate.h.

Constructor & Destructor Documentation

template<typename CoeffType>
Antioch::ArrheniusRate< CoeffType >::ArrheniusRate ( const CoeffType  Cf = 0.,
const CoeffType  Ea = 0.,
const CoeffType  rscale = Constants::R_universal<CoeffType>() 
)

Definition at line 167 of file arrhenius_rate.h.

References Antioch::ArrheniusRate< CoeffType >::_rscale.

168  : KineticsType<CoeffType>(KineticsModel::ARRHENIUS),
169  _Cf(Cf),
170  _raw_Ea(Ea),
171  _rscale(rscale)
172  {
173  _Ea = _raw_Ea / _rscale;
174  return;
175  }
CoeffType rscale() const
CoeffType Cf() const
CoeffType Ea() const
template<typename CoeffType >
Antioch::ArrheniusRate< CoeffType >::~ArrheniusRate ( )

Definition at line 178 of file arrhenius_rate.h.

179  {
180  return;
181  }

Member Function Documentation

template<typename CoeffType = double>
_Cf* Antioch::ArrheniusRate< CoeffType >::ant_exp ( -_Ea T) const
Returns
the rate evaluated at T.
the derivative with respect to temperature evaluated at T.
template<typename CoeffType = double>
_Cf* Antioch::ArrheniusRate< CoeffType >::ant_exp ( -_Ea/T.  T())
Returns
the rate evaluated at T.
template<typename CoeffType >
CoeffType Antioch::ArrheniusRate< CoeffType >::Cf ( ) const
inline
void Antioch::KineticsType< CoeffType, VectorCoeffType >::compute_rate_and_derivative ( const KineticsConditions< StateType, VectorStateType > &  conditions,
StateType &  rate,
StateType &  drate_dT 
) const
inherited
void Antioch::KineticsType< CoeffType, VectorCoeffType >::compute_rate_and_derivative ( const StateType &  temp,
StateType &  rate,
StateType &  drate_dT 
) const
inherited
StateType Antioch::KineticsType< CoeffType, VectorCoeffType >::derivative ( const StateType &  conditions) const
inherited
template<typename CoeffType = double>
_Cf VectorStateType VectorStateType Antioch::ArrheniusRate< CoeffType >::derivative ( const KineticsConditions< StateType, VectorStateType > &  T) const
template<typename CoeffType >
CoeffType Antioch::ArrheniusRate< CoeffType >::Ea ( ) const
inline
template<typename CoeffType >
CoeffType Antioch::ArrheniusRate< CoeffType >::Ea_K ( ) const
inline

Definition at line 311 of file arrhenius_rate.h.

References Antioch::ArrheniusRate< CoeffType >::_Ea.

312  { return _Ea; }
template<typename CoeffType >
CoeffType Antioch::ArrheniusRate< CoeffType >::get_parameter ( KineticsModel::Parameters  parameter) const
inline

get one parameter, characterized by enum

Definition at line 271 of file arrhenius_rate.h.

References Antioch::KineticsModel::A, antioch_error, Antioch::ArrheniusRate< CoeffType >::Cf(), Antioch::KineticsModel::E, Antioch::ArrheniusRate< CoeffType >::Ea(), Antioch::KineticsModel::R_SCALE, and Antioch::ArrheniusRate< CoeffType >::rscale().

272  {
273  switch(parameter)
274  {
276  {
277  return this->Cf();
278  }
279  break;
281  {
282  return this->Ea();
283  }
284  break;
286  {
287  return this->rscale();
288  }
289  break;
290  default:
291  {
292  antioch_error();
293  }
294  break;
295  }
296  return 0;
297  }
#define antioch_error()
CoeffType rscale() const
CoeffType Cf() const
CoeffType Ea() const
CoeffType Antioch::KineticsType< CoeffType, VectorCoeffType >::get_parameter ( KineticsModel::Parameters  parameter,
int  l 
) const
inherited

get one parameter, characterized by enum, for vectorized parameter

template<typename CoeffType >
const std::string Antioch::ArrheniusRate< CoeffType >::numeric ( ) const
virtual

print equation

Implements Antioch::KineticsType< CoeffType >.

Definition at line 184 of file arrhenius_rate.h.

References Antioch::ArrheniusRate< CoeffType >::_Cf.

185  {
186  std::stringstream os;
187  os << _Cf;
188  os << "*exp(-" << _raw_Ea << "/(R*T))";
189 
190  return os.str();
191  }
StateType Antioch::KineticsType< CoeffType, VectorCoeffType >::operator() ( const StateType &  temp) const
inherited
template<typename CoeffType = double>
_Cf VectorStateType Antioch::ArrheniusRate< CoeffType >::operator() ( const KineticsConditions< StateType, VectorStateType > &  T) const
Returns
the derivative with respect to temperature evaluated at T.
void Antioch::KineticsType< CoeffType, VectorCoeffType >::print ( std::ostream &  os = std::cout) const
inherited

Formatted print, by default to std::cout.

template<typename CoeffType = double>
template<typename StateType >
Antioch::ArrheniusRate< CoeffType >::rate ( const StateType &  T) const
Returns
the rate evaluated at T.
template<typename CoeffType = double>
template<typename StateType , typename VectorStateType >
Antioch::ArrheniusRate< CoeffType >::rate ( const KineticsConditions< StateType, VectorStateType > &  T) const
Returns
the rate evaluated at T.
template<typename CoeffType >
template<typename VectorCoeffType >
void Antioch::ArrheniusRate< CoeffType >::reset_coefs ( const VectorCoeffType &  coefficients)
inline

reset the coeffs

Two ways of modifying your rate:

  • you change totally the rate, thus you require exactly three parameters, the order assumed is Cf, Ea, rscale
  • you just change the value, thus rscale is not modified. You require exactly two parameters, the order assumed is Cf, Ea

Definition at line 231 of file arrhenius_rate.h.

References antioch_assert_greater, antioch_assert_less, Antioch::ArrheniusRate< CoeffType >::set_Cf(), Antioch::ArrheniusRate< CoeffType >::set_Ea(), and Antioch::ArrheniusRate< CoeffType >::set_rscale().

Referenced by AntiochTesting::ArrheniusRateTest< long double >::test_reset_vector_params2(), and AntiochTesting::ArrheniusRateTest< long double >::test_reset_vector_params3().

232  {
233  antioch_assert_greater(coefficients.size(),1);
234  antioch_assert_less(coefficients.size(),4);
235  if(coefficients.size() == 3)this->set_rscale(coefficients[2]);
236  this->set_Cf(coefficients[0]);
237  this->set_Ea(coefficients[1]);
238  }
#define antioch_assert_greater(expr1, expr2)
#define antioch_assert_less(expr1, expr2)
void set_Cf(const CoeffType Cf)
void set_Ea(const CoeffType Ea)
set Ea, rescale the value, unit is known
void set_rscale(const CoeffType rscale)
template<typename CoeffType>
void Antioch::ArrheniusRate< CoeffType >::reset_Ea ( const CoeffType  Ea)
inline

set Ea, no rescaling, unit is K

Definition at line 212 of file arrhenius_rate.h.

References Antioch::ArrheniusRate< CoeffType >::_rscale, and Antioch::ArrheniusRate< CoeffType >::Ea().

Referenced by Antioch::ArrheniusRate< CoeffType >::set_parameter().

213  {
214  _Ea = Ea;
215  _raw_Ea = _Ea * _rscale;
216  return;
217  }
CoeffType Ea() const
template<typename CoeffType >
CoeffType Antioch::ArrheniusRate< CoeffType >::rscale ( ) const
inline
template<typename CoeffType>
void Antioch::ArrheniusRate< CoeffType >::set_Cf ( const CoeffType  Cf)
inline
template<typename CoeffType>
void Antioch::ArrheniusRate< CoeffType >::set_Ea ( const CoeffType  Ea)
inline
void Antioch::KineticsType< CoeffType, VectorCoeffType >::set_index ( unsigned int  nr)
inherited
template<typename CoeffType>
void Antioch::ArrheniusRate< CoeffType >::set_parameter ( KineticsModel::Parameters  parameter,
CoeffType  new_value 
)
inline

set one parameter, characterized by enum

Definition at line 242 of file arrhenius_rate.h.

References Antioch::KineticsModel::A, antioch_error, Antioch::KineticsModel::E, Antioch::KineticsModel::R_SCALE, Antioch::ArrheniusRate< CoeffType >::reset_Ea(), Antioch::ArrheniusRate< CoeffType >::set_Cf(), and Antioch::ArrheniusRate< CoeffType >::set_rscale().

243  {
244  switch(parameter)
245  {
247  {
248  this->set_Cf(new_value);
249  }
250  break;
252  {
253  this->reset_Ea(new_value);
254  }
255  break;
257  {
258  this->set_rscale(new_value);
259  }
260  break;
261  default:
262  {
263  antioch_error();
264  }
265  break;
266  }
267  }
void set_Cf(const CoeffType Cf)
#define antioch_error()
void reset_Ea(const CoeffType Ea)
set Ea, no rescaling, unit is K
void set_rscale(const CoeffType rscale)
template<typename CoeffType = double>
template<typename VectorCoeffType >
void Antioch::ArrheniusRate< CoeffType >::set_parameter ( KineticsModel::Parameters  parameter,
VectorCoeffType  new_value 
)
inline

for compatibility purpose with photochemistry (particle flux reactions)

Definition at line 94 of file arrhenius_rate.h.

94 {antioch_error();}
#define antioch_error()
template<typename CoeffType>
void Antioch::ArrheniusRate< CoeffType >::set_rscale ( const CoeffType  rscale)
inline
KineticsModel::KineticsModel Antioch::KineticsType< CoeffType, VectorCoeffType >::type ( ) const
inherited

Member Data Documentation

template<typename CoeffType = double>
CoeffType Antioch::ArrheniusRate< CoeffType >::_Cf
private
template<typename CoeffType = double>
CoeffType Antioch::ArrheniusRate< CoeffType >::_Ea
private

Definition at line 67 of file arrhenius_rate.h.

Referenced by Antioch::ArrheniusRate< CoeffType >::Ea_K().

template<typename CoeffType = double>
CoeffType Antioch::ArrheniusRate< CoeffType >::_raw_Ea
private

Definition at line 66 of file arrhenius_rate.h.

Referenced by Antioch::ArrheniusRate< CoeffType >::Ea().

template<typename CoeffType = double>
CoeffType Antioch::ArrheniusRate< CoeffType >::_rscale
private
template<typename CoeffType = double>
_Cf(*) StateType StateType& drate_d Antioch::ArrheniusRate< CoeffType >::const)

Definition at line 134 of file arrhenius_rate.h.

template<typename CoeffType = double>
_Cf(*) StateType Antioch::ArrheniusRate< CoeffType >::rate)

Definition at line 134 of file arrhenius_rate.h.

template<typename CoeffType = double>
void Antioch::ArrheniusRate< CoeffType >::rate_and_derivative
inline

Definition at line 158 of file arrhenius_rate.h.

Referenced by tester().

template<typename CoeffType = double>
_Cf(* Antioch::ArrheniusRate< CoeffType >::this)(T)*(_Ea/(T *T)))template< typename StateType > void rate_and_derivative(const StateType &T

Simultaneously evaluate the rate and its derivative at T.

Definition at line 130 of file arrhenius_rate.h.

template<typename CoeffType = double>
_Cf VectorStateType VectorStateType(* Antioch::ArrheniusRate< CoeffType >::this)(T)*(_Ea/T.temp_cache().T2))template< typename StateType

Simultaneously evaluate the rate and its derivative at T.

Definition at line 154 of file arrhenius_rate.h.


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

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