antioch-0.4.0
List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
Antioch::ChemicalMixture< CoeffType > Singleton Reference

Class storing chemical mixture properties. More...

#include <chemical_mixture.h>

Public Member Functions

 ChemicalMixture (const std::string &filename=DefaultFilename::species_list(), const bool verbose=true, const std::string &species_data=DefaultFilename::chemical_mixture(), const std::string &vibration_data=DefaultFilename::vibrational_data(), const std::string &electronic_data=DefaultFilename::electronic_data())
 ascii parser by default More...
 
 ChemicalMixture (const std::vector< std::string > &species_list, const bool verbose=true, const std::string &species_data=DefaultFilename::chemical_mixture(), const std::string &vibration_data=DefaultFilename::vibrational_data(), const std::string &electronic_data=DefaultFilename::electronic_data())
 ascii parser by default More...
 
 ChemicalMixture (ParserBase< CoeffType > *parser, const std::string &species_data=DefaultFilename::chemical_mixture(), const std::string &vibration_data=DefaultFilename::vibrational_data(), const std::string &electronic_data=DefaultFilename::electronic_data())
 explicit parser, file in parser must contains species list More...
 
 ~ChemicalMixture ()
 
const ChemicalMixture
< CoeffType > & 
chemical_mixture () const
 method to send this back More...
 
void initialize_species (const std::vector< std::string > &species_list)
 method to initialize, backward compatibility More...
 
void read_species_characteristics (ParserBase< CoeffType > *parser, const std::string &species_data, const std::string &vibration_data, const std::string &electronic_data)
 method to read characteristics, using one parser More...
 
void read_species_mandatory_characteristics (ParserBase< CoeffType > *parser)
 method to read mandatory characteristics More...
 
void read_species_vibrational_characteristics (ParserBase< CoeffType > *parser)
 method to read vibrational characteristics More...
 
void read_species_electronic_characteristics (ParserBase< CoeffType > *parser)
 method to read electronic characteristics More...
 
unsigned int n_species () const
 Returns the number of species in this mixture. More...
 
void add_species (const unsigned int index, const std::string &name, CoeffType mol_wght, CoeffType h_form, CoeffType n_tr_dofs, int charge)
 
void add_species_vibrational_data (const unsigned int index, const CoeffType theta_v, const unsigned int ndg_v)
 
void add_species_electronic_data (const unsigned int index, const CoeffType theta_e, const unsigned int ndg_e)
 
const std::vector
< ChemicalSpecies< CoeffType > * > & 
chemical_species () const
 
const std::vector< Species > & species_list () const
 
const std::map< std::string,
Species > & 
species_name_map () const
 
const std::map< Species,
std::string > & 
species_inverse_name_map () const
 
const std::map< std::string,
Species > & 
active_species_name_map () const
 
CoeffType R (const unsigned int s) const
 Gas constant for species s in [J/kg-K]. More...
 
template<typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
typename Antioch::value_type
< VectorStateType >::type >
::type 
R (const VectorStateType &mass_fractions) const
 Gas constant for mixture in [J/kg-K]. More...
 
CoeffType M (const unsigned int s) const
 Molecular weight (molar mass) for species s in kg/mol. More...
 
template<typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
typename Antioch::value_type
< VectorStateType >::type >
::type 
M (const VectorStateType &mass_fractions) const
 Molecular weight (molar mass) for mixture in kg/mol. More...
 
template<typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
typename Antioch::value_type
< VectorStateType >::type >
::type 
R (const VectorStateType &mass_fractions) const
 
template<typename VectorStateType >
enable_if_c< has_size
< VectorStateType >::value,
typename Antioch::value_type
< VectorStateType >::type >
::type 
M (const VectorStateType &mass_fractions) const
 

Public Attributes

template<typename StateType >
X(const unsigned int species,
const StateType &M, const
StateType &mass_fraction)
const template< typename
VectorStateType > void X(typename
Antioch 
molar_density (const unsigned int species, const StateType &rho, const StateType &mass_fraction) const template< typename StateType
 Species mole fraction. More...
 
X(const unsigned int species,
const StateType &M, const
StateType &mass_fraction)
const template< typename
VectorStateType > void X(typename
Antioch VectorStateType void 
molar_densities (const StateType &rho, const VectorStateType &mass_fractions, VectorStateType &molar_densities) const
 

Protected Member Functions

void init_species_name_map (const std::vector< std::string > &species_list)
 
void build_inverse_name_map ()
 

Protected Attributes

std::vector< Species_species_list
 
std::vector< ChemicalSpecies
< CoeffType > * > 
_chemical_species
 
std::map< std::string, Species_species_name_map
 
std::map< Species, std::string > _species_inv_name_map
 

Detailed Description

template<typename CoeffType = double>
singleton Antioch::ChemicalMixture< CoeffType >

Class storing chemical mixture properties.

This class manages the list of ChemicalSpecies for a requested set of species from input.

We require four types of data:

Definition at line 75 of file chemical_mixture.h.

Constructor & Destructor Documentation

template<typename CoeffType >
Antioch::ChemicalMixture< CoeffType >::ChemicalMixture ( const std::string &  filename = DefaultFilename::species_list(),
const bool  verbose = true,
const std::string &  species_data = DefaultFilename::chemical_mixture(),
const std::string &  vibration_data = DefaultFilename::vibrational_data(),
const std::string &  electronic_data = DefaultFilename::electronic_data() 
)

ascii parser by default

Definition at line 38 of file chemical_mixture.C.

References Antioch::ASCIIParser< NumericType >::change_file().

42  {
43  ASCIIParser<CoeffType> parser(filename,verbose);
44 
45  read_chemical_species_composition<CoeffType>(static_cast<ParserBase<CoeffType> *> (&parser), *this);
46 
47  parser.change_file(species_data);
48  this->read_species_characteristics(&parser,species_data,vibration_data,electronic_data);
49 
50  return;
51  }
void read_species_characteristics(ParserBase< CoeffType > *parser, const std::string &species_data, const std::string &vibration_data, const std::string &electronic_data)
method to read characteristics, using one parser
template<typename CoeffType >
Antioch::ChemicalMixture< CoeffType >::ChemicalMixture ( const std::vector< std::string > &  species_list,
const bool  verbose = true,
const std::string &  species_data = DefaultFilename::chemical_mixture(),
const std::string &  vibration_data = DefaultFilename::vibrational_data(),
const std::string &  electronic_data = DefaultFilename::electronic_data() 
)

ascii parser by default

Definition at line 67 of file chemical_mixture.C.

72  {
74 
75  Antioch::ASCIIParser<CoeffType> parser(species_data,verbose);
76 
77  this->read_species_characteristics(static_cast<ParserBase<CoeffType> *>(&parser),species_data,vibration_data,electronic_data);
78 
79  return;
80  }
const std::vector< Species > & species_list() const
void initialize_species(const std::vector< std::string > &species_list)
method to initialize, backward compatibility
void read_species_characteristics(ParserBase< CoeffType > *parser, const std::string &species_data, const std::string &vibration_data, const std::string &electronic_data)
method to read characteristics, using one parser
template<typename CoeffType >
Antioch::ChemicalMixture< CoeffType >::ChemicalMixture ( ParserBase< CoeffType > *  parser,
const std::string &  species_data = DefaultFilename::chemical_mixture(),
const std::string &  vibration_data = DefaultFilename::vibrational_data(),
const std::string &  electronic_data = DefaultFilename::electronic_data() 
)

explicit parser, file in parser must contains species list

Definition at line 54 of file chemical_mixture.C.

58  {
59  read_chemical_species_composition<CoeffType>(parser, *this);
60 
61  this->read_species_characteristics(parser,species_data,vibration_data,electronic_data);
62 
63  return;
64  }
void read_species_characteristics(ParserBase< CoeffType > *parser, const std::string &species_data, const std::string &vibration_data, const std::string &electronic_data)
method to read characteristics, using one parser
template<typename CoeffType >
Antioch::ChemicalMixture< CoeffType >::~ChemicalMixture ( )

Definition at line 83 of file chemical_mixture.C.

84  {
85  // Clean up all the ChemicalSpecies we stored
86  for( typename std::vector<ChemicalSpecies<CoeffType>* >::iterator it = _chemical_species.begin();
87  it < _chemical_species.end(); ++it )
88  {
89  delete (*it);
90  }
91 
92  return;
93  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species

Member Function Documentation

template<typename CoeffType >
const std::map< std::string, Species > & Antioch::ChemicalMixture< CoeffType >::active_species_name_map ( ) const
inline

Definition at line 274 of file chemical_mixture.h.

References Antioch::ChemicalMixture< CoeffType >::_species_name_map, and antioch_deprecated.

275  {
277  return _species_name_map;
278  }
std::map< std::string, Species > _species_name_map
#define antioch_deprecated()
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::add_species ( const unsigned int  index,
const std::string &  name,
CoeffType  mol_wght,
CoeffType  h_form,
CoeffType  n_tr_dofs,
int  charge 
)

Definition at line 178 of file chemical_mixture.C.

Referenced by Antioch::ASCIIParser< NumericType >::read_chemical_species().

183  {
184  _chemical_species[index] =
185  new ChemicalSpecies<CoeffType>(name, mol_wght, h_form, n_tr_dofs, charge);
186  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::add_species_electronic_data ( const unsigned int  index,
const CoeffType  theta_e,
const unsigned int  ndg_e 
)

Definition at line 197 of file chemical_mixture.C.

Referenced by Antioch::ASCIIParser< NumericType >::read_electronic_data().

200  {
201  (_chemical_species[index])->add_electronic_data(theta_e, ndg_e);
202  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::add_species_vibrational_data ( const unsigned int  index,
const CoeffType  theta_v,
const unsigned int  ndg_v 
)

Definition at line 189 of file chemical_mixture.C.

Referenced by Antioch::ASCIIParser< NumericType >::read_vibrational_data().

192  {
193  (_chemical_species[index])->add_vibrational_data(theta_v, ndg_v);
194  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::build_inverse_name_map ( )
protected

Definition at line 148 of file chemical_mixture.C.

149  {
150  for( std::map<std::string,Species>::const_iterator it = _species_name_map.begin();
151  it != _species_name_map.end(); ++it )
152  {
153  _species_inv_name_map.insert( std::make_pair( it->second, it->first ) );
154  }
155 
156  return;
157  }
std::map< std::string, Species > _species_name_map
std::map< Species, std::string > _species_inv_name_map
template<typename CoeffType >
const ChemicalMixture< CoeffType > & Antioch::ChemicalMixture< CoeffType >::chemical_mixture ( ) const
inline

method to send this back

added for backward compatibility for WilkeMixture v/s MixtureAveragedTransportMixture, the idea is to send a chemical mixture whatever mixture is provided

Definition at line 383 of file chemical_mixture.h.

References antioch_deprecated.

Referenced by Antioch::read_blottner_data_ascii(), Antioch::read_sutherland_data_ascii(), Antioch::XMLParser< NumericType >::read_thermodynamic_data_root(), and Antioch::WilkeMixture< CoeffType >::WilkeMixture().

384  {
386  return *this;
387  }
#define antioch_deprecated()
template<typename CoeffType >
const std::vector< ChemicalSpecies< CoeffType > * > & Antioch::ChemicalMixture< CoeffType >::chemical_species ( ) const
inline
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::init_species_name_map ( const std::vector< std::string > &  species_list)
protected

Definition at line 138 of file chemical_mixture.C.

139  {
140  _species_name_map.clear();
141  for(unsigned int s = 0; s < species_list.size(); s++)
142  {
144  }
145  }
const std::vector< Species > & species_list() const
std::map< std::string, Species > _species_name_map
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::initialize_species ( const std::vector< std::string > &  species_list)

method to initialize, backward compatibility

Definition at line 114 of file chemical_mixture.C.

References antioch_error.

Referenced by Antioch::read_chemical_species_composition().

115  {
116  _chemical_species.resize( species_list.size(), NULL );
117  // Build up name map for all possible species
119 
120  // Build up inverse name map
121  this->build_inverse_name_map();
122 
123  // Populate species list for requested species
124  _species_list.reserve( species_list.size() );
125  for( unsigned int s = 0; s < species_list.size(); s++ )
126  {
127  if( _species_name_map.find( species_list[s] ) == _species_name_map.end() )
128  {
129  std::cerr << "Error in ChemicalMixture: Unknown species " << species_list[s] << std::endl;
130  antioch_error();
131  }
132 
133  _species_list.push_back( _species_name_map.find( species_list[s] )->second );
134  }
135  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
std::vector< Species > _species_list
const std::vector< Species > & species_list() const
void init_species_name_map(const std::vector< std::string > &species_list)
#define antioch_error()
std::map< std::string, Species > _species_name_map
template<typename CoeffType >
CoeffType Antioch::ChemicalMixture< CoeffType >::M ( const unsigned int  s) const
inline

Molecular weight (molar mass) for species s in kg/mol.

Definition at line 289 of file chemical_mixture.h.

References Antioch::ChemicalMixture< CoeffType >::_chemical_species.

Referenced by Antioch::MixtureAveragedTransportEvaluator< Diffusion, Viscosity, ThermalConductivity, CoeffType >::diffusion_mixing_rule(), Antioch::ChemicalMixture< CoeffType >::M(), tester(), and vectester().

290  {
291  return (_chemical_species[s])->molar_mass();
292  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
template<typename CoeffType = double>
template<typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, typename Antioch::value_type<VectorStateType>::type >::type Antioch::ChemicalMixture< CoeffType >::M ( const VectorStateType &  mass_fractions) const

Molecular weight (molar mass) for mixture in kg/mol.

$ \frac{1}{M} = \sum_s \frac{w_s}{M_s}$ where $ w_s $ is the mass fraction of species $ s $ and $ M_s $ is the molecular weight (molar mass) of species $ s $

template<typename CoeffType = double>
template<typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, typename Antioch::value_type<VectorStateType>::type >::type Antioch::ChemicalMixture< CoeffType >::M ( const VectorStateType &  mass_fractions) const
inline

Definition at line 344 of file chemical_mixture.h.

References Antioch::ChemicalMixture< CoeffType >::_chemical_species, antioch_assert_equal_to, and Antioch::ChemicalMixture< CoeffType >::M().

345  {
346  antioch_assert_equal_to( mass_fractions.size(), _chemical_species.size() );
347 
349  M = mass_fractions[0]/this->M(0);
350  for( unsigned int s = 1; s < mass_fractions.size(); s++ )
351  {
352  M += mass_fractions[s]/(this->M(s));
353  }
354 
355  return CoeffType(1)/M;
356  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
#define antioch_assert_equal_to(expr1, expr2)
CoeffType M(const unsigned int s) const
Molecular weight (molar mass) for species s in kg/mol.
template<typename CoeffType >
unsigned int Antioch::ChemicalMixture< CoeffType >::n_species ( ) const
inline
template<typename CoeffType >
CoeffType Antioch::ChemicalMixture< CoeffType >::R ( const unsigned int  s) const
inline

Gas constant for species s in [J/kg-K].

Definition at line 282 of file chemical_mixture.h.

References Antioch::ChemicalMixture< CoeffType >::_chemical_species.

Referenced by Antioch::ChemicalMixture< CoeffType >::R(), test_type(), tester(), tester_N2N(), and vectester().

283  {
284  return (_chemical_species[s])->gas_constant();
285  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
template<typename CoeffType = double>
template<typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, typename Antioch::value_type<VectorStateType>::type >::type Antioch::ChemicalMixture< CoeffType >::R ( const VectorStateType &  mass_fractions) const

Gas constant for mixture in [J/kg-K].

template<typename CoeffType = double>
template<typename VectorStateType >
enable_if_c< has_size<VectorStateType>::value, typename Antioch::value_type<VectorStateType>::type >::type Antioch::ChemicalMixture< CoeffType >::R ( const VectorStateType &  mass_fractions) const
inline

Definition at line 321 of file chemical_mixture.h.

References Antioch::ChemicalMixture< CoeffType >::_chemical_species, antioch_assert_equal_to, antioch_assert_greater, and Antioch::ChemicalMixture< CoeffType >::R().

322  {
323  antioch_assert_equal_to( mass_fractions.size(), _chemical_species.size() );
324  antioch_assert_greater( mass_fractions.size(), 0);
325 
327  R = mass_fractions[0]*this->R(0);
328  for( unsigned int s = 1; s < mass_fractions.size(); s++ )
329  {
330  R += mass_fractions[s]*this->R(s);
331  }
332 
333  return R;
334  }
std::vector< ChemicalSpecies< CoeffType > * > _chemical_species
CoeffType R(const unsigned int s) const
Gas constant for species s in [J/kg-K].
#define antioch_assert_equal_to(expr1, expr2)
#define antioch_assert_greater(expr1, expr2)
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::read_species_characteristics ( ParserBase< CoeffType > *  parser,
const std::string &  species_data,
const std::string &  vibration_data,
const std::string &  electronic_data 
)

method to read characteristics, using one parser

Definition at line 96 of file chemical_mixture.C.

References Antioch::ParserBase< NumericType >::change_file().

100  {
101  // species file is already in parser object
103 
104  //... and any vibrational data
105  parser->change_file(vibration_data);
107 
108  //... and any electronic data
109  parser->change_file(electronic_data);
111  }
void read_species_vibrational_characteristics(ParserBase< CoeffType > *parser)
method to read vibrational characteristics
void read_species_mandatory_characteristics(ParserBase< CoeffType > *parser)
method to read mandatory characteristics
void read_species_electronic_characteristics(ParserBase< CoeffType > *parser)
method to read electronic characteristics
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::read_species_electronic_characteristics ( ParserBase< CoeffType > *  parser)

method to read electronic characteristics

Definition at line 172 of file chemical_mixture.C.

173  {
174  read_species_electronic_data<CoeffType>(parser, *this);
175  }
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::read_species_mandatory_characteristics ( ParserBase< CoeffType > *  parser)

method to read mandatory characteristics

Definition at line 160 of file chemical_mixture.C.

161  {
162  read_species_data<CoeffType>(parser, *this);
163  }
template<typename CoeffType >
void Antioch::ChemicalMixture< CoeffType >::read_species_vibrational_characteristics ( ParserBase< CoeffType > *  parser)

method to read vibrational characteristics

Definition at line 166 of file chemical_mixture.C.

167  {
168  read_species_vibrational_data<CoeffType>(parser, *this);
169  }
template<typename CoeffType >
const std::map< Species, std::string > & Antioch::ChemicalMixture< CoeffType >::species_inverse_name_map ( ) const
inline

Definition at line 266 of file chemical_mixture.h.

References Antioch::ChemicalMixture< CoeffType >::_species_inv_name_map.

Referenced by Antioch::read_species_data(), tester(), and vectester().

267  {
268  return _species_inv_name_map;
269  }
std::map< Species, std::string > _species_inv_name_map
template<typename CoeffType >
const std::vector< Species > & Antioch::ChemicalMixture< CoeffType >::species_list ( ) const
inline
template<typename CoeffType >
const std::map< std::string, Species > & Antioch::ChemicalMixture< CoeffType >::species_name_map ( ) const
inline

Member Data Documentation

template<typename CoeffType = double>
std::vector<ChemicalSpecies<CoeffType>*> Antioch::ChemicalMixture< CoeffType >::_chemical_species
protected
template<typename CoeffType = double>
std::map<Species,std::string> Antioch::ChemicalMixture< CoeffType >::_species_inv_name_map
protected
template<typename CoeffType = double>
std::vector<Species> Antioch::ChemicalMixture< CoeffType >::_species_list
protected
template<typename CoeffType = double>
std::map<std::string,Species> Antioch::ChemicalMixture< CoeffType >::_species_name_map
protected
template<typename CoeffType = double>
void Antioch::ChemicalMixture< CoeffType >::molar_densities
inline

Definition at line 218 of file chemical_mixture.h.

Referenced by test_type(), tester(), tester_N2N(), and vectester().

template<typename CoeffType = double>
template<typename StateType >
X ( const unsigned int species, const StateType& M, const StateType& mass_fraction ) const template<typename VectorStateType> void X( typename Antioch Antioch::ChemicalMixture< CoeffType >::molar_density(const unsigned int species, const StateType &rho, const StateType &mass_fraction) const template< typename StateType

Species mole fraction.

Given mixture molar mass M and mass fraction for species, compute species mole fraction using the relationship $ w_i = x_i \frac{M_i}{M} $All species mole fractions

The output argument mole_fractions should already be properly sized to hold the output.Species molar density

Given total density rho and mass fraction for species, compute species moles per unit volumeSpecies molar densities

Given total density rho and mass fractions for all species, compute moles per unit volume for all species

Definition at line 207 of file chemical_mixture.h.


The documentation for this singleton was generated from the following files:

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