antioch-0.4.0
List of all members | Public Member Functions | Protected Attributes | Friends
Antioch::ChemicalSpecies< CoeffType > Class Template Reference

Class to encapsulate data for each chemical species. More...

#include <chemical_species.h>

Public Member Functions

 ChemicalSpecies (const std::string &name, const CoeffType mol_wght, const CoeffType h_form, const CoeffType n_tr_dofs, const int charge)
 Constrctor. More...
 
 ChemicalSpecies ()
 Default constructor. More...
 
 ~ChemicalSpecies ()
 Destructor. More...
 
const std::string & species () const
 Returns a descriptive name for this species. More...
 
CoeffType molar_mass () const
 Returns the molar mass in (kg/mol) More...
 
CoeffType gas_constant () const
 Returns the species ideal gas constant in [J/kg-K]. More...
 
CoeffType formation_enthalpy () const
 Returns formation enthalpy in units of [J/kg]. More...
 
CoeffType n_tr_dofs () const
 Returns number of translational degrees of freedom. More...
 
int charge () const
 Returns electrical charge number. More...
 
bool has_vibrational_modes () const
 Returns true if the chemical species has vibrational degrees. More...
 
unsigned int n_vibrational_modes () const
 Returns true if the chemical species has vibrational degrees of freedom. More...
 
const std::vector< CoeffType > & theta_v () const
 Characteristic vibrational temperature [K]. More...
 
const std::vector< unsigned int > & ndg_v () const
 Degeneracies for each vibrational mode. More...
 
const std::vector< CoeffType > & theta_e () const
 Characteristic electronic excitation temperatures [K]. More...
 
const std::vector< unsigned int > & ndg_e () const
 Degeneracies for each electronic modes. More...
 
void add_vibrational_data (const CoeffType theta_v, const CoeffType ndg_v)
 Supply vibrational data. More...
 
void add_electronic_data (const CoeffType theta_e, const CoeffType ndg_e)
 Supply electronic data. More...
 
void print (std::ostream &os=std::cout) const
 Formatted print. More...
 

Protected Attributes

const std::string _name
 Name of chemical species. More...
 
const CoeffType _mol_wght
 Molecular weight (or molar mass) in units of [kg/mol]. More...
 
const CoeffType _R
 Gas constant in units of [J/kg-K]. More...
 
const CoeffType _h_form
 Formation enthalpy in units of [J/kg]. More...
 
const CoeffType _n_tr_dofs
 Number of translational degrees of freedom. More...
 
const int _charge
 Electrical charge number. More...
 
std::vector< CoeffType > _theta_v
 Characteristic vibrational temperature in units of [K]. More...
 
std::vector< unsigned int > _ndg_v
 Degeneracies for each vibrational mode. More...
 
std::vector< CoeffType > _theta_e
 Characteristic electronic temperature in units of [K]. More...
 
std::vector< unsigned int > _ndg_e
 Degeneracies for each electronic mode. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const ChemicalSpecies< CoeffType > &species)
 Formatted print. More...
 

Detailed Description

template<typename CoeffType = double>
class Antioch::ChemicalSpecies< CoeffType >

Class to encapsulate data for each chemical species.

This class is designed to store information relevant to a chemical species. All the data stored is constant for each species, so we store const for each variable. The idea is that this will be placed inside ChemicalMixture, which will be a singleton. This is stolen from the FIN-S class SpeciesChemistry.

Definition at line 54 of file chemical_species.h.

Constructor & Destructor Documentation

template<typename CoeffType >
Antioch::ChemicalSpecies< CoeffType >::ChemicalSpecies ( const std::string &  name,
const CoeffType  mol_wght,
const CoeffType  h_form,
const CoeffType  n_tr_dofs,
const int  charge 
)
inline

Constrctor.

Definition at line 268 of file chemical_species.h.

273  : _name (name),
274  _mol_wght (mol_wght),
275  _R (Constants::R_universal<CoeffType>()/mol_wght),
276  _h_form (h_form),
278  _charge (charge)
279  {
280  return;
281  }
const CoeffType _R
Gas constant in units of [J/kg-K].
const CoeffType _h_form
Formation enthalpy in units of [J/kg].
const int _charge
Electrical charge number.
int charge() const
Returns electrical charge number.
const CoeffType _n_tr_dofs
Number of translational degrees of freedom.
CoeffType n_tr_dofs() const
Returns number of translational degrees of freedom.
const std::string _name
Name of chemical species.
const CoeffType _mol_wght
Molecular weight (or molar mass) in units of [kg/mol].
template<typename CoeffType >
Antioch::ChemicalSpecies< CoeffType >::ChemicalSpecies ( )
inline

Default constructor.

This is technically required for any std::map value type (or operator[] breaks, at least). But, we never actually want to create a SpeciesChemistry implicitly, so we throw an error if this is ever used.

Definition at line 286 of file chemical_species.h.

References antioch_error.

287  : _name("Err"),
288  _mol_wght(0),
289  _R(0),
290  _h_form(0),
291  _n_tr_dofs(0),
292  _charge(0)
293  {
294  antioch_error();
295  return;
296  }
const CoeffType _R
Gas constant in units of [J/kg-K].
const CoeffType _h_form
Formation enthalpy in units of [J/kg].
const int _charge
Electrical charge number.
#define antioch_error()
const CoeffType _n_tr_dofs
Number of translational degrees of freedom.
const std::string _name
Name of chemical species.
const CoeffType _mol_wght
Molecular weight (or molar mass) in units of [kg/mol].
template<typename CoeffType >
Antioch::ChemicalSpecies< CoeffType >::~ChemicalSpecies ( )
inline

Destructor.

Definition at line 301 of file chemical_species.h.

302  {
303  return;
304  }

Member Function Documentation

template<typename CoeffType >
void Antioch::ChemicalSpecies< CoeffType >::add_electronic_data ( const CoeffType  theta_e,
const CoeffType  ndg_e 
)
inline

Supply electronic data.

Definition at line 259 of file chemical_species.h.

261  {
262  _theta_e.push_back(theta_e);
263  _ndg_e.push_back(ndg_e);
264  }
std::vector< CoeffType > _theta_e
Characteristic electronic temperature in units of [K].
const std::vector< unsigned int > & ndg_e() const
Degeneracies for each electronic modes.
std::vector< unsigned int > _ndg_e
Degeneracies for each electronic mode.
const std::vector< CoeffType > & theta_e() const
Characteristic electronic excitation temperatures [K].
template<typename CoeffType >
void Antioch::ChemicalSpecies< CoeffType >::add_vibrational_data ( const CoeffType  theta_v,
const CoeffType  ndg_v 
)
inline

Supply vibrational data.

Definition at line 250 of file chemical_species.h.

252  {
253  _theta_v.push_back(theta_v);
254  _ndg_v.push_back(ndg_v);
255  }
std::vector< unsigned int > _ndg_v
Degeneracies for each vibrational mode.
std::vector< CoeffType > _theta_v
Characteristic vibrational temperature in units of [K].
const std::vector< CoeffType > & theta_v() const
Characteristic vibrational temperature [K].
const std::vector< unsigned int > & ndg_v() const
Degeneracies for each vibrational mode.
template<typename CoeffType >
int Antioch::ChemicalSpecies< CoeffType >::charge ( ) const
inline

Returns electrical charge number.

Definition at line 211 of file chemical_species.h.

Referenced by test_species().

212  { return _charge; }
const int _charge
Electrical charge number.
template<typename CoeffType >
CoeffType Antioch::ChemicalSpecies< CoeffType >::formation_enthalpy ( ) const
inline

Returns formation enthalpy in units of [J/kg].

Definition at line 201 of file chemical_species.h.

Referenced by Antioch::StatMechThermodynamics< CoeffType >::e_0(), and test_species().

202  { return _h_form; }
const CoeffType _h_form
Formation enthalpy in units of [J/kg].
template<typename CoeffType >
CoeffType Antioch::ChemicalSpecies< CoeffType >::gas_constant ( ) const
inline

Returns the species ideal gas constant in [J/kg-K].

$ R \equiv \frac{\hat{R}}{M} $ where $ R$ is the universal gas constant and $ M $ is the species molar mass.

Definition at line 196 of file chemical_species.h.

Referenced by Antioch::StatMechThermodynamics< CoeffType >::cv_el(), Antioch::StatMechThermodynamics< CoeffType >::e_el(), Antioch::StatMechThermodynamics< CoeffType >::e_vib(), Antioch::StatMechThermodynamics< CoeffType >::h_tot(), and test_species().

197  { return _R; }
const CoeffType _R
Gas constant in units of [J/kg-K].
template<typename CoeffType >
bool Antioch::ChemicalSpecies< CoeffType >::has_vibrational_modes ( ) const
inline

Returns true if the chemical species has vibrational degrees.

Definition at line 216 of file chemical_species.h.

217  { return !_theta_v.empty(); }
std::vector< CoeffType > _theta_v
Characteristic vibrational temperature in units of [K].
template<typename CoeffType >
CoeffType Antioch::ChemicalSpecies< CoeffType >::molar_mass ( ) const
inline

Returns the molar mass in (kg/mol)

Definition at line 191 of file chemical_species.h.

Referenced by test_species().

192  { return _mol_wght; }
const CoeffType _mol_wght
Molecular weight (or molar mass) in units of [kg/mol].
template<typename CoeffType >
CoeffType Antioch::ChemicalSpecies< CoeffType >::n_tr_dofs ( ) const
inline

Returns number of translational degrees of freedom.

Definition at line 206 of file chemical_species.h.

Referenced by test_species().

207  { return _n_tr_dofs; }
const CoeffType _n_tr_dofs
Number of translational degrees of freedom.
template<typename CoeffType >
unsigned int Antioch::ChemicalSpecies< CoeffType >::n_vibrational_modes ( ) const
inline

Returns true if the chemical species has vibrational degrees of freedom.

Definition at line 221 of file chemical_species.h.

References antioch_assert_equal_to.

222  {
223  antioch_assert_equal_to(_theta_v.size(), _ndg_v.size());
224  return _theta_v.size();
225  }
std::vector< unsigned int > _ndg_v
Degeneracies for each vibrational mode.
std::vector< CoeffType > _theta_v
Characteristic vibrational temperature in units of [K].
#define antioch_assert_equal_to(expr1, expr2)
template<typename CoeffType >
const std::vector< unsigned int > & Antioch::ChemicalSpecies< CoeffType >::ndg_e ( ) const
inline

Degeneracies for each electronic modes.

Definition at line 244 of file chemical_species.h.

Referenced by Antioch::StatMechThermodynamics< CoeffType >::cv_el(), and Antioch::StatMechThermodynamics< CoeffType >::e_el().

245  { return _ndg_e; }
std::vector< unsigned int > _ndg_e
Degeneracies for each electronic mode.
template<typename CoeffType >
const std::vector< unsigned int > & Antioch::ChemicalSpecies< CoeffType >::ndg_v ( ) const
inline

Degeneracies for each vibrational mode.

Definition at line 234 of file chemical_species.h.

Referenced by Antioch::StatMechThermodynamics< CoeffType >::cv_vib_over_R(), and Antioch::StatMechThermodynamics< CoeffType >::e_vib().

235  { return _ndg_v; }
std::vector< unsigned int > _ndg_v
Degeneracies for each vibrational mode.
template<typename CoeffType >
void Antioch::ChemicalSpecies< CoeffType >::print ( std::ostream &  os = std::cout) const
inline

Formatted print.

Defaults to std::cout.

Definition at line 309 of file chemical_species.h.

310  {
311  os << " -----------------------------\n"
312  << "| Species " << this->species() << '\n'
313  << " -----------------------------\n"
314  << std::scientific
315  << " Mol Wgt = " << this->molar_mass() << '\n'
316  << " R = " << this->gas_constant() << '\n'
317  << " h0 = " << this->formation_enthalpy() << '\n'
318  << " n_tr = " << this->n_tr_dofs() << '\n'
319  << " charge = " << this->charge() << '\n';
320 
321  for (unsigned int l=0; l<this->theta_v().size(); l++)
322  os << " theta_v_" << l << " = " << this->theta_v()[l]
323  << ", ndg = " << this->ndg_v()[l] << "\n";
324 
325  for (unsigned int l=0; l<this->theta_e().size(); l++)
326  os << " theta_e_" << l << " = " << this->theta_e()[l]
327  << ", ndg = " << this->ndg_e()[l] << "\n";
328 
329  os << '\n';
330 
331  return;
332  }
CoeffType formation_enthalpy() const
Returns formation enthalpy in units of [J/kg].
const std::string & species() const
Returns a descriptive name for this species.
const std::vector< CoeffType > & theta_v() const
Characteristic vibrational temperature [K].
const std::vector< unsigned int > & ndg_v() const
Degeneracies for each vibrational mode.
int charge() const
Returns electrical charge number.
CoeffType n_tr_dofs() const
Returns number of translational degrees of freedom.
const std::vector< unsigned int > & ndg_e() const
Degeneracies for each electronic modes.
CoeffType gas_constant() const
Returns the species ideal gas constant in [J/kg-K].
CoeffType molar_mass() const
Returns the molar mass in (kg/mol)
const std::vector< CoeffType > & theta_e() const
Characteristic electronic excitation temperatures [K].
template<typename CoeffType >
const std::string & Antioch::ChemicalSpecies< CoeffType >::species ( ) const
inline

Returns a descriptive name for this species.

Definition at line 186 of file chemical_species.h.

Referenced by test_species().

187  { return _name; }
const std::string _name
Name of chemical species.
template<typename CoeffType >
const std::vector< CoeffType > & Antioch::ChemicalSpecies< CoeffType >::theta_e ( ) const
inline

Characteristic electronic excitation temperatures [K].

Definition at line 239 of file chemical_species.h.

Referenced by Antioch::StatMechThermodynamics< CoeffType >::cv_el(), and Antioch::StatMechThermodynamics< CoeffType >::e_el().

240  { return _theta_e; }
std::vector< CoeffType > _theta_e
Characteristic electronic temperature in units of [K].
template<typename CoeffType >
const std::vector< CoeffType > & Antioch::ChemicalSpecies< CoeffType >::theta_v ( ) const
inline

Characteristic vibrational temperature [K].

Definition at line 229 of file chemical_species.h.

Referenced by Antioch::StatMechThermodynamics< CoeffType >::cv_vib_over_R(), and Antioch::StatMechThermodynamics< CoeffType >::e_vib().

230  { return _theta_v; }
std::vector< CoeffType > _theta_v
Characteristic vibrational temperature in units of [K].

Friends And Related Function Documentation

template<typename CoeffType = double>
std::ostream& operator<< ( std::ostream &  os,
const ChemicalSpecies< CoeffType > &  species 
)
friend

Formatted print.

Allows you to do std::cout << object << std::endl;

Definition at line 136 of file chemical_species.h.

138  {
139  species.print(os);
140  return os;
141  }
const std::string & species() const
Returns a descriptive name for this species.

Member Data Documentation

template<typename CoeffType = double>
const int Antioch::ChemicalSpecies< CoeffType >::_charge
protected

Electrical charge number.

Definition at line 161 of file chemical_species.h.

template<typename CoeffType = double>
const CoeffType Antioch::ChemicalSpecies< CoeffType >::_h_form
protected

Formation enthalpy in units of [J/kg].

Definition at line 155 of file chemical_species.h.

template<typename CoeffType = double>
const CoeffType Antioch::ChemicalSpecies< CoeffType >::_mol_wght
protected

Molecular weight (or molar mass) in units of [kg/mol].

Definition at line 149 of file chemical_species.h.

template<typename CoeffType = double>
const CoeffType Antioch::ChemicalSpecies< CoeffType >::_n_tr_dofs
protected

Number of translational degrees of freedom.

Definition at line 158 of file chemical_species.h.

template<typename CoeffType = double>
const std::string Antioch::ChemicalSpecies< CoeffType >::_name
protected

Name of chemical species.

Definition at line 146 of file chemical_species.h.

template<typename CoeffType = double>
std::vector<unsigned int> Antioch::ChemicalSpecies< CoeffType >::_ndg_e
protected

Degeneracies for each electronic mode.

Definition at line 173 of file chemical_species.h.

template<typename CoeffType = double>
std::vector<unsigned int> Antioch::ChemicalSpecies< CoeffType >::_ndg_v
protected

Degeneracies for each vibrational mode.

Definition at line 167 of file chemical_species.h.

template<typename CoeffType = double>
const CoeffType Antioch::ChemicalSpecies< CoeffType >::_R
protected

Gas constant in units of [J/kg-K].

Definition at line 152 of file chemical_species.h.

template<typename CoeffType = double>
std::vector<CoeffType> Antioch::ChemicalSpecies< CoeffType >::_theta_e
protected

Characteristic electronic temperature in units of [K].

Definition at line 170 of file chemical_species.h.

template<typename CoeffType = double>
std::vector<CoeffType> Antioch::ChemicalSpecies< CoeffType >::_theta_v
protected

Characteristic vibrational temperature in units of [K].

Definition at line 164 of file chemical_species.h.


The documentation for this class was generated from the following file:

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