antioch-0.4.0
Functions
eucken_thermal_cond_unit.C File Reference
#include <iostream>
#include <cmath>
#include "antioch/stat_mech_thermo.h"
#include "antioch/eucken_thermal_conductivity.h"

Go to the source code of this file.

Functions

template<typename Scalar >
int test_k (const Scalar k, const Scalar k_exact, const Scalar tol)
 
template<typename Scalar >
int tester ()
 
int main ()
 

Function Documentation

int main ( )

Definition at line 124 of file eucken_thermal_cond_unit.C.

125 {
126  return (tester<double>() ||
127 // tester<long double>() ||
128  tester<float>());
129 }
template<typename Scalar >
int test_k ( const Scalar  k,
const Scalar  k_exact,
const Scalar  tol 
)

Definition at line 41 of file eucken_thermal_cond_unit.C.

Referenced by tester().

42 {
43  using std::abs;
44 
45  int return_flag = 0;
46 
47  const Scalar rel_error = abs( (k - k_exact)/k_exact);
48 
49  if( rel_error > tol )
50  {
51  std::cerr << "Error: Mismatch in thermal conductivity" << std::endl
52  << "k = " << k << std::endl
53  << "k_exact = " << k_exact << std::endl
54  << "rel_error = " << rel_error << std::endl
55  << "tol = " << tol << std::endl;
56  return_flag = 1;
57  }
58 
59  return return_flag;
60 }
template<typename Scalar >
int tester ( )

Definition at line 63 of file eucken_thermal_cond_unit.C.

References test_k(), and Antioch::EuckenThermalConductivity< ThermoEvaluator >::trans().

64 {
65  std::vector<std::string> species_str_list;
66  const unsigned int n_species = 5;
67  species_str_list.reserve(n_species);
68  species_str_list.push_back( "N2" );
69  species_str_list.push_back( "O2" );
70  species_str_list.push_back( "N" );
71  species_str_list.push_back( "O" );
72  species_str_list.push_back( "NO" );
73 
74  const Scalar Mm_N = 14.008e-3L;
75  const Scalar Mm_O = 16.000e-3L;
76  const Scalar Mm_N2 = 2.L * Mm_N;
77  const Scalar Mm_O2 = 2.L * Mm_O;
78  const Scalar Mm_NO = Mm_N + Mm_O;
79 
80  Antioch::ChemicalMixture<Scalar> chem_mixture( species_str_list );
81 
82  const Scalar R_N2 = Antioch::Constants::R_universal<Scalar>()/Mm_N2;
83  const Scalar R_O2 = Antioch::Constants::R_universal<Scalar>()/Mm_O2;
84  const Scalar R_N = Antioch::Constants::R_universal<Scalar>()/Mm_N;
85  const Scalar R_O = Antioch::Constants::R_universal<Scalar>()/Mm_O;
86  const Scalar R_NO = Antioch::Constants::R_universal<Scalar>()/Mm_NO;
87 
88  Antioch::StatMechThermodynamics<Scalar> thermo( chem_mixture );
89 
91 
92  const Scalar mu = 3.14e-3;
93 
94  // octave gives
95  const Scalar k_N2_trans_exact = 2.5*mu*1.5*R_N2;
96  const Scalar k_N_trans_exact = 2.5*mu*1.5*R_N;
97  const Scalar k_O2_trans_exact = 2.5*mu*1.5*R_O2;
98  const Scalar k_O_trans_exact = 2.5*mu*1.5*R_O;
99  const Scalar k_NO_trans_exact = 2.5*mu*1.5*R_NO;
100 
101  int return_flag = 0;
102 
103  const Scalar tol = std::numeric_limits<Scalar>::epsilon() * 2;
104 
105  int return_flag_temp = 0;
106  return_flag_temp = test_k( k.trans(0, mu), k_N2_trans_exact, tol );
107  if( return_flag_temp != 0 ) return_flag = 1;
108 
109  return_flag_temp = test_k( k.trans(1, mu), k_O2_trans_exact, tol );
110  if( return_flag_temp != 0 ) return_flag = 1;
111 
112  return_flag_temp = test_k( k.trans(2, mu), k_N_trans_exact, tol );
113  if( return_flag_temp != 0 ) return_flag = 1;
114 
115  return_flag_temp = test_k( k.trans(3, mu), k_O_trans_exact, tol );
116  if( return_flag_temp != 0 ) return_flag = 1;
117 
118  return_flag_temp = test_k( k.trans(4, mu), k_NO_trans_exact, tol );
119  if( return_flag_temp != 0 ) return_flag = 1;
120 
121  return return_flag;
122 }
int test_k(const Scalar k, const Scalar k_exact, const Scalar tol)
Species conductivity based on Eucken relation.
Class storing chemical mixture properties.

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