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) 2013 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 cell matrix and cell residual for reaction
12 // source terms in the catalyst layer for various equation classes.
13 // - Developers: Madhur Bhaiya and M. Secanell
14 // - $Id: reaction_source_terms.h 1459 2013-08-30 22:27:10Z secanell $
15 //
16 //---------------------------------------------------------------------------
17 
18 #ifndef _FCST_FUELCELLSHOP_EQUATION_REACTION_SOURCE_TERMS_H_
19 #define _FCST_FUELCELLSHOP_EQUATION_REACTION_SOURCE_TERMS_H_
20 
21 #include "utils/fcst_constants.h"
22 
24 
25 #include "layers/catalyst_layer.h"
26 
29 
30 
31 namespace FuelCellShop
32 {
33  namespace Equation
34  {
35 
37 
38 
43  DeclException2(VariableNotFoundForKinetics,
44  std::string,
45  std::string,
46  << "For " << arg1 << " kinetics source terms, \"" << arg2 << "\" is not found as one of the solution variables.");
47 
48 
50 
56  template<int dim>
57  class ReactionSourceTerms : public EquationBase<dim>
58  {
59  public:
60 
62 
63 
68 
72  virtual ~ReactionSourceTerms();
73 
77  virtual void declare_parameters(ParameterHandler& param) const;
78 
82  virtual void initialize(ParameterHandler& param);
83 
89  {
90  cathode_kinetics = kinetics;
91  }
92 
98  {
99  anode_kinetics = kinetics;
100  }
101 
103 
105 
106 
110  virtual void assemble_cell_matrix(AppFrame::MatrixVector& cell_matrices,
111  const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info,
113 
117  virtual void assemble_cell_residual(AppFrame::FEVector& cell_residual,
118  const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info,
120 
122 
124 
125 
134  virtual void adjust_internal_cell_couplings(std::vector< couplings_map >& ) const;
135 
140  virtual void print_equation_info() const;
141 
143 
144  protected:
145 
147 
148 
152 
158 
159 
161 
162 
172 
181  virtual void make_assemblers_cell_constant_data(const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info);
182 
189 
208  virtual void assemble_matrix_for_equation(AppFrame::MatrixVector& cell_matrices,
209  const typename AppFrame::DoFApplication<dim>::CellInfo& cell_info,
210  const std::string& eq_name,
211  const FEValuesBase<dim>& test_fe,
212  const std::vector< std::vector<double> >& test_shape_functions,
213  const double& sourceterm_factor);
215 
217 
218 
222 
227 
232 
237 
242 
246  double F;
247 
249 
251 
252 
260  std::vector< std::vector<double> > phi_T_cell;
261 
269  std::vector< std::vector<double> > phi_xOxygen_cell;
270 
278  std::vector< std::vector<double> > phi_phiS_cell;
279 
287  std::vector< std::vector<double> > phi_phiM_cell;
288 
296  std::vector< std::vector<double> > phi_xWater_cell;
297 
302  std::vector<double> current_cell;
303 
308  std::vector<double> dcurrent_dphiS_cell;
309 
314  std::vector<double> dcurrent_dphiM_cell;
315 
319  std::vector<double> dcurrent_dT_cell;
320 
325  std::vector<double> dcurrent_dxOxygen_cell;
326 
331  std::vector<double> dcurrent_dxWater_cell;
332 
339 
345 
351 
357 
363 
365 
367 
368 
376 
384 
386 
391  unsigned int last_iter_cell;
392 
393  };
394 
395  } // Equation
396 
397 } // FuelCellShop
398 
399 #endif