OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
catalyst_layer.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2006-13 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 // - Class: catalyst_layer.h
10 // - Description: Class characterizing the base catalyst layer and defining interface methods.
11 // - Developers: Marc Secanell (2011-2013) and Madhur Bhaiya (2013)
12 // - Id: $Id: catalyst_layer.h 1465 2013-08-30 22:42:25Z madhur $
13 //
14 //---------------------------------------------------------------------------
15 
16 #ifndef _FUELCELLSHOP__LAYER_CATALYST_LAYER_H
17 #define _FUELCELLSHOP__LAYER_CATALYST_LAYER_H
18 
19 // Include deal.II classes
20 #include<base/parameter_handler.h>
21 #include<base/point.h>
22 #include <base/function.h>
23 #include <lac/vector.h>
24 #include <fe/fe_values.h>
25 
26 // Include FCST classes
27 #include "fcst_constants.h"
28 #include "base_layer.h"
29 #include "porous_layer.h"
30 #include "base_kinetics.h"
32 #include "catalyst_support_base.h"
33 #include "catalyst_base.h"
34 #include "platinum.h"
35 #include "carbon.h"
36 #include "nafion.h"
37 #include "PureGas.h"
38 #include "BinaryDiffusion.h"
39 
40 //Include STL
41 #include <cmath>
42 #include <iostream>
43 
44 class AgglomerateCLTest;
45 
46 namespace FuelCellShop
47 {
48  namespace Layer
49  {
144  template <int dim>
146  public PorousLayer<dim>
147  {
148 
149  public:
151 
152 
156  friend class ::AgglomerateCLTest;
158 
160 
161 
182  static void declare_CatalystLayer_parameters (const std::string &cl_section_name,
183  ParameterHandler &param)
184  {
187  iterator++)
188  {
189  iterator->second->declare_parameters(cl_section_name, param);
190  }
191  }
192 
196  static void set_CatalystLayer_parameters (const std::vector<std::string>& name_dvar,
197  const std::vector<double>& value_dvar,
198  const std::string& cl_section_name,
199  ParameterHandler &param)
200  {
201  /*
202  for (typename FuelCellShop::Layer::CatalystLayer<dim>::_mapFactory::iterator iterator = FuelCellShop::Layer::CatalystLayer<dim>::get_mapFactory()->begin();
203  iterator != FuelCellShop::Layer::CatalystLayer<dim>::get_mapFactory()->end();
204  iterator++)
205  {
206  iterator->second->set_parameters(name_dvar, value_dvar, cl_section_name, param);
207  }
208  */
209  }
210 
224  static boost::shared_ptr<FuelCellShop::Layer::CatalystLayer<dim> > create_CatalystLayer (const std::string& cl_section_name,
225  ParameterHandler &param)
226  {
227  boost::shared_ptr<FuelCellShop::Layer::CatalystLayer<dim> > pointer;
228 
229  std::string concrete_name;
230  param.enter_subsection("Fuel cell data");
231  {
232  param.enter_subsection(cl_section_name);
233  {
234  concrete_name = param.get("Catalyst layer type");
235  //deallog << "name: "<<concrete_name.c_str()<<std::endl;
236  }
237  param.leave_subsection();
238  }
239  param.leave_subsection();
240 
242 
244  {
245  if (iterator->second)
246  {
247  pointer = iterator->second->create_replica(cl_section_name);
248  }
249  else
250  {
251  deallog<<"Pointer not initialized"<<std::endl;
252  abort();
253  }
254  }
255  else
256  {
257  deallog<<"Concrete name in FuelCellShop::Layer::CatalystLayer<dim>::create_CatalystLayer does not exist"<<std::endl;
258  abort();
259  }
260 
261  pointer->initialize(param);
262 
263  return pointer;
264  }
266 
268 
269 
283  virtual void set_constant_solution(const double& value, const VariableNames& name)
284  {
286 
287  if (name == temperature_of_REV)
288  {
289  this->electrolyte->set_T(value);
290  }
291 
292  else if (name == total_pressure)
293  {
294  this->kinetics->set_p_t(value);
295  this->electrolyte->set_p_t(value);
296  }
297  }
298 
306  virtual void set_solution(const std::vector< SolutionVariable >&);
307 
312  virtual void set_derivative_flags(const std::vector<VariableNames>& flags)
313  {
314  this->derivative_flags = flags;
315  this->kinetics->set_derivative_flags(flags);
316  this->electrolyte->set_derivative_flags(flags);
317  }
318 
324  void set_reaction_kinetics(const std::string& rxn_name)
325  {
326  this->kinetics->set_reaction_kinetics(rxn_name);
327  this->catalyst->set_reaction_kinetics(rxn_name);
328  }
330 
332 
333 
350  const std::type_info& get_base_type() const
351  {
352  return typeid(CatalystLayer<dim>);
353  }
354 
356 
358 
359 
367  virtual void effective_gas_diffusivity(const double& , double& ) const
368  {
369  const std::type_info& info = typeid(*this);
370  deallog << "Pure function " << __FUNCTION__
371  << " called in Class "
372  << info.name() << std::endl;
373  };
374 
381  virtual void effective_gas_diffusivity(Table<2, double>&) const
382  {
383  const std::type_info& info = typeid(*this);
384  deallog << "Pure function " << __FUNCTION__
385  << " called in Class "
386  << info.name() << std::endl;
387  };
388 
396  virtual void effective_gas_diffusivity(Table< 2, Tensor<2,dim> >&) const
397  {
398  const std::type_info& info = typeid(*this);
399  deallog << "Pure function " << __FUNCTION__
400  << " called in Class "
401  << info.name() << std::endl;
402  };
403 
407  virtual void effective_electron_conductivity(double& ) const
408  {
409  const std::type_info& info = typeid(*this);
410  deallog << "Pure function " << __FUNCTION__
411  << " called in Class "
412  << info.name() << std::endl;
413  };
418  {
419  const std::type_info& info = typeid(*this);
420  deallog << "Pure function " << __FUNCTION__
421  << " called in Class "
422  << info.name() << std::endl;
423  };
429  virtual void derivative_effective_electron_conductivity(std::vector<double>& ) const
430  {
431  const std::type_info& info = typeid(*this);
432  deallog << "Pure function " << __FUNCTION__
433  << " called in Class "
434  << info.name() << std::endl;
435  };
441  virtual void derivative_effective_electron_conductivity(std::vector<Tensor<2,dim> >& ) const
442  {
443  const std::type_info& info = typeid(*this);
444  deallog << "Pure function " << __FUNCTION__
445  << " called in Class "
446  << info.name() << std::endl;
447  };
448 
452  virtual void effective_proton_conductivity(double& ) const
453  {
454  const std::type_info& info = typeid(*this);
455  deallog << "Pure function " << __FUNCTION__
456  << " called in Class "
457  << info.name() << std::endl;
458  };
462  virtual void effective_proton_conductivity(std::vector<double>& ) const
463  {
464  const std::type_info& info = typeid(*this);
465  deallog << "Pure function " << __FUNCTION__
466  << " called in Class "
467  << info.name() << std::endl;
468  };
474  virtual void derivative_effective_proton_conductivity(std::map< VariableNames, std::vector<double> >& ) const
475  {
476  const std::type_info& info = typeid(*this);
477  deallog << "Pure function " << __FUNCTION__
478  << " called in Class "
479  << info.name() << std::endl;
480  };
481 
485  virtual void effective_water_diffusivity(double& ) const
486  {
487  const std::type_info& info = typeid(*this);
488  deallog << "Pure function " << __FUNCTION__
489  << " called in Class "
490  << info.name() << std::endl;
491  };
496  virtual void effective_water_diffusivity(std::vector<double>& ) const
497  {
498  const std::type_info& info = typeid(*this);
499  deallog << "Pure function " << __FUNCTION__
500  << " called in Class "
501  << info.name() << std::endl;
502  }
503 
509  virtual void derivative_effective_water_diffusivity(std::map< VariableNames, std::vector<double> >& ) const
510  {
511  const std::type_info& info = typeid(*this);
512  deallog << "Pure function " << __FUNCTION__
513  << " called in Class "
514  << info.name() << std::endl;
515  }
516 
520  virtual void gas_permeablity(double& ) const
521  {
522  const std::type_info& info = typeid(*this);
523  deallog << "Pure function " << __FUNCTION__
524  << " called in Class "
525  << info.name() << std::endl;
526  };
530  virtual void gas_permeablity(Tensor<2,dim>& ) const
531  {
532  const std::type_info& info = typeid(*this);
533  deallog << "Pure function " << __FUNCTION__
534  << " called in Class "
535  << info.name() << std::endl;
536  };
542  virtual void derivative_gas_permeablity(std::vector<double>& ) const
543  {
544  const std::type_info& info = typeid(*this);
545  deallog << "Pure function " << __FUNCTION__
546  << " called in Class "
547  << info.name() << std::endl;
548  };
554  virtual void derivative_gas_permeablity(std::vector<Tensor<2,dim> >& ) const
555  {
556  const std::type_info& info = typeid(*this);
557  deallog << "Pure function " << __FUNCTION__
558  << " called in Class "
559  << info.name() << std::endl;
560  };
564  virtual void liquid_permeablity(double& ) const
565  {
566  const std::type_info& info = typeid(*this);
567  deallog << "Pure function " << __FUNCTION__
568  << " called in Class "
569  << info.name() << std::endl;
570  };
574  virtual void liquid_permeablity(Tensor<2,dim>& ) const
575  {
576  const std::type_info& info = typeid(*this);
577  deallog << "Pure function " << __FUNCTION__
578  << " called in Class "
579  << info.name() << std::endl;
580  };
586  virtual void derivative_liquid_permeablity(std::vector<double>& ) const
587  {
588  const std::type_info& info = typeid(*this);
589  deallog << "Pure function " << __FUNCTION__
590  << " called in Class "
591  << info.name() << std::endl;
592  };
598  virtual void derivative_liquid_permeablity(std::vector<Tensor<2,dim> >& ) const
599  {
600  const std::type_info& info = typeid(*this);
601  deallog << "Pure function " << __FUNCTION__
602  << " called in Class "
603  << info.name() << std::endl;
604  };
606 
608 
609 
613  virtual void current_density(std::vector<double>&)
614  {
615  const std::type_info& info = typeid(*this);
616  deallog << "Pure function " << __FUNCTION__
617  << " called in Class "
618  << info.name() << std::endl;
619  };
620 
625  virtual void current_density(std::vector<double>&, std::vector<double>&)
626  {
627  const std::type_info& info = typeid(*this);
628  deallog << "Pure function " << __FUNCTION__
629  << " called in Class "
630  << info.name() << std::endl;
631  };
632 
637  virtual void derivative_current_density(std::map< VariableNames, std::vector<double> >& )
638  {
639  const std::type_info& info = typeid(*this);
640  deallog << "Pure function " << __FUNCTION__
641  << " called in Class "
642  << info.name() << std::endl;
643  };
644 
646  virtual double get_active_area_Pt() const
647  {
648  const std::type_info& info = typeid(*this);
649  deallog << "Pure function " << __FUNCTION__
650  << " called in Class "
651  << info.name() << std::endl;
652  return 0.0;
653  };
654 
657  {
658  return this->electrolyte.get();
659  }
660 
661 
664  {
665  return this->kinetics.get();
666  }
667 
669 
670  protected:
671 
673 
674 
680  CatalystLayer();
681 
685  ~CatalystLayer();
686 
690  CatalystLayer(const std::string& name);
691 
692 
700  virtual void declare_parameters (const std::string& name, ParameterHandler &param) const;
701 
707  virtual void set_parameters (const std::vector<std::string>& name_dvar,
708  const std::vector<double>& value_dvar,
709  const std::string& name,
710  ParameterHandler &param) const;
711 
716  void initialize (ParameterHandler &param);
717 
718 
720 
721 
722 
728  typedef std::map< std::string, CatalystLayer<dim>* > _mapFactory;
730 
732 
733 
784  {
785  static _mapFactory mapFactory;
786  return &mapFactory;
787  }
789 
790 
795  virtual boost::shared_ptr<FuelCellShop::Layer::CatalystLayer<dim> > create_replica (const std::string &name)
796  {
797  const std::type_info& info = typeid(*this);
798  deallog << "Pure function " << __FUNCTION__
799  << " called in Class "
800  << info.name() << std::endl;
801  }
803 
805 
806 
810 
815 
817  std::string catalyst_type;
818 
821 
823  std::string electrolyte_type;
824 
826  std::string kinetics_type;
831  boost::shared_ptr< FuelCellShop::Material::PolymerElectrolyteBase > electrolyte;
832 
837  boost::shared_ptr< FuelCellShop::Material::CatalystSupportBase > catalyst_support;
838 
843  boost::shared_ptr< FuelCellShop::Material::CatalystBase > catalyst;
844 
846  boost::shared_ptr< FuelCellShop::Kinetics::BaseKinetics > kinetics;
847 
851  unsigned int n_quad;
852 
854  std::map<VariableNames ,SolutionVariable> solutions;
855 
858 
860  };
861 
862  } // Layer
863 
864 } // FuelCellShop
865 
866 #endif // _FUELCELLSHOP__LAYER__CATALYST_LAYER_H
867