43 const Scalar Cf1 = 1.4;
44 const Scalar Ea1 = 5.0;
45 const Scalar beta1 = 1.2;
46 const Scalar D1 = 2.5e-2;
47 const Scalar Cf2 = 2.0;
48 const Scalar Ea2 = 3.0;
49 const Scalar beta2 = 0.8;
50 const Scalar D2 = 3.0e-2;
52 const std::string equation(
"A + B -> C + D");
53 const unsigned int n_species(4);
56 std::vector<Scalar> mol_densities;
57 mol_densities.push_back(1e-2);
58 mol_densities.push_back(1e-2);
59 mol_densities.push_back(1e-2);
60 mol_densities.push_back(1e-2);
62 const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 100;
64 for(Scalar T = 300.1; T <= 2500.1; T += 10.)
69 for(
unsigned int ikinmod = 0; ikinmod < 6; ikinmod++)
85 rate_exact = Cf1 *
pow(T,beta1) + Cf2 *
pow(T,beta2);
86 derive_exact = Cf1 *
pow (T,beta1) * beta1/T + Cf2 *
pow (T,beta2) * beta2/T;
94 rate_exact = Cf1 * exp(D1*T) + Cf2 * exp(D2*T);
95 derive_exact = Cf1 * exp(D1*T) * D1 + Cf2 * exp(D2*T) * D2;
103 rate_exact = Cf1 * exp(-Ea1/T) + Cf2 * exp(-Ea2/T);
104 derive_exact = Cf1 * exp(-Ea1/T) * Ea1/
pow(T,2) + Cf2 * exp(-Ea2/T) * Ea2/
pow(T,2);
112 rate_exact = Cf1 *
pow(T,beta1) * exp(D1 * T) + Cf2 *
pow(T,beta2) * exp(D2 * T);
113 derive_exact = Cf1 *
pow(T,beta1) * exp(D1 * T) * (beta1/T + D1) + Cf2 *
pow(T,beta2) * exp(D2 * T) * (beta2/T + D2);
121 rate_exact = Cf1 *
pow(T,beta1) * exp(-Ea1/T) + Cf2 *
pow(T,beta2) * exp(-Ea2/T);
122 derive_exact = Cf1 *
pow(T,beta1) * exp(-Ea1/T) * (beta1/T + Ea1/
pow(T,2)) + Cf2 *
pow(T,beta2) * exp(-Ea2/T) * (beta2/T + Ea2/
pow(T,2));
130 rate_exact = Cf1 *
pow(T,beta1) * exp(-Ea1/T + D1 * T) + Cf2 *
pow(T,beta2) * exp(-Ea2/T + D2 * T);
131 derive_exact = Cf1 *
pow(T,beta1) * exp(-Ea1/T + D1 * T) * (D1 + beta1/T + Ea1/
pow(T,2))
132 + Cf2 *
pow(T,beta2) * exp(-Ea2/T + D2 * T) * (D2 + beta2/T + Ea2/
pow(T,2));
143 std::vector<Scalar> drate_dx;
144 drate_dx.resize(n_species);
147 if( abs( (rate1 - rate_exact)/rate_exact ) > tol )
149 std::cout << std::scientific << std::setprecision(16)
150 <<
"Error: Mismatch in rate values." << std::endl
151 <<
"Kinetics model (see enum) " << kin_mod << std::endl
152 <<
"T = " << T <<
" K" << std::endl
153 <<
"rate(T) = " << rate1 << std::endl
154 <<
"rate_exact = " << rate_exact << std::endl;
158 if( abs( (rate - rate_exact)/rate_exact ) > tol )
160 std::cout << std::scientific << std::setprecision(16)
161 <<
"Error: Mismatch in rate values." << std::endl
162 <<
"Kinetics model (see enum) " << kin_mod << std::endl
163 <<
"T = " << T <<
" K" << std::endl
164 <<
"rate(T) = " << rate << std::endl
165 <<
"rate_exact = " << rate_exact << std::endl;
169 if( abs( (drate_dT - derive_exact)/derive_exact ) > tol )
171 std::cout << std::scientific << std::setprecision(16)
172 <<
"Error: Mismatch in rate derivative values." << std::endl
173 <<
"Kinetics model (see enum) " << kin_mod << std::endl
174 <<
"T = " << T <<
" K" << std::endl
175 <<
"drate_dT(T) = " << drate_dT << std::endl
176 <<
"derive_exact = " << derive_exact << std::endl;
180 delete dupl_reaction;
181 if(return_flag)
return return_flag;
base class for kinetics models
Berthelot Hercourt-Essen rate equation.
void compute_forward_rate_coefficient_and_derivatives(const VectorStateType &molar_densities, const KineticsConditions< StateType, VectorStateType > &conditions, StateType &kfwd, StateType &dkfwd_dT, VectorStateType &dkfwd_dX) const
Antioch::enable_if_c< Antioch::is_valarray< T >::value, typename Antioch::state_type< T >::type >::type pow(const T &in, const T2 &n)
void add_forward_rate(KineticsType< CoeffType, VectorCoeffType > *rate)
Add a forward rate object.
A single reaction mechanism.
Van't Hoff rate equation.
Hercourt-Essen rate equation.
StateType compute_forward_rate_coefficient(const VectorStateType &molar_densities, const KineticsConditions< StateType, VectorStateType > &conditions) const
This class contains the conditions of the chemistry.