antioch-0.4.0
kinetics_theory_thermal_conductivity_unit.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 
27 // C++
28 #include <iostream>
29 #include <cmath>
30 
31 // Antioch
36 
37 template <typename Scalar>
38 int test_k( const Scalar k, const Scalar k_exact, const Scalar tol )
39 {
40  using std::abs;
41 
42  int return_flag = 0;
43 
44  const Scalar rel_error = abs( (k - k_exact)/k_exact);
45 
46  if( rel_error > tol )
47  {
48  std::cerr << std::setprecision(15)
49  << "Error: Mismatch in thermal conductivity" << std::endl
50  << "k = " << k << std::endl
51  << "k_exact = " << k_exact << std::endl
52  << "rel_error = " << rel_error << std::endl
53  << "tol = " << tol << std::endl;
54  return_flag = 1;
55  }
56 
57  return return_flag;
58 }
59 
60 template <typename Scalar>
61 int tester()
62 {
63  std::vector<std::string> species_str_list;
64  const unsigned int n_species = 1;
65  species_str_list.reserve(n_species);
66  species_str_list.push_back( "N2" );
67 
68  const Scalar LJ_depth_N2 = 97.53L;
69  const Scalar Z_298 = 4.0L;
70 
71  Antioch::ChemicalMixture<Scalar> chem_mixture( species_str_list );
72 
73  Antioch::StatMechThermodynamics<Scalar> thermo( chem_mixture );
74 
76 
77  const Scalar mu = 3.14e-3;
78  const Scalar dss = 5.23e-5;
79  const Scalar rho = 1.4;
80  const Scalar T = 1500.1L;
81 
82  // from bc
83  const Scalar k_N2_exact = 3.194342919259960202334421163642706718735099613817392359646;
84  int return_flag = 0;
85 
86  const Scalar tol = (std::numeric_limits<Scalar>::epsilon() * 2 < 7e-17)?7e-17:
87  std::numeric_limits<Scalar>::epsilon() * 2;
88 
89 
90  int return_flag_temp = 0;
91  return_flag_temp = test_k( k(0,mu,T,rho,dss), k_N2_exact, tol );
92  if( return_flag_temp != 0 ) return_flag = 1;
93 
94  return return_flag;
95 }
96 
97 int main()
98 {
99  return (tester<double>() ||
100  tester<long double>() ||
101  tester<float>());
102 }
Conductivity based on kinetic theory of mixtures approximations.
int test_k(const Scalar k, const Scalar k_exact, const Scalar tol)
Class storing chemical mixture properties.

Generated on Thu Jul 7 2016 11:09:46 for antioch-0.4.0 by  doxygen 1.8.8