OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ficks_transport_equation.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: ficks_transport_equation.h
11 // - Description: Header file of Ficks diffusion equation class.
12 // - Developers: M. Secanell, M. Bhaiya, V. N. Zingan, A. Kosakian, M. Sabharwal
13 //
14 //---------------------------------------------------------------------------
15 
16 #ifndef _FCST_FUELCELLSHOP_EQUATION_NEW_FICKS_EQUATION_H_
17 #define _FCST_FUELCELLSHOP_EQUATION_NEW_FICKS_EQUATION_H_
18 
19 // FCST includes
20 #include <utils/fcst_units.h>
21 #include <utils/fcst_constants.h>
25 #include <layers/catalyst_layer.h>
27 
28 // STD
29 #include <sstream>
30 #include <string>
31 
32 
33 namespace FuelCellShop
34 {
35  namespace Equation
36  {
131  template<int dim>
133  :
134  public EquationBase<dim>
135  {
136  public:
138 
139 
148  boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data = boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >()
149  );
150 
156  FicksTransportEquation(FuelCell::SystemManagement& system_management, std::string& name_section, boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data = boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >());
157 
161  virtual ~FicksTransportEquation();
162 
166  virtual void declare_parameters(ParameterHandler& param);
167 
171  virtual void initialize(ParameterHandler& param);
172 
179  inline void set_solute_and_solvent( FuelCellShop::Material::PureGas* solute, FuelCellShop::Material::PureGas* solvent, ParameterHandler& param )
180  {
181  this->gas = solute;
182  this->solvent = solvent;
183 
184  std::stringstream s;
185  s <<"Ficks Transport Equation - "<<gas->name_material();
186  this->equation_name = s.str();
187 
188  std::stringstream ss;
189  ss <<gas->name_material()<<"_molar_fraction";
190  this->name_base_variable = ss.str();
191  }
192 
194 
196 
197 
198 
205  );
206 
213  );
214 
221  );
222 
224 
226 
227 
231  virtual void print_equation_info() const;
232 
238  void class_test();
239 
244  double compute_Knudsen_diffusivity(int cell_index);
245 
249  Tensor<2,dim,double> effective_diffusion_coefficient(Tensor<2,dim,double>& D_bulk,
250  double D_Knud);
252 
253  protected:
255 
256 
270  double compute_current(double x_gas);
271 
278  double get_ICCP_residual(double c_react, double c_eq);
280 
282 
283 
289 
296 
298 
300 
301 
305  std::vector<unsigned int> dirichlet_bdry_ids;
306 
311  std::map<unsigned int, double> species_flux;
312 
314 
316 
322 
332 
342 
349 
356 
358 
360 
361 
366  virtual void make_internal_cell_couplings();
367 
372  virtual void make_boundary_types();
373 
375 
377 
378 
383 
389 
394  VariableInfo xi;
395 
399  VariableInfo t_rev;
400 
404  VariableInfo s_liquid_water;
405 
409  VariableInfo p_liquid_water;
410 
412 
414 
415 
420  std::vector< Tensor< 2, dim > > conc_Deff_cell;
421 
427  std::vector< Tensor<2,dim> > dconc_Deff_dT_cell;
428 
434  std::vector< Tensor<2,dim> > dconc_Deff_ds_cell;
435 
436 
442  std::vector< Tensor<2,dim> > dconc_Deff_dp_cell;
443 
451  std::vector< std::vector< double > > phi_xi_cell;
452 
460  std::vector< std::vector< Tensor<1,dim> > > grad_phi_xi_cell;
461 
469  std::vector< std::vector< double > > phi_T_cell;
470 
478  std::vector< std::vector< double > > phi_s_cell;
479 
487  std::vector< std::vector< double > > phi_p_cell;
488 
490 
492 
493 
501  std::vector< std::vector<double> > phi_xi_bdry;
502 
504 
509  unsigned int last_iter_cell;
510 
515  unsigned int last_iter_bdry;
516 
517 
518 
519  private:
520 
524  boost::shared_ptr<FuelCellShop::Kinetics::BaseKinetics> kinetics;
525 
529  boost::shared_ptr<FuelCellShop::Material::PolymerElectrolyteBase> electrolyte;
530 
534  boost::shared_ptr<FuelCellShop::Material::CatalystBase> catalyst;
535 
539  double concentration;
540 
544  double electronic_pot;
545 
549  double protonic_pot;
550 
554  double temperature;
555 
559  double k_ionomer;
560 
564  double delta;
565 
569  double prefactor;
570 
571  };
572 
573 } // Equation
574 
575 } // FuelCellShop
576 
577 #endif
double compute_Knudsen_diffusivity(int cell_index)
Member function used to compute the effective Knudsen diffusivity using the Knudsen radius entered us...
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_bdry_residual(FuelCell::ApplicationCore::FEVector &bdry_rhs, const typename FuelCell::ApplicationCore::DoFApplication< dim >::FaceInfo &bdry_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Assemble local boundary residual.
void set_solute_and_solvent(FuelCellShop::Material::PureGas *solute, FuelCellShop::Material::PureGas *solvent, ParameterHandler &param)
Method to set solute and solve if other constructor (not passing solute and solvent in the constructo...
Definition: ficks_transport_equation.h:179
virtual void assemble_cell_residual(FuelCell::ApplicationCore::FEVector &cell_rhs, const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Assemble local cell residual for nonlinear problems.
virtual void assemble_cell_linear_matrix(FuelCell::ApplicationCore::MatrixVector &cell_matrices, const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Assemble the local cell matrix for Linear problems.
Definition: equation_base.h:613
virtual void make_assemblers_bdry_constant_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::FaceInfo &bdry_info)
Definition: equation_base.h:450
FuelCell::SystemManagement * system_management
Pointer to the external YourApplication&lt;dim&gt;::system_management object.
Definition: equation_base.h:798
virtual void declare_parameters(ParameterHandler &param)
Declare parameters.
virtual void make_boundary_types()
This function fills out boundary_types of a derived equation class.
Definition: equation_base.h:536
virtual void make_assemblers_cell_constant_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info)
Function used to initialize cell speciific information that remains constant regardless of the cell b...
Definition: equation_base.h:442
std::string name_base_variable
Const std::string member storing name of the base solution variable corresponding to the equation rep...
Definition: equation_base.h:861
virtual void assemble_cell_Jacobian_matrix(FuelCell::ApplicationCore::MatrixVector &cell_matrices, const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Assemble the local Jacobian Matrix for Non-Linear problems.
Definition: equation_base.h:589
This class is created for the objects handed to the mesh loops.
Definition: mesh_loop_info_objects.h:544
std::vector< MatrixBlock< FullMatrix< double > > > MatrixVector
The matrix vector used in the mesh loops.
Definition: matrix_block.h:102
virtual void make_assemblers_cell_variable_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::CellInfo &cell_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Function used to compute cell specific information such as shape functions, shape function gradients...
Definition: equation_base.h:461
const std::string & name_material() const
Return the name of the layer.
Definition: base_material.h:77
Tensor< 2, dim, double > effective_diffusion_coefficient(Tensor< 2, dim, double > &D_bulk, double D_Knud)
Member function used to compute effective diffusion coefficient using the Bosanquet approximation by ...
virtual void assemble_bdry_matrix(FuelCell::ApplicationCore::MatrixVector &bdry_matrices, const typename FuelCell::ApplicationCore::DoFApplication< dim >::FaceInfo &bdry_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Assemble local boundary matrix.
virtual void initialize(ParameterHandler &param)
Initialize parameters.
virtual void make_assemblers_generic_constant_data()
Function used to initialize variable information that will be needed to assemble matrix and residual ...
Definition: equation_base.h:430
This class is a base class for all pure gases used in OpenFCST.
Definition: PureGas.h:88
void class_test()
Member function used to test the functionality of the class.
FicksTransportEquation(FuelCell::SystemManagement &system_management, FuelCellShop::Material::PureGas *solute, FuelCellShop::Material::PureGas *solvent, 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
virtual void print_equation_info() const
The function printing out the equations info.
virtual void make_internal_cell_couplings()
This function fills out internal_cell_couplings of a derived equation class.
Definition: equation_base.h:507
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
virtual void make_assemblers_bdry_variable_data(const typename FuelCell::ApplicationCore::DoFApplication< dim >::FaceInfo &bdry_info, FuelCellShop::Layer::BaseLayer< dim > *const layer)
Definition: equation_base.h:470
double compute_current(double x_gas)
Computes the current using oxygen dissolution in the ionomer film by solving a Newton loop...
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:46
This class deals with Fick&#39;s Transport Equation.
Definition: ficks_transport_equation.h:132
Virtual class used to characterize a generic layer interface.
Definition: base_layer.h:58
std::string equation_name
The name of a derived equation class.
Definition: equation_base.h:855