34 template <
typename Scalar>
36 const Scalar & rate,
const Scalar & derive,
const Scalar & T)
38 const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 2;
40 if( abs( (rate - rate_exact)/rate_exact ) > tol )
42 std::cout << std::scientific << std::setprecision(16)
43 <<
"Error: Mismatch in rate values." << std::endl
44 <<
"T = " << T <<
" K" << std::endl
45 <<
"rate(T) = " << rate << std::endl
46 <<
"rate_exact = " << rate_exact << std::endl
47 <<
"relative difference = " << abs( (rate - rate_exact)/rate_exact ) << std::endl
48 <<
"tolerance = " << tol << std::endl;
52 if( abs( (derive - derive_exact)/derive_exact ) > tol )
54 std::cout << std::scientific << std::setprecision(16)
55 <<
"Error: Mismatch in rate derivative values." << std::endl
56 <<
"T = " << T <<
" K" << std::endl
57 <<
"drate_dT(T) = " << derive << std::endl
58 <<
"derive_exact = " << derive_exact << std::endl
59 <<
"relative difference = " << abs( (derive - derive_exact)/derive_exact ) << std::endl
60 <<
"tolerance = " << tol << std::endl;
68 template <
typename Scalar>
76 for(Scalar T = 300.1L; T <= 2500.1L; T += 10.L)
78 const Scalar rate_exact = Cf*
pow(T/Tref,eta)*exp(D*T);
79 const Scalar derive_exact = Cf *
pow(T/Tref,eta) * exp(D*T) * (D + eta/T);
83 Scalar rate = berthelothercourtessen_rate(cond);
84 Scalar deriveRate = berthelothercourtessen_rate.
derivative(cond);
93 rate = berthelothercourtessen_rate(T);
94 deriveRate = berthelothercourtessen_rate.
derivative(T);
108 template <
typename Scalar>
118 int return_flag =
test_values(Cf,eta,D,Tref,berthelothercourtessen_rate);
124 berthelothercourtessen_rate.
set_Cf(Cf);
125 berthelothercourtessen_rate.
set_eta(eta);
126 berthelothercourtessen_rate.
set_D(D);
127 berthelothercourtessen_rate.
set_Tref(Tref);
129 return_flag =
test_values(Cf,eta,D,Tref,berthelothercourtessen_rate) || return_flag;
134 std::vector<Scalar> values(3);
140 return_flag =
test_values(Cf,eta,D,Tref,berthelothercourtessen_rate) || return_flag;
153 return_flag =
test_values(Cf,eta,D,Tref,berthelothercourtessen_rate) || return_flag;
161 return (tester<double>() ||
162 tester<long double>() ||
_Cf VectorStateType VectorStateType(*) VectorStateType voi rate_and_derivative)(const KineticsConditions< StateType, VectorStateType > &T, StateType &rate, StateType &drate_dT) const
void set_eta(const CoeffType eta)
Berthelot Hercourt-Essen rate equation.
Antioch::enable_if_c< Antioch::is_valarray< T >::value, typename Antioch::state_type< T >::type >::type pow(const T &in, const T2 &n)
void set_Tref(const CoeffType Tref)
int test_values(const Scalar &Cf, const Scalar &eta, const Scalar &D, const Scalar &Tref, const Antioch::BerthelotHercourtEssenRate< Scalar > &berthelothercourtessen_rate)
_Cf VectorStateType VectorStateType derivative(const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType
void reset_coefs(const VectorCoeffType &coefficients)
reset the coeffs
void set_Cf(const CoeffType Cf)
int check_rate_and_derivative(const Scalar &rate_exact, const Scalar &derive_exact, const Scalar &rate, const Scalar &derive, const Scalar &T)
void set_D(const CoeffType D)
This class contains the conditions of the chemistry.