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 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FCST_FUELCELLSHOP_EQUATION_SORPTION_SOURCE_TERMS_H_
18 #define _FCST_FUELCELLSHOP_EQUATION_SORPTION_SOURCE_TERMS_H_
19 
21 #include <layers/catalyst_layer.h>
22 
23 
24 namespace FuelCellShop
25 {
26  namespace Equation
27  {
29 
30 
35  DeclException2(VariableNotFoundForSorption,
36  std::string,
37  std::string,
38  << arg1 << " should be one of the solution variables, in order to account for " << arg2 << " .");
39 
41 
100  template<int dim>
101  class SorptionSourceTerms : public EquationBase<dim>
102  {
103  public:
104 
106 
107 
111  SorptionSourceTerms(FuelCell::SystemManagement& system_management,boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data =
112  boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >());
113 
117  virtual ~SorptionSourceTerms();
118 
122  virtual void declare_parameters(ParameterHandler& param) const;
123 
127  virtual void initialize(ParameterHandler& param);
128 
130 
132 
133 
140 
147 
149 
151 
152 
161  virtual void adjust_internal_cell_couplings(std::vector< couplings_map >& ) const;
162 
167  virtual void print_equation_info() const;
168 
172  double get_time_constant() const
173  {
174  return time_constant;
175  }
176 
181  inline bool get_flag_sorp_heat_cl() const
182  {
183  return flag_sorp_heat_cl;
184  }
185 
187 
188  protected:
189 
191 
192 
198 
200 
202 
203 
213 
223 
230 
251  const std::string& eq_name,
252  const FEValuesBase<dim>& test_fe,
253  const std::vector< std::vector<double> >& test_shape_functions,
254  const double& sourceterm_factor);
256 
258 
259 
264 
269 
274 
279 
281 
283 
284 
288  double rho_dry_cell;
289 
293  double EW_cell;
294 
299  std::vector<double> lambda_eq_cell;
300 
305  std::vector<double> dlambdaEq_dxWater_cell;
306 
311  std::vector<double> dlambdaEq_dT_cell;
312 
317  std::vector<double> h_sorp_cell;
318 
323  std::vector<double> dhsorp_dT_cell;
324 
332  std::vector< std::vector<double> > phi_T_cell;
333 
341  std::vector< std::vector<double> > phi_lambda_cell;
342 
350  std::vector< std::vector<double> > phi_xWater_cell;
351 
353 
359 
364  unsigned int last_iter_cell;
365 
366  };
367 
368  } // Equation
369 
370 } // FuelCellShop
371 
372 #endif
VariableInfo x_water
VariableInfo structure corresponding to &quot;water_molar_fraction&quot;.
Definition: sorption_source_terms.h:263
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 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:197
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:278
std::vector< double > lambda_eq_cell
from sorption isotherm, at all quadrature points in the cell.
Definition: sorption_source_terms.h:299
This class assembles source terms corresponding to sorption/desorption of water inside the catalyst l...
Definition: sorption_source_terms.h:101
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:798
std::vector< std::vector< double > > phi_T_cell
shape functions.
Definition: sorption_source_terms.h:332
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:317
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:305
std::vector< std::vector< double > > phi_xWater_cell
shape functions.
Definition: sorption_source_terms.h:350
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:268
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:181
This class is created for the objects handed to the mesh loops.
Definition: mesh_loop_info_objects.h:544
double rho_dry_cell
Density [gm/cm^3] of the dry polymer electrolyte material in the cell.
Definition: sorption_source_terms.h:288
double EW_cell
Equivalent weight of the polymer electrolyte material in the cell.
Definition: sorption_source_terms.h:293
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:172
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:311
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.
SorptionSourceTerms(FuelCell::SystemManagement &system_management, boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data=boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >())
Constructor.
This is the base class used for all Equation classes.
Definition: equation_base.h:160
std::vector< std::vector< double > > phi_lambda_cell
shape functions.
Definition: sorption_source_terms.h:341
IMPORTANT: Add all new solution variables and equations here !
Definition: system_management.h:300
This simple structure stores certain information regarding a particular variable for the equation (al...
Definition: equation_auxiliaries.h:51
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:323
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:358
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:46
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:273
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:364