13 #ifndef _FUELCELL_OPERATING_CONDITIONS__H 
   14 #define _FUELCELL_OPERATING_CONDITIONS__H 
   17 #include <deal.II/base/parameter_handler.h> 
   20 #include <boost/lexical_cast.hpp> 
   30 using namespace dealii;
 
  154         void declare_parameters (ParameterHandler ¶m) 
const;
 
  160         void initialize (ParameterHandler& param);
 
  172             cathode_mix = &c_mix;
 
  183         std::vector<double> get_rho_anode() 
const;
 
  188         std::vector<double> get_rho_cathode() 
const;
 
  194         double saturation_pressure() 
const;
 
  199         double get_x_wv(
int) 
const;
 
  204         double get_x_wv() 
const;
 
  209         double get_x_wv_anode() 
const;        
 
  214         double get_x_o2() 
const;
 
  219         double get_x_h2() 
const;
 
  224         double get_x_n2(
int) 
const;        
 
  229         double get_rho_wv(
int) 
const;
 
  234         double get_rho_wv() 
const;
 
  239         double get_rho_wv_anode() 
const;        
 
  244         double get_rho_o2() 
const;
 
  248         double get_rho_h2() 
const;        
 
  252         double get_rho_n2(
int) 
const;
 
  256         double get_rho_n2() 
const;
 
  260         double get_rho_n2_anode() 
const;        
 
  267         void set_gas_map(std::map<unsigned int, std::string> tmp);
 
  272         std::map<unsigned int, std::string> get_gas_map() 
const;
 
  279         double get_density_from_map(std::string species) 
const;
 
  285         double voltage_cell_th();
 
  290         void print_operating_conditions() 
const;
 
  295         void adjust_initial_solution(std::vector< component_materialID_value_map >& maps,
 
  316         void adjust_boundary_conditions(std::vector< component_boundaryID_value_map >& maps,
 
  371             AssertThrow(name.compare(0,16,
"density_species_") == 0, ExcMessage(
"This function is only meant to be used to get species number from density_species_*, please use another function."));
 
  373             std::string speciesStr     = name.substr(16); 
 
  374             unsigned int species_index = atoi(speciesStr.c_str()) - 1; 
 
  376             return species_index;
 
  390             unsigned int anode_gas_index = species_index - cathode_mix->n_gases();
 
  392             const std::string gas_name = anode_mix->get_gas(anode_gas_index)->name_material ();
 
  393             double M = 1e3*anode_mix->get_gas(anode_gas_index)->get_molar_mass();  
 
  397             for (
unsigned int ind_g = 0; ind_g<anode_mix->n_gases(); ind_g++) {
 
  398                 std::string name = anode_mix->get_gas(ind_g)->name_material ();
 
  399                 if (name.compare(
"water") == 0)
 
  400                     pv_a = p_sat_Pa*RH_a;
 
  402             double p_H2 = channel_dry_hydrogen_mole_fraction*(p_a-pv_a);
 
  403             double p_N2 = p_a - p_H2 - pv_a;
 
  405             if (gas_name.compare(
"water") == 0)
 
  406                 density = 1E-6*M*pv_a/(
R*T_cell);         
 
  407             else if (gas_name.compare(
"hydrogen") == 0)
 
  408                 density = 1E-6*M*p_H2/(
R*T_cell);         
 
  409             else if (gas_name.compare(
"nitrogen") == 0)
 
  410                 density = 1E-6*M*p_N2/(
R*T_cell);         
 
  412                 AssertThrow(
false, ExcMessage(
"Gas not implemented"));
 
  429             const std::string gas_name = cathode_mix->get_gas(species_index)->name_material ();
 
  430             double M = 1e3*cathode_mix->get_gas(species_index)->get_molar_mass();  
 
  433             for (
unsigned int ind_g = 0; ind_g<cathode_mix->n_gases(); ind_g++) 
 
  435                 std::string name = cathode_mix->get_gas(ind_g)->name_material ();
 
  436                 if (name.compare(
"water") == 0)
 
  437                     pv_c = p_sat_Pa*RH_c;
 
  439             double p_O2 = channel_oxygen_mole_fraction*(p_c-pv_c);
 
  440             double p_N2 = p_a - p_O2 - pv_c;
 
  442             if (gas_name.compare(
"water") == 0)
 
  443                 density = 1E-6*M*pv_c/(
R*T_cell);         
 
  444             else if (gas_name.compare(
"oxygen") == 0)
 
  445                 density = 1E-6*M*p_O2/(
R*T_cell);         
 
  446             else if (gas_name.compare(
"nitrogen") == 0)
 
  447                 density = 1E-6*M*p_N2/(
R*T_cell);         
 
  449                 AssertThrow(
false, ExcMessage(
"Gas not implemented"));
 
  533 #endif // _FUELCELL_OPERATING_CONDITIONS__H 
double p_c
Pressure of the gas mixture in the cathode B.C. 
Definition: operating_conditions.h:488
 
double get_V() const 
Return cell voltage as input in Operating Conditions subsection. 
Definition: operating_conditions.h:329
 
double T_cell
Operating temperature of the cell. 
Definition: operating_conditions.h:468
 
double c_c
Concentration of the gas mixture in the cathode B.C. 
Definition: operating_conditions.h:490
 
Class used to store, read from file and define the operating conditions for a fuel cell...
Definition: operating_conditions.h:118
 
double c_a
Concentration of the gas mixture in the anode B.C. 
Definition: operating_conditions.h:482
 
double RH_a
Relative humidity of the gas mixture in the anode B.C. 
Definition: operating_conditions.h:484
 
double E_th
Theoretical voltage for the cell. 
Definition: operating_conditions.h:476
 
double channel_oxygen_mole_fraction
Initial amount of oxygen in channel prior to humidification. 
Definition: operating_conditions.h:461
 
double get_anode_gas_density(unsigned int species_index) const 
Private function used in adjust_initial_solution and adjust_boundary_conditions that estimates the de...
Definition: operating_conditions.h:385
 
double get_pa_atm() const 
Return anode pressure as input in Operating Conditions subsection. 
Definition: operating_conditions.h:351
 
double get_pa_Pa() const 
Return anode pressure as input in Operating Conditions subsection. 
Definition: operating_conditions.h:348
 
FuelCellShop::Material::GasMixture * cathode_mix
Container storing the gas mixture in the anode compartment of the cell. 
Definition: operating_conditions.h:514
 
double get_c_c() const 
Get the total gas concentration in the cathode. 
Definition: operating_conditions.h:323
 
double get_cathode_gas_density(unsigned int species_index) const 
Private function used in adjust_initial_solution and adjust_boundary_conditions that estimates the de...
Definition: operating_conditions.h:424
 
bool adjust_BC
Bool set to true if you want to modify boundary conditions. 
Definition: operating_conditions.h:456
 
FuelCellShop::Material::GasMixture * anode_mix
Container storing the gas mixture in the anode compartment of the cell. 
Definition: operating_conditions.h:510
 
double get_RH_a() const 
Return anode relative humidity as input in Operating Conditions subsection. 
Definition: operating_conditions.h:354
 
FuelCellShop::Material::Oxygen oxygen
Get molar mass of oxygen. 
Definition: operating_conditions.h:499
 
double dV_a
Voltage drop in the anode. 
Definition: operating_conditions.h:472
 
double get_dV_a() const 
Return the voltage drop in the anode. 
Definition: operating_conditions.h:336
 
double RH_c
Relative humidity of the gas mixture in the anode B.C. 
Definition: operating_conditions.h:492
 
unsigned int get_species_index(std::string name) const 
Private member function used to extract the species index value from name. 
Definition: operating_conditions.h:369
 
double get_pc_atm() const 
Return cathode pressure as input in Operating Conditions subsection. 
Definition: operating_conditions.h:342
 
double get_T() const 
Return cell temperture as input in Operating Conditions subsection. 
Definition: operating_conditions.h:326
 
double R
Definition: operating_conditions.h:458
 
double V_cell
Operating voltage of the cell. 
Definition: operating_conditions.h:470
 
double get_OCV() const 
Get the open circuit voltage for the cell. 
Definition: operating_conditions.h:360
 
Definition: operating_conditions.h:527
 
std::map< unsigned int, std::string > gasSpeciesMap
map relating species number (key) to species material (value) 
Definition: operating_conditions.h:517
 
FuelCellShop::Material::WaterVapor water
Get molar mass of water vapour. 
Definition: operating_conditions.h:496
 
double R()
Universal gas constant, . 
Definition: fcst_constants.h:32
 
This class describes properties of pure oxygen. 
Definition: PureGas.h:974
 
void set_gas_mixtures(FuelCellShop::Material::GasMixture &c_mix, FuelCellShop::Material::GasMixture &a_mix)
Initialize the temperature and pressure for anode gas mixture and store a copy of GasMixture class in...
Definition: operating_conditions.h:167
 
double get_RH_c() const 
Return cathode relative humidity as input in Operating Conditions subsection. 
Definition: operating_conditions.h:357
 
This class describes properties of pure nitrogen. 
Definition: PureGas.h:1027
 
FuelCellShop::Material::Hydrogen hydrogen
Get molar mass of nitrogen. 
Definition: operating_conditions.h:505
 
double channel_dry_hydrogen_mole_fraction
Initial amount of hydrogen in channel prior to humidification. 
Definition: operating_conditions.h:464
 
void set_total_pressure(const double &rtotal_pressure)
This function takes a pressure (Pa) and if Isobaric fluid flow is set to true in the data file then t...
Definition: GasMixture.h:147
 
This class describes properties of gas mixtures. 
Definition: GasMixture.h:102
 
double get_c_a() const 
Get the total gas concentration in the anode. 
Definition: operating_conditions.h:345
 
double OCV
Open circuit voltage for the cell. 
Definition: operating_conditions.h:474
 
double get_pc_Pa() const 
Return cathode pressure as input in Operating Conditions subsection. 
Definition: operating_conditions.h:339
 
Electrode
Variable to switch between electrodes in molar fraction functions: 
Definition: operating_conditions.h:527
 
FuelCell Geometry information class. 
Definition: geometry.h:92
 
FuelCellShop::Material::Nitrogen nitrogen
Get molar mass of nitrogen. 
Definition: operating_conditions.h:502
 
double p_a
Pressure of the gas mixture in the anode B.C. 
Definition: operating_conditions.h:480
 
Electrode compartment
Definition: operating_conditions.h:528
 
static const unsigned int ATM_to_PA
Definition: fcst_units.h:99
 
This class describes properties of pure hydrogen. 
Definition: PureGas.h:1081
 
static double convert(double unitToConvert, double to, double from)
The conversion routine convert(unitToConvert, X, Y) should be read as: 
Definition: fcst_units.h:57
 
void set_temperature(const double &rtemperature)
This function takes a temperature (K) and if Isothermal fluid flow is set to true in the data file th...
Definition: GasMixture.h:157
 
This class describes properties of pure WaterVapor. 
Definition: PureGas.h:1134
 
const double & get_molar_mass() const 
This function returns molar_mass [kg/mol]. 
Definition: PureGas.h:116