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 // C++ Interface: agglomerate_base.h
3 //
4 // Description: Class characterizing the catalyst layer and defining effective properties
5 //
6 // Authors: Marc Secanell <secanell@ualberta.ca,
7 // Peter Dobson <pdobson@ualberta.ca>, (C) 2011
8 // University of Alberta
9 //
10 // Copyright: See COPYING file that comes with this distribution
11 //
12 //---------------------------------------------------------------------------
13 
14 #ifndef _FUELCELLSHOP__LAYER__AGGLOMERATE_BASE_H
15 #define _FUELCELLSHOP__LAYER__AGGLOMERATE_BASE_H
16 
17 #include "fcst_constants.h"
18 #include "catalyst_base.h"
19 #include "catalyst_support_base.h"
21 #include "base_kinetics.h"
22 #include "tafel_kinetics.h"
23 
24 #include "platinum.h"
25 #include "nafion.h"
26 
27 #include <vector>
28 #include <string.h>
29 
30 //Liquid water
31 #include "PureLiquid.h"
32 
33 class AnalyticalAgglomerateTest;
34 
35 namespace FuelCellShop
36 {
37 namespace MicroScale
38 {
43  {
44 
45  friend class ::AnalyticalAgglomerateTest;
46 
47  public:
50  {
51  //Constants
52  R = Constants::R();
53  F = Constants::F();
54  permittivity_0 = Constants::E0() *1e-2; // cm
55  pi = Constants::Pi();
56  maxRadialDimension = 1.0;
57  IC_loaded = false;
58  }
59 
61  virtual ~AgglomerateBase() {};
62 
67  double A, double r, double delta, double epsilon ) = 0;
68 
70  {
71  kinetics = kin;
72  };
73 
78  virtual double compute_current (double &E_r) = 0;
79 
83  void set_solution(const std::map<VariableNames,SolutionVariable>&,const VariableNames&, const int&);
84 
89  virtual std::vector<double> compute_derivative_current ()
90  {
91  Assert(false, ExcPureFunctionCalled());
92  return std::vector<double>(3, 0.0);
93  }
94 
96  inline void set_P ( double P_Tot )
97  {
98  P = P_Tot;
99  }
100 
102  inline void set_T ( double Temp )
103  {
104  T = Temp;
105  }
106 
107  inline void setLoadingWeigths(std::vector<double> weigths)
108  {
109  loadingWeigths = weigths;
110  }
111 
112  inline void set_conductivity_factor ( double temp )
113  {
114  cond_factor = temp;
115  }
116 
117  inline bool analytical_derivatives()
118  {
119  return analyticalDerivatives;
120  }
121 
122  inline void load_initial_guess(std::vector<std::vector<double>> IC){
123  initial_data = IC;
124  IC_loaded = true;
125  }
126 
127  inline bool guess_not_loaded(){
128  return !IC_loaded;
129  }
130 
131  void deep_copy_pointers();
132 
133 
134 
135  std::vector<std::vector<double>> results;
136  std::vector<std::string> column_titles;
137 
138  protected:
139 
140 
141 
142  inline void setAV(double newAV){
143  AV = newAV;
144  }
145 
146  double getAV(double location);
147 
148  void setUpLoadings();
149 
150  void interpolate_initial_data(double z[], double &x, double left_pos, double right_pos, std::vector<double> left_data, std::vector<double> right_data);
151 
152  bool use_initial_data(double z[], double &x);
153 
154  // Constants & V.ariables
156  double pi;
157  double F;
158  double R;
159 
160  // Operating Conditions
161  double P;
162  double T;
163 
164  // Kinetic parameters
165  std::vector<double> loadingWeigths;
166  std::vector<double> actualLoadings;
167  std::vector<double> loadingRadii;
168  double AV;
169 
171 
172 
173 
174  bool IC_loaded;
175 
178 
183 
188 
194 
197 
202  std::vector<double> co2_final;
208  std::vector<double> mesh_final;
209 
211  double cond_factor;
212 
214  double r_agg;
215 
217  double delta_agg;
218 
220  double epsilon_agg;
221 
223  double c_R;
224 
226  double phi_M;
227 
229  double phi_S;
230 
232  double interface;
233 
235  double D_R_N;
236 
238  double H_R_N;
239 
241  double R_tol;
242 
243  std::vector<VariableNames> sol_names;
244 
245  std::map<VariableNames, SolutionVariable> solutions;
248 
249  std::vector< std::vector<double>> initial_data;
250  };
251 }
252 }
253 
254 #endif