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 2605 2014-08-15 03:36:44Z secanell $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELLSHOP__MEMBRANE_LAYER_H
18 #define _FUELCELLSHOP__MEMBRANE_LAYER_H
19 
20 // Include FCST classes
21 #include <layers/base_layer.h>
23 #include <materials/nafion.h>
24 
25 
26 namespace FuelCellShop
27 {
28  namespace Layer
29  {
97  template <int dim>
98  class MembraneLayer :
99  public BaseLayer<dim>
100  {
101  public:
103 
104 
133  static void declare_MembraneLayer_parameters (std::string pem_section_name, ParameterHandler &param)
134  {
137  iterator++)
138  {
139  iterator->second->declare_parameters(pem_section_name, param);
140  }
141  }
142 
156  static boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > create_MembraneLayer (std::string pem_section_name,
157  ParameterHandler &param)
158  {
159  boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > pointer;
160 
161  std::string concrete_name;
162  param.enter_subsection("Fuel cell data");
163  {
164  param.enter_subsection(pem_section_name);
165  {
166  concrete_name = param.get("Membrane layer type");
167  FcstUtilities::log << "name: "<<concrete_name.c_str()<<std::endl;
168  }
169  param.leave_subsection();
170  }
171  param.leave_subsection();
172 
174 
176  {
177  if (iterator->second)
178  {
179  pointer = iterator->second->create_replica(pem_section_name);
180  }
181  else
182  {
183  FcstUtilities::log<<"Pointer not initialized"<<std::endl;
184  abort();
185  }
186  }
187  else
188  {
189  FcstUtilities::log<<"Concrete name in FuelCellShop::Layer::MembraneLayer<dim>::create_MembraneLayer does not exist"<<std::endl;
190  abort();
191  }
192 
193  pointer->initialize(param);
194 
195  return pointer;
196  }
198 
200 
201 
217  const std::type_info& get_base_type() const
218  {
219  return typeid(MembraneLayer<dim>);
220  }
221 
226  virtual void set_derivative_flags(const std::vector<VariableNames>& flags)
227  {
228  this->derivative_flags = flags;
229  this->electrolyte->set_derivative_flags(flags);
230  }
231 
245  virtual void set_constant_solution(const double& value, const VariableNames& name)
246  {
248 
249  if (name == temperature_of_REV)
250  {
251  this->electrolyte->set_T(value);
252  }
253  }
254 
257  {
258  return this->electrolyte.get();
259  }
260 
262 
264 
267  virtual void effective_proton_conductivity(double&) const;
272  virtual void effective_proton_conductivity(std::vector<double>&) const;
277  virtual void derivative_effective_proton_conductivity(std::map< VariableNames, std::vector<double> >&) const;
278 
282  virtual void effective_water_diffusivity(double&) const;
287  virtual void effective_water_diffusivity(std::vector<double>&) const;
292  virtual void derivative_effective_water_diffusivity(std::map< VariableNames, std::vector<double> >&) const;
293 
297  virtual void effective_oxygen_diffusivity(double&) const;
302  virtual void effective_oxygen_diffusivity(std::vector<double>&) const;
307  virtual void derivative_effective_oxygen_diffusivity(std::map< VariableNames, std::vector<double> >&) const;
308 
312  virtual void effective_thermal_conductivity(double&) const;
316  virtual void effective_thermal_conductivity(std::vector<double>&) const;
320  virtual void effective_thermal_conductivity(std::vector< Tensor<2,dim> >&) const;
325  virtual void derivative_effective_thermal_conductivity(std::vector< std::vector<double> >&) const;
330  virtual void derivative_effective_thermal_conductivity(std::vector< std::vector< Tensor<2,dim> > >&) const;
331 
336  virtual void effective_thermoosmotic_diffusivity(std::vector<double>& ) const;
337 
343  virtual void derivative_effective_thermoosmotic_diffusivity(std::map< VariableNames, std::vector<double> >& ) const;
344 
345 
347 
348  protected:
350 
351 
361  MembraneLayer();
369  MembraneLayer(std::string name);
370 
374  ~MembraneLayer();
375 
381  void declare_parameters(ParameterHandler &param) const
382  {
383  this->declare_parameters(this->name, param);
384  }
385 
390  virtual void declare_parameters (const std::string& name,
391  ParameterHandler &param) const;
392 
397  void initialize (ParameterHandler &param);
399 
401 
407  typedef std::map< std::string, MembraneLayer<dim>* > _mapFactory;
408 
413  {
414  static _mapFactory mapFactory;
415  return &mapFactory;
416  }
422  virtual boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > create_replica (std::string &name)
423  {
424  const std::type_info& info = typeid(*this);
425  FcstUtilities::log << "Pure function " << __FUNCTION__
426  << " called in Class "
427  << info.name() << std::endl;
428  }
430 
432 
433 
436  std::string electrolyte_type;
437 
442  boost::shared_ptr< FuelCellShop::Material::PolymerElectrolyteBase > electrolyte;
443 
445 
446  };
447 
448  }
449 }
450 
451 #endif
virtual void effective_oxygen_diffusivity(double &) const
Compute the constant effective oxygen diffusivity of the membrane.
FuelCellShop::Material::PolymerElectrolyteBase * get_electrolyte() const
Method to provide access to the pointer to electrolyte material in the membrane layer.
Definition: membrane_layer.h:256
virtual void effective_thermoosmotic_diffusivity(std::vector< double > &) const
Compute the effective thermo-osmotic diffusivity of lambda (sorbed water), at all quadrature points i...
static boost::shared_ptr< FuelCellShop::Layer::MembraneLayer< dim > > create_MembraneLayer(std::string pem_section_name, ParameterHandler &param)
Function used to select the appropriate MembraneLayer type as specified in the ParameterHandler under...
Definition: membrane_layer.h:156
static _mapFactory * get_mapFactory()
Definition: membrane_layer.h:412
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:63
virtual void derivative_effective_proton_conductivity(std::map< VariableNames, std::vector< double > > &) const
Compute the derivative of effective proton conductivity of the membrane with respect to the flags set...
static void declare_MembraneLayer_parameters(std::string pem_section_name, ParameterHandler &param)
Function used to declare all the data necessary in the parameter files for all MembraneLayer children...
Definition: membrane_layer.h:133
virtual void set_constant_solution(const double &value, const VariableNames &name)
Set those solution variables which are constant in the particular application.
Definition: base_layer.h:113
const std::string name
Name of the layer.
Definition: base_layer.h:336
void initialize(ParameterHandler &param)
Member function used to read in data and initialize the necessary data to compute the coefficients...
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: membrane_layer.h:217
virtual void set_constant_solution(const double &value, const VariableNames &name)
Set those solution variables which are constant in the particular application.
Definition: membrane_layer.h:245
Definition: system_management.h:76
virtual boost::shared_ptr< FuelCellShop::Layer::MembraneLayer< dim > > create_replica(std::string &name)
This member function is used to create an object of type gas diffusion layer.
Definition: membrane_layer.h:422
virtual void set_derivative_flags(const std::vector< VariableNames > &flags)
Method used to set the variables for which you would like to compute the derivatives in the membrane ...
Definition: membrane_layer.h:226
virtual void derivative_effective_thermal_conductivity(std::vector< std::vector< double > > &) const
Compute the derivative of the effective thermal conductivity in the membrane layer for isotropic case...
void declare_parameters(ParameterHandler &param) const
Declare all necessary parameters in order to compute the coefficients.
Definition: membrane_layer.h:381
virtual void derivative_effective_water_diffusivity(std::map< VariableNames, std::vector< double > > &) const
Compute the derivative of effective water diffusivity of the membrane with respect to the flags set b...
boost::shared_ptr< FuelCellShop::Material::PolymerElectrolyteBase > electrolyte
Pointer to the electrolyte object used in the constructor, and it is used to calculate the effective ...
Definition: membrane_layer.h:442
virtual void effective_thermal_conductivity(double &) const
Compute the constant effective thermal conductivity of membrane layer.
FCSTLogStream log
Object used to output data to file and, if file attached recorded to a file as well.
This class implements the interface to compute the properties of a &quot;standard&quot; polymer electrolyte mem...
Definition: polymer_electrolyte_material_base.h:59
virtual void derivative_effective_oxygen_diffusivity(std::map< VariableNames, std::vector< double > > &) const
Compute the derivative of effective oxygen diffusivity of the membrane with respect to the flags set ...
std::string electrolyte_type
Type of membrane.
Definition: membrane_layer.h:436
std::map< std::string, MembraneLayer< dim > * > _mapFactory
This object is used to store all objects of type GasDiffusionLayer.
Definition: membrane_layer.h:407
Virtual class used to provide the interface for all MembraneLayer children.
Definition: membrane_layer.h:98
virtual void derivative_effective_thermoosmotic_diffusivity(std::map< VariableNames, std::vector< double > > &) const
Compute the derivative of the effective thermo-osmotic diffusivity of lambda (sorbed water) in the me...
MembraneLayer()
Replica Constructors.
virtual void effective_water_diffusivity(double &) const
Compute the constant effective water diffusivity of the membrane.
std::vector< VariableNames > derivative_flags
Flags for derivatives: These flags are used to request derivatives.
Definition: base_layer.h:348
Virtual class used to characterize a generic layer interface.
Definition: base_layer.h:58
virtual void effective_proton_conductivity(double &) const
Compute the constant effective proton conductivity of the membrane.