27 #ifndef ANTIOCH_PHOTOCHEMICAL_RATE_H
28 #define ANTIOCH_PHOTOCHEMICAL_RATE_H
52 template<
typename CoeffType,
typename VectorCoeffType = std::vector<CoeffType> >
53 class PhotochemicalRate:
public KineticsType<CoeffType,VectorCoeffType>
94 void reset_coefs(
const VectorCoeffType & coefficients);
97 template<
typename VectorStateType>
98 void calculate_rate_constant(
const VectorStateType &hv_flux,
const VectorStateType &hv_lambda,
bool x_update =
true);
101 template <
typename VectorStateType>
103 operator()(const
ParticleFlux<VectorStateType> & pf) const
107 template <typename VectorStateType>
112 template <typename VectorStateType>
118 template <typename StateType, typename VectorStateType>
126 template<typename CoeffType, typename VectorCoeffType>
129 const VectorCoeffType &lambda):
137 template<
typename CoeffType,
typename VectorCoeffType>
145 template<
typename CoeffType,
typename VectorCoeffType>
152 template<
typename CoeffType,
typename VectorCoeffType>
159 template<
typename CoeffType,
typename VectorCoeffType>
165 template<
typename CoeffType,
typename VectorCoeffType>
171 _cross_section[il] = cs;
174 template<
typename CoeffType,
typename VectorCoeffType>
180 _lambda_grid[il] = l;
183 template<
typename CoeffType,
typename VectorCoeffType>
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++)
195 l[il] = coefficients[il];
196 cs[il] = coefficients[il + subsize];
198 this->set_lambda_grid(l);
199 this->set_cross_section(cs);
202 template<
typename CoeffType,
typename VectorCoeffType>
211 this->set_lambda_grid(new_value,l);
216 this->set_cross_section(new_value,l);
227 template<
typename CoeffType,
typename VectorCoeffType>
238 return this->lambda_grid()[l];
243 return this->cross_section()[l];
256 template<
typename CoeffType,
typename VectorCoeffType>
257 template<
typename VectorStateType>
262 const VectorStateType &hv_flux = pf.
flux();
263 const VectorStateType &hv_lambda = pf.
abscissa();
270 VectorStateType cross_section_on_flux_grid(hv_lambda.size());
273 _converter.
y_on_custom_grid(_lambda_grid,_cross_section,hv_lambda,cross_section_on_flux_grid);
278 for(
unsigned int ibin = 0; ibin < hv_lambda.size() - 1; ibin++)
280 k += cross_section_on_flux_grid[ibin] * hv_flux[ibin] * (hv_lambda[ibin+1] - hv_lambda[ibin]);
285 template<
typename CoeffType,
typename VectorCoeffType>
289 std::stringstream os;
290 os <<
"int_0^infty sigma(lambda) * hv(lambda) * dlambda";
296 template<
typename CoeffType,
typename VectorCoeffType>
297 template <
typename StateType,
typename VectorStateType>
306 template<
typename CoeffType,
typename VectorCoeffType>
310 return _cross_section;
313 template<
typename CoeffType,
typename VectorCoeffType>
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.
const std::string numeric() const
print equation
Stores the incoming flux of particles.
base class for kinetics models
VectorCoeffType _lambda_grid
#define antioch_assert_equal_to(expr1, expr2)
#define antioch_assert_greater(expr1, expr2)
KineticsModel::KineticsModel type() const
const VectorCoeffType & flux() const
VectorCoeffType lambda_grid() const
#define antioch_assert_less(expr1, expr2)
void set_lambda_grid(const VectorCoeffType &l)
const VectorCoeffType & abscissa() const
void init_clone(T &output, const T &example)
void reset_coefs(const VectorCoeffType &coefficients)
reset the coefficients
void set_cross_section(const VectorCoeffType &cs)
void set_parameter(KineticsModel::Parameters parameter, int l, CoeffType new_value)
set one value of one parameter, characterized by enum and its index
void set_zero(_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &a)
#define ANTIOCH_AUTOFUNC(Type, Expr)
const ANTIOCH_AUTO(StateType) KineticsTheoryThermalConductivity< ThermoEvaluator
void y_on_custom_grid(const VectorCoeffType &x_old, const VectorCoeffType &y_old, const VectorStateType &x_new, VectorStateType &y_new) const
void calculate_rate_constant(const VectorStateType &hv_flux, const VectorStateType &hv_lambda, bool x_update=true)
calculate _k for a given photon flux
SigmaBinConverter< VectorCoeffType > _converter
The parameters are reduced parameters.
VectorCoeffType _cross_section
CoeffType get_parameter(KineticsModel::Parameters parameter, int l) const
set one parameter, characterized by enum
VectorCoeffType cross_section() const
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