OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reaction_source_terms.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2006-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.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: Madhur Bhaiya, Marc Secanell, Valentin N. Zingan
14 //
15 // ----------------------------------------------------------------------------
16 
17 #ifndef _FCST_FUELCELLSHOP_EQUATION_REACTION_SOURCE_TERMS_H_
18 #define _FCST_FUELCELLSHOP_EQUATION_REACTION_SOURCE_TERMS_H_
19 
23 
24 namespace FuelCellShop
25 {
26  namespace Equation
27  {
28 
36  template<int dim>
37  class ReactionSourceTerms : public EquationBase<dim>
38  {
39  public:
40 
42 
43 
47  ReactionSourceTerms(FuelCell::SystemManagement& system_management,boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data =
48  boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >());
49 
53  virtual ~ReactionSourceTerms();
54 
58  virtual void declare_parameters(ParameterHandler& param) const;
59 
63  virtual void initialize(ParameterHandler& param);
64 
70  {
71  cathode_kinetics = kinetics;
72  }
73 
79  {
80  anode_kinetics = kinetics;
81  }
82 
84 
86 
87 
94 
101 
103 
105 
106 
115  virtual void adjust_internal_cell_couplings( std::vector< couplings_map >& dst);
116 
121  virtual void print_equation_info() const;
122 
127  inline bool get_irrev_heat_ccl() const
128  {
129  return irrev_heat_ccl;
130  }
131 
136  inline bool get_irrev_heat_acl() const
137  {
138  return irrev_heat_acl;
139  }
140 
145  inline bool get_rev_heat() const
146  {
147  return rev_heat;
148  }
149 
154  inline double get_factor_rev_heat_ccl() const
155  {
156  return factor_rev_heat_ccl;
157  }
158 
164  inline bool get_water_vap_heat_ccl() const
165  {
166  return water_vap_heat_ccl;
167  }
168 
173  {
174  return cathode_kinetics;
175  }
176 
181  {
182  return anode_kinetics;
183  }
184 
186 
187  protected:
188 
190 
191 
201 
211 
218 
241  const std::string& eq_name,
242  const FEValuesBase<dim>& test_fe,
243  const std::vector< std::vector<double> >& test_shape_functions,
244  const double& sourceterm_factor);
245 
247 
249 
250 
256 
262 
267  bool rev_heat;
268 
273 
279 
285 
291 
293 
295 
296 
301 
306 
308 
310 
311 
318 
325 
327 
329 
330 
335 
340 
345 
350 
355 
360 
365 
370 
375 
379  double F;
380 
384  double M_water;
385 
387 
389 
390 
398  std::vector< std::vector<double> > phi_T_cell;
399 
407  std::vector< std::vector<double> > phi_xOxygen_cell;
408 
416  std::vector< std::vector<double> > phi_xHydrogen_cell;
417 
425  std::vector< std::vector<double> > phi_phiS_cell;
426 
434  std::vector< std::vector<double> > phi_phiM_cell;
435 
443  std::vector< std::vector<double> > phi_xWater_cell;
444 
452  std::vector< std::vector<double> > phi_s_cell;
453 
454  std::vector< std::vector<double> > phi_p_cell;
455 
460  std::vector<double> current_cell;
461 
469  std::vector<double> heat_cell;
470 
475  std::vector<double> dcurrent_dphiS_cell;
476 
481  std::vector<double> dcurrent_dphiM_cell;
482 
486  std::vector<double> dcurrent_dT_cell;
487 
492  std::vector<double> dcurrent_dxOxygen_cell;
493 
498  std::vector<double> dcurrent_dxHydrogen_cell;
499 
504  std::vector<double> dcurrent_dxWater_cell;
505 
510  std::vector<double> dheat_dphiS_cell;
511 
516  std::vector<double> dheat_dphiM_cell;
517 
522  std::vector<double> dheat_dT_cell;
523 
528  std::vector<double> dheat_dxOxygen_cell;
529 
534  std::vector<double> dheat_dxHydrogen_cell;
535 
540  std::vector<double> dheat_dxWater_cell;
541 
548 
554 
560 
566 
572 
579 
586 
588 
590 
592 
593 
601 
609 
614  unsigned int last_iter_cell;
615 
617 
618  };
619 
620  } // Equation
621 
622 } // FuelCellShop
623 
624 #endif
std::vector< double > dheat_dphiS_cell
Derivative of heat produced w.r.t.
Definition: reaction_source_terms.h:510
std::vector< std::vector< double > > phi_p_cell
Definition: reaction_source_terms.h:454
double factor_saturationtranseq_cell
Factor for.
Definition: reaction_source_terms.h:585
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.
double M_water
Molar weight of water in grams/mole.
Definition: reaction_source_terms.h:384
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
virtual void initialize(ParameterHandler &param)
Initialize parameters.
double factor_watertranseq_cell
Factor for.
Definition: reaction_source_terms.h:578
FuelCellShop::Kinetics::BaseKinetics * get_anode_kinetics() const
Accessor for anode catalyst layer FuelCellShop::Kinetics::BaseKinetics pointer.
Definition: reaction_source_terms.h:180
virtual void make_assemblers_generic_constant_data()
This function computes Local CG FEM based assemblers - constant data (generic).
std::vector< std::vector< double > > phi_s_cell
shape functions.
Definition: reaction_source_terms.h:452
FuelCellShop::Kinetics::BaseKinetics * anode_kinetics
Pointer to Anode Kinetics object, initialized in the constructor.
Definition: reaction_source_terms.h:305
virtual void print_equation_info() const
This function prints out the info for this class.
bool cell_matrix_counter
Counter set to TRUE when cell_matrix is being assembled.
Definition: reaction_source_terms.h:600
std::vector< double > dcurrent_dphiM_cell
Derivative of current w.r.t.
Definition: reaction_source_terms.h:481
FuelCellShop::Equation::ReactionHeat * cathode_reactionheat
Pointer to Cathode ReactionHeat object.
Definition: reaction_source_terms.h:317
std::vector< double > dcurrent_dxOxygen_cell
Derivative of current w.r.t.
Definition: reaction_source_terms.h:492
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.
ReactionSourceTerms(FuelCell::SystemManagement &system_management, boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data=boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >())
Constructor.
std::vector< std::vector< double > > phi_xWater_cell
shape functions.
Definition: reaction_source_terms.h:443
std::vector< double > current_cell
Current produced [A/cm^3] at all quadrature points in the cell.
Definition: reaction_source_terms.h:460
bool water_vapour_phase
This boolean data member indicates that whether the water is produced in vapour phase (i...
Definition: reaction_source_terms.h:278
double factor_protontranseq_cell
Factor for.
Definition: reaction_source_terms.h:553
FuelCell::SystemManagement * system_management
Pointer to the external YourApplication&lt;dim&gt;::system_management object.
Definition: equation_base.h:798
FuelCellShop::Equation::ReactionHeat * anode_reactionheat
Pointer to Anode Reactionheat object.
Definition: reaction_source_terms.h:324
VariableInfo x_oxygen
VariableInfo structure corresponding to &quot;oxygen_molar_fraction&quot;.
Definition: reaction_source_terms.h:334
double factor_hydrogentranseq_cell
Factor for.
Definition: reaction_source_terms.h:571
bool rev_heat
This boolean data member indicates that the reversible (entropic) heat source due to net reaction for...
Definition: reaction_source_terms.h:267
virtual void make_assemblers_cell_constant_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info)
This function computes.
double factor_capillarytranseq_cell
Definition: reaction_source_terms.h:587
double factor_oxygentranseq_cell
Factor for.
Definition: reaction_source_terms.h:565
bool get_rev_heat() const
Method to get whether the reversible (entropic) heating due to net reaction forming liquid water prod...
Definition: reaction_source_terms.h:145
VariableInfo x_hydrogen
VariableInfo structure corresponding to &quot;hydrogen_molar_fraction&quot;.
Definition: reaction_source_terms.h:339
VariableInfo p_liquid_water
VariableInfo structure corresponding to &quot;capillary_pressure&quot;.
Definition: reaction_source_terms.h:374
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.h:614
FuelCellShop::Kinetics::BaseKinetics * get_cathode_kinetics() const
Accessor for cathode catalyst layer FuelCellShop::Kinetics::BaseKinetics pointer. ...
Definition: reaction_source_terms.h:172
VariableInfo phi_s
VariableInfo structure corresponding to &quot;electronic_electrical_potential&quot;.
Definition: reaction_source_terms.h:349
double F
Universal Faraday&#39;s constant.
Definition: reaction_source_terms.h:379
This class is created for the objects handed to the mesh loops.
Definition: mesh_loop_info_objects.h:544
virtual void adjust_internal_cell_couplings(std::vector< couplings_map > &dst)
This function is used to adjust std::vector &lt; internal_cell_couplings &gt;, which is generated after get...
std::vector< std::vector< double > > phi_xOxygen_cell
shape functions.
Definition: reaction_source_terms.h:407
std::vector< MatrixBlock< FullMatrix< double > > > MatrixVector
The matrix vector used in the mesh loops.
Definition: matrix_block.h:102
virtual void declare_parameters(ParameterHandler &param) const
Declare parameters.
std::vector< double > dcurrent_dxHydrogen_cell
Derivative of current w.r.t.
Definition: reaction_source_terms.h:498
bool cell_residual_counter
Counter set to TRUE when cell_residual is being assembled.
Definition: reaction_source_terms.h:608
std::vector< double > dheat_dT_cell
Derivative of heat produced w.r.t.
Definition: reaction_source_terms.h:522
std::vector< double > dcurrent_dxWater_cell
Derivative of current w.r.t.
Definition: reaction_source_terms.h:504
std::vector< double > dcurrent_dT_cell
Derivative of current w.r.t.
Definition: reaction_source_terms.h:486
VariableInfo s_liquid_water
VariableInfo structure corresponding to &quot;liquid_water_saturation&quot;.
Definition: reaction_source_terms.h:369
std::vector< double > heat_cell
Heat produced due to electrochemical reaction [W/cm^2] at all quadrature points in the cell...
Definition: reaction_source_terms.h:469
std::vector< std::vector< double > > phi_xHydrogen_cell
shape functions.
Definition: reaction_source_terms.h:416
double factor_electrontranseq_cell
Factor for.
Definition: reaction_source_terms.h:559
Virtual class used to provide the interface for all kinetic/reaction children.
Definition: base_kinetics.h:102
std::vector< double > dcurrent_dphiS_cell
Derivative of current w.r.t.
Definition: reaction_source_terms.h:475
double factor_rev_heat_ccl
This represents the fraction of reversible heat released corresponding to half-cell reaction of ORR...
Definition: reaction_source_terms.h:272
bool irrev_heat_acl
This boolean data member indicates that the ir-reversible heating due to HOR, inside the anode cataly...
Definition: reaction_source_terms.h:261
This class assembles the reaction source terms for all other transport equations, if there&#39;s any...
Definition: reaction_source_terms.h:37
This is the base class used for all Equation classes.
Definition: equation_base.h:160
bool water_vap_heat_ccl
This boolean data member indicates that the heat sink due to evaporation of water produced during the...
Definition: reaction_source_terms.h:284
std::string equation_name_liquid_water
This string data member indicates that the liquid water generated for the whole MEA or only cathode...
Definition: reaction_source_terms.h:290
std::vector< double > dheat_dphiM_cell
Derivative of heat produced w.r.t.
Definition: reaction_source_terms.h:516
IMPORTANT: Add all new solution variables and equations here !
Definition: system_management.h:300
double active_area_cell
Active area [cm^2/cm^3] of the cell.
Definition: reaction_source_terms.h:547
This simple structure stores certain information regarding a particular variable for the equation (al...
Definition: equation_auxiliaries.h:51
FuelCellShop::Kinetics::BaseKinetics * cathode_kinetics
Pointer to Cathode Kinetics object, initialized in the constructor.
Definition: reaction_source_terms.h:300
VariableInfo lambda
VariableInfo structure corresponding to &quot;membrane_water_content&quot;.
Definition: reaction_source_terms.h:354
bool get_irrev_heat_acl() const
Method to get whether the ir-reversible heating due to HOR, inside the anode catalyst layer is ON or ...
Definition: reaction_source_terms.h:136
virtual void assemble_matrix_for_equation(FuelCell::ApplicationCore::MatrixVector &cell_matrices, const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, const std::string &eq_name, const FEValuesBase< dim > &test_fe, const std::vector< std::vector< double > > &test_shape_functions, const double &sourceterm_factor)
This function is specifically created for assembly of cell matrices for the following equations...
double get_factor_rev_heat_ccl() const
Method to get the fraction of reversible heat released corresponding to half-cell reaction of ORR...
Definition: reaction_source_terms.h:154
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.
bool get_water_vap_heat_ccl() const
Method to get whether the heat sink due to evaoration of water produced during the ORR inside the ath...
Definition: reaction_source_terms.h:164
std::vector< std::vector< double > > phi_T_cell
shape functions.
Definition: reaction_source_terms.h:398
std::vector< double > dheat_dxHydrogen_cell
Derivative of heat produced w.r.t.
Definition: reaction_source_terms.h:534
VariableInfo t_rev
VariableInfo structure corresponding to &quot;temperature_of_REV&quot;.
Definition: reaction_source_terms.h:364
std::vector< double > dheat_dxOxygen_cell
Derivative of heat produced w.r.t.
Definition: reaction_source_terms.h:528
VariableInfo phi_m
VariableInfo structure corresponding to &quot;protonic_electrical_potential&quot;.
Definition: reaction_source_terms.h:359
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:46
std::vector< std::vector< double > > phi_phiM_cell
shape functions.
Definition: reaction_source_terms.h:434
void set_cathode_kinetics(FuelCellShop::Kinetics::BaseKinetics *kinetics)
Set the pointer to cathode kinetics in the object.
Definition: reaction_source_terms.h:69
Virtual class used to characterize a generic layer interface.
Definition: base_layer.h:58
VariableInfo x_water
VariableInfo structure corresponding to &quot;water_molar_fraction&quot;.
Definition: reaction_source_terms.h:344
This class is used to compute non-linear reaction heat source terms in a catalyst layer...
Definition: reaction_heat.h:83
void set_anode_kinetics(FuelCellShop::Kinetics::BaseKinetics *kinetics)
Set the pointer to anode kinetics in the object.
Definition: reaction_source_terms.h:78
bool get_irrev_heat_ccl() const
Method to get whether the ir-reversible heating due to ORR, inside the cathode catalyst layer is ON o...
Definition: reaction_source_terms.h:127
std::vector< double > dheat_dxWater_cell
Derivative of heat produced w.r.t.
Definition: reaction_source_terms.h:540
bool irrev_heat_ccl
This boolean data member indicates that the ir-reversible heating due to ORR, inside the cathode cata...
Definition: reaction_source_terms.h:255
std::vector< std::vector< double > > phi_phiS_cell
shape functions.
Definition: reaction_source_terms.h:425