antioch-0.4.0
Functions
mixture_conductivity_regression.C File Reference
#include "antioch_config.h"
#include "antioch/default_filename.h"
#include "antioch/vector_utils_decl.h"
#include "antioch/eucken_thermal_conductivity.h"
#include "antioch/eucken_thermal_conductivity_building.h"
#include "antioch/mixture_conductivity.h"
#include "antioch/sutherland_viscosity.h"
#include "antioch/blottner_viscosity.h"
#include "antioch/kinetics_theory_viscosity.h"
#include "antioch/mixture_viscosity.h"
#include "antioch/vector_utils.h"
#include "antioch/blottner_parsing.h"
#include "antioch/sutherland_parsing.h"
#include "antioch/kinetics_theory_viscosity_building.h"
#include "antioch/stat_mech_thermo.h"

Go to the source code of this file.

Functions

template<typename Scalar >
bool test_val (Scalar value, Scalar gold, Scalar tol, std::string test)
 
template<typename Scalar >
int tester ()
 
int main ()
 

Function Documentation

int main ( )

Definition at line 185 of file mixture_conductivity_regression.C.

186 {
187  return (tester<double>() ||
188  tester<long double>() ||
189  tester<float>());
190 }
template<typename Scalar >
bool test_val ( Scalar  value,
Scalar  gold,
Scalar  tol,
std::string  test 
)

Definition at line 51 of file mixture_conductivity_regression.C.

52 {
53  bool test_passed = true;
54 
55  Scalar error = std::abs( value - gold );
56  if( error > tol )
57  {
58  test_passed = false;
59  std::cerr << "Test "+test+" failed!" << std::endl
60  << "value = " << value << std::endl
61  << "gold = " << gold << std::endl
62  << "error = " << error << std::endl
63  << "tol = " << tol << std::endl;
64  }
65 
66  return test_passed;
67 }
template<typename Scalar >
int tester ( )

Definition at line 70 of file mixture_conductivity_regression.C.

References Antioch::DefaultSourceFilename::blottner_data(), and Antioch::DefaultSourceFilename::sutherland_data().

71 {
72  std::vector<std::string> species_str_list;
73 
74  // Test hard coded to 1 species right now. If we ever
75  // add more here, be aware that the regression test on
76  // the values is targeted at the N2 values, so if you
77  // change the species order, update the N2_species index
78  // accordingly.
79  const unsigned int n_species = 1;
80  species_str_list.reserve(n_species);
81  species_str_list.push_back( "N2" );
82  unsigned int N2_species = 0;
83 
84  Antioch::ChemicalMixture<Scalar> chem_mixture( species_str_list );
85 
86  typedef Antioch::StatMechThermodynamics<Scalar> MicroThermo;
87  MicroThermo thermo_stat( chem_mixture );
88 
89  Antioch::TransportMixture<Scalar> tran_mixture( chem_mixture );
90 
92  e_k_mixture(tran_mixture);
93 
94  Antioch::build_eucken_thermal_conductivity<MicroThermo,Scalar>(e_k_mixture, thermo_stat);
95 
97  s_mu_mixture(tran_mixture);
98 
100  b_mu_mixture(tran_mixture);
101 
102 #ifdef ANTIOCH_HAVE_GSL
104  k_mu_mixture(tran_mixture);
105 #endif // ANTIOCH_HAVE_GSL
106 
107  Antioch::read_sutherland_data_ascii<Scalar>( s_mu_mixture, Antioch::DefaultFilename::sutherland_data() );
108  Antioch::read_blottner_data_ascii<Scalar>( b_mu_mixture, Antioch::DefaultFilename::blottner_data() );
109 
110 #ifdef ANTIOCH_HAVE_GSL
111  Antioch::build_kinetics_theory_viscosity<Scalar>(k_mu_mixture);
112 #endif // ANTIOCH_HAVE_GSL
113 
114  const Scalar T = 1500.1;
115 
116  // Gold values were generated with long double version of test
117  // Eucken, Sutherland gold
118  Scalar k_e_s_N2_gold = 8.1294319021704618392660e-02L;
119  Scalar k_e_s_N2_value = 0.0; // init
120 
121  // Eucken, Blottner gold
122  Scalar k_e_b_N2_gold = 8.3906393746814049491975e-02L;
123  Scalar k_e_b_N2_value = 0.0; // init
124 
125  // Eucken KineticsTheory gold
126 #ifdef ANTIOCH_HAVE_GSL
127  Scalar k_e_kt_N2_gold = 8.6774379182691310526782e-02L;
128  Scalar k_e_kt_N2_value = 0.0; // init
129 #endif // ANTIOCH_HAVE_GSL
130 
131  std::cout << "Eucken (with SutherlandViscosity):" << std::endl;
132  for( unsigned int s = 0; s < n_species; s++ )
133  {
134  Scalar mu = s_mu_mixture(s,T);
135  Scalar value = e_k_mixture.conductivity_without_diffusion(s, T, mu);
136  if( s == N2_species )
137  k_e_s_N2_value = value;
138 
139  std::cout << "k(" << species_str_list[s] << ") = " << value << std::endl;
140  }
141 
142  std::cout << "Eucken (with BlottnerViscosity):" << std::endl;
143  for( unsigned int s = 0; s < n_species; s++ )
144  {
145  Scalar mu = b_mu_mixture(s,T);
146  Scalar value = e_k_mixture.conductivity_without_diffusion(s, T, mu);
147  if( s == N2_species )
148  k_e_b_N2_value = value;
149 
150  std::cout << "k(" << species_str_list[s] << ") = " << value << std::endl;
151  }
152 
153 #ifdef ANTIOCH_HAVE_GSL
154  std::cout << "Eucken (with KineticsTheoryViscosity):" << std::endl;
155  for( unsigned int s = 0; s < n_species; s++ )
156  {
157  Scalar mu = k_mu_mixture(s,T);
158  Scalar value = e_k_mixture.conductivity_without_diffusion(s, T, mu);
159  if( s == N2_species )
160  k_e_kt_N2_value = value;
161 
162  std::cout << "k(" << species_str_list[s] << ") = " << value << std::endl;
163  }
164 #endif // ANTIOCH_HAVE_GSL
165 
166  int return_flag = 0;
167 
168  // Now test all the values
169  Scalar tol = std::numeric_limits<Scalar>::epsilon();
170 
171  if( !test_val<Scalar>(k_e_s_N2_value, k_e_s_N2_gold, tol, "Eucken-Sutherland") )
172  return_flag = 1;
173 
174  if( !test_val<Scalar>(k_e_b_N2_value, k_e_b_N2_gold, tol, "Eucken-Blottner") )
175  return_flag = 1;
176 
177 #ifdef ANTIOCH_HAVE_GSL
178  if( !test_val<Scalar>(k_e_kt_N2_value, k_e_kt_N2_gold, tol, "Eucken-KineticsTheory") )
179  return_flag = 1;
180 #endif // ANTIOCH_HAVE_GSL
181 
182  return return_flag;
183 }
Container class for species viscosities.
Class storing chemical mixture properties.
Definition: ascii_parser.h:55
static const std::string & sutherland_data()
static const std::string & blottner_data()
Container class for species thermal conductivities.
Class storing chemical mixture properties.

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