27 #include "antioch_config.h"
41 #ifdef ANTIOCH_HAVE_GSL
43 template <
typename Scalar>
44 int test_diff(
const Scalar dij,
const Scalar dij_exact,
const Scalar tol,
const std::string & words )
50 const double rel_error = abs( (dij - dij_exact)/dij_exact);
54 std::cerr << std::setprecision(15) << std::scientific;
55 std::cerr <<
"Error: Mismatch in bimolecular coefficient of " << words << std::endl
56 <<
"Dij(T) = " << dij << std::endl
57 <<
"Dij_exact = " << dij_exact << std::endl
58 <<
"rel_error = " << rel_error << std::endl
59 <<
"tol = " << tol << std::endl;
66 template <
typename Scalar>
77 const Scalar N2_LJ_eps(97.530L);
78 const Scalar N2_LJ_depth(3.621L);
79 const Scalar N2_dipole(0.L);
80 const Scalar N2_polar(1.760L);
81 const Scalar N2_Zrot(4.L);
82 const Scalar N2_mass(28.016e-3L);
84 const Scalar CH4_LJ_eps(141.400L);
85 const Scalar CH4_LJ_depth(3.746L);
86 const Scalar CH4_dipole(0.L);
87 const Scalar CH4_polar(2.6L);
88 const Scalar CH4_Zrot(13.L);
89 const Scalar CH4_mass(16.043e-3L);
91 const Scalar H2O_LJ_eps(572.4L);
92 const Scalar H2O_LJ_depth(2.605L);
93 const Scalar H2O_dipole(1.844L);
94 const Scalar H2O_polar(0.L);
95 const Scalar H2O_Zrot(4.L);
96 const Scalar H2O_mass(18.016e-3L);
98 CH4(1,CH4_LJ_eps,CH4_LJ_depth,CH4_dipole,CH4_polar,CH4_Zrot,CH4_mass),
99 H2O(2,H2O_LJ_eps,H2O_LJ_depth,H2O_dipole,H2O_polar,H2O_Zrot,H2O_mass);
102 Antioch::MolecularBinaryDiffusion<Scalar,Antioch::GSLSpliner>
103 D00(N2,N2), D01(N2,CH4), D02(N2,H2O),
104 D10(CH4,N2), D11(CH4,CH4), D12(CH4,H2O),
105 D20(H2O,N2), D21(H2O,CH4), D22(H2O,H2O);
107 const Scalar T = 1500.1;
108 const Scalar cTot = 5e-7;
111 const Scalar D00_exact_times_interp = 3.575629059282712203350417538824313603e3;
112 const Scalar D11_exact_times_interp = 4.415035849326582722446637772820322872e3;
113 const Scalar D22_exact_times_interp = 8.615250909281137767894964155009068175e3;
114 const Scalar D10_exact_times_interp = 4.048999169845892614961423528844221310e3;
115 const Scalar D20_exact_times_interp = 5.468107000169991297723144486054211050e3;
116 const Scalar D12_exact_times_interp = 5.973341001459783642751059656941311432e3;
120 const Scalar tol = (std::numeric_limits<Scalar>::epsilon() * 10. < 2e-16)?2e-16:
121 std::numeric_limits<Scalar>::epsilon() * 10.;
124 std::cout <<
"*** Testing symetry ...";
126 return_flag = test_diff( D10(T,cTot) , D01(T,cTot), tol,
"N2 - CH4 symetry" ) || return_flag;
127 return_flag = test_diff( D12(T,cTot) , D21(T,cTot), tol,
"CH4 - H2O symetry" ) || return_flag;
128 return_flag = test_diff( D20(T,cTot) , D02(T,cTot), tol,
"H2O - N2 symetry" ) || return_flag;
130 (return_flag)?std::cout <<
" ...failed\n":std::cout <<
" ...passed\n";
131 std::cout <<
"*****************************\n" << std::endl;
134 return_flag = test_diff( D00(T,cTot) * D00.Stockmayer(T), D00_exact_times_interp, tol,
"N2 - N2" ) || return_flag;
135 return_flag = test_diff( D11(T,cTot) * D11.Stockmayer(T), D11_exact_times_interp, tol,
"CH4 - CH4" ) || return_flag;
136 return_flag = test_diff( D22(T,cTot) * D22.Stockmayer(T), D22_exact_times_interp, tol,
"H2O - H2O" ) || return_flag;
137 return_flag = test_diff( D10(T,cTot) * D10.Stockmayer(T), D10_exact_times_interp, tol,
"N2 - CH4" ) || return_flag;
138 return_flag = test_diff( D12(T,cTot) * D12.Stockmayer(T), D12_exact_times_interp, tol,
"CH4 - H2O" ) || return_flag;
139 return_flag = test_diff( D20(T,cTot) * D20.Stockmayer(T), D20_exact_times_interp, tol,
"N2 - H2O" ) || return_flag;
143 #endif // ANTIOCH_HAVE_GSL
148 #ifdef ANTIOCH_HAVE_GSL
149 return tester<double>() ||
150 tester<long double>() ||
Class to encapsulate data relevant for transport for each chemical species.
int tester(const std::string &testname)