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 "fcst_constants.h"
23 #include "base_material.h"
24 #include "base_layer.h"
25 #include "porous_layer.h"
26 #include "PSD_base.h"
27 
28 // Include deal.II classes
29 #include <base/parameter_handler.h>
30 #include <base/point.h>
31 #include <base/function.h>
32 #include <lac/vector.h>
33 #include <fe/fe_values.h>
34 
35 //Include STL
36 #include<cmath>
37 #include<iostream>
38 
39 using namespace dealii;
40 
41 namespace FuelCellShop
42 {
43  namespace Layer
44  {
116  template <int dim>
118  public PorousLayer<dim>
119  {
120  public:
122 
123 
138  static const std::string concrete_name;
140 
142 
182  static void declare_GasDiffusionLayer_parameters (const std::string& gdl_section_name, ParameterHandler &param)
183  {
184 
187  iterator++)
188  {
189  iterator->second->declare_parameters(gdl_section_name, param);
190  }
191  }
192 
206  static boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > create_GasDiffusionLayer (const std::string& gld_section_name,
207  ParameterHandler &param)
208  {
209 
210  boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > pointer;
211 
212  std::string concrete_name;
213  param.enter_subsection("Fuel cell data");
214  {
215  param.enter_subsection(gld_section_name);
216  {
217  concrete_name = param.get("Gas diffusion layer type");
218  FcstUtilities::log << "name: "<<concrete_name.c_str()<<std::endl;
219  }
220  param.leave_subsection();
221  }
222  param.leave_subsection();
223 
225 
227  {
228  if (iterator->second)
229  {
230  pointer = iterator->second->create_replica(gld_section_name);
231  }
232  else
233  {
234  FcstUtilities::log<<"Pointer not initialized"<<std::endl;
235  abort();
236  }
237  }
238  else
239  {
240  FcstUtilities::log<<"Concrete name in FuelCellShop::Layer::GasDiffusionLayer<dim>::create_GasDiffusionLayer does not exist"<<std::endl;
241  abort();
242  }
243 
244  pointer->initialize(param);
245 
246  return pointer;
247  }
249 
251 
252 
259  virtual void set_diffusion_species_name(std::string &name)
260  {
261  Assert((name != "oxygen" || name != "nitrogen" || name != "water" || name != "electron"),
262  ExcNotImplemented());
263  diffusion_species_name = name;
264  };
266 
268 
269 
285  const std::type_info& get_base_type() const
286  {
287  return typeid(GasDiffusionLayer<dim>);
288  }
289 
293  virtual void test_class() const;
295 
297 
298 
304  virtual void effective_gas_diffusivity(const double&, const double&, double&) const
305  {
306  const std::type_info& info = typeid(*this);
307  FcstUtilities::log << "Pure function " << __FUNCTION__
308  << " called in Class "
309  << info.name() << std::endl;
310 
311  };
317  virtual void effective_gas_diffusivity(const double&, const double&, Tensor<2,dim>&) const
318  {
319  const std::type_info& info = typeid(*this);
320  FcstUtilities::log << "Pure function " << __FUNCTION__
321  << " called in Class "
322  << info.name() << std::endl;
323  };
324 
331  virtual void effective_gas_diffusivity(std::vector< Tensor<2,dim> >&) const
332  {
333  const std::type_info& info = typeid(*this);
334  FcstUtilities::log << "Pure function " << __FUNCTION__
335  << " called in Class "
336  << info.name() << std::endl;
337  };
345  virtual void derivative_effective_gas_diffusivity(std::map< VariableNames, std::vector< Tensor<2,dim> > >&) const
346  {
347  const std::type_info& info = typeid(*this);
348  FcstUtilities::log << "Pure function " << __FUNCTION__
349  << " called in Class "
350  << info.name() << std::endl;
351  };
352 
359  virtual void effective_gas_diffusivity(Table<2, double>& D_eff ) const;
367  virtual void effective_gas_diffusivity(Table< 2, Tensor<2,dim> > &D_eff ) const;
368 
369 
373  virtual void effective_electron_conductivity(double& ) const
374  {
375  const std::type_info& info = typeid(*this);
376  FcstUtilities::log << "Pure function " << __FUNCTION__
377  << " called in Class "
378  << info.name() << std::endl;
379  };
380 
384  virtual void effective_electron_conductivity(const double& /*prop*/, double& /*prop_eff*/) const
385  {
386  const std::type_info& info = typeid(*this);
387  FcstUtilities::log << "Pure function " << __FUNCTION__
388  << " called in Class "
389  << info.name() << std::endl;
390  };
391 
395  virtual void effective_electron_conductivity(Tensor<2,dim>& ) const
396  {
397  const std::type_info& info = typeid(*this);
398  FcstUtilities::log << "Pure function " << __FUNCTION__
399  << " called in Class "
400  << info.name() << std::endl;
401  }
405  virtual void effective_electron_conductivity(const double& /*prop*/, Tensor<2,dim>& /*prop_eff*/) const
406  {
407  const std::type_info& info = typeid(*this);
408  FcstUtilities::log << "Pure function " << __FUNCTION__
409  << " called in Class "
410  << info.name() << std::endl;
411  }
412 
418  virtual void derivative_effective_electron_conductivity(std::vector<Tensor<2,dim> >& ) const
419  {
420  const std::type_info& info = typeid(*this);
421  FcstUtilities::log << "Pure function " << __FUNCTION__
422  << " called in Class "
423  << info.name() << std::endl;
424  };
428  virtual void effective_thermal_conductivity(double& ) const
429  {
430  const std::type_info& info = typeid(*this);
431  FcstUtilities::log << "Pure function " << __FUNCTION__
432  << " called in Class "
433  << info.name() << std::endl;
434  };
438  virtual void effective_thermal_conductivity(Tensor<2,dim>& ) const
439  {
440  const std::type_info& info = typeid(*this);
441  FcstUtilities::log << "Pure function " << __FUNCTION__
442  << " called in Class "
443  << info.name() << std::endl;
444  };
445 
449  virtual void effective_thermal_conductivity(std::vector< Tensor<2,dim> >&) const
450  {
451  const std::type_info& info = typeid(*this);
452  FcstUtilities::log << "Pure function " << __FUNCTION__
453  << " called in Class "
454  << info.name() << std::endl;
455  };
461  virtual void derivative_effective_thermal_conductivity(std::vector<Tensor<2,dim> >& ) const
462  {
463  const std::type_info& info = typeid(*this);
464  FcstUtilities::log << "Pure function " << __FUNCTION__
465  << " called in Class "
466  << info.name() << std::endl;
467  };
471  virtual void gas_permeablity(double& ) const
472  {
473  const std::type_info& info = typeid(*this);
474  FcstUtilities::log << "Pure function " << __FUNCTION__
475  << " called in Class "
476  << info.name() << std::endl;
477  };
481  virtual void gas_permeablity(Tensor<2,dim>& ) const
482  {
483  const std::type_info& info = typeid(*this);
484  FcstUtilities::log << "Pure function " << __FUNCTION__
485  << " called in Class "
486  << info.name() << std::endl;
487  };
493  virtual void derivative_gas_permeablity(std::vector<Tensor<2,dim> >& ) const
494  {
495  const std::type_info& info = typeid(*this);
496  FcstUtilities::log << "Pure function " << __FUNCTION__
497  << " called in Class "
498  << info.name() << std::endl;
499  };
500 
501 
505  virtual void liquid_permeablity(std::vector< Tensor<2,dim> >& ) const
506  {
507  const std::type_info& info = typeid(*this);
508  FcstUtilities::log << "Pure function " << __FUNCTION__
509  << " called in Class "
510  << info.name() << std::endl;
511  };
517  virtual void derivative_liquid_permeablity(std::map< VariableNames, std::vector< Tensor<2,dim> > >& ) const
518  {
519  const std::type_info& info = typeid(*this);
520  FcstUtilities::log << "Pure function " << __FUNCTION__
521  << " called in Class "
522  << info.name() << std::endl;
523  };
524 
528  virtual void pcapillary(std::vector<double>&) const
529  {
530  const std::type_info& info = typeid(*this);
531  FcstUtilities::log << "Pure function " << __FUNCTION__
532  << " called in Class "
533  << info.name() << std::endl;
534  };
538  virtual void dpcapillary_dsat(std::vector<double> &) const
539  {
540  const std::type_info& info = typeid(*this);
541  FcstUtilities::log << "Pure function " << __FUNCTION__
542  << " called in Class "
543  << info.name() << std::endl;
544  };
550  virtual void derivative_dpcapillary_dsat(std::map< VariableNames, std::vector<double> > &) const
551  {
552  const std::type_info& info = typeid(*this);
553  FcstUtilities::log << "Pure function " << __FUNCTION__
554  << " called in Class "
555  << info.name() << std::endl;
556  };
557 
562  virtual void interfacial_surface_area(std::vector<double>&) const
563  {
564  const std::type_info& info = typeid(*this);
565  FcstUtilities::log << "Pure function " << __FUNCTION__
566  << " called in Class "
567  << info.name() << std::endl;
568  };
574  virtual void derivative_interfacial_surface_area(std::map< VariableNames, 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 
583 
584  protected:
586 
587 
590  typedef std::map< std::string, GasDiffusionLayer<dim>* > _mapFactory;
591  //typedef std::map< std::string, boost::shared_ptr<GasDiffusionLayer<dim> > > _mapFactory;
593 
595 
596 
600  {
601  static _mapFactory mapFactory;
602  return &mapFactory;
603  }
605 
607 
618 
622  ~GasDiffusionLayer();
626  GasDiffusionLayer(const std::string& name);
627 
634  void declare_parameters (ParameterHandler &param) const
635  {
636  this->declare_parameters(this->name, param);
637  }
638 
643  virtual void declare_parameters (const std::string& name,
644  ParameterHandler &param) const;
645 
652  void initialize (ParameterHandler &param);
654 
656 
657 
662  virtual boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > create_replica (const std::string &name)
663  {
664  const std::type_info& info = typeid(*this);
665  FcstUtilities::log << "Pure function " << __FUNCTION__
666  << " called in Class "
667  << info.name() << std::endl;
668  }
670 
672 
673 
677 
679  std::string PSD_type;
680 
684  double porosity;
685 
689  Tensor<2,dim> tortuosity_tensor;
690 
696 
702 
708 
709  /*** Pointer to the PSD object*/
710  boost::shared_ptr< FuelCellShop::MicroScale::BasePSD<dim> > PSD;
712 
713  };
714 
715  }
716 
717 } // FuelCellShop
718 
719 #endif // _FUELCELLSHOP__GAS_DIFFUSION_LAYER_H
void declare_parameters(ParameterHandler &param) const
Declare parameters for a parameter file.
Definition: gas_diffusion_layer.h:634
virtual void pcapillary(std::vector< double > &) const
Compute , at all quadrature points in the cell.
Definition: gas_diffusion_layer.h:528
double porosity
Porosity of the GDL.
Definition: gas_diffusion_layer.h:684
Virtual class used to provide the interface for all GasDiffusionLayer children.
Definition: gas_diffusion_layer.h:117
virtual void effective_electron_conductivity(double &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:373
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:259
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:562
boost::shared_ptr< FuelCellShop::MicroScale::BasePSD< dim > > PSD
Definition: gas_diffusion_layer.h:710
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:505
virtual void effective_electron_conductivity(const double &, double &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:384
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:62
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:304
virtual void effective_electron_conductivity(const double &, Tensor< 2, dim > &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:405
virtual void effective_thermal_conductivity(double &) const
Compute the effective thermal conductivity (isotropic) in the GDL.
Definition: gas_diffusion_layer.h:428
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:517
Tensor< 2, dim > electron_conductivity_tensor
Tensor storing the effective electronic conductivity of the layer.
Definition: gas_diffusion_layer.h:707
static const std::string concrete_name
Concrete name used for objects of this class.
Definition: gas_diffusion_layer.h:138
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:574
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:493
static _mapFactory * get_mapFactory()
Definition: gas_diffusion_layer.h:599
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:550
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:285
std::map< std::string, GasDiffusionLayer< dim > * > _mapFactory
This object is used to store all objects of type GasDiffusionLayer.
Definition: gas_diffusion_layer.h:590
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:689
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:662
virtual void effective_electron_conductivity(Tensor< 2, dim > &) const
Compute the effective electron conductivity in the GDL.
Definition: gas_diffusion_layer.h:395
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:206
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:345
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:418
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:449
virtual void dpcapillary_dsat(std::vector< double > &) const
Compute , at all quadrature points in the GDL.
Definition: gas_diffusion_layer.h:538
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:182
virtual void gas_permeablity(Tensor< 2, dim > &) const
Compute the GDL gas permeability.
Definition: gas_diffusion_layer.h:481
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:461
Tensor< 2, dim > thermal_conductivity_tensor
Tensor storing the effective thermal conductivity of the layer.
Definition: gas_diffusion_layer.h:695
std::string diffusion_species_name
If GDL properties are stored inside the class (e.g.
Definition: gas_diffusion_layer.h:676
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:317
std::string PSD_type
PSD class type from input file.
Definition: gas_diffusion_layer.h:679
virtual void gas_permeablity(double &) const
Compute the GDL gas permeability.
Definition: gas_diffusion_layer.h:471
Virtual class used to implement properties that are characteristic of a porous layer.
Definition: porous_layer.h:65
double electron_conductivity
Double storing the electric conductivity of the GDL is the layer is isotropic.
Definition: gas_diffusion_layer.h:701
virtual void effective_thermal_conductivity(Tensor< 2, dim > &) const
Compute the effective thermal conductivity (anisotropic) in the GDL.
Definition: gas_diffusion_layer.h:438
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:331