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

Photochemical rate. More...

#include <kinetics_type.h>

Inheritance diagram for Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >:
Antioch::KineticsType< CoeffType, VectorCoeffType >

Public Member Functions

 PhotochemicalRate (const VectorCoeffType &cs, const VectorCoeffType &lambda)
 
 PhotochemicalRate ()
 
 ~PhotochemicalRate ()
 
VectorCoeffType cross_section () const
 
VectorCoeffType lambda_grid () const
 
void set_cross_section (const VectorCoeffType &cs)
 
void set_lambda_grid (const VectorCoeffType &l)
 
void set_cross_section (CoeffType cs, int il)
 
void set_lambda_grid (CoeffType l, int il)
 
void set_parameter (KineticsModel::Parameters parameter, int l, CoeffType new_value)
 set one value of one parameter, characterized by enum and its index More...
 
CoeffType get_parameter (KineticsModel::Parameters parameter, int l) const
 set one parameter, characterized by enum More...
 
void reset_coefs (const VectorCoeffType &coefficients)
 reset the coefficients More...
 
template<typename VectorStateType >
void calculate_rate_constant (const VectorStateType &hv_flux, const VectorStateType &hv_lambda, bool x_update=true)
 calculate _k for a given photon flux More...
 
const std::string numeric () const
 print equation More...
 
KineticsModel::KineticsModel type () const
 
template<typename StateType , typename VectorStateType >
StateType operator() (const KineticsConditions< StateType, VectorStateType > &conditions) const
 
template<typename StateType >
StateType operator() (const StateType &temp) const
 
template<typename StateType , typename VectorStateType >
StateType derivative (const KineticsConditions< StateType, VectorStateType > &conditions) const
 
template<typename StateType >
StateType derivative (const StateType &conditions) const
 
CoeffType get_parameter (KineticsModel::Parameters parameter) const
 get one parameter, characterized by enum More...
 
template<typename StateType , typename VectorStateType >
void compute_rate_and_derivative (const KineticsConditions< StateType, VectorStateType > &conditions, StateType &rate, StateType &drate_dT) const
 
template<typename StateType >
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

template<typename VectorStateType >
operator()(const ParticleFlux
< VectorStateType > &pf) const
template< typename
VectorStateType > typename
value_type< VectorStateType > 
derivative (const ParticleFlux< VectorStateType > &) const template< typename StateType
 Simultaneously evaluate the rate and its derivative at T. More...
 
operator()(const ParticleFlux
< VectorStateType > &pf) const
template< typename
VectorStateType > typename
value_type< VectorStateType >
VectorStateType void 
rate_and_derivative (const ParticleFlux< VectorStateType > &pf, StateType &rate, StateType &drate_dT) const
 

Private Attributes

VectorCoeffType _cross_section
 
VectorCoeffType _lambda_grid
 
SigmaBinConverter
< VectorCoeffType > 
_converter
 

Detailed Description

template<typename CoeffType, typename VectorCoeffType = std::vector<CoeffType>>
class Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >

Photochemical rate.

Todo:
Need to find a place to store k once calculated, and recalculate only if the photon flux has changed. Might want also to re-put _cross_section_on_flux_grid, as usually, changes will appear in the photon flux, not the lambda grid.

Definition at line 65 of file kinetics_type.h.

Constructor & Destructor Documentation

template<typename CoeffType , typename VectorCoeffType >
Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::PhotochemicalRate ( const VectorCoeffType &  cs,
const VectorCoeffType &  lambda 
)
inline

Definition at line 128 of file photochemical_rate.h.

129  :
130  KineticsType<CoeffType,VectorCoeffType>(KineticsModel::PHOTOCHEM),
131  _cross_section(cs),
132  _lambda_grid(lambda)
133  {
134  return;
135  }
template<typename CoeffType , typename VectorCoeffType >
Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::PhotochemicalRate ( )
inline

Definition at line 139 of file photochemical_rate.h.

139  :
140  KineticsType<CoeffType,VectorCoeffType>(KineticsModel::PHOTOCHEM)
141  {
142  return;
143  }
template<typename CoeffType , typename VectorCoeffType >
Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::~PhotochemicalRate ( )
inline

Definition at line 147 of file photochemical_rate.h.

148  {
149  return;
150  }

Member Function Documentation

template<typename CoeffType, typename VectorCoeffType = std::vector<CoeffType>>
template<typename VectorStateType >
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::calculate_rate_constant ( const VectorStateType &  hv_flux,
const VectorStateType &  hv_lambda,
bool  x_update = true 
)

calculate _k for a given photon flux

template<typename CoeffType , typename VectorCoeffType >
template<typename StateType , typename VectorStateType >
void Antioch::KineticsType< CoeffType, VectorCoeffType >::compute_rate_and_derivative ( const KineticsConditions< StateType, VectorStateType > &  conditions,
StateType &  rate,
StateType &  drate_dT 
) const
inlineinherited

Definition at line 336 of file kinetics_type.h.

References antioch_error, Antioch::KineticsModel::ARRHENIUS, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::KineticsModel::CONSTANT, Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::KineticsModel::KOOIJ, Antioch::KineticsConditions< StateType, VectorStateType >::particle_flux(), Antioch::KineticsModel::PHOTOCHEM, and Antioch::KineticsModel::VANTHOFF.

Referenced by test_values().

338  {
339  switch (my_type)
340  {
342  {
343  (static_cast<const ConstantRate<CoeffType>*>(this))->rate_and_derivative(conditions,rate,drate_dT);
344  }
345  break;
346 
348  {
349  (static_cast<const HercourtEssenRate<CoeffType>*>(this))->rate_and_derivative(conditions,rate,drate_dT);
350  }
351  break;
352 
354  {
355  (static_cast<const BerthelotRate<CoeffType>*>(this))->rate_and_derivative(conditions,rate,drate_dT);
356  }
357  break;
358 
360  {
361  (static_cast<const ArrheniusRate<CoeffType>*>(this))->rate_and_derivative(conditions,rate,drate_dT);
362  }
363  break;
364 
365  case(KineticsModel::BHE):
366  {
367  (static_cast<const BerthelotHercourtEssenRate<CoeffType>*>(this))->rate_and_derivative(conditions,rate,drate_dT);
368  }
369  break;
370 
371  case(KineticsModel::KOOIJ):
372  {
373  (static_cast<const KooijRate<CoeffType>*>(this))->rate_and_derivative(conditions,rate,drate_dT);
374  }
375  break;
376 
378  {
379  (static_cast<const VantHoffRate<CoeffType>*>(this))->rate_and_derivative(conditions,rate,drate_dT);
380  }
381  break;
382 
384  {
385  (static_cast<const PhotochemicalRate<CoeffType,VectorCoeffType>*>(this))->rate_and_derivative(conditions.particle_flux(my_index),rate,drate_dT);
386  }
387  break;
388 
389  default:
390  {
391  antioch_error();
392  }
393 
394  } // switch(my_type)
395 
396  return;
397  }
#define antioch_error()
KineticsModel::KineticsModel my_type
template<typename CoeffType , typename VectorCoeffType >
template<typename StateType >
void Antioch::KineticsType< CoeffType, VectorCoeffType >::compute_rate_and_derivative ( const StateType &  temp,
StateType &  rate,
StateType &  drate_dT 
) const
inlineinherited

Definition at line 482 of file kinetics_type.h.

References antioch_deprecated.

484  {
487  (KineticsConditions<StateType> (temp), rate, drate_dT);
488  }
void compute_rate_and_derivative(const KineticsConditions< StateType, VectorStateType > &conditions, StateType &rate, StateType &drate_dT) const
#define antioch_deprecated()
template<typename CoeffType , typename VectorCoeffType >
VectorCoeffType Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::cross_section ( ) const
inline

Definition at line 308 of file photochemical_rate.h.

309  {
310  return _cross_section;
311  }
template<typename CoeffType , typename VectorCoeffType >
template<typename StateType , typename VectorStateType >
StateType Antioch::KineticsType< CoeffType, VectorCoeffType >::derivative ( const KineticsConditions< StateType, VectorStateType > &  conditions) const
inlineinherited

Definition at line 259 of file kinetics_type.h.

References antioch_error, Antioch::KineticsModel::ARRHENIUS, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::KineticsModel::CONSTANT, Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::KineticsModel::KOOIJ, Antioch::KineticsConditions< StateType, VectorStateType >::particle_flux(), Antioch::KineticsModel::PHOTOCHEM, Antioch::KineticsConditions< StateType, VectorStateType >::T(), Antioch::KineticsModel::VANTHOFF, and Antioch::zero_clone().

Referenced by test_values().

260  {
261  switch(my_type)
262  {
264  {
265  return (static_cast<const ConstantRate<CoeffType>*>(this))->derivative(conditions);
266  }
267  break;
268 
270  {
271  return (static_cast<const HercourtEssenRate<CoeffType>*>(this))->derivative(conditions);
272  }
273  break;
274 
276  {
277  return (static_cast<const BerthelotRate<CoeffType>*>(this))->derivative(conditions);
278  }
279  break;
280 
282  {
283  return (static_cast<const ArrheniusRate<CoeffType>*>(this))->derivative(conditions);
284  }
285  break;
286 
287  case(KineticsModel::BHE):
288  {
289  return (static_cast<const BerthelotHercourtEssenRate<CoeffType>*>(this))->derivative(conditions);
290  }
291  break;
292 
293  case(KineticsModel::KOOIJ):
294  {
295  return (static_cast<const KooijRate<CoeffType>*>(this))->derivative(conditions);
296  }
297  break;
298 
300  {
301  return (static_cast<const VantHoffRate<CoeffType>*>(this))->derivative(conditions);
302  }
303  break;
304 
306  {
307  return (static_cast<const PhotochemicalRate<CoeffType,VectorCoeffType>*>(this))->derivative(conditions.particle_flux(my_index));
308  }
309  break;
310 
311  default:
312  {
313  antioch_error();
314  }
315 
316  } // switch(my_type)
317 
318  // Dummy
319  return zero_clone(conditions.T());
320  }
#define antioch_error()
KineticsModel::KineticsModel my_type
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType , typename VectorCoeffType >
template<typename StateType >
StateType Antioch::KineticsType< CoeffType, VectorCoeffType >::derivative ( const StateType &  conditions) const
inlineinherited

Definition at line 326 of file kinetics_type.h.

References antioch_deprecated.

327  {
329  return derivative
330  ( KineticsConditions<StateType> (temp) );
331  }
StateType derivative(const KineticsConditions< StateType, VectorStateType > &conditions) const
#define antioch_deprecated()
template<typename CoeffType , typename VectorCoeffType >
CoeffType Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::get_parameter ( KineticsModel::Parameters  parameter,
int  l 
) const
inline

set one parameter, characterized by enum

Definition at line 229 of file photochemical_rate.h.

References antioch_assert_less, antioch_error, Antioch::KineticsModel::LAMBDA, and Antioch::KineticsModel::SIGMA.

230  {
231 
233 
234  switch(parameter)
235  {
237  {
238  return this->lambda_grid()[l];
239  }
240  break;
242  {
243  return this->cross_section()[l];
244  }
245  break;
246  default:
247  {
248  antioch_error();
249  }
250  break;
251  }
252 
253  return 0;
254  }
VectorCoeffType lambda_grid() const
#define antioch_assert_less(expr1, expr2)
#define antioch_error()
VectorCoeffType cross_section() const
template<typename CoeffType , typename VectorCoeffType >
CoeffType Antioch::KineticsType< CoeffType, VectorCoeffType >::get_parameter ( KineticsModel::Parameters  parameter) const
inherited

get one parameter, characterized by enum

Definition at line 400 of file kinetics_type.h.

References antioch_error, Antioch::KineticsModel::ARRHENIUS, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::KineticsModel::CONSTANT, Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::KineticsModel::KOOIJ, and Antioch::KineticsModel::VANTHOFF.

401  {
402  switch (my_type)
403  {
405  {
406  return (static_cast<const ConstantRate<CoeffType>*>(this))->get_parameter(parameter);
407  }
408  break;
409 
411  {
412  return (static_cast<const HercourtEssenRate<CoeffType>*>(this))->get_parameter(parameter);
413  }
414  break;
415 
417  {
418  return (static_cast<const BerthelotRate<CoeffType>*>(this))->get_parameter(parameter);
419  }
420  break;
421 
423  {
424  return (static_cast<const ArrheniusRate<CoeffType>*>(this))->get_parameter(parameter);
425  }
426  break;
427 
428  case(KineticsModel::BHE):
429  {
430  return (static_cast<const BerthelotHercourtEssenRate<CoeffType>*>(this))->get_parameter(parameter);
431  }
432  break;
433 
434  case(KineticsModel::KOOIJ):
435  {
436  return (static_cast<const KooijRate<CoeffType>*>(this))->get_parameter(parameter);
437  }
438  break;
439 
441  {
442  return (static_cast<const VantHoffRate<CoeffType>*>(this))->get_parameter(parameter);
443  }
444  break;
445 
446  default:
447  {
448  antioch_error();
449  }
450 
451  } // switch(my_type)
452 
453  return 0;
454  }
#define antioch_error()
KineticsModel::KineticsModel my_type
template<typename CoeffType , typename VectorCoeffType >
VectorCoeffType Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::lambda_grid ( ) const
inline

Definition at line 315 of file photochemical_rate.h.

316  {
317  return _lambda_grid;
318  }
template<typename CoeffType , typename VectorCoeffType >
const std::string Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::numeric ( ) const
inlinevirtual

print equation

Implements Antioch::KineticsType< CoeffType, VectorCoeffType >.

Definition at line 287 of file photochemical_rate.h.

288  {
289  std::stringstream os;
290  os << "int_0^infty sigma(lambda) * hv(lambda) * dlambda";
291 
292  return os.str();
293  }
template<typename CoeffType , typename VectorCoeffType >
template<typename StateType , typename VectorStateType >
StateType Antioch::KineticsType< CoeffType, VectorCoeffType >::operator() ( const KineticsConditions< StateType, VectorStateType > &  conditions) const
inlineinherited

Definition at line 182 of file kinetics_type.h.

References antioch_error, Antioch::KineticsModel::ARRHENIUS, Antioch::KineticsModel::BERTHELOT, Antioch::KineticsModel::BHE, Antioch::KineticsModel::CONSTANT, Antioch::KineticsModel::HERCOURT_ESSEN, Antioch::KineticsModel::KOOIJ, Antioch::KineticsConditions< StateType, VectorStateType >::particle_flux(), Antioch::KineticsModel::PHOTOCHEM, Antioch::KineticsConditions< StateType, VectorStateType >::T(), Antioch::KineticsModel::VANTHOFF, and Antioch::zero_clone().

183  {
184  switch(my_type)
185  {
187  {
188  return (static_cast<const ConstantRate<CoeffType>*>(this))->rate(conditions);
189  }
190  break;
191 
193  {
194  return (static_cast<const HercourtEssenRate<CoeffType>*>(this))->rate(conditions);
195  }
196  break;
197 
199  {
200  return (static_cast<const BerthelotRate<CoeffType>*>(this))->rate(conditions);
201  }
202  break;
203 
205  {
206  return (static_cast<const ArrheniusRate<CoeffType>*>(this))->rate(conditions);
207  }
208  break;
209 
210  case(KineticsModel::BHE):
211  {
212  return (static_cast<const BerthelotHercourtEssenRate<CoeffType>*>(this))->rate(conditions);
213  }
214  break;
215 
216  case(KineticsModel::KOOIJ):
217  {
218  return (static_cast<const KooijRate<CoeffType>*>(this))->rate(conditions);
219  }
220  break;
221 
223  {
224  return (static_cast<const VantHoffRate<CoeffType>*>(this))->rate(conditions);
225  }
226  break;
227 
229  {
230  return (static_cast<const PhotochemicalRate<CoeffType,VectorCoeffType>*>(this))->rate(conditions.particle_flux(my_index));
231  }
232  break;
233 
234  default:
235  {
236  antioch_error();
237  }
238 
239  } // switch(my_type)
240 
241  // Dummy
242  return zero_clone(conditions.T());
243  }
#define antioch_error()
KineticsModel::KineticsModel my_type
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145
template<typename CoeffType , typename VectorCoeffType >
template<typename StateType >
StateType Antioch::KineticsType< CoeffType, VectorCoeffType >::operator() ( const StateType &  temp) const
inlineinherited

Definition at line 249 of file kinetics_type.h.

References antioch_deprecated.

250  {
252  return operator()
253  (KineticsConditions<StateType>(temp) );
254  }
#define antioch_deprecated()
template<typename CoeffType , typename VectorCoeffType >
void Antioch::KineticsType< CoeffType, VectorCoeffType >::print ( std::ostream &  os = std::cout) const
inlineinherited

Formatted print, by default to std::cout.

Definition at line 144 of file kinetics_type.h.

145  {
146  os << numeric();
147  }
virtual const std::string numeric() const =0
template<typename CoeffType , typename VectorCoeffType >
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::reset_coefs ( const VectorCoeffType &  coefficients)
inline

reset the coefficients

Contrary to the other rate models, no choice here in the VectorCoeffType type. The order assumed is lambda, cross-section

Definition at line 185 of file photochemical_rate.h.

References antioch_assert_equal_to.

186  {
187  // we require the two vectors being the same size
188  antioch_assert_equal_to(coefficients.size()%2,0);
189 
190  const unsigned int subsize(coefficients.size()/2);
191  VectorCoeffType l(subsize);
192  VectorCoeffType cs(subsize);
193  for(unsigned int il = 0; il < subsize; il++)
194  {
195  l[il] = coefficients[il];
196  cs[il] = coefficients[il + subsize];
197  }
198  this->set_lambda_grid(l);
199  this->set_cross_section(cs);
200  }
#define antioch_assert_equal_to(expr1, expr2)
void set_lambda_grid(const VectorCoeffType &l)
void set_cross_section(const VectorCoeffType &cs)
template<typename CoeffType , typename VectorCoeffType >
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::set_cross_section ( const VectorCoeffType &  cs)
inline

Definition at line 154 of file photochemical_rate.h.

155  {
156  _cross_section = cs;
157  }
template<typename CoeffType , typename VectorCoeffType >
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::set_cross_section ( CoeffType  cs,
int  il 
)
inline

Definition at line 167 of file photochemical_rate.h.

References antioch_assert_less.

168  {
170 
171  _cross_section[il] = cs;
172  }
#define antioch_assert_less(expr1, expr2)
template<typename CoeffType , typename VectorCoeffType >
void Antioch::KineticsType< CoeffType, VectorCoeffType >::set_index ( unsigned int  nr)
inlineinherited

Definition at line 174 of file kinetics_type.h.

175  {
176  my_index = nr;
177  }
template<typename CoeffType , typename VectorCoeffType >
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::set_lambda_grid ( const VectorCoeffType &  l)
inline

Definition at line 161 of file photochemical_rate.h.

162  {
163  _lambda_grid = l;
164  }
template<typename CoeffType , typename VectorCoeffType >
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::set_lambda_grid ( CoeffType  l,
int  il 
)
inline

Definition at line 176 of file photochemical_rate.h.

References antioch_assert_less.

177  {
179 
180  _lambda_grid[il] = l;
181  }
#define antioch_assert_less(expr1, expr2)
template<typename CoeffType , typename VectorCoeffType >
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::set_parameter ( KineticsModel::Parameters  parameter,
int  l,
CoeffType  new_value 
)
inline

set one value of one parameter, characterized by enum and its index

Definition at line 204 of file photochemical_rate.h.

References antioch_error, Antioch::KineticsModel::LAMBDA, and Antioch::KineticsModel::SIGMA.

Referenced by tester().

205  {
206 
207  switch(parameter)
208  {
210  {
211  this->set_lambda_grid(new_value,l);
212  }
213  break;
215  {
216  this->set_cross_section(new_value,l);
217  }
218  break;
219  default:
220  {
221  antioch_error();
222  }
223  break;
224  }
225  }
void set_lambda_grid(const VectorCoeffType &l)
#define antioch_error()
void set_cross_section(const VectorCoeffType &cs)
template<typename CoeffType , typename VectorCoeffType >
KineticsModel::KineticsModel Antioch::KineticsType< CoeffType, VectorCoeffType >::type ( ) const
inlineinherited

Definition at line 160 of file kinetics_type.h.

Referenced by Antioch::reset_parameter_of_rate(), and Antioch::reset_rate().

161  {
162  return my_type;
163  }
KineticsModel::KineticsModel my_type

Member Data Documentation

template<typename CoeffType, typename VectorCoeffType = std::vector<CoeffType>>
SigmaBinConverter<VectorCoeffType> Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::_converter
private

Definition at line 59 of file photochemical_rate.h.

template<typename CoeffType, typename VectorCoeffType = std::vector<CoeffType>>
VectorCoeffType Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::_cross_section
private

Definition at line 57 of file photochemical_rate.h.

template<typename CoeffType, typename VectorCoeffType = std::vector<CoeffType>>
VectorCoeffType Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::_lambda_grid
private

Definition at line 58 of file photochemical_rate.h.

template<typename CoeffType, typename VectorCoeffType = std::vector<CoeffType>>
template<typename VectorStateType >
operator() (const ParticleFlux<VectorStateType> & pf) const template <typename VectorStateType> typename value_type<VectorStateType> Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::derivative(const ParticleFlux< VectorStateType > &) const template< typename StateType

Simultaneously evaluate the rate and its derivative at T.

Returns
the rate
the rate evaluated at the given photon spectrum.
the derivative with respect to temperature.

Definition at line 114 of file photochemical_rate.h.

template<typename CoeffType, typename VectorCoeffType = std::vector<CoeffType>>
void Antioch::PhotochemicalRate< CoeffType, VectorCoeffType >::rate_and_derivative
inline

Definition at line 119 of file photochemical_rate.h.


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

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