OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
agglomerate_water_1D.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 // C++ Interface: agglomerate_water_1D.h
3 //
4 // Description: Used to solve a system of equations representing a
5 // spherical water-filled agglomerate.
6 //
7 // Author: Peter Dobson <pdobson@ualberta.ca>, (C) 2011
8 // Philip Wardlaw,
9 // University of Alberta
10 //
11 // Copyright: See COPYING file that comes with this distribution
12 //
13 //---------------------------------------------------------------------------
14 
15 #ifndef FUEL_CELL__WATER_AGGLOMERATE_1D__H
16 #define FUEL_CELL__WATER_AGGLOMERATE_1D__H
17 
18 //------------------------------
19 // STD LIBRARY DECLARATIONS
20 //------------------------------
21 
22 
23 //------------------------------
24 // DEAL.II DECLARATIONS
25 //------------------------------
26 
27 
28 //------------------------------
29 // FUEL CELL DECLARATIONS
30 //------------------------------
31 
33 #include <contribs/DAE_wrapper.h>
34 
35 //Liquid water
36 #include <materials/PureLiquid.h>
37 
38 
39 namespace FuelCellShop
40 {
41 namespace MicroScale
42 {
43 
68 {
69 public:
70 
71 
72 
73  static const std::string concrete_name;
74 
75 
76 
81  virtual SolutionMap compute_current ( );
82 
83 
87  virtual std::string get_name(){
88  return concrete_name;
89  }
90 
97  virtual double aux_volume_fraction(){
98 
99 
101  std::map<Props, double> p = this->layer->get_properties();
102 
103  return p[Props::solid_fraction]*epsilon_agg/(1-epsilon_agg);
104 
105  }
106 
107 
108 
109 
110 protected:
111 
115  int cont_tolerance (double start_tol, double end_tol);
116 
121  int cont_cd ();
122 
124  void setup_DAE_solver ();
125 
126 
127  /*
128  * Virtual function for returning film thickness in nano meters.
129  *
130  */
131  virtual double get_film_thickness(){
132  return delta_agg*1e7;
133  }
134 
135  /*
136  * Virtual function for returning agglomerate radius in nano meters.
137  *
138  */
139  virtual double get_radius(){
140  return r_agg*1e7;
141  }
142 
144  void set_structure ( );
145 
147  WaterAgglomerate ( int verbose = 1 );
148  WaterAgglomerate (std::string concrete_name);
149 
150 
151  /*
152  * Protected virtual member function for declaring parameters
153  *
154  *
155  *
156  */
157  virtual void declare_parameters (ParameterHandler &param) const
158  {
160  water.declare_parameters(param);
161  param.enter_subsection(concrete_name);{
162 
163  param.declare_entry("Relative core charge factor", "0.0", Patterns::Double(0.0,1.0),
164  "Factor dictating the amount of negative charged ions existing in the "
165  "water filled core. Fraction of film sulphonic concentration.");
166  }
167  param.leave_subsection();
168 
169  }
170 
171  /*
172  * Protected virtual member function for initializing parameters
173  */
174  virtual void initialize (ParameterHandler &param)
175  {
177  water.initialize(param);
178  param.enter_subsection(concrete_name);{
179 
180  core_charge_factor = param.get_double("Relative core charge factor");
181  }
182  param.leave_subsection();
183 
184 
185  }
186 
187 
206  double compute_thickness_agg ();
207 
224  virtual double compute_epsilon_agg ();
225 
226 
228 
230 
234  virtual boost::shared_ptr<FuelCellShop::MicroScale::MicroScaleBase> create_replica ()
235  {
236  return boost::shared_ptr<FuelCellShop::MicroScale::MicroScaleBase> (new FuelCellShop::MicroScale::WaterAgglomerate());
237  }
239 
240 
248  void fsub ( double &, double [], double [], double [] );
249 
250  static void fsub_wrapper ( double &, double [], double [], double [] );
251 
259  void dfsub ( double &, double [], double [], double [] );
260 
261  static void dfsub_wrapper ( double &, double [], double [], double [] );
262 
269  void gsub ( int &, double [], double & );
270 
271  static void gsub_wrapper ( int &, double [], double & );
272 
278  void dgsub ( int &, double [], double [] );
279 
280  static void dgsub_wrapper ( int &, double [], double [] );
281 
288  void guess ( double &, double [], double [], double [] );
289 
290  static void guess_wrapper ( double &, double [], double [], double [] );
291 
292 
293 
296 
297  // Transport Parameters
299  double D_H_NAF;
300  double D_H_Water;
301 
303  double D_O2_N;
304  double DO2_Water;
305 
307  double HO2N;
308 
309  /*Permitivity and charge characteristics of the core*/
313 
314  std::vector<std::string> derivative_flags;
315 
317  double H_tol;
318 
319  //Continuation variables
320  double lambda;
321  double lambda2;
322 
323 
324 };
325 
326 }//namespace Layer
327 }//namespace FuelCellShop
328 
329 #endif
int cont_tolerance(double start_tol, double end_tol)
Function which implements a continuation based on the tolerance.
double DO2_Water
Definition: agglomerate_water_1D.h:304
static void guess_wrapper(double &, double[], double[], double[])
int cont_cd()
Function which implements a continuation based on lambda - modifying the source terms to scale back t...
static void dfsub_wrapper(double &, double[], double[], double[])
std::vector< std::string > derivative_flags
Definition: agglomerate_water_1D.h:314
void set_structure()
Set the composition and structure of the agglomerate.
Base class for numerical agglomerates.
Definition: numerical_agglomerate_base.h:59
void gsub(int &, double[], double &)
Define the boundary conditions.
virtual double get_radius()
Definition: agglomerate_water_1D.h:139
FuelCellShop::Material::LiquidWater water
Object to store information on water, necessary for water filled agglomerate.
Definition: agglomerate_water_1D.h:295
virtual void initialize(ParameterHandler &param)
Class that solves a water-filled agglomerate problem in 1D.
Definition: agglomerate_water_1D.h:67
virtual void declare_parameters(ParameterHandler &param) const
double D_H_NAF
Proton Diffusivity in Nafion and water.
Definition: agglomerate_water_1D.h:299
double D_H_Water
Definition: agglomerate_water_1D.h:300
Convenient storage object for SolutionVariables.
Definition: fcst_variables.h:457
virtual std::string get_name()
Return name of class instance, i.e.
Definition: agglomerate_water_1D.h:87
Properties
Definition: multi_scale_CL.h:202
static const std::string concrete_name
Definition: agglomerate_water_1D.h:73
static void fsub_wrapper(double &, double[], double[], double[])
double r_agg
Definition: agglomerate_base.h:177
void setup_DAE_solver()
Setup the variables in the problem required by the DAE Solver.
WaterAgglomerate(int verbose=1)
Constructors.
FuelCellShop::Layer::MultiScaleCL< deal_II_dimension > * layer
Definition: micro_scale_base.h:354
virtual boost::shared_ptr< FuelCellShop::MicroScale::MicroScaleBase > create_replica()
This member function is used to create an object of type MicroScaleBase.
Definition: agglomerate_water_1D.h:234
double epsilon_agg
Definition: agglomerate_base.h:188
double core_charge_factor
Definition: agglomerate_water_1D.h:312
void dgsub(int &, double[], double[])
The derivatives of the boundary conditions.
double compute_thickness_agg()
Member function to compute the thickness of the agglomerate thin film based on the radius and structu...
double lambda2
Definition: agglomerate_water_1D.h:321
void declare_parameters(ParameterHandler &param) const
Declare all necessary parameters in order to compute the coefficients.
This class is to be used as a wrapper for the functions needed in the DAESolver.
Definition: DAE_wrapper.h:82
static void dgsub_wrapper(int &, double[], double[])
double rel_permittivity_Naf
Definition: agglomerate_water_1D.h:311
double D_O2_N
Oxygen Diffusivity in Nafion and water.
Definition: agglomerate_water_1D.h:303
virtual double compute_epsilon_agg()
Compute the volume fraction of nafion inside the agglomerate given the catalyst layer ionomer volume ...
virtual double aux_volume_fraction()
MicroScale object may have extra contribution to volume of layer, e.g.
Definition: agglomerate_water_1D.h:97
static WaterAgglomerate const * PROTOTYPE
Definition: agglomerate_water_1D.h:229
LiquidWater as a publicly derived class of Pureliquid.
Definition: PureLiquid.h:62
double HO2N
Henry&#39;s Constant for oxygen in nafion.
Definition: agglomerate_water_1D.h:307
double delta_agg
Definition: agglomerate_base.h:183
virtual double get_film_thickness()
Definition: agglomerate_water_1D.h:131
double H_tol
absolute tolerance in proton concentration
Definition: agglomerate_water_1D.h:317
double lambda
Definition: agglomerate_water_1D.h:320
void fsub(double &, double[], double[], double[])
Define the DAE function.
void guess(double &, double[], double[], double[])
The initial guess.
void dfsub(double &, double[], double[], double[])
The Jacobian of fsub.
double rel_permittivity_water
Definition: agglomerate_water_1D.h:310
void initialize(ParameterHandler &param)
Member function used to read in data and initialize the necessary data to compute the coefficients...
virtual SolutionMap compute_current()
Main function of the class used to compute the current over the whole agglomerate at the local operat...
virtual void declare_parameters(ParameterHandler &param) const
Definition: agglomerate_water_1D.h:157
static void gsub_wrapper(int &, double[], double &)
virtual void initialize(ParameterHandler &param)
Definition: agglomerate_water_1D.h:174
std::map< Properties, double > get_properties()
Definition: multi_scale_CL.h:216