GRINS-0.7.0
Functions
cantera_transport_regression.C File Reference
#include <iomanip>
#include "grins_config.h"
#include "grins/cantera_mixture.h"
#include "grins/cantera_transport.h"
#include "grins/cached_values.h"
#include "grins/materials_parsing.h"
#include "grins/physics_naming.h"
#include "libmesh/getpot.h"
Include dependency graph for cantera_transport_regression.C:

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 41 of file cantera_transport_regression.C.

References GRINS::CachedValues::add_quantity(), GRINS::Cache::MASS_FRACTIONS, GRINS::CanteraTransport::mu_and_k_and_D(), GRINS::CanteraMixture::R_mix(), GRINS::CachedValues::set_values(), GRINS::CachedValues::set_vector_values(), GRINS::Cache::TEMPERATURE, and GRINS::Cache::THERMO_PRESSURE.

42 {
43  // Check command line count.
44  if( argc < 2 )
45  {
46  // TODO: Need more consistent error handling.
47  std::cerr << "Error: Must specify input file." << std::endl;
48  exit(1); // TODO: something more sophisticated for parallel runs?
49  }
50 
51  GetPot input( argv[1] );
52 
53  std::vector<std::string> species(5);
54  species[0] = input( "Materials/TestMaterial/GasMixture/species", "DIE!", 0 );
55  species[1] = input( "Materials/TestMaterial/GasMixture/species", "DIE!", 1 );
56  species[2] = input( "Materials/TestMaterial/GasMixture/species", "DIE!", 2 );
57  species[3] = input( "Materials/TestMaterial/GasMixture/species", "DIE!", 3 );
58  species[4] = input( "Materials/TestMaterial/GasMixture/species", "DIE!", 4 );
59 
60  GRINS::CanteraMixture cantera_mixture(input,"TestMaterial");
61 
62  GRINS::CanteraTransport cantera_trans(cantera_mixture);
63 
64  double T = 1000.0;
65 
66  double P = 100000.0;
67 
68  std::vector<double> Y(5,0.2);
69 
70  double rho = P/T/cantera_mixture.R_mix(Y);
71 
72  GRINS::CachedValues cache;
73 
77 
78  std::vector<double> Tqp(1,T);
79  std::vector<double> Pqp(1,P);
80  std::vector<std::vector<double> > Yqp(1,Y);
81 
85 
86  double mu, k;
87  std::vector<libMesh::Real> D(5,0.0);
88 
89  double dummy = 0.0;
90 
91  cantera_trans.mu_and_k_and_D( T, rho, dummy, Y, mu, k, D );
92 
93  int return_flag = 0;
94 
95  const double tol = 6.0e-15;
96 
97  const double mu_reg = 4.2134235819759682e-05;
98  const double k_reg = 5.7138665373733508e-02;
99  std::vector<libMesh::Real> D_reg(5,0.0);
100  D_reg[0] = 1.7611544183904180e-04;
101  D_reg[1] = 1.7169898621123060e-04;
102  D_reg[2] = 1.7379080956310527e-04;
103  D_reg[3] = 2.6991049091576078e-04;
104  D_reg[4] = 2.6488528311729070e-04;
105 
106  if( std::fabs( (mu_reg - mu)/mu ) > tol )
107  {
108  std::cerr << "Error: Mismatch in viscosity." << std::endl
109  << std::setprecision(16) << std::scientific
110  << "mu = " << mu << std::endl
111  << "mu_reg = " << mu_reg << std::endl;
112  return_flag = 1;
113  }
114 
115  if( std::fabs( (k_reg - k)/k ) > tol )
116  {
117  std::cerr << "Error: Mismatch in thermal conductivity." << std::endl
118  << std::setprecision(16) << std::scientific
119  << "k = " << k << std::endl
120  << "k_reg = " << k_reg << std::endl;
121  return_flag = 1;
122  }
123 
124  for( unsigned int i = 0; i < 5; i++ )
125  {
126  if( std::fabs( (D_reg[i] - D[i])/D[i] ) > tol )
127  {
128  std::cerr << "Error: Mismatch in diffusion coefficient." << std::endl
129  << std::setprecision(16) << std::scientific
130  << "i = " << i << std::endl
131  << "D = " << D[i] << std::endl
132  << "D_reg = " << D_reg[i] << std::endl;
133  return_flag = 1;
134  }
135  }
136  /*
137  std::cout << std::setprecision(16) << std::scientific
138  << "mu = " << mu << std::endl
139  << "k = " << k << std::endl;
140  for( unsigned int i = 0; i < 5; i++ )
141  {
142  std::cout << std::setprecision(16) << std::scientific
143  << "D[" << i << "] = " << D[i]
144  << std::endl;
145  }
146  */
147 
148  return return_flag;
149 }
void set_values(unsigned int quantity, std::vector< libMesh::Number > &values)
Definition: cached_values.C:72
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
void add_quantity(unsigned int quantity)
Definition: cached_values.C:40
Wrapper class for evaluating transport properties using Cantera.
void set_vector_values(unsigned int quantity, std::vector< std::vector< libMesh::Number > > &values)
Definition: cached_values.C:93

Generated on Thu Jun 2 2016 21:52:29 for GRINS-0.7.0 by  doxygen 1.8.10