OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gas_diffusion_layer.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: gas_diffusion_layer.h
11 // - Description: Base Gas Diffusion Layer Class. It implements the interface for other gas diffusion layer classes
12 // and some common methods.
13 // - Developers: M. Secanell
14 // - $Id: gas_diffusion_layer.h 2605 2014-08-15 03:36:44Z secanell $
15 //
16 //---------------------------------------------------------------------------
17 
18 #ifndef _FUELCELLSHOP__GAS_DIFFUSION_LAYER_H
19 #define _FUELCELLSHOP__GAS_DIFFUSION_LAYER_H
20 
21 // FCST classes
22 #include <utils/fcst_constants.h>
24 #include <layers/base_layer.h>
25 #include <layers/porous_layer.h>
26 
27 using namespace dealii;
28 
29 namespace FuelCellShop
30 {
31  namespace Layer
32  {
104  template <int dim>
106  public PorousLayer<dim>
107  {
108  public:
110 
111 
126  static const std::string concrete_name;
128 
130 
170  static void declare_GasDiffusionLayer_parameters (const std::string& gdl_section_name, ParameterHandler &param)
171  {
172 
175  iterator++)
176  {
177  iterator->second->declare_parameters(gdl_section_name, param);
178  }
179  }
180 
194  static boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > create_GasDiffusionLayer (const std::string& gld_section_name,
195  ParameterHandler &param)
196  {
197 
198  boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > pointer;
199 
200  std::string concrete_name;
201  param.enter_subsection("Fuel cell data");
202  {
203  param.enter_subsection(gld_section_name);
204  {
205  concrete_name = param.get("Gas diffusion layer type");
206  FcstUtilities::log << "name: "<<concrete_name.c_str()<<std::endl;
207  }
208  param.leave_subsection();
209  }
210  param.leave_subsection();
211 
213 
215  {
216  if (iterator->second)
217  {
218  pointer = iterator->second->create_replica(gld_section_name);
219  }
220  else
221  {
222  FcstUtilities::log<<"Pointer not initialized"<<std::endl;
223  abort();
224  }
225  }
226  else
227  {
228  FcstUtilities::log<<"Concrete name in FuelCellShop::Layer::GasDiffusionLayer<dim>::create_GasDiffusionLayer does not exist"<<std::endl;
229  abort();
230  }
231 
232  pointer->initialize(param);
233 
234  return pointer;
235  }
237 
239 
240 
247  virtual void set_diffusion_species_name(std::string &name)
248  {
249  Assert((name != "oxygen" || name != "nitrogen" || name != "water" || name != "electron"),
250  ExcNotImplemented());
251  diffusion_species_name = name;
252  };
254 
256 
257 
273  const std::type_info& get_base_type() const
274  {
275  return typeid(GasDiffusionLayer<dim>);
276  }
277 
281  virtual void test_class() const;
283 
285 
286 
292  virtual void effective_gas_diffusivity(const double&, const double&, double&) const
293  {
294  const std::type_info& info = typeid(*this);
295  FcstUtilities::log << "Pure function " << __FUNCTION__
296  << " called in Class "
297  << info.name() << std::endl;
298 
299  };
305  virtual void effective_gas_diffusivity(const double&, const double&, Tensor<2,dim>&) const
306  {
307  const std::type_info& info = typeid(*this);
308  FcstUtilities::log << "Pure function " << __FUNCTION__
309  << " called in Class "
310  << info.name() << std::endl;
311  };
312 
319  virtual void effective_gas_diffusivity(std::vector< Tensor<2,dim> >&) const
320  {
321  const std::type_info& info = typeid(*this);
322  FcstUtilities::log << "Pure function " << __FUNCTION__
323  << " called in Class "
324  << info.name() << std::endl;
325  };
326 
334  virtual void derivative_effective_gas_diffusivity(std::map< VariableNames, std::vector< Tensor<2,dim> > >&) const
335  {
336  const std::type_info& info = typeid(*this);
337  FcstUtilities::log << "Pure function " << __FUNCTION__
338  << " called in Class "
339  << info.name() << std::endl;
340  };
341 
350  virtual void effective_gas_diffusivity(Table<2, double>& D_eff ) const
351  {
352  const std::type_info& info = typeid(*this);
353  FcstUtilities::log << "!!!!!!!!!!!!!!! This class will die soon. Do not use. It is a terrible interface. !!!!!!!!!!!!!!!!!!!!!!!!!! "
354  << info.name() << std::endl;
355  };
365  virtual void effective_gas_diffusivity(Table< 2, Tensor<2,dim> > &D_eff ) const
366  {
367  const std::type_info& info = typeid(*this);
368  FcstUtilities::log << "!!!!!!!!!!!!!!!!!!!! This class will die soon. Do not use. It is a terrible interface. !!!!!!!!!!!!!!!!!!!!!!!! "
369  << info.name() << std::endl;
370  };
371 
375  virtual void effective_electron_conductivity(double& ) const
376  {
377  const std::type_info& info = typeid(*this);
378  FcstUtilities::log << "Pure function " << __FUNCTION__
379  << " called in Class "
380  << info.name() << std::endl;
381  };
382 
386  virtual void effective_electron_conductivity(const double& /*prop*/, double& /*prop_eff*/) const
387  {
388  const std::type_info& info = typeid(*this);
389  FcstUtilities::log << "Pure function " << __FUNCTION__
390  << " called in Class "
391  << info.name() << std::endl;
392  };
393 
397  virtual void effective_electron_conductivity(Tensor<2,dim>& ) const
398  {
399  const std::type_info& info = typeid(*this);
400  FcstUtilities::log << "Pure function " << __FUNCTION__
401  << " called in Class "
402  << info.name() << std::endl;
403  }
407  virtual void effective_electron_conductivity(const double& /*prop*/, Tensor<2,dim>& /*prop_eff*/) const
408  {
409  const std::type_info& info = typeid(*this);
410  FcstUtilities::log << "Pure function " << __FUNCTION__
411  << " called in Class "
412  << info.name() << std::endl;
413  }
414 
420  virtual void derivative_effective_electron_conductivity(std::vector<Tensor<2,dim> >& ) const
421  {
422  const std::type_info& info = typeid(*this);
423  FcstUtilities::log << "Pure function " << __FUNCTION__
424  << " called in Class "
425  << info.name() << std::endl;
426  };
430  virtual void effective_thermal_conductivity(double& ) const
431  {
432  const std::type_info& info = typeid(*this);
433  FcstUtilities::log << "Pure function " << __FUNCTION__
434  << " called in Class "
435  << info.name() << std::endl;
436  };
440  virtual void effective_thermal_conductivity(Tensor<2,dim>& ) const
441  {
442  const std::type_info& info = typeid(*this);
443  FcstUtilities::log << "Pure function " << __FUNCTION__
444  << " called in Class "
445  << info.name() << std::endl;
446  };
447 
451  virtual void effective_thermal_conductivity(std::vector< Tensor<2,dim> >&) const
452  {
453  const std::type_info& info = typeid(*this);
454  FcstUtilities::log << "Pure function " << __FUNCTION__
455  << " called in Class "
456  << info.name() << std::endl;
457  };
463  virtual void derivative_effective_thermal_conductivity(std::vector<Tensor<2,dim> >& ) const
464  {
465  const std::type_info& info = typeid(*this);
466  FcstUtilities::log << "Pure function " << __FUNCTION__
467  << " called in Class "
468  << info.name() << std::endl;
469  };
473  virtual void gas_permeablity(double& ) const
474  {
475  const std::type_info& info = typeid(*this);
476  FcstUtilities::log << "Pure function " << __FUNCTION__
477  << " called in Class "
478  << info.name() << std::endl;
479  };
483  virtual void gas_permeablity(Tensor<2,dim>& ) const
484  {
485  const std::type_info& info = typeid(*this);
486  FcstUtilities::log << "Pure function " << __FUNCTION__
487  << " called in Class "
488  << info.name() << std::endl;
489  };
495  virtual void derivative_gas_permeablity(std::vector<Tensor<2,dim> >& ) const
496  {
497  const std::type_info& info = typeid(*this);
498  FcstUtilities::log << "Pure function " << __FUNCTION__
499  << " called in Class "
500  << info.name() << std::endl;
501  };
502 
503 
507  virtual void liquid_permeablity(std::vector< Tensor<2,dim> >& ) const
508  {
509  const std::type_info& info = typeid(*this);
510  FcstUtilities::log << "Pure function " << __FUNCTION__
511  << " called in Class "
512  << info.name() << std::endl;
513  };
519  virtual void derivative_liquid_permeablity(std::map< VariableNames, std::vector< Tensor<2,dim> > >& ) const
520  {
521  const std::type_info& info = typeid(*this);
522  FcstUtilities::log << "Pure function " << __FUNCTION__
523  << " called in Class "
524  << info.name() << std::endl;
525  };
531  virtual void relative_liquid_permeability_PSD(std::vector< Tensor<2,dim> >& ) const
532  {
533  const std::type_info& info = typeid(*this);
534  FcstUtilities::log << "Pure function " << __FUNCTION__
535  << " called in Class "
536  << info.name() << std::endl;
537  };
538 
539  virtual void derivative_relative_liquid_permeablity_PSD(std::vector<double> & ) const
540  {
541  const std::type_info& info = typeid(*this);
542  FcstUtilities::log << "Pure function " << __FUNCTION__
543  << " called in Class "
544  << info.name() << std::endl;
545  };
546 
547  virtual void derivative_relative_liquid_permeablity_PSD(std::map< VariableNames, std::vector< Tensor<2,dim> > > & ) const
548  {
549  const std::type_info& info = typeid(*this);
550  FcstUtilities::log << "Pure function " << __FUNCTION__
551  << " called in Class "
552  << info.name() << std::endl;
553  };
554 
555  virtual void saturated_liquid_permeablity_PSD(double& ) const
556  {
557  const std::type_info& info = typeid(*this);
558  FcstUtilities::log << "Pure function " << __FUNCTION__
559  << " called in Class "
560  << info.name() << std::endl;
561  };
562 
566  virtual void pcapillary(std::vector<double>&) const
567  {
568  const std::type_info& info = typeid(*this);
569  FcstUtilities::log << "Pure function " << __FUNCTION__
570  << " called in Class "
571  << info.name() << std::endl;
572  };
573 
574  virtual void saturation_from_capillary_equation(std::vector<double>&) const
575  {
576  const std::type_info& info = typeid(*this);
577  FcstUtilities::log << "Pure function " << __FUNCTION__
578  << " called in Class "
579  << info.name() << std::endl;
580  };
581 
582  virtual void derivative_saturation_from_capillary_equation_PSD(std::vector<double>&) const
583  {
584  const std::type_info& info = typeid(*this);
585  FcstUtilities::log << "Pure function " << __FUNCTION__
586  << " called in Class "
587  << info.name() << std::endl;
588  };
592  virtual void dpcapillary_dsat(std::vector<double> &) const
593  {
594  const std::type_info& info = typeid(*this);
595  FcstUtilities::log << "Pure function " << __FUNCTION__
596  << " called in Class "
597  << info.name() << std::endl;
598  };
604  virtual void derivative_dpcapillary_dsat(std::map< VariableNames, std::vector<double> > &) const
605  {
606  const std::type_info& info = typeid(*this);
607  FcstUtilities::log << "Pure function " << __FUNCTION__
608  << " called in Class "
609  << info.name() << std::endl;
610  };
611 
616  virtual void interfacial_surface_area(std::vector<double>&) const
617  {
618  const std::type_info& info = typeid(*this);
619  FcstUtilities::log << "Pure function " << __FUNCTION__
620  << " called in Class "
621  << info.name() << std::endl;
622  };
628  virtual void derivative_interfacial_surface_area(std::map< VariableNames, std::vector<double> >&) const
629  {
630  const std::type_info& info = typeid(*this);
631  FcstUtilities::log << "Pure function " << __FUNCTION__
632  << " called in Class "
633  << info.name() << std::endl;
634  };
635 
640  virtual void interfacial_surface_area_PSD(std::vector<double>&) const
641  {
642  const std::type_info& info = typeid(*this);
643  FcstUtilities::log << "Pure function " << __FUNCTION__
644  << " called in Class "
645  << info.name() << std::endl;
646  };
652  virtual void derivative_interfacial_surface_area_PSD(std::map< VariableNames, std::vector<double> >&) const
653  {
654  const std::type_info& info = typeid(*this);
655  FcstUtilities::log << "Pure function " << __FUNCTION__
656  << " called in Class "
657  << info.name() << std::endl;
658  };
659 
660  virtual void derivative_interfacial_surface_area_PSD(std::vector<double>&) const
661  {
662  const std::type_info& info = typeid(*this);
663  FcstUtilities::log << "Pure function " << __FUNCTION__
664  << " called in Class "
665  << info.name() << std::endl;
666  };
668 
669  protected:
671 
672 
675  typedef std::map< std::string, GasDiffusionLayer<dim>* > _mapFactory;
676  //typedef std::map< std::string, boost::shared_ptr<GasDiffusionLayer<dim> > > _mapFactory;
678 
680 
681 
685  {
686  static _mapFactory mapFactory;
687  return &mapFactory;
688  }
690 
692 
703 
707  ~GasDiffusionLayer();
711  GasDiffusionLayer(const std::string& name);
712 
719  void declare_parameters (ParameterHandler &param) const
720  {
721  this->declare_parameters(this->name, param);
722  }
723 
728  virtual void declare_parameters (const std::string& name,
729  ParameterHandler &param) const;
730 
737  void initialize (ParameterHandler &param);
739 
741 
742 
747  virtual boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > create_replica (const std::string &name)
748  {
749  const std::type_info& info = typeid(*this);
750  FcstUtilities::log << "Pure function " << __FUNCTION__
751  << " called in Class "
752  << info.name() << std::endl;
753  }
755 
757 
758 
762 
764  std::string PSD_type;
765 
769  double porosity;
770 
774  Tensor<2,dim> tortuosity_tensor;
775 
781 
787 
793 
795 
796  };
797 
798  }
799 
800 } // FuelCellShop
801 
802 #endif // _FUELCELLSHOP__GAS_DIFFUSION_LAYER_H
void declare_parameters(ParameterHandler &param) const
Declare parameters for a parameter file.
Definition: gas_diffusion_layer.h:719
virtual void pcapillary(std::vector< double > &) const
Compute , at all quadrature points in the cell.
Definition: gas_diffusion_layer.h:566
double porosity
Porosity of the GDL.
Definition: gas_diffusion_layer.h:769
Virtual class used to provide the interface for all GasDiffusionLayer children.
Definition: gas_diffusion_layer.h:105
virtual void derivative_interfacial_surface_area_PSD(std::map< VariableNames, std::vector< double > > &) const
Compute the derivative of the liquid-gas interfacial surface area per unit volume, with respect to either the solution variables or design parameters, at all quadrature points in the CL.
Definition: gas_diffusion_layer.h:652
virtual void effective_electron_conductivity(double &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:375
virtual void set_diffusion_species_name(std::string &name)
Member function used by some applications such as dummyGDL in order to know which value to return...
Definition: gas_diffusion_layer.h:247
virtual void interfacial_surface_area(std::vector< double > &) const
Compute the liquid-gas interfacial surface area per unit volume, , at all quadrature points in the GD...
Definition: gas_diffusion_layer.h:616
virtual void saturated_liquid_permeablity_PSD(double &) const
Definition: gas_diffusion_layer.h:555
virtual void liquid_permeablity(std::vector< Tensor< 2, dim > > &) const
Compute the anisotropic GDL liquid permeability , at all quadrature points in the cell...
Definition: gas_diffusion_layer.h:507
virtual void effective_electron_conductivity(const double &, double &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:386
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:63
virtual void effective_gas_diffusivity(const double &, const double &, double &) const
Compute the effective property in the pores of the GDL.
Definition: gas_diffusion_layer.h:292
virtual void effective_electron_conductivity(const double &, Tensor< 2, dim > &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:407
virtual void effective_gas_diffusivity(Table< 2, double > &D_eff) const
Return the effective diffusivty in the GDL for all the gases assigned to the layer using set_gases_an...
Definition: gas_diffusion_layer.h:350
virtual void effective_thermal_conductivity(double &) const
Compute the effective thermal conductivity (isotropic) in the GDL.
Definition: gas_diffusion_layer.h:430
virtual void derivative_liquid_permeablity(std::map< VariableNames, std::vector< Tensor< 2, dim > > > &) const
Compute the derivative of the anisotropic liquid permeability in the GDL with respect to either the s...
Definition: gas_diffusion_layer.h:519
virtual void derivative_relative_liquid_permeablity_PSD(std::map< VariableNames, std::vector< Tensor< 2, dim > > > &) const
Definition: gas_diffusion_layer.h:547
Tensor< 2, dim > electron_conductivity_tensor
Tensor storing the effective electronic conductivity of the layer.
Definition: gas_diffusion_layer.h:792
static const std::string concrete_name
Concrete name used for objects of this class.
Definition: gas_diffusion_layer.h:126
virtual void derivative_interfacial_surface_area(std::map< VariableNames, std::vector< double > > &) const
Compute the derivative of the liquid-gas interfacial surface area per unit volume, with respect to either the solution variables or design parameters, at all quadrature points in the GDL.
Definition: gas_diffusion_layer.h:628
virtual void derivative_gas_permeablity(std::vector< Tensor< 2, dim > > &) const
Compute the derivative of the effective gas permeability in the GDL with respect to either the soluti...
Definition: gas_diffusion_layer.h:495
virtual void derivative_saturation_from_capillary_equation_PSD(std::vector< double > &) const
Definition: gas_diffusion_layer.h:582
virtual void relative_liquid_permeability_PSD(std::vector< Tensor< 2, dim > > &) const
Compute the derivative of the anisotropic liquid permeability in the GDL with respect to either the s...
Definition: gas_diffusion_layer.h:531
static _mapFactory * get_mapFactory()
Definition: gas_diffusion_layer.h:684
virtual void saturation_from_capillary_equation(std::vector< double > &) const
Definition: gas_diffusion_layer.h:574
virtual void derivative_dpcapillary_dsat(std::map< VariableNames, std::vector< double > > &) const
Compute the derivative of in the GDL, with respect to either the solution or design parameters...
Definition: gas_diffusion_layer.h:604
const std::type_info & get_base_type() const
This member function returns a type_info object with the name of the base layer type the inherited cl...
Definition: gas_diffusion_layer.h:273
std::map< std::string, GasDiffusionLayer< dim > * > _mapFactory
This object is used to store all objects of type GasDiffusionLayer.
Definition: gas_diffusion_layer.h:675
FCSTLogStream log
Object used to output data to file and, if file attached recorded to a file as well.
Tensor< 2, dim > tortuosity_tensor
Tortuosity tensor of the GDL.
Definition: gas_diffusion_layer.h:774
virtual boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer< dim > > create_replica(const std::string &name)
This member function is used to create an object of type gas diffusion layer.
Definition: gas_diffusion_layer.h:747
virtual void effective_electron_conductivity(Tensor< 2, dim > &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:397
static boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer< dim > > create_GasDiffusionLayer(const std::string &gld_section_name, ParameterHandler &param)
Function used to select the appropriate GasDiffusionLayer type as specified in the ParameterHandler u...
Definition: gas_diffusion_layer.h:194
virtual void effective_gas_diffusivity(Table< 2, Tensor< 2, dim > > &D_eff) const
Return a tensor with the effective diffusivty in the GDL for all the gases assigned to the layer usin...
Definition: gas_diffusion_layer.h:365
virtual void derivative_effective_gas_diffusivity(std::map< VariableNames, std::vector< Tensor< 2, dim > > > &) const
Return the derivative of effective diffusivity w.r.t solution variables/design parameters for nonisot...
Definition: gas_diffusion_layer.h:334
virtual void derivative_effective_electron_conductivity(std::vector< Tensor< 2, dim > > &) const
Compute the derivative of the effective electron conductivity in the GDL with respect to either the s...
Definition: gas_diffusion_layer.h:420
virtual void effective_thermal_conductivity(std::vector< Tensor< 2, dim > > &) const
Compute the effective thermal conductivity (anisotropic) in the GDL, dependent on various solution va...
Definition: gas_diffusion_layer.h:451
virtual void derivative_relative_liquid_permeablity_PSD(std::vector< double > &) const
Definition: gas_diffusion_layer.h:539
virtual void dpcapillary_dsat(std::vector< double > &) const
Compute , at all quadrature points in the GDL.
Definition: gas_diffusion_layer.h:592
static void declare_GasDiffusionLayer_parameters(const std::string &gdl_section_name, ParameterHandler &param)
Function used to declare all the data necessary in the parameter files for all GasDiffusionLayer chil...
Definition: gas_diffusion_layer.h:170
virtual void gas_permeablity(Tensor< 2, dim > &) const
Compute the GDL gas permeability.
Definition: gas_diffusion_layer.h:483
virtual void interfacial_surface_area_PSD(std::vector< double > &) const
Compute the liquid-gas interfacial surface area per unit volume, , at all quadrature points in the CL...
Definition: gas_diffusion_layer.h:640
virtual void derivative_effective_thermal_conductivity(std::vector< Tensor< 2, dim > > &) const
Compute the derivative of the effective thermal conductivity in the GDL with respect to either the so...
Definition: gas_diffusion_layer.h:463
Tensor< 2, dim > thermal_conductivity_tensor
Tensor storing the effective thermal conductivity of the layer.
Definition: gas_diffusion_layer.h:780
std::string diffusion_species_name
If GDL properties are stored inside the class (e.g.
Definition: gas_diffusion_layer.h:761
virtual void effective_gas_diffusivity(const double &, const double &, Tensor< 2, dim > &) const
Compute the effective property in the pores of the GDL.
Definition: gas_diffusion_layer.h:305
std::string PSD_type
PSD class type from input file.
Definition: gas_diffusion_layer.h:764
virtual void gas_permeablity(double &) const
Compute the GDL gas permeability.
Definition: gas_diffusion_layer.h:473
Virtual class used to implement properties that are characteristic of a porous layer.
Definition: porous_layer.h:75
virtual void derivative_interfacial_surface_area_PSD(std::vector< double > &) const
Definition: gas_diffusion_layer.h:660
double electron_conductivity
Double storing the electric conductivity of the GDL is the layer is isotropic.
Definition: gas_diffusion_layer.h:786
virtual void effective_thermal_conductivity(Tensor< 2, dim > &) const
Compute the effective thermal conductivity (anisotropic) in the GDL.
Definition: gas_diffusion_layer.h:440
virtual void effective_gas_diffusivity(std::vector< Tensor< 2, dim > > &) const
Return the effective diffusivity [m^2/s] for nonisothermal with/without two-phase case in the GDL...
Definition: gas_diffusion_layer.h:319