28 #include "antioch_config.h"
53 #ifdef ANTIOCH_HAVE_GSL
56 template <
typename Scalar>
57 int check_value(
const Scalar ref,
const Scalar candidate,
const Scalar tol,
const std::string& test_name)
61 std::cout <<
"Testing "+test_name <<
"...";
63 Scalar error = std::abs((ref - candidate)/ref);
67 std::cout <<
"FAILED!" << std::endl;
68 std::cerr << std::scientific << std::setprecision(16);
69 std::cerr <<
" reference = " << ref << std::endl
70 <<
" candidate = " << candidate << std::endl
71 <<
" relative error = " << error << std::endl
72 <<
" tolerance = " << tol << std::endl;
77 std::cout <<
"PASSED!" << std::endl;
83 template <
typename Scalar>
86 std::vector<std::string> molecules;
87 molecules.push_back(
"CH4");
88 molecules.push_back(
"N2");
89 molecules.push_back(
"H2");
91 const unsigned int n_species = molecules.size();
103 MacroThermo nasa_thermo( nasa_mixture );
107 MicroThermo micro_thermo(nasa_thermo, chem_mixture);
116 Antioch::build_kinetics_theory_viscosity<Scalar,Antioch::GSLSpliner>(ps_mu);
119 bimol_D( tran_mixture );
123 Scalar T_max(8000.L);
125 ps_mu.extrapolate_max_temp(T_max);
126 bimol_D.extrapolate_max_temp(T_max);
128 std::vector<std::vector<Scalar> > D_matrix_reg(n_species);
129 std::vector<std::vector<Scalar> > D_matrix(n_species);
130 for(
unsigned int s = 0; s < n_species; s++ )
132 D_matrix[s].resize(n_species);
133 D_matrix_reg[s].resize(n_species);
136 Scalar mu_CH4_reg = 1.0573148339577483e-04;
137 Scalar mu_N2_reg = 1.5770745584335467e-04;
138 Scalar mu_H2_reg = 4.6078198688681625e-05;
140 D_matrix_reg[0][0] = 8.1850066826705467e-03;
141 D_matrix_reg[0][1] = 7.7255676543780075e-03;
142 D_matrix_reg[0][2] = 4.5830263450987500e-02;
143 D_matrix_reg[1][0] = 7.7255676543780075e-03;
144 D_matrix_reg[1][1] = 7.0195276250601020e-03;
145 D_matrix_reg[1][2] = 3.1562763815500983e-03;
146 D_matrix_reg[2][0] = 4.5830263450987500e-02;
147 D_matrix_reg[2][1] = 3.1562763815500983e-03;
148 D_matrix_reg[2][2] = -4.3151204734397887e-03;
150 Scalar mu_CH4 = ps_mu(0,7900.0);
151 Scalar mu_N2 = ps_mu(1,7900.0);
152 Scalar mu_H2 = ps_mu(2,3900.0);
154 bimol_D.compute_binary_diffusion_matrix(6900.0, 1.0, D_matrix);
156 Scalar tol = 10.0*std::numeric_limits<Scalar>::epsilon();
159 return_flag = check_value( mu_CH4_reg, mu_CH4, tol,
"mu_CH4" ) ||
160 check_value( mu_N2_reg, mu_N2, tol,
"mu_N2" ) ||
161 check_value( mu_H2_reg, mu_H2, tol,
"mu_H2" );
164 for(
unsigned int s = 0; s < n_species; s++ )
166 for(
unsigned int t = s+1; t < n_species; t++ )
168 std::stringstream convert;
170 std::string test_name =
"D["+convert.str()+
"]";
173 test_name +=
"["+convert.str()+
"] symmetry";
175 return_flag = return_flag ||
176 check_value( D_matrix[s][t], D_matrix[t][s], tol, test_name );
181 for(
unsigned int s = 0; s < n_species; s++ )
183 for(
unsigned int t = 0; t < n_species; t++ )
185 std::stringstream convert;
187 std::string test_name =
"D["+convert.str()+
"]";
190 test_name +=
"["+convert.str()+
"]";
192 return_flag = return_flag ||
193 check_value( D_matrix_reg[s][t], D_matrix[s][t], tol, test_name );
202 #endif // ANTIOCH_HAVE_GSL
207 #ifdef ANTIOCH_HAVE_GSL
209 return (tester<float>() ||
Container class for species viscosities.
Container class for species binary diffusion models.
void read_nasa_mixture_data(NASAThermoMixture< NumericType, CurveType > &thermo, const std::string &filename=DefaultSourceFilename::thermo_data(), ParsingType=ASCII, bool verbose=true)
int tester(const std::string &testname)
Class storing chemical mixture properties.
static const std::string & thermo_data()
Class storing chemical mixture properties.