35 template <
typename Scalar>
37 const Scalar & rate,
const Scalar & derive,
const Scalar & T)
39 const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 2;
41 if( abs( (rate - rate_exact)/rate_exact ) > tol )
43 std::cout << std::scientific << std::setprecision(16)
44 <<
"Error: Mismatch in rate values." << std::endl
45 <<
"T = " << T <<
" K" << std::endl
46 <<
"rate(T) = " << rate << std::endl
47 <<
"rate_exact = " << rate_exact << std::endl
48 <<
"relative difference = " << abs( (rate - rate_exact)/rate_exact ) << std::endl
49 <<
"tolerance = " << tol << std::endl;
53 if( abs( (derive - derive_exact)/derive_exact ) > tol )
55 std::cout << std::scientific << std::setprecision(16)
56 <<
"Error: Mismatch in rate derivative values." << std::endl
57 <<
"T = " << T <<
" K" << std::endl
58 <<
"drate_dT(T) = " << derive << std::endl
59 <<
"derive_exact = " << derive_exact << std::endl
60 <<
"relative difference = " << abs( (derive - derive_exact)/derive_exact ) << std::endl
61 <<
"tolerance = " << tol << std::endl;
69 template <
typename Scalar>
78 for(Scalar T = 300.1L; T <= 2500.1L; T += 10.L)
81 const Scalar rate_exact = Cf*
pow(T/Tref,eta)*exp(-Ea/(R*T));
82 const Scalar derive_exact = exp(-Ea/(R*T)) *
pow(T/Tref,eta) * Cf * (Ea/(R*T*T) + eta/T );
86 Scalar rate = kooij_rate(cond);
87 Scalar deriveRate = kooij_rate.
derivative(cond);
109 template <
typename Scalar>
121 int return_flag =
test_values(Cf,eta,Ea,Tref,R,kooij_rate);
134 return_flag =
test_values(Cf,eta,Ea,Tref,R,kooij_rate) || return_flag;
139 std::vector<Scalar> values(3);
145 return_flag =
test_values(Cf,eta,Ea,Tref,R,kooij_rate) || return_flag;
150 R = Antioch::Constants::R_universal<Scalar>();
160 return_flag =
test_values(Cf,eta,Ea,Tref,R,kooij_rate) || return_flag;
167 return (tester<double>() ||
168 tester<long double>() ||
void set_Tref(const CoeffType Tref)
void set_Ea(const CoeffType Ea)
set _raw_Ea, unit is known (cal.mol-1, J.mol-1, whatever), _Ea is computed
void set_rscale(const CoeffType scale)
int check_rate_and_derivative(const Scalar &rate_exact, const Scalar &derive_exact, const Scalar &rate, const Scalar &derive, const Scalar &T)
Antioch::enable_if_c< Antioch::is_valarray< T >::value, typename Antioch::state_type< T >::type >::type pow(const T &in, const T2 &n)
_Cf VectorStateType VectorStateType(*) VectorStateType voi rate_and_derivative)(const KineticsConditions< StateType, VectorStateType > &T, StateType &rate, StateType &drate_dT) const
_Cf VectorStateType VectorStateType derivative(const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType
T get_SI_factor() const
Multiplicative coefficient getter.
void set_Cf(const CoeffType Cf)
void reset_coefs(const VectorCoeffType &coefficients)
reset the coeffs
void set_eta(const CoeffType eta)
int test_values(const Scalar &Cf, const Scalar &eta, const Scalar &Ea, const Scalar &Tref, const Scalar &R, const Antioch::KooijRate< Scalar > &kooij_rate)
This class contains the conditions of the chemistry.