antioch-0.4.0
Functions
mixture_viscosity_unit.C File Reference
#include <iostream>
#include <cmath>
#include "antioch_config.h"
#include "antioch/default_filename.h"
#include "antioch/vector_utils_decl.h"
#include "antioch/sutherland_viscosity.h"
#include "antioch/blottner_viscosity.h"
#include "antioch/kinetics_theory_viscosity.h"
#include "antioch/gsl_spliner.h"
#include "antioch/vector_utils.h"
#include "antioch/mixture_viscosity.h"
#include "antioch/blottner_parsing.h"
#include "antioch/sutherland_parsing.h"
#include "antioch/kinetics_theory_viscosity_building.h"

Go to the source code of this file.

Functions

template<typename Scalar >
int test_values (Scalar test_value, Scalar exact_value, Scalar tol)
 
template<typename Scalar >
int tester ()
 
int main ()
 

Function Documentation

int main ( )

Definition at line 160 of file mixture_viscosity_unit.C.

161 {
162  return (tester<double>() ||
163  tester<long double>() ||
164  tester<float>());
165 }
template<typename Scalar >
int test_values ( Scalar  test_value,
Scalar  exact_value,
Scalar  tol 
)

Definition at line 52 of file mixture_viscosity_unit.C.

Referenced by tester().

53 {
54  int return_flag = 0;
55  Scalar error = std::abs(test_value - exact_value);
56 
57  if( error > tol )
58  {
59  std::cout << std::setprecision(16) << std::scientific;
60 
61  std::cout << "ERROR: Value exceeds tolerance!" << std::endl
62  << "test_value = " << test_value << std::endl
63  << "exact_value = " << exact_value << std::endl
64  << "error = " << error << std::endl
65  << "tol = " << tol << std::endl;
66 
67  return_flag = 1;
68  }
69 
70  return return_flag;
71 }
template<typename Scalar >
int tester ( )

Definition at line 74 of file mixture_viscosity_unit.C.

References Antioch::DefaultSourceFilename::blottner_data(), Antioch::ChemicalMixture< CoeffType >::M(), Antioch::DefaultSourceFilename::sutherland_data(), and test_values().

75 {
76  std::vector<std::string> species_str_list;
77  const unsigned int n_species = 2;
78  species_str_list.reserve(n_species);
79  species_str_list.push_back( "N2" );
80  species_str_list.push_back( "O2" );
81 
82  Antioch::ChemicalMixture<Scalar> chem_mixture( species_str_list );
83 
84  Antioch::TransportMixture<Scalar> tran_mixture( chem_mixture );
85 
86  Antioch::SutherlandViscosity<Scalar> s_N2(1.399306e-06, 1.066667e+02);
87  Antioch::SutherlandViscosity<Scalar> s_O2(1.693411e-06, 1.270000e+02);
88 
89  Antioch::BlottnerViscosity<Scalar> b_N2(2.68142000000e-02, 3.17783800000e-01, -1.13155513000e+01);
90  Antioch::BlottnerViscosity<Scalar> b_O2(4.49290000000e-02, -8.26158000000e-02, -9.20194750000e+00);
91 
92 #ifdef ANTIOCH_HAVE_GSL
93  Antioch::KineticsTheoryViscosity<Scalar, Antioch::GSLSpliner> k_N2(97.530, 3.621, 0.0, chem_mixture.M(0)/Antioch::Constants::Avogadro<Scalar>());
94  Antioch::KineticsTheoryViscosity<Scalar, Antioch::GSLSpliner> k_O2(107.400, 3.458, 0.0, chem_mixture.M(1)/Antioch::Constants::Avogadro<Scalar>() );
95 #endif // ANTIOCH_HAVE_GSL
96 
98  s_mu_mixture(tran_mixture);
99 
101  b_mu_mixture(tran_mixture);
102 
103 #ifdef ANTIOCH_HAVE_GSL
105  k_mu_mixture(tran_mixture);
106 #endif // ANTIOCH_HAVE_GSL
107 
108  Antioch::read_sutherland_data_ascii<Scalar>( s_mu_mixture, Antioch::DefaultFilename::sutherland_data() );
109  Antioch::read_blottner_data_ascii<Scalar>( b_mu_mixture, Antioch::DefaultFilename::blottner_data() );
110 
111 #ifdef ANTIOCH_HAVE_GSL
112  Antioch::build_kinetics_theory_viscosity<Scalar>(k_mu_mixture);
113 #endif // ANTIOCH_HAVE_GSL
114 
115  std::cout << s_mu_mixture << std::endl;
116  std::cout << b_mu_mixture << std::endl;
117 
118 #ifdef ANTIOCH_HAVE_GSL
119  std::cout << k_mu_mixture << std::endl;
120 #endif // ANTIOCH_HAVE_GSL
121 
122  const Scalar T = 1500.1;
123 
124  std::cout << "Sutherland:" << std::endl;
125  for( unsigned int s = 0; s < n_species; s++ )
126  {
127  std::cout << "mu(" << species_str_list[s] << ") = " << s_mu_mixture(s, T) << std::endl;
128  }
129 
130  std::cout << "Blottner:" << std::endl;
131  for( unsigned int s = 0; s < n_species; s++ )
132  {
133  std::cout << "mu(" << species_str_list[s] << ") = " << b_mu_mixture(s, T) << std::endl;
134  }
135 
136 #ifdef ANTIOCH_HAVE_GSL
137  std::cout << "Kinetic Theory:" << std::endl;
138  for( unsigned int s = 0; s < n_species; s++ )
139  {
140  std::cout << "mu(" << species_str_list[s] << ") = " << k_mu_mixture(s, T) << std::endl;
141  }
142 #endif // ANTIOCH_HAVE_GSL
143 
144  int return_flag = 0;
145 
146  Scalar tol = 2.0*std::numeric_limits<Scalar>::epsilon();
147  return_flag = test_values( s_mu_mixture(0, T), s_N2(T), tol ) ||
148  test_values( s_mu_mixture(1, T), s_O2(T), tol ) ||
149  test_values( b_mu_mixture(0, T), b_N2(T), tol ) ||
150  test_values( b_mu_mixture(1, T), b_O2(T), tol );
151 
152 #ifdef ANTIOCH_HAVE_GSL
153  return_flag = test_values( k_mu_mixture(0, T), k_N2(T), tol ) ||
154  test_values( k_mu_mixture(1, T), k_O2(T), tol );
155 #endif // ANTIOCH_HAVE_GSL
156 
157  return return_flag;
158 }
Container class for species viscosities.
int test_values(Scalar test_value, Scalar exact_value, Scalar tol)
Class storing chemical mixture properties.
Definition: ascii_parser.h:55
static const std::string & sutherland_data()
static const std::string & blottner_data()
Class storing chemical mixture properties.

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