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::MicroPorousLayer< dim > Class Template Reference

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

#include <micro_porous_layer.h>

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

Public Member Functions

Initalization
void declare_parameters (ParameterHandler &param) const
 Declare parameters for a parameter file.
 
void initialize (ParameterHandler &param)
 Member function used to read in data and initialize the necessary data to compute the coefficients.
 
Accessors and info
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.
 
Effective property calculators
virtual void effective_gas_diffusivity (const double &property, double &effective_property) const
 Compute the effective property in the pores.
 
virtual void effective_gas_diffusivity (const double &property, Tensor< 2, dim > &effective_property) const
 Compute the effective property in the pores.
 
virtual void effective_gas_diffusivity (Table< 2, Tensor< 2, dim > > &D_eff) const
 Compute the effective property in the pores.
 
virtual void effective_electron_conductivity (double &) const
 Compute the effective conductivity.
 
virtual void effective_electron_conductivity (Tensor< 2, dim > &) const
 Compute the effective conductivity.
 
virtual bool set_method_effective_transport_property_solid (std::string)
 Specify the methodology to be used to compute the effective properties for the porous phase.
 
virtual void effective_transport_property_solid (const double &property, double &effective_property) const
 Compute the effective property of a property that is defined by the network of fibres.
 
virtual void effective_transport_property_solid (const Tensor< 2, dim > &property, Tensor< 2, dim > &effective_property) const
 Compute the effective property of a property that is defined by the network of fibres.
 
- Public Member Functions inherited from FuelCellShop::Layer::PorousLayer< dim >
void set_gases_and_compute (std::vector< FuelCellShop::Material::PureGas * > &gases_in, const double &pressure_in, const double &temperature_in)
 Member function used to store all the gases that are in the pore space in the gas diffusion layer as well as their temperature [Kelvin] and total pressure [atm].
 
void compute_gas_diffusion (FuelCellShop::Material::PureGas *solute_gas, FuelCellShop::Material::PureGas *solvent_gas)
 Member function used to compute bulk diffusion coefficients and derivatives w.r.t temperature for non-isothermal case and store inside the layer.
 
void set_gases (std::vector< FuelCellShop::Material::PureGas * > &gases_in, const double &pressure_in)
 Member function used to store all the gases that are in the pore space in the porous layer.
 
void set_temperature (const SolutionVariable &T_in)
 Member function used to set the temperature ]Kelvin] at every quadrature point inside the cell.
 
FuelCellShop::Material::PureGasget_gas_pointer (int index) const
 Return the FuelCellShop::Material::PureGas pointer that is stored inside the class in the ith position.
 
std::vector
< FuelCellShop::Material::PureGas * > 
get_gases () const
 Returns the vector of FuelCellShop::Material::PureGas pointers stored in the porous layer.
 
void get_gas_index (FuelCellShop::Material::PureGas *gas_type, int &index) const
 Return the gas index in the GDL class.
 
void get_T_and_p (double &T, double &p) const
 Return the constant temperature [Kelvin] and constant pressure [atm] inside the layer.
 
void get_p (double &p) const
 Return the constant pressure [atm] inside the layer.
 
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.
 
virtual bool test_layer () const
 This virtual class should be used for any derived class to be able to test the functionality of the class.
 
- Public Member Functions inherited from FuelCellShop::Layer::BaseLayer< dim >
virtual void set_derivative_flags (const std::vector< VariableNames > &flags)
 Set the variables for which you would like to compute the derivatives.
 
void set_position (std::vector< Point< dim > > &p)
 Member function used by some applications such as dummyGDL in order to know which value to return.
 
virtual void set_constant_solution (const double &value, const VariableNames &name)
 Set those solution variables which are constant in the particular application.
 
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.
 
bool belongs_to_material (const char material_id)
 Check if a given cell belongs to the catalyst layer.
 
const std::string & name_material ()
 Return the name of the layer.
 
virtual bool test_layer ()
 This virtual class should be used for any derived class to be able to test the functionality of the class.
 
unsigned int get_material_id ()
 Return the material id of the layer.
 

Declaration

static const std::string concrete_name
 Concrete name used for objects of this class.
 
 MicroPorousLayer ()
 Replica Constructor.
 
 MicroPorousLayer (const std::string &name)
 Constructor.
 
 ~MicroPorousLayer ()
 Destructor.
 
void declare_parameters (const std::string &name, ParameterHandler &param) const
 Declare parameters for a parameter file.
 
void set_parameters (const std::vector< std::string > &name_dvar, const std::vector< double > &value_dvar, const std::string &name, ParameterHandler &param) const
 Member function used to set new parameters values in the optimization loop.
 

Instance Delivery

typedef std::map< std::string,
MicroPorousLayer< dim > * > 
_mapFactory
 This object is used to store all objects of type MicroPorousLayer.
 
static void declare_MicroPorousLayer_parameters (const std::string &mpl_section_name, ParameterHandler &param)
 Function used to declare all the data necessary in the parameter files former all MicroPorousLayer children.
 
static void set_MicroPorousLayer_parameters (const std::vector< std::string > &name_dvar, const std::vector< double > &value_dvar, const std::string &mpl_section_name, ParameterHandler &param)
 This routine is only used for optimization and parameteric studies purposes when using the Dakota Interface.
 
static boost::shared_ptr
< FuelCellShop::Layer::MicroPorousLayer
< dim > > 
create_MicroPorousLayer (const std::string &mpl_section_name, ParameterHandler &param)
 Function used to select the appropriate MicroPorousLayer.
 
virtual boost::shared_ptr
< FuelCellShop::Layer::MicroPorousLayer
< dim > > 
create_replica (const std::string &name)
 This member function is used to create an object of type micro porous layer.
 
static _mapFactoryget_mapFactory ()
 Return the map library that stores all childrens of this class.
 

Additional Inherited Members

- Protected Member Functions inherited from FuelCellShop::Layer::PorousLayer< dim >
 PorousLayer (const std::string &name)
 Constructor.
 
 PorousLayer ()
 Constructor.
 
virtual ~PorousLayer ()
 Destructor.
 
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.
 
virtual void set_parameters (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.
 
virtual void gas_diffusion_coefficients (Table< 2, double > &) const
 Return the molecular diffusivty all the gases assigned to the layer using set_gases_and_compute.
 
virtual void derivative_gas_diffusion_coefficients (std::vector< Table< 2, double > > &) const
 Return the derivative of the molecular diffusion coefficient with respect to the derivative flags for all the gases assigned to the layer using set_gases_and_compute.
 
- Protected Attributes inherited from FuelCellShop::Layer::PorousLayer< dim >
std::string diffusion_species_name
 If GDL properties are stored inside the class (e.g DummyGDL) then, return the property stored under coefficient_name name.
 
std::vector
< FuelCellShop::Material::PureGas * > 
gases
 Gases inside the layer.
 
double temperature
 Temperature [Kelvin] used to compute gas diffusivity.
 
double pressure
 Total pressure [atm] used to compute gas diffusivity.
 
SolutionVariable T_vector
 Temperature at every quadrature point inside the cell.
 
Table< 2, double > D_ECtheory
 Tensor of diffusion coefficients – This are computed with setting up the gas so that they do not need to be recomputed all the time.
 
std::vector< Table< 2, double > > dD_ECtheory_dx
 Vector of tensors for the derivative of the diffusion coefficients – This are computed with setting up the gas so that they do not need to be recomputed all the time.
 
std::vector< double > D_bulk
 Vector of bulk diffusion coefficients at every quadrature point inside the cell.
 
std::vector< double > dD_bulk_dT
 Vector of derivative of bulk diffusion coefficients w.r.t temperature, at every quadrature point inside the cell.
 

Detailed Description

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

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

No object of type MicroPorousLayer should ever be created, instead this layer is used to initialize pointers of type MicroPorousLayer. 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 MicroPorousLayer with the children selected.

All public functions are virtual but the static functions used to declare parameters and to initialize a pointer of MicroPorousLayer, i.e. declare_all_MicroPorousLayer_parameters, set_all_MicroPorousLayer_parameters and create_MicroPorousLayer.

Usage Details:

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

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

boost::shared_ptr<FuelCellShop::Layer::MicroPorousLayer<dim> > CMPL;

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 app_cathode.cc:

//--------- IN DECLARE_PARAMETERS ------------------------------------------------------
template <int dim>
void
NAME::AppCathode<dim>::declare_parameters(ParameterHandler& param)
{
(...)
// Declare section on the input file where all info will be stored. In this case Fuel Cell Data > Cathode microporous layer
(...)
}
//--------- IN SET_PARAMETERS ------------------------------------------------------
template <int dim>
void
NAME::AppCathode<dim>::set_parameters(const std::vector<std::string>& name_dvar,
const std::vector<double>& value_dvar,
ParameterHandler& param)
{
(...)
// Set any parameters in the parameter file related to the layers.
FuelCellShop::Layer::MicroPorousLayer<dim>::set_MicroPorousLayer_parameters(name_dvar, value_dvar, "Cathode microporous layer", param);
(...)
}
//--------- IN INITIALIZE ------------------------------------------------------
template <int dim>
void
NAME::AppCathode<dim>::_initialize(ParameterHandler& param)
{
(...)
// Initialize layer classes:
std::vector< FuelCellShop::Material::PureGas * > gases;
gases.push_back(&oxygen);
gases.push_back(&nitrogen);
// Here, I specify the gases that exist in the MPL and their temperature and pressure (based on operating conditions):
CMPL->set_gases_and_compute(gases, OC.get_pc_atm (), OC.get_T());
(...)
}
Author
M. Secanell, 2013

Member Typedef Documentation

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

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

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 DummyMPL or SGL24BC.

Constructor & Destructor Documentation

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

Replica Constructor.

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::MicroPorousLayer< dim >::MicroPorousLayer ( const std::string &  name)
protected

Constructor.

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

Destructor.

Member Function Documentation

template<int dim>
static boost::shared_ptr<FuelCellShop::Layer::MicroPorousLayer<dim> > FuelCellShop::Layer::MicroPorousLayer< dim >::create_MicroPorousLayer ( const std::string &  mpl_section_name,
ParameterHandler &  param 
)
inlinestatic

Function used to select the appropriate MicroPorousLayer.

References FuelCellShop::Layer::MicroPorousLayer< dim >::create_replica(), and FuelCellShop::Layer::MicroPorousLayer< dim >::get_mapFactory().

Here is the call graph for this function:

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

This member function is used to create an object of type micro porous layer.

Warning
This class MUST be redeclared in every child.

Reimplemented in FuelCellShop::Layer::DesignMPL< dim >, and FuelCellShop::Layer::SGL24BC< dim >.

Referenced by FuelCellShop::Layer::MicroPorousLayer< dim >::create_MicroPorousLayer().

Here is the caller graph for this function:

template<int dim>
static void FuelCellShop::Layer::MicroPorousLayer< dim >::declare_MicroPorousLayer_parameters ( const std::string &  mpl_section_name,
ParameterHandler &  param 
)
inlinestatic

Function used to declare all the data necessary in the parameter files former all MicroPorousLayer children.

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

Parameters
mpl_section_nameName of the section that will encapuslate all the information about the CL
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 mpl_section_name <- This is the name used in the parameter file
set Micro porous layer type = SGL24BC # Types available: SGL24BC | DesignMPL
end
end

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

Here is the call graph for this function:

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

Declare parameters for a parameter file.

Deprecated:
Use declare_MicroPorousLayer_parameters

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

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

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

Declare parameters for a parameter file.

The parameters that need to be declared are

  • Porosity (default : 0.3) Represents the porosity in t*he GDL
  • Method effective transport properties in pores (default: Bruggemann) Other options "Given|Bruggemann|Percolation|Mezedur"
  • Method effective transport properties in fibres (default: Bruggemann) Other options "Given|Bruggemann|Percolation|Mezedur"

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

template<int dim>
virtual void FuelCellShop::Layer::MicroPorousLayer< dim >::effective_electron_conductivity ( double &  ) const
inlinevirtual

Compute the effective conductivity.

To compute the effective properties it will use the method specified in set_method_effective_transport_property_solid . This function is used for the isotropic MPL

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

template<int dim>
virtual void FuelCellShop::Layer::MicroPorousLayer< dim >::effective_electron_conductivity ( Tensor< 2, dim > &  ) const
inlinevirtual

Compute the effective conductivity.

To compute the effective properties it will use the method specified in set_method_effective_transport_property_solid . This function is used for the anisotropic MPL.

Reimplemented in FuelCellShop::Layer::DesignMPL< dim >, and FuelCellShop::Layer::SGL24BC< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MicroPorousLayer< dim >::effective_gas_diffusivity ( const double &  property,
double &  effective_property 
) const
inlinevirtual

Compute the effective property in the pores.

This is used for example to compute effective diffusivity of gases. This routine is used in the isotropic case

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

template<int dim>
virtual void FuelCellShop::Layer::MicroPorousLayer< dim >::effective_gas_diffusivity ( const double &  property,
Tensor< 2, dim > &  effective_property 
) const
inlinevirtual

Compute the effective property in the pores.

This is used for example to compute effective diffusivity of gases This routine can be used either in the isotropic or anisotripic case

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

template<int dim>
virtual void FuelCellShop::Layer::MicroPorousLayer< dim >::effective_gas_diffusivity ( Table< 2, Tensor< 2, dim > > &  D_eff) const
inlinevirtual

Compute the effective property in the pores.

This is used to compute effective diffusivity of gases. This routine can be used either in the isotropic or anisotropic cases. Bulk diffusion coefficients or their derivatives are obtained from Mixure::BinaryDiffusion classes inside this method.

Note
The routine FuelCellShop::Layer::PorousLayer< dim >::set_gases_and_compute (std::vector< FuelCellShop::Material::PureGas * > &gases, double pressure, double temperature) (in the parent class) should have been called prior to using this class.

Reimplemented in FuelCellShop::Layer::DesignMPL< dim >, and FuelCellShop::Layer::SGL24BC< dim >.

template<int dim>
virtual void FuelCellShop::Layer::MicroPorousLayer< dim >::effective_transport_property_solid ( const double &  property,
double &  effective_property 
) const
inlinevirtual

Compute the effective property of a property that is defined by the network of fibres.

For example this could be used to compute the effective electron conductivity or heat conduction. NOTE: Isotropic case

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

template<int dim>
virtual void FuelCellShop::Layer::MicroPorousLayer< dim >::effective_transport_property_solid ( const Tensor< 2, dim > &  property,
Tensor< 2, dim > &  effective_property 
) const
inlinevirtual

Compute the effective property of a property that is defined by the network of fibres.

For example this could be used to compute the effective electron conductivity or heat conduction. Note: Anisotropic case.

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

template<int dim>
const std::type_info& FuelCellShop::Layer::MicroPorousLayer< 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>
static _mapFactory* FuelCellShop::Layer::MicroPorousLayer< dim >::get_mapFactory ( )
inlinestaticprotected

Return the map library that stores all childrens of this class.

The declare_parameters of each one of the children that are in the map are called in declare_all_MicroPorousLayer_parameters.

Warning
In order for children of this class to appear in the map the following four things are necessary
  • a static PROTOTYPE object has to be created. For example, in the .h file:
    static DummyMPL<dim> const* PROTOTYPE;
    in the .cc file:
    template <int dim>
    NAME::DummyMPL<dim> const* NAME::DummyMPL<dim>::PROTOTYPE = new NAME::DummyMPL<dim>();
  • a default constructor which creates the PROTOTYPE is needed, e.g.
    template <int dim>
    NAME::DummyMPL<dim>::DummyMPL()
    : FuelCellShop::Layer::MicroPorousLayer<dim> ()
    {
    deallog<<" Register DummyMPL MPL to FactoryMap"<<std::endl;
    this->get_mapFactory()->insert(std::pair<std::string, FuelCellShop::Layer::MicroPorousLayer<dim>* >(concrete_name, this));
    }
  • a static std::string concrete_name must be declared and initialized to the desired name of the children class. This name is used as the name in the map and as the name of the subsection where its parameters are declared. For example, in the .h file:
    static const std::string concrete_name;
    in the .cc file:
    template <int dim>
    const std::string NAME::DummyMPL<dim>::concrete_name ("DummyMPL");
  • virtual boost::shared_ptr<FuelCellShop::Layer::MicroPorousLayer<dim> > create_replica () needs to be re-implemented in the child. For example, in the .h file
    virtual boost::shared_ptr<FuelCellShop::Layer::MicroPorousLayer<dim> > create_replica (const std::string &name)
    {
    return boost::shared_ptr<FuelCellShop::Layer::MicroPorousLayer<dim> > (new FuelCellShop::Layer::DummyMPL<dim> (name));
    }

Referenced by FuelCellShop::Layer::MicroPorousLayer< dim >::create_MicroPorousLayer(), FuelCellShop::Layer::MicroPorousLayer< dim >::declare_MicroPorousLayer_parameters(), and FuelCellShop::Layer::MicroPorousLayer< dim >::set_MicroPorousLayer_parameters().

Here is the caller graph for this function:

template<int dim>
void FuelCellShop::Layer::MicroPorousLayer< dim >::initialize ( ParameterHandler &  param)
virtual

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

Deprecated:

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

template<int dim>
virtual bool FuelCellShop::Layer::MicroPorousLayer< dim >::set_method_effective_transport_property_solid ( std::string  )
inlinevirtual

Specify the methodology to be used to compute the effective properties for the porous phase.

Return true if the change has been succssful. The different methods are explained in declare_parameters

template<int dim>
static void FuelCellShop::Layer::MicroPorousLayer< dim >::set_MicroPorousLayer_parameters ( const std::vector< std::string > &  name_dvar,
const std::vector< double > &  value_dvar,
const std::string &  mpl_section_name,
ParameterHandler &  param 
)
inlinestatic

This routine is only used for optimization and parameteric studies purposes when using the Dakota Interface.

This routine is used to modify the variables in the ParameterHandler object based on the design variable values returned by Dakota

Note
Each child has to have a set_parameters member function where the parameters in the parameter file are associated with design variable names in Dakota. For available design parameter names, please see DakotaInterface.

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

Here is the call graph for this function:

template<int dim>
void FuelCellShop::Layer::MicroPorousLayer< dim >::set_parameters ( const std::vector< std::string > &  name_dvar,
const std::vector< double > &  value_dvar,
const std::string &  name,
ParameterHandler &  param 
) const
inlineprotected

Member function used to set new parameters values in the optimization loop.

Member Data Documentation

template<int dim>
const std::string FuelCellShop::Layer::MicroPorousLayer< dim >::concrete_name
static

Concrete name used for objects of this class.

This name is used when setting up the subsection where the data is stored in the input file.

The data will be store under

subsection name_specified_in_constructor
set Material id = 2
set Microporous layer type = DummyMPL # <-here I select the type of object of type MicroPorousLayer
subsection DummyMPL # <- this is the concrete_name for this class
set all info relevant to this object
end
end

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