35 template <
typename Scalar>
43 const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
45 for(Scalar T = 300.1L; T <= 2500.1L; T += 10.L)
47 const Scalar rate_exact = Cf *
pow(T/Tref,eta) * exp(-Ea/(R*T) + D*T);
48 const Scalar derive_exact = Cf *
pow(T/Tref,eta) * exp(-Ea/(R*T) + D*T) * (D + eta/T + Ea/(R*T*T));
50 Scalar rate1 = vanthoff_rate(T);
51 Scalar deriveRate1 = vanthoff_rate.
derivative(T);
57 if( abs( (rate1 - rate_exact)/rate_exact ) > tol )
59 std::cout << std::scientific << std::setprecision(16)
60 <<
"Error: Mismatch in rate values." << std::endl
61 <<
"T = " << T <<
" K" << std::endl
62 <<
"rate(T) = " << rate1 << std::endl
63 <<
"rate_exact = " << rate_exact << std::endl
64 <<
"Van't Hoff: " << vanthoff_rate << std::endl;
68 if( abs( (rate - rate_exact)/rate_exact ) > tol )
70 std::cout << std::scientific << std::setprecision(16)
71 <<
"Error: Mismatch in rate values." << std::endl
72 <<
"T = " << T <<
" K" << std::endl
73 <<
"rate(T) = " << rate << std::endl
74 <<
"rate_exact = " << rate_exact << std::endl
75 <<
"Van't Hoff: " << vanthoff_rate << std::endl;
79 if( abs( (deriveRate1 - derive_exact)/derive_exact ) > tol )
81 std::cout << std::scientific << std::setprecision(16)
82 <<
"Error: Mismatch in rate derivative values." << std::endl
83 <<
"T = " << T <<
" K" << std::endl
84 <<
"drate_dT(T) = " << deriveRate1 << std::endl
85 <<
"derive_exact = " << derive_exact << std::endl
86 <<
"Van't Hoff: " << vanthoff_rate << std::endl;
90 if( abs( (deriveRate - derive_exact)/derive_exact ) > tol )
92 std::cout << std::scientific << std::setprecision(16)
93 <<
"Error: Mismatch in rate derivative values." << std::endl
94 <<
"T = " << T <<
" K" << std::endl
95 <<
"drate_dT(T) = " << deriveRate << std::endl
96 <<
"derive_exact = " << derive_exact << std::endl
97 <<
"Van't Hoff: " << vanthoff_rate << std::endl;
101 if(return_flag)
break;
107 template <
typename Scalar>
120 int return_flag =
test_values(Cf,eta,Ea,D,Tref,R,vanthoff_rate);
132 vanthoff_rate.
set_D(D);
136 return_flag =
test_values(Cf,eta,Ea,D,Tref,R,vanthoff_rate) || return_flag;
142 std::vector<Scalar> values(4);
149 return_flag =
test_values(Cf,eta,Ea,D,Tref,R,vanthoff_rate) || return_flag;
156 R = Antioch::Constants::R_universal<Scalar>();
166 return_flag =
test_values(Cf,eta,Ea,D,Tref,R,vanthoff_rate) || return_flag;
174 return (tester<double>() ||
175 tester<long double>() ||
void reset_coefs(const VectorCoeffType &coefficients)
reset the coeffs
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_Cf(const CoeffType Cf)
T get_SI_factor() const
Multiplicative coefficient getter.
void set_D(const CoeffType D)
void set_Tref(const CoeffType Tref)
_Cf VectorStateType VectorStateType(*) VectorStateType voi rate_and_derivative)(const KineticsConditions< StateType, VectorStateType > &T, StateType &rate, StateType &drate_dT) const
Van't Hoff rate equation.
void set_rscale(const CoeffType rscale)
int test_values(const Scalar &Cf, const Scalar &eta, const Scalar &Ea, const Scalar &D, const Scalar &Tref, const Scalar &R, const Antioch::VantHoffRate< Scalar > &vanthoff_rate)
void set_Ea(const CoeffType Ea)
set _raw_Ea, unit is known (cal.mol-1, J.mol-1, whatever), _Ea is computed
void set_eta(const CoeffType eta)
_Cf VectorStateType VectorStateType derivative(const KineticsConditions< StateType, VectorStateType > &T) const ANTIOCH_AUTOFUNC(StateType