74 std::vector<std::string> species_str_list;
75 const unsigned int n_species = 5;
76 species_str_list.reserve(n_species);
77 species_str_list.push_back(
"N2" );
78 species_str_list.push_back(
"O2" );
79 species_str_list.push_back(
"N" );
80 species_str_list.push_back(
"O" );
81 species_str_list.push_back(
"NO" );
87 Antioch::read_reaction_set_data_xml<Scalar>( input_name,
true, reaction_set );
89 const Scalar T = 1500.0;
90 const Scalar P = 1.0e5;
95 std::vector<Scalar> Y(n_species,0.2);
97 const Scalar R_mix = chem_mixture.R(Y);
99 const Scalar rho = P/(R_mix*T);
101 std::vector<Scalar> molar_densities(n_species,0.0);
102 chem_mixture.molar_densities(rho,Y,molar_densities);
104 std::vector<Scalar> h_RT_minus_s_R(n_species);
109 std::vector<Scalar> net_rates,kfwd_const,kbkwd_const,kfwd,kbkwd,fwd_conc,bkwd_conc;
111 reaction_set.get_reactive_scheme(conditions,molar_densities,h_RT_minus_s_R,net_rates,
112 kfwd_const,kbkwd_const,kfwd,kbkwd,fwd_conc,bkwd_conc);
114 std::vector<Scalar> net_rates_exact,
121 net_rates_exact.resize(5,0.L);
122 kfwd_const_exact.resize(5,0.L);
123 kbkwd_const_exact.resize(5,0.L);
124 kfwd_exact.resize(5,0.L);
125 kbkwd_exact.resize(5,0.L);
126 fwd_conc_exact.resize(5,1.L);
127 bkwd_conc_exact.resize(5,1.L);
129 const Scalar Rcal = Antioch::Constants::R_universal<Scalar>() * Antioch::Constants::R_universal_unit<Scalar>().factor_to_some_unit(
"cal/mol/K");
130 const Scalar P0_RT(1.0e5/Antioch::Constants::R_universal<Scalar>()/T);
132 kfwd_const_exact[0] = 7e15L *
std::pow(T,-1.6L) * std::exp(-224801.3L/(Rcal * T)) *
133 (4.2857L * (molar_densities[2] + molar_densities[3])
134 + molar_densities[0] + molar_densities[1] + molar_densities[4] );
135 fwd_conc_exact[0] = molar_densities[0];
136 bkwd_conc_exact[0] =
std::pow(molar_densities[2],2);
139 kfwd_const_exact[1] = 2e15L *
std::pow(T,-1.5L) * std::exp(-117881.7L/(Rcal * T)) *
140 (5.0L * (molar_densities[2] + molar_densities[3])
141 + molar_densities[0] + molar_densities[1] + molar_densities[4] );
142 fwd_conc_exact[1] = molar_densities[1];
143 bkwd_conc_exact[1] =
std::pow(molar_densities[3],2);
146 kfwd_const_exact[2] = 5e9L * std::exp(-149943.0L/(Rcal * T)) *
147 (22.0L * (molar_densities[2] + molar_densities[3] + molar_densities[4])
148 + molar_densities[0] + molar_densities[1]);
149 fwd_conc_exact[2] = molar_densities[4];
150 bkwd_conc_exact[2] = molar_densities[2] * molar_densities[3];
153 kfwd_const_exact[3] = 5.7e9L *
std::pow(T,0.42) * std::exp(-85269.6L/(Rcal * T));
154 fwd_conc_exact[3] = molar_densities[0] * molar_densities[3];
157 kfwd_const_exact[4] = 8.4e9L * std::exp(-38526.0L/(Rcal * T));
158 fwd_conc_exact[4] = molar_densities[4] * molar_densities[3];
160 for(
unsigned int rxn = 0; rxn < 5; rxn++)
164 kbkwd_const_exact[rxn] = kfwd_const_exact[rxn]/reaction_set.reaction(rxn).equilibrium_constant(P0_RT,h_RT_minus_s_R);
165 kbkwd_exact[rxn] = kbkwd_const_exact[rxn] * bkwd_conc_exact[rxn];
167 kfwd_exact[rxn] = kfwd_const_exact[rxn] * fwd_conc_exact[rxn];
168 net_rates_exact[rxn] = kfwd_exact[rxn] - kbkwd_exact[rxn];
172 for(
unsigned int rxn = 0; rxn < 5; rxn++)
174 return_flag =
check_test(net_rates_exact[rxn],net_rates[rxn],
"net rates",rxn) ||
176 return_flag =
check_test(kfwd_const_exact[rxn],kfwd_const[rxn],
"rate constant forward",rxn) ||
178 return_flag =
check_test(kfwd_exact[rxn],kfwd[rxn],
"rate forward",rxn) ||
180 return_flag =
check_test(fwd_conc_exact[rxn],fwd_conc[rxn],
"concentrations forward",rxn) ||
185 return_flag =
check_test(kbkwd_const_exact[rxn],kbkwd_const[rxn],
"rate constant backward",rxn) ||
187 return_flag =
check_test(kbkwd_exact[rxn],kbkwd[rxn],
"rate backward",rxn) ||
189 return_flag =
check_test(bkwd_conc_exact[rxn],bkwd_conc[rxn],
"concentrations backward",rxn) ||
This class encapsulates all the reaction mechanisms considered in a chemical nonequilibrium simulatio...
Antioch::enable_if_c< Antioch::is_valarray< T >::value, typename Antioch::state_type< T >::type >::type pow(const T &in, const T2 &n)
int check_test(const Scalar &exact, const Scalar &cal, const std::string &words, unsigned int rxn)
Class storing chemical mixture properties.
StateType h_RT_minus_s_R(const Cache< StateType > &cache, unsigned int species) const
We currently need different specializations for scalar vs vector inputs here.
This class contains the conditions of the chemistry.