33 template <
typename Scalar>
35 const Scalar & rate,
const Scalar & derive,
const Scalar & T)
37 const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 2;
39 if( abs( (rate - rate_exact)/rate_exact ) > tol )
41 std::cout << std::scientific << std::setprecision(16)
42 <<
"Error: Mismatch in rate values." << std::endl
43 <<
"T = " << T <<
" K" << std::endl
44 <<
"rate(T) = " << rate << std::endl
45 <<
"rate_exact = " << rate_exact << std::endl
46 <<
"relative difference = " << abs( (rate - rate_exact)/rate_exact ) << std::endl
47 <<
"tolerance = " << tol << std::endl;
51 if( abs( (derive - derive_exact)/derive_exact ) > tol )
53 std::cout << std::scientific << std::setprecision(16)
54 <<
"Error: Mismatch in rate derivative values." << std::endl
55 <<
"T = " << T <<
" K" << std::endl
56 <<
"drate_dT(T) = " << derive << std::endl
57 <<
"derive_exact = " << derive_exact << std::endl
58 <<
"relative difference = " << abs( (derive - derive_exact)/derive_exact ) << std::endl
59 <<
"tolerance = " << tol << std::endl;
67 template <
typename Scalar>
74 for(Scalar T = 300.1; T <= 2500.1; T += 10.)
76 const Scalar rate_exact = Cf*exp(D*T);
77 const Scalar derive_exact = D * Cf * exp(D*T);
81 Scalar rate = berthelot_rate(cond);
82 Scalar deriveRate = berthelot_rate.
derivative(cond);
91 rate = berthelot_rate(T);
104 template <
typename Scalar>
112 int return_flag =
test_values(Cf,D,berthelot_rate);
116 berthelot_rate.
set_Cf(Cf);
117 berthelot_rate.
set_D(D);
118 return_flag =
test_values(Cf,D,berthelot_rate) || return_flag;
123 std::vector<Scalar> values(2);
127 return_flag =
test_values(Cf,D,berthelot_rate) || return_flag;
134 return (tester<double>() ||
135 tester<long double>() ||
_Cf VectorStateType VectorStateType(*) VectorStateType voi rate_and_derivative)(const KineticsConditions< StateType, VectorStateType > &T, StateType &rate, StateType &drate_dT) const
int check_rate_and_derivative(const Scalar &rate_exact, const Scalar &derive_exact, const Scalar &rate, const Scalar &derive, const Scalar &T)
void reset_coefs(const VectorCoeffType &coefficients)
reset the coeffs
void set_D(const CoeffType D)
int test_values(const Scalar &Cf, const Scalar &D, const Antioch::BerthelotRate< Scalar > &berthelot_rate)
void set_Cf(const CoeffType Cf)
This class contains the conditions of the chemistry.
_Cf VectorStateType VectorStateType derivative(const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType