GRINS-0.6.0
Functions
antioch_thermo_tables.C File Reference
#include "grins_config.h"
#include <iostream>
#include <vector>
#include <iomanip>
#include <cstdlib>
#include <fstream>
#include <cmath>
#include "antioch/chemical_mixture.h"
#include "antioch/cea_evaluator.h"
#include "antioch/stat_mech_thermo.h"
#include "antioch/temp_cache.h"
#include "antioch/cea_mixture_ascii_parsing.h"
Include dependency graph for antioch_thermo_tables.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 46 of file antioch_thermo_tables.C.

47 {
48  if( argc < 2 )
49  {
50  std::cerr << "Error: Must specify at least 1 species name!" << std::endl;
51  exit(1);
52  }
53 
54  unsigned n_species = argc-1;
55  std::vector<std::string> species_list(n_species);
56  for( unsigned int s = 0; s < n_species; s++)
57  {
58  species_list[s] = std::string(argv[s+1]);
59  }
60 
61  Antioch::ChemicalMixture<double> chem_mixture( species_list );
62 
63  Antioch::CEAThermoMixture<double> cea_mixture( chem_mixture );
64  Antioch::read_cea_mixture_data_ascii_default( cea_mixture );
65 
66  Antioch::CEAEvaluator<double> cea_thermo( cea_mixture );
67 
68  Antioch::StatMechThermodynamics<double> stat_mech_thermo( chem_mixture );
69 
70  double T0 = 300.0;
71  double delta_T = 100.0;
72 
73  std::ofstream output;
74  output.open( "thermo.dat", std::ios::trunc );
75  output << "# Species names" << std::endl;
76  for( unsigned int s = 0; s < n_species; s++)
77  {
78  output << species_list[s] << " ";
79  }
80  output << std::endl;
81  output << "# T [K] CEA h_s StatMech h_s" << std::endl;
82  output.close();
83 
84  for( unsigned int i = 0; i < 56; i++ )
85  {
86  double T = T0 + i*delta_T;
87 
88  output.open( "thermo.dat", std::ios::app );
89  output << std::scientific << std::setprecision(16);
90  output << T << " ";
91 
92  Antioch::TempCache<double> T_cache(T);
93 
94  for( unsigned int s = 0; s < n_species; s++)
95  {
96  output << cea_thermo.h(T_cache,s) << " ";
97  }
98 
99  for( unsigned int s = 0; s < n_species; s++)
100  {
101  output << std::scientific << std::setprecision(16)
102  << stat_mech_thermo.h_tot( s, T ) - stat_mech_thermo.h_tot( s, 298.15 )
103  + stat_mech_thermo.e_0( s ) << " ";
104  }
105 
106  for( unsigned int s = 0; s < n_species; s++)
107  {
108  output << std::scientific << std::setprecision(16)
109  << stat_mech_thermo.e_tr( s, T ) << " ";
110  }
111 
112  for( unsigned int s = 0; s < n_species; s++)
113  {
114  output << std::scientific << std::setprecision(16)
115  << stat_mech_thermo.e_vib( s, T ) << " ";
116  }
117 
118  for( unsigned int s = 0; s < n_species; s++)
119  {
120  output << std::scientific << std::setprecision(16)
121  << stat_mech_thermo.e_el( s, T ) << " ";
122  }
123 
124  for( unsigned int s = 0; s < n_species; s++)
125  {
126  output << std::scientific << std::setprecision(16)
127  << stat_mech_thermo.e_0( s ) << " ";
128  }
129 
130  for( unsigned int s = 0; s < n_species; s++)
131  {
132  output << std::scientific << std::setprecision(16)
133  << stat_mech_thermo.cv_trans( s ) << " ";
134  }
135 
136  for( unsigned int s = 0; s < n_species; s++)
137  {
138  output << std::scientific << std::setprecision(16)
139  << stat_mech_thermo.cv_rot( s ) << " ";
140  }
141 
142  output << std::endl;
143  output.close();
144  }
145  return 0;
146 }

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