OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
FuelCellShop::MicroScale::WaterAgglomerate Class Reference

Class that solves a water-filled agglomerate problem in 1D. More...

#include <agglomerate_water_1D.h>

Inheritance diagram for FuelCellShop::MicroScale::WaterAgglomerate:
Inheritance graph
[legend]
Collaboration diagram for FuelCellShop::MicroScale::WaterAgglomerate:
Collaboration graph
[legend]

Public Member Functions

virtual SolutionMap compute_current ()
 Main function of the class used to compute the current over the whole agglomerate at the local operating conditions. More...
 
virtual std::string get_name ()
 Return name of class instance, i.e. More...
 
virtual double aux_volume_fraction ()
 MicroScale object may have extra contribution to volume of layer, e.g. More...
 
- Public Member Functions inherited from FuelCellShop::MicroScale::AgglomerateBase
virtual ~AgglomerateBase ()
 
virtual void print_properties ()
 Print out key agglomerate information (name, radius, film thickness, porosity). More...
 
virtual std::vector< double > compute_derivative_current ()
 Function to compute the derivative of the current density at the local operating conditions. More...
 
virtual bool has_derivatives ()
 Returns true if the class instance can calculate current density derivatives. More...
 
virtual void set_solution (const std::map< VariableNames, SolutionVariable > &, const VariableNames &, const int &)
 Function for setting the solution map(reactant concentration, phi_s, phi_m, etc.). More...
 
- Public Member Functions inherited from FuelCellShop::MicroScale::MicroScaleBase
virtual ~MicroScaleBase ()
 Destructor. More...
 
- Public Member Functions inherited from FuelCell::ApplicationCore::DAEWrapper
 DAEWrapper ()
 Constructor. More...
 
 ~DAEWrapper ()
 Destructor. More...
 
double integrate (double lb, double ub, std::vector< double > &W, std::vector< double > &F)
 Member function that integrates a solution between a lower and upper bound. More...
 
void get_quadrature_points (double lb, double ub, std::vector< double > &X, std::vector< double > &W, FuelCell::ApplicationCore::DAESolver *prob)
 Function that obtains the gaussian quadrature points and weights. More...
 
void verbosity (int i)
 Set the verbosity variable (controls output to screen) More...
 
void DAE_Error (int flag)
 Indicates error in the solve function. More...
 
void clear_memory ()
 

Static Public Attributes

static const std::string concrete_name
 

Protected Member Functions

int cont_tolerance (double start_tol, double end_tol)
 Function which implements a continuation based on the tolerance. More...
 
int cont_cd ()
 Function which implements a continuation based on lambda - modifying the source terms to scale back the equations. More...
 
void setup_DAE_solver ()
 Setup the variables in the problem required by the DAE Solver. More...
 
virtual double get_film_thickness ()
 
virtual double get_radius ()
 
void set_structure ()
 Set the composition and structure of the agglomerate. More...
 
 WaterAgglomerate (int verbose=1)
 Constructors. More...
 
 WaterAgglomerate (std::string concrete_name)
 
virtual void declare_parameters (ParameterHandler &param) const
 
virtual void initialize (ParameterHandler &param)
 
double compute_thickness_agg ()
 Member function to compute the thickness of the agglomerate thin film based on the radius and structure. More...
 
virtual double compute_epsilon_agg ()
 Compute the volume fraction of nafion inside the agglomerate given the catalyst layer ionomer volume fraction , $ \epsilon_N $; size of the agglomerate, $ r_{agg} $; and, porosity inside the agglomerate, $ \epsilon_{agg} $, the necessary ionomer thin film thickness is computed such that the correct volume fractions are obtained. More...
 
void fsub (double &, double[], double[], double[])
 Define the DAE function. More...
 
void dfsub (double &, double[], double[], double[])
 The Jacobian of fsub. More...
 
void gsub (int &, double[], double &)
 Define the boundary conditions. More...
 
void dgsub (int &, double[], double[])
 The derivatives of the boundary conditions. More...
 
void guess (double &, double[], double[], double[])
 The initial guess. More...
 
- Protected Member Functions inherited from FuelCellShop::MicroScale::NumericalAgglomerateBase
void setAV (double newAV)
 
 NumericalAgglomerateBase ()
 Constructor. More...
 
 ~NumericalAgglomerateBase ()
 Destructor. More...
 
void update_initial_solution ()
 
void save_initial_solution ()
 
double getAV (double location)
 
bool use_initial_data (double z[], const double &x)
 
virtual void make_thread_safe (ParameterHandler &param, unsigned int thread_index)
 
- Protected Member Functions inherited from FuelCellShop::MicroScale::AgglomerateBase
void _initialize_film_porosity ()
 
 AgglomerateBase ()
 
- Protected Member Functions inherited from FuelCellShop::MicroScale::MicroScaleBase
void set_layer (FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *_layer)
 
 MicroScaleBase ()
 
- Protected Member Functions inherited from FuelCellShop::MicroScale::SphericalAgglomerateGeometry
 SphericalAgglomerateGeometry ()
 
virtual double compute_thickness_agg (FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer)
 Member function to compute the thickness of the agglomerate thin film based on the radius and structure. More...
 
virtual double compute_epsilon_agg (FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer)
 Compute the volume fraction of nafion inside the agglomerate given the catalyst layer ionomer volume fraction , $ \epsilon_N $; size of the agglomerate, $ r_{agg} $; and, porosity inside the agglomerate, $ \epsilon_{agg} $, the necessary ionomer thin film thickness is computed such that the correct volume fractions are obtained. More...
 
virtual double compute_epsilon_N (const double delta_agg, const double thickness_agg) const
 Function used to compute the amount of electrolyte in the catalyst layer. More...
 
virtual double compute_depsilonN_dthickness (const double thickness_agg) const
 Function to compute

\[ \frac{\partial \epsilon_N^{cat}}{\partial thickness_{agg}} \]

This function should only be used to calculate the thin film thickness using Newton's method. More...

 
virtual double compute_depsilonN_depsilon_agg (FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer) const
 Function to compute

\[ \frac{\partial \epsilon_N^{cat}}{\partial \epsilon_{agg}} \]

This function should only be used to calculate the thin film thickness using Newton's method. More...

 
virtual double compute_n (FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer) const
 Member function to compute the number of agglomerates. More...
 
virtual double compute_dn_depsilon_agg (FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer) const
 Compute the derivative of n with respect to the porosity of the agglomerate. More...
 

Static Protected Member Functions

static void fsub_wrapper (double &, double[], double[], double[])
 
static void dfsub_wrapper (double &, double[], double[], double[])
 
static void gsub_wrapper (int &, double[], double &)
 
static void dgsub_wrapper (int &, double[], double[])
 
static void guess_wrapper (double &, double[], double[], double[])
 
- Static Protected Member Functions inherited from FuelCellShop::MicroScale::MicroScaleBase
static _mapFactoryget_mapFactory ()
 This member function is used to create an object of type MicroScaleBase. More...
 

Protected Attributes

FuelCellShop::Material::LiquidWater water
 Object to store information on water, necessary for water filled agglomerate. More...
 
double D_H_NAF
 Proton Diffusivity in Nafion and water. More...
 
double D_H_Water
 
double D_O2_N
 Oxygen Diffusivity in Nafion and water. More...
 
double DO2_Water
 
double HO2N
 Henry's Constant for oxygen in nafion. More...
 
double rel_permittivity_water
 
double rel_permittivity_Naf
 
double core_charge_factor
 
std::vector< std::string > derivative_flags
 
double H_tol
 absolute tolerance in proton concentration More...
 
double lambda
 
double lambda2
 
- Protected Attributes inherited from FuelCellShop::MicroScale::NumericalAgglomerateBase
std::vector< std::vector
< double > > 
final_results
 
std::vector< std::vector
< double > > 
initial_solution
 
std::vector< std::string > column_names
 
double R_tol
 
- Protected Attributes inherited from FuelCellShop::MicroScale::AgglomerateBase
boost::shared_ptr
< FuelCellShop::Material::CatalystBase
catalyst
 Boost shared pointer to catalyst object. More...
 
boost::shared_ptr
< FuelCellShop::Material::PolymerElectrolyteBase
electrolyte
 Boost shared pointer to electrolyte object. More...
 
boost::shared_ptr
< FuelCellShop::Kinetics::BaseKinetics
kinetics
 Boost shared pointer to kinetics object. More...
 
std::map< VariableNames,
SolutionVariable
solutions
 Member data for storing solutions. More...
 
std::vector< VariableNamessol_names
 
VariableNames reactant
 
VariableNames tempReactantName
 
int sol_index
 
double permittivity_0
 Constants. More...
 
double F
 
double R
 
double P
 
double AV
 
double c_R
 
bool has_derivatives_
 
double c_H
 
double phi_M
 
double phi_S
 
double interface
 
double D_R_N
 
double H_R_N
 Henry's Constant for primary reactant in nafion, [Pa cm^3/mol]. More...
 
std::string fixed_agg_variable
 
- Protected Attributes inherited from FuelCellShop::MicroScale::MicroScaleBase
FuelCellShop::Layer::MultiScaleCL
< deal_II_dimension > * 
layer
 
- Protected Attributes inherited from FuelCellShop::MicroScale::SphericalAgglomerateGeometry
double pi
 
double r_agg
 
double delta_agg
 
double epsilon_agg
 
double n_agg
 
- Protected Attributes inherited from FuelCell::ApplicationCore::DAEWrapper
int n_mesh
 Number of mesh points. More...
 
double * mesh
 Array of mesh points. More...
 
int n_colloc
 Number of collocation points. More...
 
int n_output
 Output integer variable. More...
 
int n_comp
 number of PDEs More...
 
int n_y
 number of Algebraic constraints More...
 
int * mm
 array of integers storing the order of each PDE More...
 
int m_star
 Integer representing the total number of variables given by $ \sum mm[i] $. More...
 
double boundary_0
 Left boundary point. More...
 
double boundary_1
 Right boundary point. More...
 
double * zeta
 Array of boundary points. More...
 
FuelCell::ApplicationCore::DAESolverprob
 DAE problem solver object. More...
 
double * fixpnt
 Array of fixed points on the mesh. More...
 
int * ltol
 
double * tol
 
double cm_to_m
 Convert from centimetres to metres. More...
 
double cm2_to_m2
 Convert from centimetres squared to metres squared. More...
 
double cm3_to_m3
 Convert from centimetres cubed to metres cubed. More...
 

Instance Delivery

static WaterAgglomerate const * PROTOTYPE
 
virtual boost::shared_ptr
< FuelCellShop::MicroScale::MicroScaleBase
create_replica ()
 This member function is used to create an object of type MicroScaleBase. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from FuelCellShop::MicroScale::MicroScaleBase
static void declare_MicroScale_parameters (ParameterHandler &param)
 Function used to declare all the data necessary in the parameter files for all MicroScale children. More...
 
static boost::shared_ptr
< FuelCellShop::MicroScale::MicroScaleBase
create_MicroStructure (ParameterHandler &param, FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer)
 Function used to select the appropriate MicroScale type as specified in the ParameterHandler under line. More...
 
- Protected Types inherited from FuelCellShop::MicroScale::AgglomerateBase
typedef
FuelCellShop::Layer::MultiScaleCL
< deal_II_dimension >
::Properties 
CLPropNames
 
typedef std::map< CLPropNames,
double > 
CL_Properties
 
- Protected Types inherited from FuelCellShop::MicroScale::MicroScaleBase
typedef std::map< std::string,
MicroScaleBase * > 
_mapFactory
 This object is used to store all objects of type MicroScaleBase. More...
 
- Protected Types inherited from FuelCellShop::MicroScale::SphericalAgglomerateGeometry
typedef
FuelCellShop::Layer::MultiScaleCL
< deal_II_dimension >
::Properties 
CLPropNames
 
typedef std::map< CLPropNames,
double > 
CL_Properties
 

Detailed Description

Class that solves a water-filled agglomerate problem in 1D.

This class uses the DAE solver interface to solve the problem using COLDAE (included in the contrib folder) to solve a boundary value problem.

Input parameters

LIST OF INPUT PARAMETERS FOR THE CLASS.

* ...
* subsection MicroScale
* subsection WaterAgglomerateNumerical
* set Relative core charge factor = 0.0 #Factor of ionic charge concentration, fraction of film sulphonic concentration.
* end
* subsection Materials
* subsection Water
* set Oxygen diffusion coefficient [cm^2/s]= 9.19e-5
* set Proton diffusion coefficient [cm^2/s]= 9.2e-5
* set Relative permittivity=60
* end
* end
* end
*

Constructor & Destructor Documentation

FuelCellShop::MicroScale::WaterAgglomerate::WaterAgglomerate ( int  verbose = 1)
protected

Constructors.

FuelCellShop::MicroScale::WaterAgglomerate::WaterAgglomerate ( std::string  concrete_name)
protected

Member Function Documentation

virtual double FuelCellShop::MicroScale::WaterAgglomerate::aux_volume_fraction ( )
inlinevirtual

MicroScale object may have extra contribution to volume of layer, e.g.

water.

The water filled model contributes to the porosity of the CL due to the presence of liquid water in the agglomerate primary pores.

Implements FuelCellShop::MicroScale::MicroScaleBase.

Reimplemented in FuelCellShop::MicroScale::HybridAgglomerate.

References FuelCellShop::MicroScale::SphericalAgglomerateGeometry::epsilon_agg, FuelCellShop::Layer::MultiScaleCL< dim >::get_properties(), and FuelCellShop::MicroScale::MicroScaleBase::layer.

Referenced by FuelCellShop::MicroScale::HybridAgglomerate::aux_volume_fraction().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual SolutionMap FuelCellShop::MicroScale::WaterAgglomerate::compute_current ( )
virtual

Main function of the class used to compute the current over the whole agglomerate at the local operating conditions.

Implements FuelCellShop::MicroScale::MicroScaleBase.

virtual double FuelCellShop::MicroScale::WaterAgglomerate::compute_epsilon_agg ( )
protectedvirtual

Compute the volume fraction of nafion inside the agglomerate given the catalyst layer ionomer volume fraction , $ \epsilon_N $; size of the agglomerate, $ r_{agg} $; and, porosity inside the agglomerate, $ \epsilon_{agg} $, the necessary ionomer thin film thickness is computed such that the correct volume fractions are obtained.

A Newton loop is used in order to obtain the correct value for the agglomerate porosity, $ \epsilon_{agg} $.

Note
compute_thickness_agg and compute_epsilon_agg are mutually exclusive and the selection between using one method or the other depends on the inpu parameter:
* set Constant agglomerate parameter [Thickness | Porosity] = Thickness
* set Agglomerate porosity = 0.25 #specify if Porosity is selected in variable above
* set Thickness of the agglomerate film [nm] = 80 #specify if Thickness is selected in property above
*

Reimplemented in FuelCellShop::MicroScale::HybridAgglomerate.

double FuelCellShop::MicroScale::WaterAgglomerate::compute_thickness_agg ( )
protected

Member function to compute the thickness of the agglomerate thin film based on the radius and structure.

For a given ionomer volume fraction, $ \epsilon_N $; size of the agglomerate, $ r_{agg} $; and, porosity inside the agglomerate, $ \epsilon_{agg} $, the necessary ionomer thin film thickness is computed such that the correct volume fractions are obtained.

A Newton loop is used in order to obtain the correct value for the thickness of the agglomerate film, $ \delta_{agg} $

Note
compute_thickness_agg and compute_epsilon_agg are mutually exclusive and the selection between using one method or the other depends on the inpu parameter:
* set Constant agglomerate parameter [Thickness | Porosity] = Thickness
* set Agglomerate porosity = 0.25 #specify if Porosity is selected in variable above
* set Thickness of the agglomerate film [nm] = 80 #specify if Thickness is selected in property above
*
int FuelCellShop::MicroScale::WaterAgglomerate::cont_cd ( )
protected

Function which implements a continuation based on lambda - modifying the source terms to scale back the equations.

int FuelCellShop::MicroScale::WaterAgglomerate::cont_tolerance ( double  start_tol,
double  end_tol 
)
protected

Function which implements a continuation based on the tolerance.

virtual boost::shared_ptr<FuelCellShop::MicroScale::MicroScaleBase> FuelCellShop::MicroScale::WaterAgglomerate::create_replica ( )
inlineprotectedvirtual

This member function is used to create an object of type MicroScaleBase.

Implements FuelCellShop::MicroScale::MicroScaleBase.

Reimplemented in FuelCellShop::MicroScale::HybridAgglomerate.

virtual void FuelCellShop::MicroScale::WaterAgglomerate::declare_parameters ( ParameterHandler &  param) const
inlineprotectedvirtual
void FuelCellShop::MicroScale::WaterAgglomerate::dfsub ( double &  ,
double  [],
double  [],
double  [] 
)
protectedvirtual

The Jacobian of fsub.

Until we decide on how to get AD support in FCST, we must enter the Jacobian in manually. Note that a one-dimensional array must be passed back to COLDAE. However, it is easier to define a two-dimensional array as the matrix (see COLDAE.f). After, use c_to_for_matrix to convert it to the correct one-dimensional array.

Implements FuelCell::ApplicationCore::DAEWrapper.

static void FuelCellShop::MicroScale::WaterAgglomerate::dfsub_wrapper ( double &  ,
double  [],
double  [],
double  [] 
)
staticprotected
void FuelCellShop::MicroScale::WaterAgglomerate::dgsub ( int &  ,
double  [],
double  [] 
)
protectedvirtual

The derivatives of the boundary conditions.

See COLDAE.f

Implements FuelCell::ApplicationCore::DAEWrapper.

static void FuelCellShop::MicroScale::WaterAgglomerate::dgsub_wrapper ( int &  ,
double  [],
double  [] 
)
staticprotected
void FuelCellShop::MicroScale::WaterAgglomerate::fsub ( double &  ,
double  [],
double  [],
double  [] 
)
protectedvirtual

Define the DAE function.

In this case,it is simply a system of ODES. COLDAE allows for the system to be defined as a system of 2 mixed-order ODEs. See COLDAE.f for additional information about how to define fsub. In particular, see COLDAE.f for the meaning of z and y. Note that because a BVP is solved, y is not used.

Implements FuelCell::ApplicationCore::DAEWrapper.

static void FuelCellShop::MicroScale::WaterAgglomerate::fsub_wrapper ( double &  ,
double  [],
double  [],
double  [] 
)
staticprotected
virtual double FuelCellShop::MicroScale::WaterAgglomerate::get_film_thickness ( )
inlineprotectedvirtual
virtual std::string FuelCellShop::MicroScale::WaterAgglomerate::get_name ( )
inlinevirtual

Return name of class instance, i.e.

concrete name.

Implements FuelCellShop::MicroScale::MicroScaleBase.

Reimplemented in FuelCellShop::MicroScale::HybridAgglomerate.

References concrete_name.

virtual double FuelCellShop::MicroScale::WaterAgglomerate::get_radius ( )
inlineprotectedvirtual
void FuelCellShop::MicroScale::WaterAgglomerate::gsub ( int &  ,
double  [],
double &   
)
protectedvirtual

Define the boundary conditions.

There are 4 boundary conditions. Note that i refers to the ith boundary condition. See COLDAE.f

Implements FuelCell::ApplicationCore::DAEWrapper.

static void FuelCellShop::MicroScale::WaterAgglomerate::gsub_wrapper ( int &  ,
double  [],
double &   
)
staticprotected
void FuelCellShop::MicroScale::WaterAgglomerate::guess ( double &  ,
double  [],
double  [],
double  [] 
)
protectedvirtual

The initial guess.

This is optional, but a good idea for this problem. If we do not provide this, CODAE will use a constant of 0.0 for an initial guess.

Implements FuelCell::ApplicationCore::DAEWrapper.

static void FuelCellShop::MicroScale::WaterAgglomerate::guess_wrapper ( double &  ,
double  [],
double  [],
double  [] 
)
staticprotected
virtual void FuelCellShop::MicroScale::WaterAgglomerate::initialize ( ParameterHandler &  param)
inlineprotectedvirtual
void FuelCellShop::MicroScale::WaterAgglomerate::set_structure ( )
protectedvirtual

Set the composition and structure of the agglomerate.

Implements FuelCellShop::MicroScale::MicroScaleBase.

void FuelCellShop::MicroScale::WaterAgglomerate::setup_DAE_solver ( )
protectedvirtual

Setup the variables in the problem required by the DAE Solver.

Implements FuelCell::ApplicationCore::DAEWrapper.

Member Data Documentation

const std::string FuelCellShop::MicroScale::WaterAgglomerate::concrete_name
static
double FuelCellShop::MicroScale::WaterAgglomerate::core_charge_factor
protected

Referenced by initialize().

double FuelCellShop::MicroScale::WaterAgglomerate::D_H_NAF
protected

Proton Diffusivity in Nafion and water.

double FuelCellShop::MicroScale::WaterAgglomerate::D_H_Water
protected
double FuelCellShop::MicroScale::WaterAgglomerate::D_O2_N
protected

Oxygen Diffusivity in Nafion and water.

std::vector<std::string> FuelCellShop::MicroScale::WaterAgglomerate::derivative_flags
protected
double FuelCellShop::MicroScale::WaterAgglomerate::DO2_Water
protected
double FuelCellShop::MicroScale::WaterAgglomerate::H_tol
protected

absolute tolerance in proton concentration

double FuelCellShop::MicroScale::WaterAgglomerate::HO2N
protected

Henry's Constant for oxygen in nafion.

double FuelCellShop::MicroScale::WaterAgglomerate::lambda
protected
double FuelCellShop::MicroScale::WaterAgglomerate::lambda2
protected
WaterAgglomerate const* FuelCellShop::MicroScale::WaterAgglomerate::PROTOTYPE
staticprotected
double FuelCellShop::MicroScale::WaterAgglomerate::rel_permittivity_Naf
protected
double FuelCellShop::MicroScale::WaterAgglomerate::rel_permittivity_water
protected
FuelCellShop::Material::LiquidWater FuelCellShop::MicroScale::WaterAgglomerate::water
protected

Object to store information on water, necessary for water filled agglomerate.

Referenced by FuelCellShop::MicroScale::HybridAgglomerate::declare_parameters(), declare_parameters(), FuelCellShop::MicroScale::HybridAgglomerate::initialize(), and initialize().


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