OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reaction_source_terms_KG.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2015 by Energy Systems Design Laboratory, University of Alberta
6 //
7 // This software is distributed under the MIT license
8 // For more information, see the README file in /doc/LICENSE
9 //
10 // - Class: reaction_source_terms_KG.h
11 // - Description: This class is used to assemble both cell matrix and cell residual
12 // for reaction source terms in the catalyst layers for various equation classes
13 // - Developers: Marc Secanell, 2015
14 //
15 // ----------------------------------------------------------------------------
16 #ifndef _FCST_FUELCELLSHOP_EQUATION_REACTION_SOURCE_TERMS_KG_H_
17 #define _FCST_FUELCELLSHOP_EQUATION_REACTION_SOURCE_TERMS_KG_H_
18 
22 
23 namespace FuelCellShop
24 {
25  namespace Equation
26  {
34  template<int dim>
36  {
37  public:
38 
40 
41 
45  ReactionSourceTermsKG(FuelCell::SystemManagement& system_management,boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data =
46  boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >());
47 
51  virtual ~ReactionSourceTermsKG();
52 
56  virtual void declare_parameters(ParameterHandler& param) const;
57 
61  virtual void initialize(ParameterHandler& param);
62 
68  {
69  cathode_kinetics = kinetics;
70  }
71 
77  {
78  anode_kinetics = kinetics;
79  }
80 
82 
84 
85 
92 
99 
101 
103 
104 
113  virtual void adjust_internal_cell_couplings( std::vector< couplings_map >& dst,
114  const std::vector< FuelCellShop::Material::PureGas* >& gases = std::vector< FuelCellShop::Material::PureGas* >() );
115 
120  virtual void print_equation_info() const;
121 
126  {
127  return cathode_kinetics;
128  }
129 
134  {
135  return anode_kinetics;
136  }
137 
139 
140  protected:
141 
143 
144 
154 
161 
167 
169 
171 
172 
176 
181 
183 
185 
186 
191  unsigned int last_iter_cell;
192 
194 
196 
197 
203  virtual void make_matrix_block_indices();
204 
210  virtual void make_residual_indices();
211 
215  unsigned int n_species;
216 
220  unsigned int indexO2;
221 
225  unsigned int indexH2;
226 
230  unsigned int indexH2O;
231 
235  double multiplierO2;
236 
240  double multiplierH2;
241 
246 
250  std::vector<double> molar_mass;
251 
255  std::vector< FEValuesExtractors::Scalar > density_extractors;
256 
260  FEValuesExtractors::Scalar electronic_electrical_potential_extractor;
261 
265  FEValuesExtractors::Scalar protonic_electrical_potential_extractor;
266 
272  std::vector<double> T_mixture;
273 
279  std::vector<double> ORR_current_density;
280 
288 
296 
302 
307  std::vector<double> HOR_current_density;
308 
314 
320 
326 
331  std::vector< std::vector<double> > density_old;
332 
338 
344 
353  std::vector< std::vector< std::vector<double> > > phi_density;
354 
362  std::vector< std::vector<double> > phi_electronic_electrical_potential;
363 
371  std::vector< std::vector<double> > phi_protonic_electrical_potential;
372 
376  std::string eq_generic_prefix;
377 
381  std::vector<std::string> eq_postfixes;
382 
386  std::vector<std::string> var_postfixes;
387 
391  std::string eq_name;
392 
396  std::string var_name;
397 
399 
406  inline void set_species_couplings (unsigned int reacting_species_equation_number, unsigned int species_number, std::vector< couplings_map >& equation_map)
407  {
408  unsigned int index = reacting_species_equation_number;
409  unsigned int g = species_number;
410 
411  eq_name = "Kerkhof-Geboers Fluid Transport Equations - steady-state - compressible - isothermal - single-phase - multi-component - mass conservation - " + eq_postfixes[g-1];
412 
413  couplings_map::iterator iter = equation_map[index].find(eq_name);
414 
415  if( iter != equation_map[index].end() )
416  {
417  iter->second["electronic_electrical_potential"] = DoFTools::always;
418  iter->second["protonic_electrical_potential"] = DoFTools::always;
419  }
420  else
421  AssertThrow( false, ExcInternalError() );
422  }
423 
424  inline void set_density_couplings (unsigned int species_number, couplings_map::iterator iter)
425  {
426 
427  if( species_number != -1 )
428  {
429  var_name = "density_" + var_postfixes[species_number-1];
430  iter->second[var_name] = DoFTools::always;
431  }
432  else
433  AssertThrow( false, ExcNotImplemented() );
434  }
435  };
436 
437  } // Equation
438 
439 } // FuelCellShop
440 
441 #endif
virtual void make_assemblers_generic_constant_data()
This function computes Local CG FEM based assemblers - constant data (generic).
std::vector< double > DORR_current_density_Doxygen_concentration
ORR current density derivative with respect to oxygen concentration (gas, NOT gas-liquid) in the quad...
Definition: reaction_source_terms_KG.h:287
std::vector< FEValuesExtractors::Scalar > density_extractors
Density extractors.
Definition: reaction_source_terms_KG.h:255
std::vector< double > T_mixture
Constant temperature of species mixture in the quadrature points of a cell, .
Definition: reaction_source_terms_KG.h:272
virtual void declare_parameters(ParameterHandler &param) const
Declare parameters.
std::string eq_generic_prefix
For internal use only.
Definition: reaction_source_terms_KG.h:376
boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data
Data object for the application data to be passed to the equation classes.
Definition: equation_base.h:890
FuelCellShop::Kinetics::BaseKinetics * anode_kinetics
Pointer to Anode Kinetics object, initialized in the constructor.
Definition: reaction_source_terms_KG.h:180
std::vector< std::vector< double > > phi_electronic_electrical_potential
Electronic electrical potential shape functions.
Definition: reaction_source_terms_KG.h:362
std::vector< std::vector< double > > density_old
Density of each species in the quadrature points of a cell at a previous Newton iteration.
Definition: reaction_source_terms_KG.h:331
virtual void assemble_cell_residual(FuelCell::ApplicationCore::FEVector &cell_residual, const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Assemble local cell residual.
unsigned int indexO2
Keeps oxygen set of fluid transport equations.
Definition: reaction_source_terms_KG.h:220
FEValuesExtractors::Scalar electronic_electrical_potential_extractor
Electronic electrical potential extractor.
Definition: reaction_source_terms_KG.h:260
void set_species_couplings(unsigned int reacting_species_equation_number, unsigned int species_number, std::vector< couplings_map > &equation_map)
Function used to set the appropriate couplings between equations.
Definition: reaction_source_terms_KG.h:406
void set_anode_kinetics(FuelCellShop::Kinetics::BaseKinetics *kinetics)
Set the pointer to anode kinetics in the object.
Definition: reaction_source_terms_KG.h:76
void set_density_couplings(unsigned int species_number, couplings_map::iterator iter)
Definition: reaction_source_terms_KG.h:424
FuelCell::SystemManagement * system_management
Pointer to the external YourApplication&lt;dim&gt;::system_management object.
Definition: equation_base.h:798
virtual void make_assemblers_cell_constant_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info)
This function computes.
virtual void make_residual_indices()
This function fills out the max number of residual_indices which need to be updated due to the source...
virtual void make_matrix_block_indices()
This function fills out the max number of matrix_block_indices which need to be updated due to the so...
std::vector< double > DHOR_current_density_Dhydrogen_concentration
HOR current density derivative with respect to hydrogen concentration (gas, NOT gas-liquid) in the qu...
Definition: reaction_source_terms_KG.h:313
unsigned int indexH2
Keeps hydrogen set of fluid transport equations.
Definition: reaction_source_terms_KG.h:225
std::string var_name
For internal use only.
Definition: reaction_source_terms_KG.h:396
std::vector< double > ORR_current_density
ORR current density in the quadrature points of a cell at a previous Newton iteration.
Definition: reaction_source_terms_KG.h:279
std::vector< std::vector< double > > phi_protonic_electrical_potential
Protonic electrical potential shape functions.
Definition: reaction_source_terms_KG.h:371
FuelCellShop::Kinetics::BaseKinetics * get_cathode_kinetics() const
Accessor for cathode catalyst layer FuelCellShop::Kinetics::BaseKinetics pointer. ...
Definition: reaction_source_terms_KG.h:125
std::string eq_name
For internal use only.
Definition: reaction_source_terms_KG.h:391
std::vector< std::string > var_postfixes
For internal use only.
Definition: reaction_source_terms_KG.h:386
double multiplierH2
Hydrogen source multiplier, .
Definition: reaction_source_terms_KG.h:240
std::vector< double > DORR_current_density_Dprotonic_electrical_potential
ORR current density derivative with respect to protonic electrical potential in the quadrature points...
Definition: reaction_source_terms_KG.h:301
FuelCellShop::Kinetics::BaseKinetics * get_anode_kinetics() const
Accessor for anode catalyst layer FuelCellShop::Kinetics::BaseKinetics pointer.
Definition: reaction_source_terms_KG.h:133
unsigned int last_iter_cell
Variable used to store the index in cell_info-&gt;global_data of the previous Newton solution The soluti...
Definition: reaction_source_terms_KG.h:191
std::vector< double > molar_mass
Molar mass of pure gas, .
Definition: reaction_source_terms_KG.h:250
virtual void print_equation_info() const
This function prints out the info for this class.
This class is created for the objects handed to the mesh loops.
Definition: mesh_loop_info_objects.h:544
virtual void initialize(ParameterHandler &param)
Initialize parameters.
std::vector< MatrixBlock< FullMatrix< double > > > MatrixVector
The matrix vector used in the mesh loops.
Definition: matrix_block.h:102
FuelCellShop::Kinetics::BaseKinetics * cathode_kinetics
Pointer to Cathode Kinetics object, initialized in the constructor.
Definition: reaction_source_terms_KG.h:175
std::vector< double > electronic_electrical_potential_old
Electronic electrical potential in the quadrature points of a cell at a previous Newton iteration...
Definition: reaction_source_terms_KG.h:337
unsigned int indexH2O
Keeps water vapor set of fluid transport equations.
Definition: reaction_source_terms_KG.h:230
std::vector< std::vector< std::vector< double > > > phi_density
Density shape functions.
Definition: reaction_source_terms_KG.h:353
Virtual class used to provide the interface for all kinetic/reaction children.
Definition: base_kinetics.h:102
std::vector< std::string > eq_postfixes
For internal use only.
Definition: reaction_source_terms_KG.h:381
This class assembles the reaction source terms for all other transport equations, if there&#39;s any...
Definition: reaction_source_terms_base.h:57
std::vector< double > protonic_electrical_potential_old
Protonic electrical potential in the quadrature points of a cell at a previous Newton iteration...
Definition: reaction_source_terms_KG.h:343
double multiplierO2
Oxygen source multiplier, .
Definition: reaction_source_terms_KG.h:235
virtual void make_assemblers_cell_variable_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
This function computes.
IMPORTANT: Add all new solution variables and equations here !
Definition: system_management.h:300
std::vector< double > DHOR_current_density_Delectronic_electrical_potential
HOR current density derivative with respect to electronic electrical potential in the quadrature poin...
Definition: reaction_source_terms_KG.h:319
ReactionSourceTermsKG(FuelCell::SystemManagement &system_management, boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data=boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >())
Constructor.
std::vector< double > HOR_current_density
HOR current density in the quadrature points of a cell at a previous Newton iteration.
Definition: reaction_source_terms_KG.h:307
virtual void assemble_cell_matrix(FuelCell::ApplicationCore::MatrixVector &cell_matrices, const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Assemble local cell matrix.
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:46
std::vector< double > DORR_current_density_Delectronic_electrical_potential
ORR current density derivative with respect to electronic electrical potential in the quadrature poin...
Definition: reaction_source_terms_KG.h:295
Virtual class used to characterize a generic layer interface.
Definition: base_layer.h:58
This class assembles the reaction source terms for all other transport equations, if there&#39;s any...
Definition: reaction_source_terms_KG.h:35
virtual void adjust_internal_cell_couplings(std::vector< couplings_map > &dst, const std::vector< FuelCellShop::Material::PureGas * > &gases=std::vector< FuelCellShop::Material::PureGas * >())
This function is used to adjust std::vector &lt; internal_cell_couplings &gt;, which is generated after get...
std::vector< double > DHOR_current_density_Dprotonic_electrical_potential
HOR current density derivative with respect to protonic electrical potential in the quadrature points...
Definition: reaction_source_terms_KG.h:325
FEValuesExtractors::Scalar protonic_electrical_potential_extractor
Protonic electrical potential extractor.
Definition: reaction_source_terms_KG.h:265
double multiplierH2O
Water vapor source multiplier, .
Definition: reaction_source_terms_KG.h:245
unsigned int n_species
Number of species, .
Definition: reaction_source_terms_KG.h:215
void set_cathode_kinetics(FuelCellShop::Kinetics::BaseKinetics *kinetics)
Set the pointer to cathode kinetics in the object.
Definition: reaction_source_terms_KG.h:67