GRINS-0.6.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 "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 39 of file cantera_transport_regression.C.

References GRINS::CachedValues::add_quantity(), GRINS::CanteraTransport::D(), GRINS::CanteraTransport::k(), GRINS::Cache::MASS_FRACTIONS, GRINS::CanteraTransport::mu(), GRINS::CachedValues::set_values(), GRINS::CachedValues::set_vector_values(), GRINS::Cache::TEMPERATURE, and GRINS::Cache::THERMO_PRESSURE.

40 {
41  // Check command line count.
42  if( argc < 2 )
43  {
44  // TODO: Need more consistent error handling.
45  std::cerr << "Error: Must specify input file." << std::endl;
46  exit(1); // TODO: something more sophisticated for parallel runs?
47  }
48 
49  GetPot input( argv[1] );
50 
51  std::vector<std::string> species(5);
52  species[0] = input( "Physics/Chemistry/species", "DIE!", 0 );
53  species[1] = input( "Physics/Chemistry/species", "DIE!", 1 );
54  species[2] = input( "Physics/Chemistry/species", "DIE!", 2 );
55  species[3] = input( "Physics/Chemistry/species", "DIE!", 3 );
56  species[4] = input( "Physics/Chemistry/species", "DIE!", 4 );
57 
58  GRINS::CanteraMixture cantera_mixture(input);
59 
60  GRINS::CanteraTransport cantera_trans(cantera_mixture);
61 
62  double T = 1000.0;
63 
64  double P = 100000.0;
65 
66  std::vector<double> Y(5,0.2);
67 
68  GRINS::CachedValues cache;
69 
73 
74  std::vector<double> Tqp(1,T);
75  std::vector<double> Pqp(1,P);
76  std::vector<std::vector<double> > Yqp(1,Y);
77 
81 
82  const double mu = cantera_trans.mu(cache,0);
83  const double k = cantera_trans.k(cache,0);
84 
85  std::vector<libMesh::Real> D(5,0.0);
86 
87  cantera_trans.D(cache, 0, D);
88 
89  int return_flag = 0;
90 
91  const double tol = 6.0e-15;
92 
93  const double mu_reg = 4.2134235819759682e-05;
94  const double k_reg = 5.7138665373733508e-02;
95  std::vector<libMesh::Real> D_reg(5,0.0);
96  D_reg[0] = 1.7611544183904180e-04;
97  D_reg[1] = 1.7169898621123060e-04;
98  D_reg[2] = 1.7379080956310527e-04;
99  D_reg[3] = 2.6991049091576078e-04;
100  D_reg[4] = 2.6488528311729070e-04;
101 
102  if( std::fabs( (mu_reg - mu)/mu ) > tol )
103  {
104  std::cerr << "Error: Mismatch in viscosity." << std::endl
105  << std::setprecision(16) << std::scientific
106  << "mu = " << mu << std::endl
107  << "mu_reg = " << mu_reg << std::endl;
108  return_flag = 1;
109  }
110 
111  if( std::fabs( (k_reg - k)/k ) > tol )
112  {
113  std::cerr << "Error: Mismatch in thermal conductivity." << std::endl
114  << std::setprecision(16) << std::scientific
115  << "k = " << k << std::endl
116  << "k_reg = " << k_reg << std::endl;
117  return_flag = 1;
118  }
119 
120  for( unsigned int i = 0; i < 5; i++ )
121  {
122  if( std::fabs( (D_reg[i] - D[i])/D[i] ) > tol )
123  {
124  std::cerr << "Error: Mismatch in diffusion coefficient." << std::endl
125  << std::setprecision(16) << std::scientific
126  << "i = " << i << std::endl
127  << "D = " << D[i] << std::endl
128  << "D_reg = " << D_reg[i] << std::endl;
129  return_flag = 1;
130  }
131  }
132  /*
133  std::cout << std::setprecision(16) << std::scientific
134  << "mu = " << mu << std::endl
135  << "k = " << k << std::endl;
136  for( unsigned int i = 0; i < 5; i++ )
137  {
138  std::cout << std::setprecision(16) << std::scientific
139  << "D[" << i << "] = " << D[i]
140  << std::endl;
141  }
142  */
143 
144  return return_flag;
145 }
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 Mon Jun 22 2015 21:32:21 for GRINS-0.6.0 by  doxygen 1.8.9.1