OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
membrane_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 //
10 // - Class: membrane_layer.h
11 // - Description: (base) class for membrane layers
12 // - Developers: Marc Secanell (2013) and Madhur Bhaiya (2012-13)
13 // - Id: $Id: membrane_layer.h 1460 2013-08-30 22:28:49Z madhur $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELLSHOP__MEMBRANE_LAYER_H
18 #define _FUELCELLSHOP__MEMBRANE_LAYER_H
19 
20 // Include FCST classes
21 #include "base_layer.h"
23 #include "nafion.h"
24 
25 
26 namespace FuelCellShop
27 {
28  namespace Layer
29  {
115  template <int dim>
117  public BaseLayer<dim>
118  {
119  public:
121 
122 
151  static void declare_MembraneLayer_parameters (std::string pem_section_name, ParameterHandler &param)
152  {
155  iterator++)
156  {
157  iterator->second->declare_parameters(pem_section_name, param);
158  }
159  }
163  static void set_MembraneLayer_parameters (const std::vector<std::string>& name_dvar,
164  const std::vector<double>& value_dvar,
165  const std::string pem_section_name,
166  ParameterHandler &param)
167  {
170  iterator++)
171  {
172  iterator->second->set_parameters(name_dvar, value_dvar, pem_section_name, param);
173  }
174 
175  }
176 
190  static boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > create_MembraneLayer (std::string pem_section_name,
191  ParameterHandler &param)
192  {
193  boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > pointer;
194 
195  std::string concrete_name;
196  param.enter_subsection("Fuel cell data");
197  {
198  param.enter_subsection(pem_section_name);
199  {
200  concrete_name = param.get("Membrane layer type");
201  deallog << "name: "<<concrete_name.c_str()<<std::endl;
202  }
203  param.leave_subsection();
204  }
205  param.leave_subsection();
206 
208 
210  {
211  if (iterator->second)
212  {
213  pointer = iterator->second->create_replica(pem_section_name);
214  }
215  else
216  {
217  deallog<<"Pointer not initialized"<<std::endl;
218  abort();
219  }
220  }
221  else
222  {
223  deallog<<"Concrete name in FuelCellShop::Layer::MembraneLayer<dim>::create_MembraneLayer does not exist"<<std::endl;
224  abort();
225  }
226 
227  pointer->initialize(param);
228 
229  return pointer;
230  }
232 
234 
235 
251  const std::type_info& get_base_type() const
252  {
253  return typeid(MembraneLayer<dim>);
254  }
255 
260  virtual void set_derivative_flags(const std::vector<VariableNames>& flags)
261  {
262  this->derivative_flags = flags;
263  this->electrolyte->set_derivative_flags(flags);
264  }
265 
279  virtual void set_constant_solution(const double& value, const VariableNames& name)
280  {
282 
283  if (name == temperature_of_REV)
284  {
285  this->electrolyte->set_T(value);
286  }
287  }
288 
291  {
292  return this->electrolyte.get();
293  }
294 
296 
297 
298 
301  virtual void effective_proton_conductivity(double&) const;
306  virtual void effective_proton_conductivity(std::vector<double>&) const;
311  virtual void derivative_effective_proton_conductivity(std::map< VariableNames, std::vector<double> >&) const;
312 
316  virtual void effective_water_diffusivity(double&) const;
321  virtual void effective_water_diffusivity(std::vector<double>&) const;
326  virtual void derivative_effective_water_diffusivity(std::map< VariableNames, std::vector<double> >&) const;
327 
331  virtual void effective_oxygen_diffusivity(double&) const;
336  virtual void effective_oxygen_diffusivity(std::vector<double>&) const;
341  virtual void derivative_effective_oxygen_diffusivity(std::map< VariableNames, std::vector<double> >&) const;
342 
344 
345  protected:
347 
348 
358  MembraneLayer();
366  MembraneLayer(std::string name);
367 
371  ~MembraneLayer();
372 
378  void declare_parameters(ParameterHandler &param) const
379  {
380  this->declare_parameters(this->name, param);
381  }
382 
387  virtual void declare_parameters (const std::string& name,
388  ParameterHandler &param) const;
389 
394  virtual void set_parameters (const std::vector<std::string>& name_dvar,
395  const std::vector<double>& value_dvar,
396  const std::string& name,
397  ParameterHandler &param) const
398  {}
399 
400 
405  void initialize (ParameterHandler &param);
407 
408 
409 
415  typedef std::map< std::string, MembraneLayer<dim>* > _mapFactory;
416 
421  {
422  static _mapFactory mapFactory;
423  return &mapFactory;
424  }
430  virtual boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > create_replica (std::string &name)
431  {
432  const std::type_info& info = typeid(*this);
433  deallog << "Pure function " << __FUNCTION__
434  << " called in Class "
435  << info.name() << std::endl;
436  }
438 
440 
441 
444  std::string electrolyte_type;
445 
450  boost::shared_ptr< FuelCellShop::Material::PolymerElectrolyteBase > electrolyte;
451 
453 
454  };
455 
456  }
457 }
458 
459 #endif