OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
agglomerate_base.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2006-2014 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: AgglomerateBase
11 // - Description: Base class for agglomerate objects, implements MicroScaleBase
12 // - Developers: Philip Wardlaw, Peter Dobson, Michael Moore, Marc Secanell, University of Alberta
13 // - $Id: agglomerate_base.h 2605 2014-08-15 03:36:44Z secanell $
14 //
15 // ----------------------------------------------------------------------------
16 
17 #ifndef _FUELCELLSHOP__LAYER__AGGLOMERATE_BASE_H
18 #define _FUELCELLSHOP__LAYER__AGGLOMERATE_BASE_H
19 
20 //FCST materials and kinetics classes
21 #include <catalyst_base.h>
23 #include <base_kinetics.h>
24 #include <double_trap_kinetics.h>
25 #include <tafel_kinetics.h>
26 #include <dual_path_kinetics.h>
27 
28 //Micro scale base class
29 #include <micro_scale_base.h>
30 #include <random>
31 #include <limits> // std::numeric_limits
32 
33 
34 namespace FuelCellShop
35 {
36  namespace MicroScale
37  {
71  {
72 
73 
74  public:
75 
76  /*
77  * Destructor
78  */
79  virtual ~AgglomerateBase(){};
80 
84  virtual void print_properties();
85 
87 
88 
100  virtual void set_solution(const std::map<VariableNames,SolutionVariable>&,const VariableNames&, const int&);
102 
114  virtual std::vector<double> compute_derivative_current ()
115  {
116  Assert(false, ExcPureFunctionCalled());
117  return std::vector<double>(sol_names.size(), 0.0);
118  }
119 
120 
129  virtual bool has_derivatives()
130  {
131  return has_derivatives_;
132  }
133 
134 
135 
136 
137  /*
138  * Agglomerate will deep copy it's pointers (kinetics, materials), use this for parallel execution.
139  *
140  * \warning This following function determines reaction name based on type of kinetics model
141  * \warning which may not necessarily be correct and only will work for currently
142  * \warning implemented kinetics models.
143  * \warning A more robust mothod of determining the reaction name at this scope is required.
144  * \warning Use of new kineitics models, or existing kinetics models for different reactions
145  * \warning will result in a bugs.
146  */
147  virtual void make_thread_safe(ParameterHandler &param, unsigned int thread_index);
148 
149 
150  protected:
151 
152  /*
153  * Method for setting up film thickness or porosity depending on parameters
154  * called in initialize() or adjust_poly adjust_polydisperse_structure().
155  */
157 
158 
159 
160  /*
161  * Type defs to make accessing layer info a bit easier
162  */
163 
165  typedef std::map<CLPropNames, double> CL_Properties;
166 
167 
168  /*
169  * Constructor, sets up some constants
170  */
172  {
173  //Constants
174  R = Constants::R();
175  F = Constants::F();
176  permittivity_0 = Constants::E0() *1e-2; // cm
177  pi = Constants::Pi();
178 
179  }
180 
181 
182  /*
183  * Protected virtual member function for declaring parameters, pure
184  * in MicroScaleBase, implemented here in AgglomerateBase.
185  * Parameter structure is hierarchical, therefore children should
186  * call their parent's declare parameter function from their own declare
187  * parameter function.
188  */
189  virtual void declare_parameters (ParameterHandler &param) const;
190 
191  /*
192  * Protected virtual member function for initializing parameters, pure
193  * in MicroScaleBase, implemented here in AgglomerateBase.
194  * Parameter structure is hierarchical, therefore children should
195  * call their parent's initialize function from their own declare
196  * parameter function.
197  */
198  virtual void initialize (ParameterHandler &param);
199 
200  /*
201  * Pure virtual function for returning film thickness in nano meters.
202  *
203  * Must be implemented in child, where informed unit conversion will occur.
204  */
205  virtual double get_film_thickness() = 0;
206 
207  /*
208  * Pure virtual function for returning agglomerate radius in nano meters.
209  *
210  * Must be implemented in child, where informed unit conversion will occur.
211  */
212  virtual double get_radius() = 0;
213 
232  virtual double compute_thickness_agg ();
233 
250  virtual double compute_epsilon_agg ();
251 
261  virtual double compute_epsilon_N ( const double delta_agg, const double thickness_agg ) const;
262 
272  virtual double compute_depsilonN_dthickness ( const double thickness_agg ) const;
273 
283  virtual double compute_depsilonN_depsilon_agg () const;
284 
295  virtual double compute_n() const;
296 
305  virtual double compute_dn_depsilon_agg() const;
306 
307 
313  boost::shared_ptr<FuelCellShop::Material::CatalystBase > catalyst;
314 
320  boost::shared_ptr<FuelCellShop::Material::PolymerElectrolyteBase> electrolyte;
321 
327  boost::shared_ptr<FuelCellShop::Kinetics::BaseKinetics> kinetics;
328 
332  std::map<VariableNames, SolutionVariable> solutions;
333  std::vector<VariableNames> sol_names;
336 
337 
341  double permittivity_0; //permittivity of free space (scaled in constructor)
342  double pi;
343  double F; //Faraday's Constant
344  double R; //Gas constant (molar)
345 
346  /*
347  * Pressure of domain in pascals
348  */
349  double P;
350 
351  /*
352  * Active area, [cm^2/cm^3], Scaled to solid fraction by MSCL,
353  * scaled to agglomerate core by non abstract agglomerate classes
354  */
355  double AV;
356 
357  /*
358  * Radius of the agglomerate, typically [nm], but units may depend
359  * on non abstract child
360  */
361  double r_agg;
362 
363  /*
364  * Thickness of the ionomer thin film, typically [nm], but units may depend
365  * on non abstract child
366  */
367  double delta_agg;
368 
369  /*
370  * Porosity % of the ionomer thin film
371  */
372  double epsilon_agg;
373 
374  /*
375  * Concentration of primary reactant at the boundary, [mol/cm^3]
376  */
377  double c_R;
378 
379  /*
380  * Boolean determining whether or not the agglomerate object returns derivatives.
381  */
383 
384  /*
385  * Concentration of protons at the boundary, [mol/cm^3]
386  */
387  double c_H;
388 
389  /*
390  * Electrolyte (Membrane) phase potential at the boundary, [V]
391  */
392  double phi_M;
393 
394  /*
395  * Solid phase potential through the agglomerate, [V]
396  */
397  double phi_S;
398 
399  /*
400  * Value of the boundary between the thin film and agglomerate domain
401  *
402  * Dimensionless (0.0 to 1.0)
403  */
404  double interface;
405 
406  /*
407  * Oxygen Diffusion, [cm^2/s]
408  */
409  double D_R_N;
410 
414  double H_R_N;
415 
416  /*
417  * Variable used to select if thickness or porosity should be constant
418  */
419  std::string fixed_agg_variable;
420 
421  /*
422  * Number of agglomerates in CL domain
423  */
424  double n_agg;
425 
426 
427 
428 
429 
430  };
431  }
432 }
433 
434 #endif
virtual void make_thread_safe(ParameterHandler &param, unsigned int thread_index)
std::vector< VariableNames > sol_names
Definition: agglomerate_base.h:333
double interface
Definition: agglomerate_base.h:404
virtual void declare_parameters(ParameterHandler &param) const
double r_agg
Definition: agglomerate_base.h:361
virtual double compute_thickness_agg()
Member function to compute the thickness of the agglomerate thin film based on the radius and structu...
double delta_agg
Definition: agglomerate_base.h:367
double F()
Faraday constant, .
Definition: fcst_constants.h:38
double phi_S
Definition: agglomerate_base.h:397
double phi_M
Definition: agglomerate_base.h:392
virtual double compute_epsilon_agg()
Compute the volume fraction of nafion inside the agglomerate given the catalyst layer ionomer volume ...
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.
The base class for agglomerate objects in OpenFCST.
Definition: agglomerate_base.h:70
double n_agg
Definition: agglomerate_base.h:424
virtual double compute_n() const
Member function to compute the number of agglomerates.
boost::shared_ptr< FuelCellShop::Material::CatalystBase > catalyst
Boost shared pointer to catalyst object.
Definition: agglomerate_base.h:313
std::map< CLPropNames, double > CL_Properties
Definition: agglomerate_base.h:165
virtual std::vector< double > compute_derivative_current()
Function to compute the derivative of the current density at the local operating conditions.
Definition: agglomerate_base.h:114
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:62
double c_H
Definition: agglomerate_base.h:387
virtual void print_properties()
Print out key agglomerate information (name, radius, film thickness, porosity).
virtual double compute_depsilonN_depsilon_agg() const
Inline function to compute This function should only be used to calculate the thin film thickness us...
Properties
Definition: multi_scale_CL.h:212
virtual double compute_dn_depsilon_agg() const
Compute the derivative of n with respect to the porosity of the agglomerate.
FuelCellShop::Layer::MultiScaleCL< deal_II_dimension >::Properties CLPropNames
Definition: agglomerate_base.h:164
double R()
Universal gas constant, .
Definition: fcst_constants.h:33
boost::shared_ptr< FuelCellShop::Material::PolymerElectrolyteBase > electrolyte
Boost shared pointer to electrolyte object.
Definition: agglomerate_base.h:320
double c_R
Definition: agglomerate_base.h:377
std::map< VariableNames, SolutionVariable > solutions
Member data for storing solutions.
Definition: agglomerate_base.h:332
double permittivity_0
Constants.
Definition: agglomerate_base.h:341
VariableNames reactant
Definition: agglomerate_base.h:334
virtual void initialize(ParameterHandler &param)
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.).
double pi
Definition: agglomerate_base.h:342
The base class for micro scale objects in OpenFCST.
Definition: micro_scale_base.h:134
double AV
Definition: agglomerate_base.h:355
boost::shared_ptr< FuelCellShop::Kinetics::BaseKinetics > kinetics
Boost shared pointer to kinetics object.
Definition: agglomerate_base.h:327
double D_R_N
Definition: agglomerate_base.h:409
double epsilon_agg
Definition: agglomerate_base.h:372
std::string fixed_agg_variable
Definition: agglomerate_base.h:419
int sol_index
Definition: agglomerate_base.h:335
double P
Definition: agglomerate_base.h:349
double H_R_N
Henry&#39;s Constant for primary reactant in nafion, [Pa cm^3/mol].
Definition: agglomerate_base.h:414
double E0()
Permittivity of free space, .
Definition: fcst_constants.h:48
virtual double compute_depsilonN_dthickness(const double thickness_agg) const
Function to compute This function should only be used to calculate the thin film thickness using New...
virtual ~AgglomerateBase()
Definition: agglomerate_base.h:79
double R
Definition: agglomerate_base.h:344
VariableNames tempReactantName
Definition: agglomerate_base.h:334
double Pi()
.
Definition: fcst_constants.h:43
double F
Definition: agglomerate_base.h:343
AgglomerateBase()
Definition: agglomerate_base.h:171
virtual bool has_derivatives()
Returns true if the class instance can calculate current density derivatives.
Definition: agglomerate_base.h:129
bool has_derivatives_
Definition: agglomerate_base.h:382