OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
polymer_electrolyte_material_base.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2006-13 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: polymer_electrolyte_material_base.h
11 // - Description: base class for polymer electrolyte materials e.g. Nafion
12 // - Developers: M. Secanell and Madhur Bhaiya
13 // - Id: $Id: polymer_electrolyte_material_base.h 1461 2013-08-30 22:30:08Z madhur $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELLSHOP_POLYMER_ELECTROLYTE_MATERIAL_BASE__H
18 #define _FUELCELLSHOP_POLYMER_ELECTROLYTE_MATERIAL_BASE__H
19 
20 // Include deal.II classes
21 #include <base/parameter_handler.h>
22 #include <base/point.h>
23 #include <base/function.h>
24 #include <lac/vector.h>
25 #include <fe/fe_values.h>
26 
27 // Include FCST classes
29 #include "utils/fcst_constants.h"
30 #include "materials/PureGas.h"
31 
32 //Include STL
33 #include <cmath>
34 #include <iostream>
35 
36 
37 namespace FuelCellShop
38 {
39  namespace Material
40  {
63  :
64  public BaseMaterial
65  {
66  public:
68 
69 
74  static void declare_PolymerElectrolyte_parameters (ParameterHandler &param)
75  {
76 
77  for (typename FuelCellShop::Material::PolymerElectrolyteBase::_mapFactory::iterator iterator = FuelCellShop::Material::PolymerElectrolyteBase::get_mapFactory()->begin();
79  iterator++)
80  {
81  iterator->second->declare_parameters(param);
82  }
83  }
84 
88  static void set_PolymerElectrolyte_parameters (const std::vector<std::string>& name_dvar,
89  const std::vector<double>& value_dvar,
90  ParameterHandler &param)
91  {
92  for (typename FuelCellShop::Material::PolymerElectrolyteBase::_mapFactory::iterator iterator = FuelCellShop::Material::PolymerElectrolyteBase::get_mapFactory()->begin();
94  iterator++)
95  {
96  iterator->second->set_parameters(name_dvar,value_dvar, param);
97  }
98  }
99 
118  static boost::shared_ptr<FuelCellShop::Material::PolymerElectrolyteBase > create_PolymerElectrolyte (ParameterHandler &param,
119  std::string polymer_electrolyte_name)
120  {
121  boost::shared_ptr<FuelCellShop::Material::PolymerElectrolyteBase > pointer;
122 
123  typename FuelCellShop::Material::PolymerElectrolyteBase::_mapFactory::iterator iterator = FuelCellShop::Material::PolymerElectrolyteBase::get_mapFactory()->find(polymer_electrolyte_name);
124 
126  {
127  if (iterator->second)
128  {
129  pointer = iterator->second->create_replica();
130  }
131  else
132  {
133  deallog<<"Pointer not initialized"<<std::endl;
134  abort();
135  }
136  }
137  else
138  {
139  deallog<<"Concrete name in FuelCellShop::Material::PolymerElectrolyteBase::create_PolymerElectrolyte does not exist"<<std::endl;
140  abort();
141  }
142 
143  pointer->initialize(param);
144 
145  return pointer;
146  }
148 
150 
151 
157  virtual void sorption_isotherm(std::vector<double>&) const
158  {
159  const std::type_info& info = typeid(*this);
160  deallog << "Pure function " << __FUNCTION__
161  << " called in Class "
162  << info.name() << std::endl;
163  }
171  virtual void sorption_isotherm_derivative(std::map < VariableNames, std::vector<double> >&) const
172  {
173  const std::type_info& info = typeid(*this);
174  deallog << "Pure function " << __FUNCTION__
175  << " called in Class "
176  << info.name() << std::endl;
177  }
178 
184  virtual void proton_conductivity(double&) const
185  {
186  const std::type_info& info = typeid(*this);
187  deallog << "Pure function " << __FUNCTION__
188  << " called in Class "
189  << info.name() << std::endl;
190  }
196  virtual void proton_conductivity(std::vector<double>&) const
197  {
198  const std::type_info& info = typeid(*this);
199  deallog << "Pure function " << __FUNCTION__
200  << " called in Class "
201  << info.name() << std::endl;
202  }
209  virtual void proton_conductivity_derivative(std::map< VariableNames, std::vector<double> >&) const
210  {
211  const std::type_info& info = typeid(*this);
212  deallog << "Pure function " << __FUNCTION__
213  << " called in Class "
214  << info.name() << std::endl;
215  }
216 
222  virtual void water_diffusivity(double&) const
223  {
224  const std::type_info& info = typeid(*this);
225  deallog << "Pure function " << __FUNCTION__
226  << " called in Class "
227  << info.name() << std::endl;
228  }
234  virtual void water_diffusivity(std::vector<double>&) const
235  {
236  const std::type_info& info = typeid(*this);
237  deallog << "Pure function " << __FUNCTION__
238  << " called in Class "
239  << info.name() << std::endl;
240  }
247  virtual void water_diffusivity_derivative(std::map< VariableNames, std::vector<double> >&) const
248  {
249  const std::type_info& info = typeid(*this);
250  deallog << "Pure function " << __FUNCTION__
251  << " called in Class "
252  << info.name() << std::endl;
253  }
254 
260  virtual void electroosmotic_drag(std::vector<double>&) const
261  {
262  const std::type_info& info = typeid(*this);
263  deallog << "Pure function " << __FUNCTION__
264  << " called in Class "
265  << info.name() << std::endl;
266  }
273  virtual void electroosmotic_drag_derivative(std::map< VariableNames, std::vector<double> >&) const
274  {
275  const std::type_info& info = typeid(*this);
276  deallog << "Pure function " << __FUNCTION__
277  << " called in Class "
278  << info.name() << std::endl;
279  }
280 
286  virtual void oxygen_diffusivity(double&) const
287  {
288  const std::type_info& info = typeid(*this);
289  deallog << "Pure function " << __FUNCTION__
290  << " called in Class "
291  << info.name() << std::endl;
292  }
298  virtual void oxygen_diffusivity(std::vector<double>&) const
299  {
300  const std::type_info& info = typeid(*this);
301  deallog << "Pure function " << __FUNCTION__
302  << " called in Class "
303  << info.name() << std::endl;
304  }
311  virtual void oxygen_diffusivity_derivative(std::map< VariableNames, std::vector<double> >&) const
312  {
313  const std::type_info& info = typeid(*this);
314  deallog << "Pure function " << __FUNCTION__
315  << " called in Class "
316  << info.name() << std::endl;
317  }
318 
324  virtual void proton_diffusivity(double&) const
325  {
326  const std::type_info& info = typeid(*this);
327  deallog << "Pure function " << __FUNCTION__
328  << " called in Class "
329  << info.name() << std::endl;
330  }
331 
333 
335 
336 
338  inline double get_density() const
339  {
340  return rho_M;
341  }
342 
344  inline double get_H_O2() const
345  {
346  return H_O2;
347  }
348 
350  inline double get_H_H2() const
351  {
352  return H_H2;
353  }
354 
356  inline double get_EW() const
357  {
358  return EW;
359  }
360 
362  inline double get_permittivity() const
363  {
364  return permittivity;
365  }
366 
368 
370 
371 
375  inline void set_p_t(const double& p_t)
376  {
377  p_total = p_t;
378  }
379 
383  inline void set_T (const double& Temp)
384  {
385  T = Temp;
386  }
387 
391  inline void set_lambda(const double& L)
392  {
393  lambda = L;
394  }
395 
402  {
403  Assert( ((l_in.is_initialized()) && (l_in.get_variablename() == membrane_water_content)),
404  ExcMessage("Input solution variable not initialized properly in PolymerElectrolyteBase::set_membrane_water_content method.") );
405 
406  lambda_var = l_in;
407 
408  if ( !T_var.is_initialized() )
410  }
411 
418  {
419  Assert( ((T_in.is_initialized()) && (T_in.get_variablename() == temperature_of_REV)),
420  ExcMessage("Input solution variable not initialized properly in PolymerElectrolyteBase::set_temperature method.") );
421 
422  T_var = T_in;
423 
424  if ( !lambda_var.is_initialized() )
426  }
427 
435  {
436  Assert( ((x_in.is_initialized()) && (x_in.get_variablename() == water_molar_fraction)),
437  ExcMessage("Input solution variable not initialized properly in PolymerElectrolyteBase::set_water_molar_fraction method.") );
438 
439  xwater_var = x_in;
440 
441  if ( !T_var.is_initialized() )
443  }
445 
446  protected:
448 
449 
453  : BaseMaterial(name)
454  {
455  lambda = 12.0;
456  T = 0.0; // Used for assertion to throw error, if temperature values are not set.
457  p_total = 0.0; // Used for assertion to throw error, if pressure values are not set.
458  };
459 
464  : FuelCellShop::Material::BaseMaterial()
465  {
466  lambda = 12.0;
467  T = 0.0; // Used for assertion to throw error, if temperature values are not set.
468  p_total = 0.0; // Used for assertion to throw error, if pressure values are not set.
469  };
470 
475  {
476  };
477 
482  virtual void declare_parameters(ParameterHandler &param) const
483  {
484  const std::type_info& info = typeid(*this);
485  deallog << "Pure function " << __FUNCTION__
486  << " called in Class "
487  << info.name() << std::endl;
488  };
489 
499  virtual void set_parameters (const std::vector<std::string>& name_dvar,
500  const std::vector<double>& value_dvar,
501  ParameterHandler& param)
502  {
503  const std::type_info& info = typeid(*this);
504  deallog << "Pure function " << __FUNCTION__
505  << " called in Class "
506  << info.name() << std::endl;
507  };
508 
512  virtual void initialize (ParameterHandler &param)
513  {
514  const std::type_info& info = typeid(*this);
515  deallog << "Pure function " << __FUNCTION__
516  << " called in Class "
517  << info.name() << std::endl;
518  };
520 
522 
523 
526  typedef std::map< std::string, FuelCellShop::Material::PolymerElectrolyteBase* > _mapFactory;
528 
530 
531 
535  {
536  static _mapFactory mapFactory;
537  return &mapFactory;
538  }
540 
542 
543 
547  virtual boost::shared_ptr<FuelCellShop::Material::PolymerElectrolyteBase > create_replica ()
548  {
549  const std::type_info& info = typeid(*this);
550  deallog << "Pure function " << __FUNCTION__
551  << " called in Class "
552  << info.name() << std::endl;
553  }
555 
557 
558 
559  double EW;
560 
562  double rho_M;
563 
567  double H_O2;
571  double H_H2;
575  double permittivity;
576 
577 
579  double T;
580 
584  double lambda;
585 
587  double p_total;
588 
589 
593  double sigma_p;
594 
598  double diffusion_w;
599 
604  double given_n_drag;
605 
609  double D_O2;
610 
614  double D_Protons;
616 
618 
619 
623  std::string method_conductivity;
624 
628  std::string method_sorption;
629 
633  std::string method_diffusivity;
634 
640 
642 
643 
648 
653 
659  };
660  }
661 }
662 
663 #endif