OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
FuelCellShop::Layer::MembraneLayer< dim > Class Template Reference

Virtual class used to provide the interface for all MembraneLayer children. More...

#include <membrane_layer.h>

Inheritance diagram for FuelCellShop::Layer::MembraneLayer< dim >:
Inheritance graph
[legend]
Collaboration diagram for FuelCellShop::Layer::MembraneLayer< dim >:
Collaboration graph
[legend]

Public Member Functions

Accessors and Initialization
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 class belongs to, i.e. More...
 
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 layer. More...
 
virtual void set_constant_solution (const double &value, const VariableNames &name)
 Set those solution variables which are constant in the particular application. More...
 
FuelCellShop::Material::PolymerElectrolyteBaseget_electrolyte () const
 Method to provide access to the pointer to electrolyte material in the membrane layer. More...
 
Effective property calculators
virtual void effective_proton_conductivity (double &) const
 Compute the constant effective proton conductivity of the membrane. More...
 
virtual void effective_proton_conductivity (std::vector< double > &) const
 Compute the effective proton conductivity of the membrane at every quadrature point, as a function of solution variables. More...
 
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 by set_derivative_flags, at every quadrature point. More...
 
virtual void effective_water_diffusivity (double &) const
 Compute the constant effective water diffusivity of the membrane. More...
 
virtual void effective_water_diffusivity (std::vector< double > &) const
 Compute the effective water diffusivity of the membrane at every quadrature point, as a function of solution variables. More...
 
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 by set_derivative_flags, at every quadrature point. More...
 
virtual void effective_oxygen_diffusivity (double &) const
 Compute the constant effective oxygen diffusivity of the membrane. More...
 
virtual void effective_oxygen_diffusivity (std::vector< double > &) const
 Compute the effective oxygen diffusivity of the membrane at every quadrature point, as a function of solution variables. More...
 
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 by set_derivative_flags, at every quadrature point. More...
 
virtual void effective_thermal_conductivity (double &) const
 Compute the constant effective thermal conductivity of membrane layer. More...
 
virtual void effective_thermal_conductivity (std::vector< double > &) const
 Compute the effective thermal conductivity of membrane layer for isotropic case at all quadrature points. More...
 
virtual void effective_thermal_conductivity (std::vector< Tensor< 2, dim > > &) const
 Compute the effective thermal conductivity of membrane layer for anisotropic case at all quadrature points. More...
 
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 at all quadrature points. More...
 
virtual void derivative_effective_thermal_conductivity (std::vector< std::vector< Tensor< 2, dim > > > &) const
 Compute the derivative of the effective thermal conductivity in the membrane layer for anisotropic case at all quadrature points. More...
 
virtual void effective_thermoosmotic_diffusivity (std::vector< double > &) const
 Compute the effective thermo-osmotic diffusivity of lambda (sorbed water), at all quadrature points in the membrane layer. More...
 
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 membrane layer with respect to either the solution or design parameters. More...
 
- Public Member Functions inherited from FuelCellShop::Layer::BaseLayer< dim >
void set_position (const std::vector< Point< dim > > &p)
 Member function used by some applications such as dummyGDL in order to know which value to return. More...
 
virtual void set_local_material_id (const unsigned int &id)
 Function for setting local material id, for unit testing purposes. More...
 
void unset_local_material_id ()
 Function for unsetting local material id, so that it isn't incorrectly used later Once the key is "unset" to some invalid value, an error will be thrown if the key is requested again without being set. More...
 
virtual void set_solution (const std::vector< SolutionVariable > &)
 If the effective properties in the layer depend on the solution, the solution for a given cell should be passed to the class using this member function. More...
 
bool belongs_to_material (const unsigned int material_id)
 Check if a given cell belongs to the catalyst layer and assign. More...
 
const std::string & name_layer () const
 Return the name of the layer. More...
 
virtual void print_layer_properties () const
 This member function is a virtual class that can be used to output to screen information from the layer. More...
 
virtual bool test_layer ()
 This virtual class should be used for any derived class to be able to test the functionality of the class. More...
 
std::vector< unsigned int > get_material_ids ()
 Return the local material id of the layer. More...
 
unsigned int local_material_id () const
 Return the local material id of the layer, performs a check. More...
 

Protected Member Functions

Constructors, destructor, and initalization
 MembraneLayer ()
 Replica Constructors. More...
 
 MembraneLayer (std::string name)
 Constructor. More...
 
 ~MembraneLayer ()
 Destructor. More...
 
void declare_parameters (ParameterHandler &param) const
 Declare all necessary parameters in order to compute the coefficients. More...
 
virtual void declare_parameters (const std::string &name, ParameterHandler &param) const
 Declare parameters for a parameter file. More...
 
void initialize (ParameterHandler &param)
 Member function used to read in data and initialize the necessary data to compute the coefficients. More...
 
- Protected Member Functions inherited from FuelCellShop::Layer::BaseLayer< dim >
 BaseLayer ()
 Constructor. More...
 
 BaseLayer (const std::string &name)
 Constructor. More...
 
virtual ~BaseLayer ()
 Destructor. More...
 
virtual void set_parameters (const std::string &object_name, const std::vector< std::string > &name_dvar, const std::vector< double > &value_dvar, ParameterHandler &param)
 Member function used to change the values in the parameter file for a given list of parameters. More...
 
virtual void set_parameters (const std::vector< std::string > &name_dvar, const std::vector< double > &value_dvar, ParameterHandler &param)
 Set parameters in parameter file. More...
 

Protected Attributes

Internal variables
std::string electrolyte_type
 Type of membrane. More...
 
boost::shared_ptr
< FuelCellShop::Material::PolymerElectrolyteBase
electrolyte
 Pointer to the electrolyte object used in the constructor, and it is used to calculate the effective properties of the membrane layer. More...
 
- Protected Attributes inherited from FuelCellShop::Layer::BaseLayer< dim >
const std::string name
 Name of the layer. More...
 
std::vector< unsigned int > material_ids
 List of material IDs that belong to the layer. More...
 
std::vector< Point< dim > > point
 Coordinates of the point where we would like to compute the effective properties. More...
 
std::vector< VariableNamesderivative_flags
 Flags for derivatives: These flags are used to request derivatives. More...
 
std::map< VariableNames, double > constant_solutions
 Map storing values of solution variables constant in a particular application. More...
 

Instance Delivery

typedef std::map< std::string,
MembraneLayer< dim > * > 
_mapFactory
 This object is used to store all objects of type GasDiffusionLayer. More...
 
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. More...
 
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 line. More...
 
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. More...
 
static _mapFactoryget_mapFactory ()
 

Detailed Description

template<int dim>
class FuelCellShop::Layer::MembraneLayer< dim >

Virtual class used to provide the interface for all MembraneLayer children.

No object of type MembraneLayer should ever be created, instead this layer is used to initialize pointers of type MembraneLayer. The class has a database of children such that it will declare all necessary parameters for all children in the input file, read the input file, create the appripriate children and return a pointer to MembraneLayer with the children selected.

All public functions are virtual but the static functions used to declare parameters and to initialize a pointer of MembraneLayer, i.e. declare_all_MembraneLayer_parameters, set_all_MembraneLayer_parameters and create_MembraneLayer.

Usage Details:

In order to create a membrane layer within an application, the following steps need to be taken.

First, in the application .h file, create a pointer to a MembraneLayer object, i.e.

* boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > PEM;
*

This pointer object will be available anywhere inside the application. Because we do not want to worry about deleting the pointer afterwards, we use a Boost pointer which has its own memory management algorithms. See the Boost website for more information

Once the pointer is available, we need to do three things in the application

The object is ready for use now.

Here is a code example from ??.cc:

* //--------- IN DECLARE_PARAMETERS ------------------------------------------------------
* template <int dim>
* void
* NAME::??<dim>::declare_parameters(ParameterHandler& param)
* {
* (...)
* // Declare section on the input file where all info will be stored. In this case Fuel Cell Data > Membrane layer
* (...)
* }
*
* //--------- IN INITIALIZE ------------------------------------------------------
* template <int dim>
* void
* NAME::App???<dim>::_initialize(ParameterHandler& param)
* {
* (...)
* // Initialize layer classes:
* electrolyte.initialize(param);
* PEM->initialize(param);
* (...)
* }
*
Author
M. Secanell, 2013

Member Typedef Documentation

template<int dim>
typedef std::map< std::string, MembraneLayer<dim>* > FuelCellShop::Layer::MembraneLayer< dim >::_mapFactory
protected

This object is used to store all objects of type GasDiffusionLayer.

This information in then used in layer_generator.h in order to create the correct object depending on the specified concrete type of layer selected such as DummyGDL or SGL24BA.

Constructor & Destructor Documentation

template<int dim>
FuelCellShop::Layer::MembraneLayer< dim >::MembraneLayer ( )
protected

Replica Constructors.

Warning
For internal use only.

Constructor used only to create a prototype. Do not use in general since this will not include the name of the section in the parameter file you need.

template<int dim>
FuelCellShop::Layer::MembraneLayer< dim >::MembraneLayer ( std::string  name)
protected

Constructor.

Note
Eventually, I would like to make this private.
Deprecated:
Use create_MembraneLayer
template<int dim>
FuelCellShop::Layer::MembraneLayer< dim >::~MembraneLayer ( )
protected

Destructor.

Member Function Documentation

template<int dim>
static boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > FuelCellShop::Layer::MembraneLayer< dim >::create_MembraneLayer ( std::string  pem_section_name,
ParameterHandler &  param 
)
inlinestatic

Function used to select the appropriate MembraneLayer type as specified in the ParameterHandler under line.

* set Membrane type = NafionMembrane
*

current options are [ ]

The class will read the appropriate section in the parameter file, i.e. the one with name

Parameters
pem_section_name,createan object of the desired type and return it.

References FuelCellShop::Layer::MembraneLayer< dim >::create_replica(), FuelCellShop::Layer::MembraneLayer< dim >::get_mapFactory(), and FcstUtilities::log.

Here is the call graph for this function:

template<int dim>
virtual boost::shared_ptr<FuelCellShop::Layer::MembraneLayer<dim> > FuelCellShop::Layer::MembraneLayer< dim >::create_replica ( std::string &  name)
inlineprotectedvirtual

This member function is used to create an object of type gas diffusion layer.

Warning
This class MUST be redeclared in every child.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

References FcstUtilities::log.

Referenced by FuelCellShop::Layer::MembraneLayer< dim >::create_MembraneLayer().

Here is the caller graph for this function:

template<int dim>
static void FuelCellShop::Layer::MembraneLayer< dim >::declare_MembraneLayer_parameters ( std::string  pem_section_name,
ParameterHandler &  param 
)
inlinestatic

Function used to declare all the data necessary in the parameter files for all MembraneLayer children.

This member function should be used instead of declare_parameters() when we want to use a MembraneLayer pointer that selects the type of PEM to run at runtime.

Parameters
pem_section_nameName of the section that will encapuslate all the information about the PEM
paramParameterHandler object used to store all information about the simulation. Used to read the parameter file.

The parameter file would look as follows:

* subsection Fuel cell data
* (...)
* subsection Membrane layer #This is the name provided in gld_section_name
*
* set Membrane layer type = NafionMembrane #[ NafionMembrane ]
* set Material id = 2
*
* subsection NafionMembrane # This is the subsection for the first children
* set
* end
* end
* (...)
* end
*

References FuelCellShop::Layer::MembraneLayer< dim >::get_mapFactory().

Here is the call graph for this function:

template<int dim>
void FuelCellShop::Layer::MembraneLayer< dim >::declare_parameters ( ParameterHandler &  param) const
inlineprotectedvirtual

Declare all necessary parameters in order to compute the coefficients.

Deprecated:
Use declare_all_MembraneLayer_parameters

Reimplemented from FuelCellShop::Layer::BaseLayer< dim >.

References FuelCellShop::Layer::BaseLayer< dim >::name.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::declare_parameters ( const std::string &  name,
ParameterHandler &  param 
) const
protectedvirtual

Declare parameters for a parameter file.

Reimplemented from FuelCellShop::Layer::BaseLayer< dim >.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::derivative_effective_oxygen_diffusivity ( std::map< VariableNames, std::vector< double > > &  ) const
virtual

Compute the derivative of effective oxygen diffusivity of the membrane with respect to the flags set by set_derivative_flags, at every quadrature point.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::derivative_effective_proton_conductivity ( std::map< VariableNames, std::vector< double > > &  ) const
virtual

Compute the derivative of effective proton conductivity of the membrane with respect to the flags set by set_derivative_flags, at every quadrature point.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::derivative_effective_thermal_conductivity ( std::vector< std::vector< double > > &  ) const
virtual

Compute the derivative of the effective thermal conductivity in the membrane layer for isotropic case at all quadrature points.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::derivative_effective_thermal_conductivity ( std::vector< std::vector< Tensor< 2, dim > > > &  ) const
virtual

Compute the derivative of the effective thermal conductivity in the membrane layer for anisotropic case at all quadrature points.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::derivative_effective_thermoosmotic_diffusivity ( std::map< VariableNames, std::vector< double > > &  ) const
virtual

Compute the derivative of the effective thermo-osmotic diffusivity of lambda (sorbed water) in the membrane layer with respect to either the solution or design parameters.

The parameters with respect to which the derivatives are computed are setup in FuelCellShop::Layer::set_derivative_flags()

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::derivative_effective_water_diffusivity ( std::map< VariableNames, std::vector< double > > &  ) const
virtual

Compute the derivative of effective water diffusivity of the membrane with respect to the flags set by set_derivative_flags, at every quadrature point.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_oxygen_diffusivity ( double &  ) const
virtual

Compute the constant effective oxygen diffusivity of the membrane.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_oxygen_diffusivity ( std::vector< double > &  ) const
virtual

Compute the effective oxygen diffusivity of the membrane at every quadrature point, as a function of solution variables.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_proton_conductivity ( double &  ) const
virtual

Compute the constant effective proton conductivity of the membrane.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_proton_conductivity ( std::vector< double > &  ) const
virtual

Compute the effective proton conductivity of the membrane at every quadrature point, as a function of solution variables.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_thermal_conductivity ( double &  ) const
virtual

Compute the constant effective thermal conductivity of membrane layer.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_thermal_conductivity ( std::vector< double > &  ) const
virtual

Compute the effective thermal conductivity of membrane layer for isotropic case at all quadrature points.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_thermal_conductivity ( std::vector< Tensor< 2, dim > > &  ) const
virtual

Compute the effective thermal conductivity of membrane layer for anisotropic case at all quadrature points.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_thermoosmotic_diffusivity ( std::vector< double > &  ) const
virtual

Compute the effective thermo-osmotic diffusivity of lambda (sorbed water), at all quadrature points in the membrane layer.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_water_diffusivity ( double &  ) const
virtual

Compute the constant effective water diffusivity of the membrane.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::effective_water_diffusivity ( std::vector< double > &  ) const
virtual

Compute the effective water diffusivity of the membrane at every quadrature point, as a function of solution variables.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
const std::type_info& FuelCellShop::Layer::MembraneLayer< dim >::get_base_type ( ) const
inlinevirtual

This member function returns a type_info object with the name of the base layer type the inherited class belongs to, i.e.

Note that this is necessary if we want to find out not the name of the actual class which can be obtain using

const std::type_info& name = typeid(*this)

but the name of the parent class.

Note
Do not re-implement this class in children classes

Reimplemented from FuelCellShop::Layer::BaseLayer< dim >.

template<int dim>
FuelCellShop::Material::PolymerElectrolyteBase* FuelCellShop::Layer::MembraneLayer< dim >::get_electrolyte ( ) const
inline

Method to provide access to the pointer to electrolyte material in the membrane layer.

References FuelCellShop::Layer::MembraneLayer< dim >::electrolyte.

template<int dim>
static _mapFactory* FuelCellShop::Layer::MembraneLayer< dim >::get_mapFactory ( )
inlinestaticprotected
template<int dim>
void FuelCellShop::Layer::MembraneLayer< dim >::initialize ( ParameterHandler &  param)
protectedvirtual

Member function used to read in data and initialize the necessary data to compute the coefficients.

Reimplemented from FuelCellShop::Layer::BaseLayer< dim >.

Reimplemented in FuelCellShop::Layer::NafionMembrane< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::set_constant_solution ( const double &  value,
const VariableNames name 
)
inlinevirtual

Set those solution variables which are constant in the particular application.

If the effective properties in the layer depend on other variables that are usually part of the solution vector but are assumed to be constant in this simulation, the const solution value should be passed to the class using this member function. This method should be called in the initialization section of the application. This function takes value to be set as the first argument and the VariableNames as second argument. For instance, it's required to store constant temperature value for an isothermal application, in that case this method can be used. e.g., in order to set temperature as 353.0 [Kelvin] in the layer, you can use the following code:

* // In the initialization section of the application.
* layer.set_constant_solution(353.0, VariableNames::temperature_of_REV);
*

If temperature_of_REV is passed using this method, it also sets the temperature [Kelvin] values in the electrolyte object.

Reimplemented from FuelCellShop::Layer::BaseLayer< dim >.

References FuelCellShop::Layer::MembraneLayer< dim >::electrolyte, FuelCellShop::Layer::BaseLayer< dim >::set_constant_solution(), and temperature_of_REV.

Here is the call graph for this function:

template<int dim>
virtual void FuelCellShop::Layer::MembraneLayer< dim >::set_derivative_flags ( const std::vector< VariableNames > &  flags)
inlinevirtual

Method used to set the variables for which you would like to compute the derivatives in the membrane layer.

It takes vector of VariableNames as an input argument. It also sets the derivative flags in the electrolyte object of the catalyst layer.

Reimplemented from FuelCellShop::Layer::BaseLayer< dim >.

References FuelCellShop::Layer::BaseLayer< dim >::derivative_flags, and FuelCellShop::Layer::MembraneLayer< dim >::electrolyte.

Member Data Documentation

template<int dim>
boost::shared_ptr< FuelCellShop::Material::PolymerElectrolyteBase > FuelCellShop::Layer::MembraneLayer< dim >::electrolyte
protected

Pointer to the electrolyte object used in the constructor, and it is used to calculate the effective properties of the membrane layer.

Referenced by FuelCellShop::Layer::MembraneLayer< dim >::get_electrolyte(), FuelCellShop::Layer::MembraneLayer< dim >::set_constant_solution(), and FuelCellShop::Layer::MembraneLayer< dim >::set_derivative_flags().

template<int dim>
std::string FuelCellShop::Layer::MembraneLayer< dim >::electrolyte_type
protected

Type of membrane.


The documentation for this class was generated from the following file: