OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
agglomerate_ionomer_1D.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 // C++ Interface: agglomerate_ionomer_1D.h
3 //
4 // Description: Used to solve a system of equations representing a
5 // spherical ionomer-filled agglomerate.
6 //
7 // Authors: Jason Boisvert <jjb701@mail.usask.ca>, (C) 2011
8 // University of Saskatchewan,
9 // Peter Dobson <pdobson@ualberta.ca>,
10 // Philip Wardlaw,
11 // Michael Moore,
12 // University of Alberta.
13 
14 // Copyright: See COPYING file that comes with this distribution
15 //
16 //---------------------------------------------------------------------------
17 
18 #ifndef FUEL_CELL__IONOMER_AGGLOMERATE_NUMERICAL_1D__H
19 #define FUEL_CELL__IONOMER_AGGLOMERATE_NUMERICAL_1D__H
20 
21 
22 //------------------------------
23 // FUEL CELL DECLARATIONS
24 //-----------------------------
26 #include <contribs/DAE_wrapper.h>
27 
28 
29 
30 
31 namespace FuelCellShop
32 {
33 namespace MicroScale
34 {
35 
56 {
57 public:
58 
59 
60  static const std::string concrete_name;
61 
66  virtual SolutionMap compute_current ( );
67 
71  virtual std::string get_name(){
72  return concrete_name;
73  }
74 
80  virtual double aux_volume_fraction(){
81  return 0;
82  }
83 
84 protected:
85 
87  void setup_DAE_solver ();
88 
92  int cont_tolerance (double start_tol, double end_tol);
93 
94  /*
95  * Virtual function for returning film thickness in nano meters.
96  *
97  */
98  virtual double get_film_thickness(){
99  return delta_agg*1e9;
100  }
101 
102  /*
103  * Virtual function for returning agglomerate radius in nano meters.
104  *
105  */
106  virtual double get_radius(){
107  return r_agg*1e9;
108  }
109 
111  virtual void set_structure ();
112 
114 
116 
120  virtual boost::shared_ptr<FuelCellShop::MicroScale::MicroScaleBase> create_replica ()
121  {
122  return boost::shared_ptr<FuelCellShop::MicroScale::MicroScaleBase> (new FuelCellShop::MicroScale::IonomerAgglomerate ());
123  }
125 
127  IonomerAgglomerate ( int verbose = 1 );
128  IonomerAgglomerate(std::string name);
129 
130  /*
131  * Protected virtual member function for declaring parameters
132  */
133  virtual void declare_parameters (ParameterHandler &param) const
134  {
136  param.enter_subsection(concrete_name);{
137  param.declare_entry("Proton Conductivity factor", "1.0",
138  Patterns::Double());
139  param.declare_entry("Non Equilibrium BC Rate constant", "1.0", Patterns::Double());
140  param.declare_entry("Use non equilibrium BC", "false",
141  Patterns::Bool());
142  }
143  param.leave_subsection();
144 
145 
146 
147 
148  }
149 
150  /*
151  * Protected virtual member function for initializing parameters
152  */
153  virtual void initialize (ParameterHandler &param)
154  {
156  param.enter_subsection(concrete_name);{
157  cond_factor = param.get_double("Proton Conductivity factor");
158  k_O2 = param.get_double("Non Equilibrium BC Rate constant");
159  non_equil_bc = param.get_bool("Use non equilibrium BC");
160  }
161  param.leave_subsection();
162 
163 
164  }
165 
166 private:
167 
168 
169 
177  void fsub ( double &, double [], double [], double [] );
178 
179  static void fsub_wrapper ( double &, double [], double [], double [] );
180 
188  void dfsub ( double &, double [], double [], double [] );
189 
190  static void dfsub_wrapper ( double &, double [], double [], double [] );
191 
198  void gsub ( int &, double [], double & );
199 
200  static void gsub_wrapper ( int &, double [], double & );
201 
207  void dgsub ( int &, double [], double [] );
208 
209  static void dgsub_wrapper ( int &, double [], double [] );
210 
217  void guess ( double &, double [], double [], double [] );
218 
219  static void guess_wrapper ( double &, double [], double [], double [] );
220 
221 
223  double cond_factor;
224 
226  double k_O2;
227 
230 
231  // Transport Parameters
233  double sigma_p;
234  double lambda; //used for continuity
235  bool uFD; //use finte differences
236  double endTol; //set tolerance for final solution
238 
239 };
240 
241 }
242 }
243 
244 #endif
static const std::string concrete_name
Definition: agglomerate_ionomer_1D.h:60
virtual void initialize(ParameterHandler &param)
Definition: agglomerate_ionomer_1D.h:153
Base class for numerical agglomerates.
Definition: numerical_agglomerate_base.h:59
virtual void initialize(ParameterHandler &param)
virtual void declare_parameters(ParameterHandler &param) const
static void gsub_wrapper(int &, double[], double &)
virtual void set_structure()
Set the composition and structure of the agglomerate.
Convenient storage object for SolutionVariables.
Definition: fcst_variables.h:457
static void fsub_wrapper(double &, double[], double[], double[])
double lambda
Definition: agglomerate_ionomer_1D.h:234
IonomerAgglomerate(int verbose=1)
Constructors.
double prev_effectiveness
Definition: agglomerate_ionomer_1D.h:237
static void dfsub_wrapper(double &, double[], double[], double[])
double r_agg
Definition: agglomerate_base.h:177
static IonomerAgglomerate const * PROTOTYPE
Definition: agglomerate_ionomer_1D.h:115
virtual void declare_parameters(ParameterHandler &param) const
Definition: agglomerate_ionomer_1D.h:133
void guess(double &, double[], double[], double[])
The initial guess.
bool non_equil_bc
Bool to determine if the non-equilibrium boundary condition is used.
Definition: agglomerate_ionomer_1D.h:229
double k_O2
Rate constant for non-equilibrium boundary condition.
Definition: agglomerate_ionomer_1D.h:226
void fsub(double &, double[], double[], double[])
Define the DAE function.
virtual double get_film_thickness()
Definition: agglomerate_ionomer_1D.h:98
void dfsub(double &, double[], double[], double[])
The Jacobian of fsub.
static void guess_wrapper(double &, double[], double[], double[])
This class is to be used as a wrapper for the functions needed in the DAESolver.
Definition: DAE_wrapper.h:82
Class that solves an ionomer-filled agglomerate problem in 1D.
Definition: agglomerate_ionomer_1D.h:55
virtual boost::shared_ptr< FuelCellShop::MicroScale::MicroScaleBase > create_replica()
This member function is used to create an object of type MicroScaleBase.
Definition: agglomerate_ionomer_1D.h:120
double endTol
Definition: agglomerate_ionomer_1D.h:236
void dgsub(int &, double[], double[])
The derivatives of the boundary conditions.
double delta_agg
Definition: agglomerate_base.h:183
virtual double aux_volume_fraction()
MicroScale object may have extra contribution to volume of layer, e.g.
Definition: agglomerate_ionomer_1D.h:80
bool uFD
Definition: agglomerate_ionomer_1D.h:235
static void dgsub_wrapper(int &, double[], double[])
int cont_tolerance(double start_tol, double end_tol)
Function which implements a continuation based on the tolerance.
void setup_DAE_solver()
Setup the variables in the problem required by the DAE Solver.
virtual SolutionMap compute_current()
Main function of the class used to compute the current over the whole agglomerate at the local operat...
void gsub(int &, double[], double &)
Define the boundary conditions.
double cond_factor
Used to modify the proton conductivity in agglomerate.
Definition: agglomerate_ionomer_1D.h:223
double sigma_p
Proton conductivity.
Definition: agglomerate_ionomer_1D.h:233
virtual std::string get_name()
Return name of class instance, i.e.
Definition: agglomerate_ionomer_1D.h:71
virtual double get_radius()
Definition: agglomerate_ionomer_1D.h:106