OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BinaryDiffusion.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2013 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: BinaryDiffusion.h
11 // - Description: Class storing methods compute binary diffusion coefficients
12 // - Developers: Ali MalekpourKoupaei, M. Secanell and Madhur Bhaiya
13 // - $Id: BinaryDiffusion.h 1354 2013-08-17 00:01:22Z secanell $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELLSHOP__BINARYDIFFUSION__H
18 #define _FUELCELLSHOP__BINARYDIFFUSION__H
19 
20 #define __Del(p) {if(p) delete p; p=__null;}
21 #define __printf __builtin_printf
22 #define __scanf __builtin_scanf
23 #define __exp __builtin_exp
24 #define __pow __builtin_pow
25 #define __DUMMY -9999
26 
27 //Include STL and boost libraries
28 #include <cmath>
29 #include <iostream>
30 #include <string>
31 #include <vector>
32 #include <map>
33 #include <cctype>
34 #include <boost/lexical_cast.hpp>
35 
36 //Include deal.ii classes
37 #include <base/exceptions.h>
38 
39 // openFCST classes
40 #include "PureGas.h"
41 #include "fcst_variables.h"
42 
43 
45 
46 namespace FuelCellShop
47 {
48  namespace Mixture
49  {
50 
51 
56  {
57  protected:
59  public:
60 
61  //class constructors
65 
66  //class distructor
67  virtual ~BinaryDiffusion();
68 
69  // the method's specs.
70  virtual char* get_name() =0;
71  virtual char* get_description() =0;
72  virtual enDiffusionModelID get_ID() =0;
73 
79  virtual void compute_diffusion (double& D) =0;
80 
86  virtual void compute_diffusion(std::vector<double>& D_vec) =0;
87 
88  virtual double compute_diffusion (const double& T,const double& p) =0;
89  virtual void compute_diffusion (double& D,std::vector<double>& dD) =0;
90  virtual void compute_diffusion (const double& T,const double& p,
91  double& D,std::vector<double>& dD) =0;
92  virtual void compute_dD (std::vector<double>& dD) =0;
93  virtual double compute_dD_dP (const double& T,const double& p) =0;
94  virtual double compute_dD_dT (const double& T,const double& p) =0;
95 
102  virtual void compute_dD_dT(std::vector<double>& dD_dT_vec) =0;
103 
109  void set_T_and_p(const double& T,const double& p);
110 
115  void set_p(const double& p_atm);
116 
123 
126 
127  virtual void scan();
128  virtual void report() ;
129  virtual void report2file(char* filename);
130 
131  protected:
135  double T;
139  double p;
140 
147  };
148  //---------------------------------------------------------------------------
149 
150  /*
151  VaporDiffusion as a publicly derived class of BinaryDiffusion
152  */
154  {
155  public:
156 
157  //class constructors
158  VaporDiffusion();
161 
162  //class distructor
163  virtual ~VaporDiffusion();
164 
165  virtual double getSikmaAB(const double& sikma_A,
166  const double& sikma_B) =0;
167  virtual double getTstarAB(const double& Tstar_A,
168  const double& Tstar_B) =0;
169  virtual double getOmegaAB(const double& Tstar) =0;
170 
171  virtual void scan();
172  virtual void report() ;
173  virtual void report2file(char* filename);
174  };
175  //---------------------------------------------------------------------------
176 
215  {
216  public:
217 
218  //class constructors
219  ChapmanEnskog();
222 
223  //class distructor
224  virtual ~ChapmanEnskog();
225 
226  virtual char* get_name();
227  virtual char* get_description();
228  virtual enDiffusionModelID get_ID();
229 
230  virtual double getSikmaAB(const double& sikma_A,
231  const double& sikma_B);
232  virtual double getTstarAB(const double& Tstar_A,
233  const double& Tstar_B);
234  virtual double getOmegaAB(const double& Tstar);
240  virtual void compute_diffusion (double& D);
241 
247  virtual void compute_diffusion(std::vector<double>& D_vec);
248 
252  virtual double compute_diffusion (const double& T,const double& p);
258  virtual void compute_diffusion (double& D,std::vector<double>& dD) ;
263  virtual void compute_diffusion (const double& T,const double& p,
264  double& D,std::vector<double>& dD);
265  virtual void compute_dD (std::vector<double>& dD);
266  virtual double compute_dD_dP (const double& T,const double& p);
267  virtual double compute_dD_dT (const double& T,const double& p);
268 
275  virtual void compute_dD_dT(std::vector<double>& dD_dT_vec);
276 
277  virtual void scan();
278  virtual void report() ;
279  virtual void report2file(char* filename);
280 
281  private:
282  double M_A,M_B;
283  double Tnb_A,Tnb_B;
284  double Vl_A,Vl_B;
285  double sikma_A,sikma_B;
286  double Tstar_A,Tstar_B;
288  double omega_DAB;
289  };
290  //---------------------------------------------------------------------------
291 
292  /*
293  LiquidDiffusion as a publicly derived class of BinaryDiffusion
294  */
296  {
297  public:
298 
299  //class constructors
300  LiquidDiffusion();
303 
304  //class distructor
305  virtual ~LiquidDiffusion();
306 
307  virtual void scan();
308  virtual void report() ;
309  virtual void report2file(char* filename);
310  };
311  //---------------------------------------------------------------------------
312 
313  /*
314  Wilke-Chang as a publicly derived class of BinaryDiffusion
315  */
317  {
318  public:
319 
320  //class constructors
321  WilkeChang();
324 
325  //class distructor
326  virtual ~WilkeChang();
327 
328  virtual char* get_name();
329  virtual char* get_description();
330  virtual enDiffusionModelID get_ID();
331 
332  virtual void compute_diffusion (double& D) ;
333  virtual double compute_diffusion (const double& T,const double& p) ;
334  virtual void compute_diffusion (double& D,std::vector<double>& dD) ;
335  virtual void compute_diffusion (const double& T,const double& p,
336  double& D,std::vector<double>& dD) ;
337  virtual void compute_dD (std::vector<double>& dD) ;
338  virtual double compute_dD_dP (const double& T,const double& p) ;
339  virtual double compute_dD_dT (const double& T,const double& p) ;
340 
341  virtual void scan();
342  virtual void report() ;
343  virtual void report2file(char* filename);
344 
345  private:
346  double mu, phi;
347  void get_phi(double& phi);
348 
349  };
350  //---------------------------------------------------------------------------
351 
352  /*
353  HanBartelsInterpolation as a publicly derived class of BinaryDiffusion
354  */
356  {
357  public:
358 
359  //class constructors
363 
364  //class distructor
365  virtual ~HanBartelsInterpolation();
366 
367  virtual char* get_name();
368  virtual char* get_description();
369  virtual enDiffusionModelID get_ID();
370 
371  virtual void compute_diffusion (double& D) ;
372  virtual double compute_diffusion (const double& T,const double& p) ;
373  virtual void compute_diffusion (double& D,std::vector<double>& dD) ;
374  virtual void compute_diffusion (const double& T,const double& p,
375  double& D,std::vector<double>& dD) ;
376  virtual void compute_dD (std::vector<double>& dD) ;
377  virtual double compute_dD_dP (const double& T,const double& p) ;
378  virtual double compute_dD_dT (const double& T,const double& p) ;
379 
380  virtual void scan();
381  virtual void report() ;
382  virtual void report2file(char* filename);
383 
384  private:
385  double mu, phi;
386  void get_phi(double& phi);
387 
388  };
389  //---------------------------------------------------------------------------
390 
391  /*
392  Ferrell-Himmelblau as a publicly derived class of BinaryDiffusion
393  */
395  {
396  public:
397 
398  //class constructors
402 
403  //class distructor
404  virtual ~FerrellHimmelblau();
405 
406  virtual char* get_name();
407  virtual char* get_description();
408  virtual enDiffusionModelID get_ID();
409 
410  virtual void compute_diffusion (double& D) ;
411  virtual double compute_diffusion (const double& T,const double& p) ;
412  virtual void compute_diffusion (double& D,std::vector<double>& dD) ;
413  virtual void compute_diffusion (const double& T,const double& p,
414  double& D,std::vector<double>& dD) ;
415  virtual void compute_dD (std::vector<double>& dD) ;
416  virtual double compute_dD_dP (const double& T,const double& p) ;
417  virtual double compute_dD_dT (const double& T,const double& p) ;
418 
419  virtual void scan();
420  virtual void report() ;
421  virtual void report2file(char* filename);
422 
423  private:
424 
425  };
426  //---------------------------------------------------------------------------
427  }
428 }
429 
430 #endif