OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
FuelCellShop::Mixture::IdealGasMixture Class Reference

Implementation of the ideal gas law for mixtures. More...

#include <ideal_gas.h>

Public Member Functions

 IdealGasMixture ()
 Constructor.
 
 ~IdealGasMixture ()
 Destructor.
 
void set_pT_xi_and_gases (const double p, const double T, const std::vector< double > xv, std::vector< FuelCellShop::Material::PureGas * > gases)
 Function to set the temperature in K, pressure in Pa of the gas and the molar fractions.
 
void set_cT_xi_and_gases (const double c, const double T, const std::vector< double > xv, std::vector< FuelCellShop::Material::PureGas * > gases)
 Function to modify the temperature in K and concentration in mol/m3 of the gas.
 
void set_pv_T_and_gases (const std::vector< double > pv, const double T, std::vector< FuelCellShop::Material::PureGas * > gases)
 Function to set the temperature in K, pressure in Pa of the gas and the molar fractions.
 
void set_cv_T_and_gases (const std::vector< double > cv, const double T, std::vector< FuelCellShop::Material::PureGas * > gases)
 Function to modify the temperature in K and concentration in mol/m3 of the gas.
 
double get_T ()
 Member function used to return the temperature of the gas in Kelvin.
 
double get_p ()
 Member function used to return the total pressure of the gas mixture in Pascal.
 
std::vector< double > get_pi ()
 Member function used to return the partial pressure of the components in the gas in Pascal.
 
double get_p_atm ()
 Member function used to return the pressure of the gas mixture in atm.
 
double get_c ()
 Member function used to return the concentration of the gas in mol/m3.
 
std::vector< double > get_ci ()
 Member function used to return the concentration of the components in the gas in mol/m3.
 
double get_density ()
 Member function used to return the density of the gas in kg/m3.
 
std::vector< double > get_densityi ()
 Member function used to return the partial density of the gas in kg/m3.
 
std::vector< double > get_xi ()
 Member function used to return the mole fraction of the components in the gas mixture.
 
dealii::SmartPointer
< FuelCellShop::Material::PureGas
get_gas (const unsigned int index)
 Member function used to return a pointer to the gas type stored in position index.
 
void print_properties_to_screen ()
 Member function that prints to screen p, T and c.
 
void test ()
 Member function used to test class is working NOTE: The test is not complete at this point since it does not test all set_* options.
 

Private Attributes

bool initialized
 Bool element that let's me know if the class has been initialized.
 
double temp
 Temperature of the gas, [K].
 
double press
 Pressure of the gas, [Pa].
 
double conc
 Concentration of the gas, [mol/m3].
 
double density
 Density of the gas, [kg/m3].
 
double M_mix
 Molar mass of the mixture [g/mol mix].
 
std::vector< double > pressv
 Pressure of the gas, [Pa].
 
std::vector< double > concv
 Concentration of the gas, [mol/m3].
 
std::vector< double > densityv
 Density of the gas, [kg/m3].
 
std::vector< SmartPointer
< FuelCellShop::Material::PureGas > > 
gas_types
 Vector containing pointers to all gas species.
 

Detailed Description

Implementation of the ideal gas law for mixtures.

This class once initialized using several of the set_xx options will return partial pressures, concentrations for each species and mole fractions.

Usage details

In order to use this class, you first need to use one of the set_* options in order to initialize all the variables that define an ideal gas. In the set_* member function all properties are computed. If you would like to change, temperature, type of gas, etc. you will need to call this routine again. Once the set routine has been called, then you can request any gas property using get_* routines.

std::vector<FuelCellShop::Material::PureGas* > gasv;
gasv.push_back(&oxygen);
gasv.push_back(&nitrogen);
// NOTE: The order is important. The FuelCellShop::Material::PureGas MUST be created before the
// object of type IdealGasMixuture otherwise the gases would be destroyed first at the end of the
// program leading to SmartPointer errors!!!
std::vector<double> xv;
xv.push_back(0.5);
xv.push_back(0.5);
marc.set_pT_xi_and_gases(101325, 298, xv, gasv);
Author
M. Secanell
Date
2012

Constructor & Destructor Documentation

FuelCellShop::Mixture::IdealGasMixture::IdealGasMixture ( )
inline

Constructor.

FuelCellShop::Mixture::IdealGasMixture::~IdealGasMixture ( )
inline

Destructor.

Member Function Documentation

double FuelCellShop::Mixture::IdealGasMixture::get_c ( )
inline

Member function used to return the concentration of the gas in mol/m3.

References conc, and initialized.

Referenced by test().

Here is the caller graph for this function:

std::vector<double> FuelCellShop::Mixture::IdealGasMixture::get_ci ( )
inline

Member function used to return the concentration of the components in the gas in mol/m3.

References concv, and initialized.

Referenced by test().

Here is the caller graph for this function:

double FuelCellShop::Mixture::IdealGasMixture::get_density ( )
inline

Member function used to return the density of the gas in kg/m3.

References density, and initialized.

Referenced by test().

Here is the caller graph for this function:

std::vector<double> FuelCellShop::Mixture::IdealGasMixture::get_densityi ( )
inline

Member function used to return the partial density of the gas in kg/m3.

References densityv, and initialized.

dealii::SmartPointer<FuelCellShop::Material::PureGas> FuelCellShop::Mixture::IdealGasMixture::get_gas ( const unsigned int  index)
inline

Member function used to return a pointer to the gas type stored in position index.

References gas_types, and initialized.

Referenced by test().

Here is the caller graph for this function:

double FuelCellShop::Mixture::IdealGasMixture::get_p ( )
inline

Member function used to return the total pressure of the gas mixture in Pascal.

References initialized, and press.

Referenced by test().

Here is the caller graph for this function:

double FuelCellShop::Mixture::IdealGasMixture::get_p_atm ( )
inline

Member function used to return the pressure of the gas mixture in atm.

References initialized, and press.

std::vector<double> FuelCellShop::Mixture::IdealGasMixture::get_pi ( )
inline

Member function used to return the partial pressure of the components in the gas in Pascal.

References initialized, and pressv.

double FuelCellShop::Mixture::IdealGasMixture::get_T ( )
inline

Member function used to return the temperature of the gas in Kelvin.

References initialized, and temp.

Referenced by test().

Here is the caller graph for this function:

std::vector<double> FuelCellShop::Mixture::IdealGasMixture::get_xi ( )
inline

Member function used to return the mole fraction of the components in the gas mixture.

References initialized, press, and pressv.

void FuelCellShop::Mixture::IdealGasMixture::print_properties_to_screen ( )
inline

Member function that prints to screen p, T and c.

References conc, concv, density, densityv, initialized, press, pressv, and temp.

void FuelCellShop::Mixture::IdealGasMixture::set_cT_xi_and_gases ( const double  c,
const double  T,
const std::vector< double >  xv,
std::vector< FuelCellShop::Material::PureGas * >  gases 
)
inline

Function to modify the temperature in K and concentration in mol/m3 of the gas.

References conc, concv, density, densityv, gas_types, initialized, M_mix, press, pressv, Constants::R(), and temp.

Here is the call graph for this function:

void FuelCellShop::Mixture::IdealGasMixture::set_cv_T_and_gases ( const std::vector< double >  cv,
const double  T,
std::vector< FuelCellShop::Material::PureGas * >  gases 
)
inline

Function to modify the temperature in K and concentration in mol/m3 of the gas.

References conc, concv, density, densityv, gas_types, initialized, M_mix, press, pressv, Constants::R(), and temp.

Referenced by test().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuelCellShop::Mixture::IdealGasMixture::set_pT_xi_and_gases ( const double  p,
const double  T,
const std::vector< double >  xv,
std::vector< FuelCellShop::Material::PureGas * >  gases 
)
inline

Function to set the temperature in K, pressure in Pa of the gas and the molar fractions.

References conc, concv, density, densityv, gas_types, initialized, M_mix, press, pressv, Constants::R(), and temp.

Here is the call graph for this function:

void FuelCellShop::Mixture::IdealGasMixture::set_pv_T_and_gases ( const std::vector< double >  pv,
const double  T,
std::vector< FuelCellShop::Material::PureGas * >  gases 
)
inline

Function to set the temperature in K, pressure in Pa of the gas and the molar fractions.

References conc, concv, density, densityv, gas_types, initialized, M_mix, press, pressv, Constants::R(), and temp.

Here is the call graph for this function:

void FuelCellShop::Mixture::IdealGasMixture::test ( )
inline

Member function used to test class is working NOTE: The test is not complete at this point since it does not test all set_* options.

References get_c(), get_ci(), get_density(), get_gas(), get_p(), get_T(), and set_cv_T_and_gases().

Here is the call graph for this function:

Member Data Documentation

double FuelCellShop::Mixture::IdealGasMixture::conc
private
std::vector<double> FuelCellShop::Mixture::IdealGasMixture::concv
private
double FuelCellShop::Mixture::IdealGasMixture::density
private
std::vector<double> FuelCellShop::Mixture::IdealGasMixture::densityv
private
std::vector<SmartPointer<FuelCellShop::Material::PureGas> > FuelCellShop::Mixture::IdealGasMixture::gas_types
private

Vector containing pointers to all gas species.

Referenced by get_gas(), set_cT_xi_and_gases(), set_cv_T_and_gases(), set_pT_xi_and_gases(), and set_pv_T_and_gases().

bool FuelCellShop::Mixture::IdealGasMixture::initialized
private
double FuelCellShop::Mixture::IdealGasMixture::M_mix
private

Molar mass of the mixture [g/mol mix].

Referenced by set_cT_xi_and_gases(), set_cv_T_and_gases(), set_pT_xi_and_gases(), and set_pv_T_and_gases().

double FuelCellShop::Mixture::IdealGasMixture::press
private
std::vector<double> FuelCellShop::Mixture::IdealGasMixture::pressv
private
double FuelCellShop::Mixture::IdealGasMixture::temp
private

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