OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PSD_base.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: PSD_base.h
11 // - Description: Base class for pore size distribution model.
12 // - Developers: 2009-13 by Marc Secanell, University of Alberta
13 // 2013-14 by Jie Zhou, University of Alberta
14 // - $ $
15 //
16 //---------------------------------------------------------------------------
17 #ifndef _FUELCELLSHOP__BASE__PSD_H
18 #define _FUELCELLSHOP__BASE__PSD_H
19 
20 // Include deal.II classes
21 #include <deal.II/base/parameter_handler.h>
22 #include <deal.II/base/point.h>
23 #include <deal.II/base/function.h>
24 #include <deal.II/lac/vector.h>
25 #include <deal.II/fe/fe_values.h>
26 
27 //Include STL
28 #include <cmath>
29 #include <iostream>
30 #include <math.h>
31 
32 // Include OpenFCST routines:
35 #include <utils/fcst_utilities.h>
36 #include <utils/fcst_constants.h>
37 
38 using namespace dealii;
39 
40 namespace FuelCellShop
41 {
42 
43 
44  namespace MicroScale
45  {
128  template <int dim>
129  class BasePSD : public Subscriptor
130  {
131  public:
132 
134 
135 
138  virtual ~BasePSD() {}
140 
142 
143 
162  static void declare_PSD_parameters (ParameterHandler &param)
163  {
166  iterator++)
167  {
168  iterator->second->declare_parameters(param);
169  }
170  }
171 
185  static boost::shared_ptr<FuelCellShop::MicroScale::BasePSD<dim> > create_PSD (const std::string& psd_section_name,
186  ParameterHandler &param)
187  {
188  boost::shared_ptr<FuelCellShop::MicroScale::BasePSD<dim> > pointer;
189 
190  std::string concrete_name;
191 
192  param.enter_subsection("PSD parameters");
193  {
194  param.enter_subsection("BasePSD");
195  {
196  concrete_name = param.get("psd type");
197  }
198  param.leave_subsection();
199  }
200  param.leave_subsection();
201 
203 
205  {
206  if (iterator->second)
207  {
208  pointer = iterator->second->create_replica(psd_section_name);
209  }
210  else
211  {
212  FcstUtilities::log<<"Pointer not initialized"<<std::endl;
213  abort();
214  }
215  }
216  else
217  {
218  FcstUtilities::log<<"Concrete name in FuelCellShop::MicroScale::BasePSD::create_psd does not exist"<<std::endl;
219  abort();
220  }
221 
222  pointer->initialize(param);
223 
224  return pointer;
225  }
227 
229 
230 
248  virtual const std::type_info& get_base_type() const
249  {
250  const std::type_info& info = typeid(*this);
251  FcstUtilities::log << "Pure function " << __FUNCTION__
252  << " called in Class "
253  << info.name() << std::endl;
254  }
255 
256 
260  inline void set_porosity(double porosity )
261  {
262  this->por = porosity;
263  }
264 
268  inline double get_porosity() const
269  {
270  return this->por;
271  }
272 
278  inline void set_derivative_flags(const std::vector<VariableNames>& flags)
279  {
280  this->derivative_flags = flags;
281  }
282 
294  virtual void set_constant_solution(const double& value, const VariableNames& name)
295  {
296  constant_solutions[name] = value;
297  }
298 
308  virtual void set_solution(const std::vector< SolutionVariable >&)
309  {
310  const std::type_info& info = typeid(*this);
311  deallog << "Pure function " << __FUNCTION__
312  << " called in Class "
313  << info.name() << std::endl;
314  }
315 
320  virtual inline void set_temperature (const SolutionVariable& T_in)
321  {
322  const std::type_info& info = typeid(*this);
323  deallog << "Pure function " << __FUNCTION__
324  << " called in Class "
325  << info.name() << std::endl;
326  }
327 
332  virtual inline void set_capillary_pressure (const SolutionVariable& C_in)
333  {
334  const std::type_info& info = typeid(*this);
335  deallog << "Pure function " << __FUNCTION__
336  << " called in Class "
337  << info.name() << std::endl;
338  }
339 
346  virtual inline void set_critical_radius()
347  {
348  const std::type_info& info = typeid(*this);
349  deallog << "Pure function " << __FUNCTION__
350  << " called in Class "
351  << info.name() << std::endl;
352 
353  }
358  virtual inline void get_PSD_plot()
359  {
360  const std::type_info& info = typeid(*this);
361  deallog << "Pure function " << __FUNCTION__
362  << " called in Class "
363  << info.name() << std::endl;
364  }
365 
372  virtual inline void set_saturation()
373  {
374  const std::type_info& info = typeid(*this);
375  deallog << "Pure function " << __FUNCTION__
376  << " called in Class "
377  << info.name() << std::endl;
378  }
379 
386  virtual inline void initialize(ParameterHandler &param)
387  {
388  const std::type_info& info = typeid(*this);
389  deallog << "Pure function " << __FUNCTION__
390  << " called in Class "
391  << info.name() << std::endl;
392  }
394 
396 
397 
400  inline const std::string& name_psd() const
401  {
402  return name;
403  }
404 
409  virtual void print_psd_properties() const
410  {
411  const std::type_info& info = typeid(*this);
412  deallog << "Pure function " << __FUNCTION__
413  << " called in Class "
414  << info.name() << std::endl;
415  }
416 
429  virtual void get_saturation(std::vector<double>& ) const = 0;
430  virtual void get_derivative_saturation(std::vector<double>& ) const = 0;
436  virtual void get_global_saturated_permeability(double& ) const = 0;
437 
443  virtual void get_relative_liquid_permeability(std::vector<double>& ) const = 0;
444 
450  virtual void get_derivative_relative_liquid_permeability(std::vector<double>& ) const = 0;
451 
457  virtual void get_relative_gas_permeability(std::vector<double>& ) const = 0;
458 
464  virtual void get_liquid_gas_interfacial_surface(std::vector<double>& ) const = 0;
465 
471  virtual void get_derivative_liquid_gas_interfacial_surface(std::vector<double>& ) const = 0;
472 
478  virtual void get_wetted_wall_surface_area(std::vector<double>& ) const = 0;
479 
485  virtual void get_knudsen_radius(std::vector<double>& ) const = 0;
486 
488 
489  protected:
491 
492 
502  {};
503 
507  BasePSD(const std::string& name);
508 
516  void virtual declare_parameters (ParameterHandler &param) const;
517 
522  void _initialize (ParameterHandler &param) ;
523 
525 
527 
530  typedef std::map< std::string, BasePSD<dim>* > _mapFactory;
532 
534 
535 
583  {
584  static _mapFactory mapFactory;
585  return &mapFactory;
586  }
588 
589 
594  virtual boost::shared_ptr<FuelCellShop::MicroScale::BasePSD<dim> > create_replica (const std::string &name)
595  {
596  const std::type_info& info = typeid(*this);
597  deallog << "Pure function " << __FUNCTION__
598  << " called in Class "
599  << info.name() << std::endl;
600  }
602 
604 
605 
608  const std::string name;
609 
611  std::vector<VariableNames> derivative_flags;
612 
616  std::map< VariableNames, double > constant_solutions;
617 
621  double gamma;
622 
627 
631  double lamda;
632 
636  double F_HI;
637 
641  double F_HO;
642 
646  std::vector<double> f_k;
647 
651  std::vector<double> r_k;
652 
656  std::vector<double> s_k;
657 
661  double por;
663  };
664 
665  } // PSD
666 
667 } // FuelCellShop
668 
669 #endif
virtual void set_critical_radius()
Member function used to set the critical radius [nm] at every quadrature point inside the cell...
Definition: PSD_base.h:346
virtual boost::shared_ptr< FuelCellShop::MicroScale::BasePSD< dim > > create_replica(const std::string &name)
This member function is used to create an object of type gas diffusion layer.
Definition: PSD_base.h:594
virtual ~BasePSD()
Destructor.
Definition: PSD_base.h:138
double get_porosity() const
Definition: PSD_base.h:268
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:63
std::vector< double > f_k
The f_k is the contribution of the log-normal distribution k to the total PSD.
Definition: PSD_base.h:646
virtual void set_temperature(const SolutionVariable &T_in)
Member function used to set the temperature [Kelvin] at every quadrature point inside the cell...
Definition: PSD_base.h:320
This structure is used to encapsulate data from constant values and variable solution data that is us...
Definition: fcst_variables.h:86
const std::string & name_psd() const
Return the name of the PSD.
Definition: PSD_base.h:400
void set_porosity(double porosity)
Definition: PSD_base.h:260
static void declare_PSD_parameters(ParameterHandler &param)
Function used to declare all the data necessary in the parameter files for all BasePSD children...
Definition: PSD_base.h:162
double lamda
The lamda is measured from the mercury intrusion experiment.
Definition: PSD_base.h:631
virtual void set_constant_solution(const double &value, const VariableNames &name)
Set those solution variables which are constant in the particular application.
Definition: PSD_base.h:294
virtual void print_psd_properties() const
This function prints out the psd properties.
Definition: PSD_base.h:409
FCSTLogStream log
Object used to output data to file and, if file attached recorded to a file as well.
std::map< VariableNames, double > constant_solutions
Map storing values of solution variables constant in a particular application.
Definition: PSD_base.h:616
std::vector< VariableNames > derivative_flags
Flags for derivatives: These flags are used to request derivatives of material properties.
Definition: PSD_base.h:611
virtual const std::type_info & get_base_type() const
This member function return the name of the type of layer, i.e.
Definition: PSD_base.h:248
const std::string name
Name of the psd.
Definition: PSD_base.h:608
double por
The por is the porosity inherited from the layer class.
Definition: PSD_base.h:661
std::vector< double > r_k
The r_k is the characteristic pore size of the distribution k.
Definition: PSD_base.h:651
static _mapFactory * get_mapFactory()
Return the map library that stores all childrens of this class.
Definition: PSD_base.h:582
double contact_angle
The contact_angle is the contact angle between air and water.
Definition: PSD_base.h:626
virtual void initialize(ParameterHandler &param)
Member function used to set the saturation at every quadrature point inside the cell.
Definition: PSD_base.h:386
virtual void set_solution(const std::vector< SolutionVariable > &)
If the effective properties in the psd depend on the solution, the solution for a given cell should b...
Definition: PSD_base.h:308
std::map< std::string, BasePSD< dim > * > _mapFactory
This object is used to store all objects of type psd.
Definition: PSD_base.h:530
double gamma
The gamma is the Water-air interface surface tension.
Definition: PSD_base.h:621
virtual void get_PSD_plot()
This function is used to create PSD configuration plot by outputing all the numbers.
Definition: PSD_base.h:358
Pore Size Distribution.
Definition: PSD_base.h:129
static boost::shared_ptr< FuelCellShop::MicroScale::BasePSD< dim > > create_PSD(const std::string &psd_section_name, ParameterHandler &param)
Function used to select the appropriate CatalystLayer type as specified in the ParameterHandler under...
Definition: PSD_base.h:185
double F_HO
The F_HO is the fraction of the total volume corresponding to the hydrophobic pores.
Definition: PSD_base.h:641
virtual void set_saturation()
Member function used to set the saturation at every quadrature point inside the cell.
Definition: PSD_base.h:372
double F_HI
The F_HI is the fraction of the total volume corresponding to the hydrophilic pores.
Definition: PSD_base.h:636
BasePSD()
Constructor.
Definition: PSD_base.h:501
virtual void set_capillary_pressure(const SolutionVariable &C_in)
Member function used to set the capillary pressure [psi] at every quadrature point inside the cell...
Definition: PSD_base.h:332
void set_derivative_flags(const std::vector< VariableNames > &flags)
Set the names of FCST solution variables with respect to which you would like to compute the derivati...
Definition: PSD_base.h:278
std::vector< double > s_k
The s_k is the spread of the distribution k.
Definition: PSD_base.h:656