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
27 
28 //Micro scale base class
30 
31 //STD
32 #include <random>
33 #include <limits> // std::numeric_limits
34 
35 
36 namespace FuelCellShop
37 {
38  namespace MicroScale
39  {
40 
41 
56  {
57 
58  protected:
59 
60  double pi;
61 
62  /*
63  * Type defs to make accessing layer info a bit easier
64  */
65 
67  typedef std::map<CLPropNames, double> CL_Properties;
68 
69 
70  /*
71  * Default Constructor
72  */
74  {
75  pi = Constants::Pi();
76 
77  };
78 
98 
116 
126  virtual double compute_epsilon_N ( const double delta_agg, const double thickness_agg ) const;
127 
137  virtual double compute_depsilonN_dthickness ( const double thickness_agg ) const;
138 
149 
161 
171 
172 
173  /*
174  * Radius of the agglomerate, typically [nm], but units may depend
175  * on non abstract child
176  */
177  double r_agg;
178 
179  /*
180  * Thickness of the ionomer thin film, typically [nm], but units may depend
181  * on non abstract child
182  */
183  double delta_agg;
184 
185  /*
186  * Porosity % of the agglomerate core
187  */
188  double epsilon_agg;
189 
190 
191  /*
192  * Number of agglomerates in CL domain
193  */
194  double n_agg;
195 
196 
197  };
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
241  {
242 
243 
244  public:
245 
246  /*
247  * Destructor
248  */
249  virtual ~AgglomerateBase(){};
250 
254  virtual void print_properties();
255 
257 
258 
270  virtual void set_solution(const std::map<VariableNames,SolutionVariable>&,const VariableNames&, const int&);
272 
284  virtual std::vector<double> compute_derivative_current ()
285  {
286  Assert(false, ExcPureFunctionCalled());
287  return std::vector<double>(sol_names.size(), 0.0);
288  }
289 
290 
299  virtual bool has_derivatives()
300  {
301  return has_derivatives_;
302  }
303 
304 
305 
306 
307  /*
308  * Agglomerate will deep copy it's pointers (kinetics, materials), use this for parallel execution.
309  *
310  * \warning This following function determines reaction name based on type of kinetics model
311  * \warning which may not necessarily be correct and only will work for currently
312  * \warning implemented kinetics models.
313  * \warning A more robust mothod of determining the reaction name at this scope is required.
314  * \warning Use of new kineitics models, or existing kinetics models for different reactions
315  * \warning will result in bugs.
316  */
317  virtual void make_thread_safe(ParameterHandler &param, unsigned int thread_index);
318 
319 
320  protected:
321 
322  /*
323  * Method for setting up film thickness or porosity depending on parameters
324  * called in initialize() or adjust_poly adjust_polydisperse_structure().
325  */
327 
328 
329 
330  /*
331  * Type defs to make accessing layer info a bit easier
332  */
333 
335  typedef std::map<CLPropNames, double> CL_Properties;
336 
337 
338  /*
339  * Constructor, sets up some constants
340  */
342  {
343  //Constants
344  R = Constants::R();
345  F = Constants::F();
346  permittivity_0 = Constants::E0() *1e-2; // cm
347  }
348 
349 
350  /*
351  * Protected virtual member function for declaring parameters, pure
352  * in MicroScaleBase, implemented here in AgglomerateBase.
353  * Parameter structure is hierarchical, therefore children should
354  * call their parent's declare parameter function from their own declare
355  * parameter function.
356  */
357  virtual void declare_parameters (ParameterHandler &param) const;
358 
359  /*
360  * Protected virtual member function for initializing parameters, pure
361  * in MicroScaleBase, implemented here in AgglomerateBase.
362  * Parameter structure is hierarchical, therefore children should
363  * call their parent's initialize function from their own declare
364  * parameter function.
365  */
366  virtual void initialize (ParameterHandler &param);
367 
368  /*
369  * Pure virtual function for returning film thickness in nano meters.
370  *
371  * Must be implemented in child, where informed unit conversion will occur.
372  */
373  virtual double get_film_thickness() = 0;
374 
375  /*
376  * Pure virtual function for returning agglomerate radius in nano meters.
377  *
378  * Must be implemented in child, where informed unit conversion will occur.
379  */
380  virtual double get_radius() = 0;
381 
382 
388  boost::shared_ptr<FuelCellShop::Material::CatalystBase > catalyst;
389 
395  boost::shared_ptr<FuelCellShop::Material::PolymerElectrolyteBase> electrolyte;
396 
402  boost::shared_ptr<FuelCellShop::Kinetics::BaseKinetics> kinetics;
403 
407  std::map<VariableNames, SolutionVariable> solutions;
408  std::vector<VariableNames> sol_names;
411 
412 
416  double permittivity_0; //permittivity of free space (scaled in constructor)
417  double F; //Faraday's Constant
418  double R; //Gas constant (molar)
419 
420  /*
421  * Pressure of domain in pascals
422  */
423  double P;
424 
425  /*
426  * Active area, [cm^2/cm^3], Scaled to solid fraction by MSCL,
427  * scaled to agglomerate core by non abstract agglomerate classes
428  */
429  double AV;
430 
431  /*
432  * Concentration of primary reactant at the boundary, [mol/cm^3]
433  */
434  double c_R;
435 
436  /*
437  * Boolean determining whether or not the agglomerate object returns derivatives.
438  */
440 
441  /*
442  * Concentration of protons at the boundary, [mol/cm^3]
443  */
444  double c_H;
445 
446  /*
447  * Electrolyte (Membrane) phase potential at the boundary, [V]
448  */
449  double phi_M;
450 
451  /*
452  * Solid phase potential through the agglomerate, [V]
453  */
454  double phi_S;
455 
456  /*
457  * Value of the boundary between the thin film and agglomerate domain
458  *
459  * Dimensionless (0.0 to 1.0)
460  */
461  double interface;
462 
463  /*
464  * Oxygen Diffusion, [cm^2/s]
465  */
466  double D_R_N;
467 
471  double H_R_N;
472 
473  /*
474  * Variable used to select if thickness or porosity should be constant
475  */
476  std::string fixed_agg_variable;
477 
478 
479  };
480  }
481 }
482 
483 #endif
virtual void make_thread_safe(ParameterHandler &param, unsigned int thread_index)
std::vector< VariableNames > sol_names
Definition: agglomerate_base.h:408
double interface
Definition: agglomerate_base.h:461
virtual void declare_parameters(ParameterHandler &param) const
This class implements methods for calculating geometric parameters of a spherical agglomerate surroun...
Definition: agglomerate_base.h:55
double F()
Faraday constant, .
Definition: fcst_constants.h:37
double phi_S
Definition: agglomerate_base.h:454
double phi_M
Definition: agglomerate_base.h:449
The base class for agglomerate objects in OpenFCST.
Definition: agglomerate_base.h:240
boost::shared_ptr< FuelCellShop::Material::CatalystBase > catalyst
Boost shared pointer to catalyst object.
Definition: agglomerate_base.h:388
SphericalAgglomerateGeometry()
Definition: agglomerate_base.h:73
std::map< CLPropNames, double > CL_Properties
Definition: agglomerate_base.h:335
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:284
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:63
double c_H
Definition: agglomerate_base.h:444
virtual void print_properties()
Print out key agglomerate information (name, radius, film thickness, porosity).
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.
Properties
Definition: multi_scale_CL.h:202
double r_agg
Definition: agglomerate_base.h:177
FuelCellShop::Layer::MultiScaleCL< deal_II_dimension >::Properties CLPropNames
Definition: agglomerate_base.h:334
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 structu...
double pi
Definition: agglomerate_base.h:60
double epsilon_agg
Definition: agglomerate_base.h:188
double R()
Universal gas constant, .
Definition: fcst_constants.h:32
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 double compute_depsilonN_depsilon_agg(FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer) const
Function to compute This function should only be used to calculate the thin film thickness using New...
boost::shared_ptr< FuelCellShop::Material::PolymerElectrolyteBase > electrolyte
Boost shared pointer to electrolyte object.
Definition: agglomerate_base.h:395
double c_R
Definition: agglomerate_base.h:434
std::map< VariableNames, SolutionVariable > solutions
Member data for storing solutions.
Definition: agglomerate_base.h:407
double permittivity_0
Constants.
Definition: agglomerate_base.h:416
VariableNames reactant
Definition: agglomerate_base.h:409
std::map< CLPropNames, double > CL_Properties
Definition: agglomerate_base.h:67
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.).
The base class for micro scale objects in OpenFCST.
Definition: micro_scale_base.h:134
double AV
Definition: agglomerate_base.h:429
double delta_agg
Definition: agglomerate_base.h:183
FuelCellShop::Layer::MultiScaleCL< deal_II_dimension >::Properties CLPropNames
Definition: agglomerate_base.h:66
boost::shared_ptr< FuelCellShop::Kinetics::BaseKinetics > kinetics
Boost shared pointer to kinetics object.
Definition: agglomerate_base.h:402
double n_agg
Definition: agglomerate_base.h:194
double D_R_N
Definition: agglomerate_base.h:466
std::string fixed_agg_variable
Definition: agglomerate_base.h:476
int sol_index
Definition: agglomerate_base.h:410
double P
Definition: agglomerate_base.h:423
virtual double compute_n(FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > *layer) const
Member function to compute the number of agglomerates.
double H_R_N
Henry&#39;s Constant for primary reactant in nafion, [Pa cm^3/mol].
Definition: agglomerate_base.h:471
double E0()
Permittivity of free space, .
Definition: fcst_constants.h:47
virtual ~AgglomerateBase()
Definition: agglomerate_base.h:249
double R
Definition: agglomerate_base.h:418
VariableNames tempReactantName
Definition: agglomerate_base.h:409
double Pi()
.
Definition: fcst_constants.h:42
double F
Definition: agglomerate_base.h:417
AgglomerateBase()
Definition: agglomerate_base.h:341
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 ...
virtual bool has_derivatives()
Returns true if the class instance can calculate current density derivatives.
Definition: agglomerate_base.h:299
bool has_derivatives_
Definition: agglomerate_base.h:439
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.