OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sorption_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: sorption_source_terms.h
11 // - Description: This class is used to assemble cell matrix and cell residual
12 // corresponding to sorption/desorption of water inside the catalyst layer.
13 // - Developers: Marc Secanell, Madhur Bhaiya
14 // - $Id: sorption_source_terms.h 2605 2014-08-15 03:36:44Z secanell $
15 //
16 //---------------------------------------------------------------------------
17 
18 #ifndef _FCST_FUELCELLSHOP_EQUATION_SORPTION_SOURCE_TERMS_H_
19 #define _FCST_FUELCELLSHOP_EQUATION_SORPTION_SOURCE_TERMS_H_
20 
21 #include "utils/fcst_constants.h"
23 #include "layers/catalyst_layer.h"
24 
25 
26 namespace FuelCellShop
27 {
28  namespace Equation
29  {
31 
32 
37  DeclException2(VariableNotFoundForSorption,
38  std::string,
39  std::string,
40  << arg1 << " should be one of the solution variables, in order to account for " << arg2 << " .");
41 
43 
102  template<int dim>
103  class SorptionSourceTerms : public EquationBase<dim>
104  {
105  public:
106 
108 
109 
114 
118  virtual ~SorptionSourceTerms();
119 
123  virtual void declare_parameters(ParameterHandler& param) const;
124 
128  virtual void initialize(ParameterHandler& param);
129 
131 
133 
134 
141 
148 
150 
152 
153 
162  virtual void adjust_internal_cell_couplings(std::vector< couplings_map >& ) const;
163 
168  virtual void print_equation_info() const;
169 
173  double get_time_constant() const
174  {
175  return time_constant;
176  }
177 
182  inline bool get_flag_sorp_heat_cl() const
183  {
184  return flag_sorp_heat_cl;
185  }
186 
188 
189  protected:
190 
192 
193 
199 
201 
203 
204 
214 
224 
231 
252  const std::string& eq_name,
253  const FEValuesBase<dim>& test_fe,
254  const std::vector< std::vector<double> >& test_shape_functions,
255  const double& sourceterm_factor);
257 
259 
260 
265 
270 
275 
280 
282 
284 
285 
289  double rho_dry_cell;
290 
294  double EW_cell;
295 
300  std::vector<double> lambda_eq_cell;
301 
306  std::vector<double> dlambdaEq_dxWater_cell;
307 
312  std::vector<double> dlambdaEq_dT_cell;
313 
318  std::vector<double> h_sorp_cell;
319 
324  std::vector<double> dhsorp_dT_cell;
325 
333  std::vector< std::vector<double> > phi_T_cell;
334 
342  std::vector< std::vector<double> > phi_lambda_cell;
343 
351  std::vector< std::vector<double> > phi_xWater_cell;
352 
354 
360 
365  unsigned int last_iter_cell;
366 
367  };
368 
369  } // Equation
370 
371 } // FuelCellShop
372 
373 #endif
VariableInfo x_water
VariableInfo structure corresponding to &quot;water_molar_fraction&quot;.
Definition: sorption_source_terms.h:264
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...
bool flag_sorp_heat_cl
This boolean data member indicates that the heat release/absorption, due to sorption/desorption insid...
Definition: sorption_source_terms.h:198
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.
double time_constant
Time constant, [1/s].
Definition: sorption_source_terms.h:279
std::vector< double > lambda_eq_cell
from sorption isotherm, at all quadrature points in the cell.
Definition: sorption_source_terms.h:300
This class assembles source terms corresponding to sorption/desorption of water inside the catalyst l...
Definition: sorption_source_terms.h:103
virtual void adjust_internal_cell_couplings(std::vector< couplings_map > &) const
This function is used to adjust std::vector &lt; internal_cell_couplings &gt;, which is generated after get...
FuelCell::SystemManagement * system_management
Pointer to the external YourApplication&lt;dim&gt;::system_management object.
Definition: equation_base.h:817
std::vector< std::vector< double > > phi_T_cell
shape functions.
Definition: sorption_source_terms.h:333
std::vector< double > h_sorp_cell
Enthalpy of sorption of water, [J/mol], at all quadrature points in the cell.
Definition: sorption_source_terms.h:318
std::vector< double > dlambdaEq_dxWater_cell
Derivative of w.r.t &quot;water_molar_fraction&quot;, at all quadrature points in the cell.
Definition: sorption_source_terms.h:306
std::vector< std::vector< double > > phi_xWater_cell
shape functions.
Definition: sorption_source_terms.h:351
virtual void declare_parameters(ParameterHandler &param) const
Declare parameters.
VariableInfo lambda
VariableInfo structure corresponding to &quot;membrane_water_content&quot;.
Definition: sorption_source_terms.h:269
virtual void print_equation_info() const
This function prints out the info for this class.
virtual void initialize(ParameterHandler &param)
Initialize parameters.
bool get_flag_sorp_heat_cl() const
Method to get whether the heat release/absorption due to sorption/desorption, inside the catalyst lay...
Definition: sorption_source_terms.h:182
This class is created for the objects handed to the mesh loops.
Definition: mesh_loop_info_objects.h:625
double rho_dry_cell
Density [gm/cm^3] of the dry polymer electrolyte material in the cell.
Definition: sorption_source_terms.h:289
double EW_cell
Equivalent weight of the polymer electrolyte material in the cell.
Definition: sorption_source_terms.h:294
std::vector< MatrixBlock< FullMatrix< double > > > MatrixVector
The matrix vector used in the mesh loops.
Definition: matrix_block.h:102
DeclException2(VariableShouldExistForEquation, std::string, std::string,<< "The user-defined variable with name \""<< arg1<< "\" should be one of the solution variables for equation with name \""<< arg2<< "\"")
Exception thrown when a particular variable required by the equation class, does not exist in the use...
double get_time_constant() const
Returns time constant [1/s].
Definition: sorption_source_terms.h:173
std::vector< double > dlambdaEq_dT_cell
Derivative of w.r.t &quot;temperature_of_REV&quot;, at all quadrature points in the cell.
Definition: sorption_source_terms.h:312
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.
This class contains generic data and methods heavily used by all derived equation classes...
Definition: equation_base.h:199
SorptionSourceTerms(FuelCell::SystemManagement &system_management)
Constructor.
std::vector< std::vector< double > > phi_lambda_cell
shape functions.
Definition: sorption_source_terms.h:342
IMPORTANT: Add all new solution variables and equations here !
Definition: system_management.h:271
This simple structure stores certain information regarding a particular variable for the equation (al...
Definition: equation_base.h:121
std::vector< double > dhsorp_dT_cell
Derivative of w.r.t &quot;temperature_of_REV&quot;, at all quadrature points in the cell.
Definition: sorption_source_terms.h:324
virtual void make_assemblers_generic_constant_data()
This function computes Local CG FEM based assemblers - constant data (generic).
virtual void make_assemblers_cell_constant_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info)
This function computes.
bool cell_residual_counter
Counter set to TRUE when cell_residual is being assembled.
Definition: sorption_source_terms.h:359
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:39
Virtual class used to characterize a generic layer interface.
Definition: base_layer.h:58
VariableInfo t_rev
VariableInfo structure corresponding to &quot;temperature_of_REV&quot;.
Definition: sorption_source_terms.h:274
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 last_iter_cell
Variable used to store the index in cell_info-&gt;global_data of the previous Newton solution The soluti...
Definition: sorption_source_terms.h:365