GRINS-0.6.0
Functions
antioch_wilke_evaluator_regression.C File Reference
#include "grins_config.h"
#include <iomanip>
#include <limits>
#include <vector>
#include "grins/antioch_wilke_transport_mixture.h"
#include "grins/antioch_wilke_transport_evaluator.h"
#include "grins/cached_values.h"
#include "libmesh/getpot.h"
Include dependency graph for antioch_wilke_evaluator_regression.C:

Go to the source code of this file.

Functions

int test_generic (const libMesh::Real value, const libMesh::Real value_reg, const std::string &name)
 
template<typename Viscosity >
int test_mu (const libMesh::Real mu)
 
template<typename Thermo , typename Conductivity >
int test_k (const libMesh::Real k)
 
template<typename Thermo , typename Viscosity , typename Conductivity , typename Diffusivity >
int test_D (const std::vector< libMesh::Real > &D)
 
template<>
int test_mu< Antioch::MixtureViscosity< Antioch::BlottnerViscosity< libMesh::Real > > > (const libMesh::Real mu)
 
template<typename Thermo , typename Viscosity , typename Conductivity , typename Diffusivity >
int test_evaluator (const GetPot &input)
 
int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 191 of file antioch_wilke_evaluator_regression.C.

192 {
193  // Check command line count.
194  if( argc < 2 )
195  {
196  // TODO: Need more consistent error handling.
197  std::cerr << "Error: Must specify input file." << std::endl;
198  exit(1);
199  }
200 
201  GetPot input( argv[1] );
202 
203  int return_flag = 0;
204 
205  std::cout << std::endl << "Running StatMesh, Blottner, Eucken, Constant Lewis regression test." << std::endl;
206  return_flag = test_evaluator<Antioch::StatMechThermodynamics<libMesh::Real>,
207  Antioch::MixtureViscosity<Antioch::BlottnerViscosity<libMesh::Real> >,
208  Antioch::EuckenThermalConductivity<Antioch::StatMechThermodynamics<libMesh::Real> >,
209  Antioch::ConstantLewisDiffusivity<libMesh::Real> >(input);
210 
211  return return_flag;
212 }
template<typename Thermo , typename Viscosity , typename Conductivity , typename Diffusivity >
int test_D ( const std::vector< libMesh::Real > &  D)
template<typename Thermo , typename Viscosity , typename Conductivity , typename Diffusivity >
int test_evaluator ( const GetPot &  input)

Definition at line 115 of file antioch_wilke_evaluator_regression.C.

References GRINS::CachedValues::add_quantity(), GRINS::AntiochWilkeTransportEvaluator< Thermo, Viscosity, Conductivity, Diffusivity >::D(), GRINS::AntiochWilkeTransportEvaluator< Thermo, Viscosity, Conductivity, Diffusivity >::k(), GRINS::Cache::MASS_FRACTIONS, GRINS::Cache::MIXTURE_DENSITY, GRINS::AntiochWilkeTransportEvaluator< Thermo, Viscosity, Conductivity, Diffusivity >::mu(), GRINS::AntiochWilkeTransportEvaluator< Thermo, Viscosity, Conductivity, Diffusivity >::mu_and_k(), GRINS::CachedValues::set_values(), GRINS::CachedValues::set_vector_values(), GRINS::AntiochChemistry::species_name(), and GRINS::Cache::TEMPERATURE.

116 {
118 
120 
121  const libMesh::Real T = 1000;
122 
123  const libMesh::Real rho = 1.0e-3;
124 
125  const unsigned int n_species = 5;
126 
127  std::vector<libMesh::Real> Y(n_species,0.2);
128 
129  GRINS::CachedValues cache;
130 
132  std::vector<double> Tqp(1,T);
134 
136  std::vector<double> rhoqp(1,rho);
138 
140  std::vector<std::vector<double> > Yqp(1,Y);
142 
143  libMesh::Real mu = evaluator.mu( cache, 0 );
144 
145  libMesh::Real k = evaluator.k( cache, 0 );
146 
147  libMesh::Real mu2 = 0.0;
148  libMesh::Real k2 = 0.0;
149 
150  evaluator.mu_and_k( cache, 0, mu2, k2 );
151 
152  std::vector<libMesh::Real> D(n_species,0.0);
153 
154  evaluator.D( cache, 0, D );
155 
156  std::cout << std::scientific << std::setprecision(16)
157  << "mu = " << mu << std::endl;
158 
159  std::cout << std::scientific << std::setprecision(16)
160  << "k = " << k << std::endl;
161 
162  for( unsigned int i = 0; i < n_species; i++ )
163  {
164  std::cout << std::scientific << std::setprecision(16)
165  << "D(" << mixture.species_name(i) << ") = " << D [i] << std::endl;
166  }
167 
168  int return_flag = 0;
169 
170  int return_flag_temp = 0;
171 
172  return_flag_temp = test_mu<Viscosity>( mu );
173  if( return_flag_temp != 0 ) return_flag = 1;
174 
175  return_flag_temp = test_k<Thermo,Conductivity>( k );
176  if( return_flag_temp != 0 ) return_flag = 1;
177 
178  return_flag_temp = test_mu<Viscosity>( mu2 );
179  if( return_flag_temp != 0 ) return_flag = 1;
180 
181  return_flag_temp = test_k<Thermo,Conductivity>( k2 );
182  if( return_flag_temp != 0 ) return_flag = 1;
183 
184  return_flag_temp = test_D<Thermo,Viscosity,Conductivity,Diffusivity>( D );
185  if( return_flag_temp != 0 ) return_flag = 1;
186 
187  return return_flag;
188 }
void set_values(unsigned int quantity, std::vector< libMesh::Number > &values)
Definition: cached_values.C:72
void add_quantity(unsigned int quantity)
Definition: cached_values.C:40
void set_vector_values(unsigned int quantity, std::vector< std::vector< libMesh::Number > > &values)
Definition: cached_values.C:93
Wrapper class for storing state for computing Wilke transport properties using Antioch.
Wrapper class for evaluating Wilke transport properties using Antioch.
int test_generic ( const libMesh::Real  value,
const libMesh::Real  value_reg,
const std::string &  name 
)

Definition at line 43 of file antioch_wilke_evaluator_regression.C.

Referenced by test_mu< Antioch::MixtureViscosity< Antioch::BlottnerViscosity< libMesh::Real > > >().

44 {
45  int return_flag = 0;
46 
47  const double tol = std::numeric_limits<double>::epsilon()*10;
48 
49  const double rel_error = std::fabs( (value - value_reg)/value_reg );
50 
51  if( rel_error > tol )
52  {
53  return_flag = 1;
54  std::cout << "Mismatch in "+name << std::endl
55  << name+" = " << value << std::endl
56  << name+"_reg = " << value_reg << std::endl
57  << "rel_error = " << rel_error << std::endl;
58  }
59 
60  return return_flag;
61 }
template<typename Thermo , typename Conductivity >
int test_k ( const libMesh::Real  k)
template<typename Viscosity >
int test_mu ( const libMesh::Real  mu)
template<>
int test_mu< Antioch::MixtureViscosity< Antioch::BlottnerViscosity< libMesh::Real > > > ( const libMesh::Real  mu)

Definition at line 74 of file antioch_wilke_evaluator_regression.C.

References test_generic().

75 {
76  double mu_reg = 4.5123309407810213e-05;
77 
78  return test_generic(mu,mu_reg,"mu");
79 }
int test_generic(const libMesh::Real value, const libMesh::Real value_reg, const std::string &name)

Generated on Mon Jun 22 2015 21:32:21 for GRINS-0.6.0 by  doxygen 1.8.9.1