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 1460 2013-08-30 22:28:49Z madhur $
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 
27 // Include deal.II classes
28 #include <base/parameter_handler.h>
29 #include <base/point.h>
30 #include <base/function.h>
31 #include <lac/vector.h>
32 #include <fe/fe_values.h>
33 
34 //Include STL
35 #include<cmath>
36 #include<iostream>
37 
38 using namespace dealii;
39 
40 namespace FuelCellShop
41 {
42  namespace Layer
43  {
133  template <int dim>
135  public PorousLayer<dim>
136  {
137  public:
139 
140 
155  static const std::string concrete_name;
157 
159 
199  static void declare_GasDiffusionLayer_parameters (const std::string& gld_section_name, ParameterHandler &param)
200  {
201 
204  iterator++)
205  {
206  iterator->second->declare_parameters(gld_section_name, param);
207  }
208  }
212  static void set_GasDiffusionLayer_parameters (const std::vector<std::string>& name_dvar,
213  const std::vector<double>& value_dvar,
214  std::string gld_section_name,
215  ParameterHandler &param)
216  {
219  iterator++)
220  {
221  iterator->second->set_parameters(name_dvar,value_dvar,gld_section_name, param);
222  }
223  }
237  static boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > create_GasDiffusionLayer (const std::string& gld_section_name,
238  ParameterHandler &param)
239  {
240 
241  boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > pointer;
242 
243  std::string concrete_name;
244  param.enter_subsection("Fuel cell data");
245  {
246  param.enter_subsection(gld_section_name);
247  {
248  concrete_name = param.get("Gas diffusion layer type");
249  deallog << "name: "<<concrete_name.c_str()<<std::endl;
250  }
251  param.leave_subsection();
252  }
253  param.leave_subsection();
254 
256 
258  {
259  if (iterator->second)
260  {
261  pointer = iterator->second->create_replica(gld_section_name);
262  }
263  else
264  {
265  deallog<<"Pointer not initialized"<<std::endl;
266  abort();
267  }
268  }
269  else
270  {
271  deallog<<"Concrete name in FuelCellShop::Layer::GasDiffusionLayer<dim>::create_GasDiffusionLayer does not exist"<<std::endl;
272  abort();
273  }
274 
275  pointer->initialize(param);
276 
277  return pointer;
278  }
280 
282 
283 
290  virtual void set_diffusion_species_name(std::string &name)
291  {
292  Assert((name != "oxygen" || name != "nitrogen" || name != "water" || name != "electron"),
293  ExcNotImplemented());
294  diffusion_species_name = name;
295  };
297 
299 
300 
316  const std::type_info& get_base_type() const
317  {
318  return typeid(GasDiffusionLayer<dim>);
319  }
320 
324  virtual void test_class() const;
326 
328 
329 
337  virtual void effective_gas_diffusivity(const double& ,
338  double& ) const
339  {
340  const std::type_info& info = typeid(*this);
341  deallog << "Pure function " << __FUNCTION__
342  << " called in Class "
343  << info.name() << std::endl;
344 
345  };
346 
355  virtual void effective_gas_diffusivity(const double& ,
356  Tensor<2,dim>& ) const
357  {
358  const std::type_info& info = typeid(*this);
359  deallog << "Pure function " << __FUNCTION__
360  << " called in Class "
361  << info.name() << std::endl;
362  };
363 
370  virtual void effective_gas_diffusivity(Table<2, double>& D_eff ) const;
371 
379  virtual void effective_gas_diffusivity(Table< 2, Tensor<2,dim> > &D_eff ) const;
380 
391  virtual void derivative_effective_gas_diffusivity(std::vector<Table< 2, Tensor<2,dim> > >& ) const
392  {
393  const std::type_info& info = typeid(*this);
394  deallog << "Pure function " << __FUNCTION__
395  << " called in Class "
396  << info.name() << std::endl;
397  };
398 
402  virtual void effective_electron_conductivity(double& ) const
403  {
404  const std::type_info& info = typeid(*this);
405  deallog << "Pure function " << __FUNCTION__
406  << " called in Class "
407  << info.name() << std::endl;
408  };
409 
413  virtual void effective_electron_conductivity(const double& /*prop*/, double& /*prop_eff*/) const
414  {
415  const std::type_info& info = typeid(*this);
416  deallog << "Pure function " << __FUNCTION__
417  << " called in Class "
418  << info.name() << std::endl;
419  };
420 
424  virtual void effective_electron_conductivity(Tensor<2,dim>& ) const
425  {
426  const std::type_info& info = typeid(*this);
427  deallog << "Pure function " << __FUNCTION__
428  << " called in Class "
429  << info.name() << std::endl;
430  }
434  virtual void effective_electron_conductivity(const double& /*prop*/, Tensor<2,dim>& /*prop_eff*/) const
435  {
436  const std::type_info& info = typeid(*this);
437  deallog << "Pure function " << __FUNCTION__
438  << " called in Class "
439  << info.name() << std::endl;
440  }
441 
447  virtual void derivative_effective_electron_conductivity(std::vector<Tensor<2,dim> >& ) const
448  {
449  const std::type_info& info = typeid(*this);
450  deallog << "Pure function " << __FUNCTION__
451  << " called in Class "
452  << info.name() << std::endl;
453  };
454 
458  virtual void gas_permeablity(double& ) const
459  {
460  const std::type_info& info = typeid(*this);
461  deallog << "Pure function " << __FUNCTION__
462  << " called in Class "
463  << info.name() << std::endl;
464  };
468  virtual void gas_permeablity(Tensor<2,dim>& ) const
469  {
470  const std::type_info& info = typeid(*this);
471  deallog << "Pure function " << __FUNCTION__
472  << " called in Class "
473  << info.name() << std::endl;
474  };
480  virtual void derivative_gas_permeablity(std::vector<Tensor<2,dim> >& ) const
481  {
482  const std::type_info& info = typeid(*this);
483  deallog << "Pure function " << __FUNCTION__
484  << " called in Class "
485  << info.name() << std::endl;
486  };
490  virtual void liquid_permeablity(double& ) const
491  {
492  const std::type_info& info = typeid(*this);
493  deallog << "Pure function " << __FUNCTION__
494  << " called in Class "
495  << info.name() << std::endl;
496  };
500  virtual void liquid_permeablity(Tensor<2,dim>& ) const
501  {
502  const std::type_info& info = typeid(*this);
503  deallog << "Pure function " << __FUNCTION__
504  << " called in Class "
505  << info.name() << std::endl;
506  };
512  virtual void derivative_liquid_permeablity(std::vector<Tensor<2,dim> >& ) const
513  {
514  const std::type_info& info = typeid(*this);
515  deallog << "Pure function " << __FUNCTION__
516  << " called in Class "
517  << info.name() << std::endl;
518  };
520 
521  protected:
523 
524 
527  typedef std::map< std::string, GasDiffusionLayer<dim>* > _mapFactory;
528  //typedef std::map< std::string, boost::shared_ptr<GasDiffusionLayer<dim> > > _mapFactory;
530 
532 
533 
536  static _mapFactory * get_mapFactory()
537  {
538  static _mapFactory mapFactory;
539  return &mapFactory;
540  }
542 
543 
544 
555 
559  ~GasDiffusionLayer();
563  GasDiffusionLayer(const std::string& name);
564 
571  void declare_parameters (ParameterHandler &param) const
572  {
573  this->declare_parameters(this->name, param);
574  }
575 
580  virtual void declare_parameters (const std::string& name,
581  ParameterHandler &param) const;
582 
587  virtual void set_parameters (const std::vector<std::string>& name_dvar,
588  const std::vector<double>& value_dvar,
589  const std::string& name,
590  ParameterHandler &param) const
591  {
592  const std::type_info& info = typeid(*this);
593  deallog << "Pure function " << __FUNCTION__
594  << " called in Class "
595  << info.name() << std::endl;
596  }
597 
598 
605  void initialize (ParameterHandler &param);
607 
609 
610 
615  virtual boost::shared_ptr<FuelCellShop::Layer::GasDiffusionLayer<dim> > create_replica (const std::string &name)
616  {
617  const std::type_info& info = typeid(*this);
618  deallog << "Pure function " << __FUNCTION__
619  << " called in Class "
620  << info.name() << std::endl;
621  }
623 
625 
626 
630 
634  double porosity;
635 
640 
646 
652 
654 
655  };
656 
657  }
658 
659 } // FuelCellShop
660 
661 #endif // _FUELCELLSHOP__GAS_DIFFUSION_LAYER_H