Memosa-FVM  0.2
BatteryBC.h
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #include "FloatVarDict.h"
6 #include "AMG.h"
7 
8 template<class T>
9 struct BatterySpeciesBC : public FloatVarDict<T>
10 {
12  {
13  this->defineVar("specifiedConcentration",T(0.0));
14  this->defineVar("specifiedMassFlux",T(1.0));
15 
16  }
17  string bcType;
18 };
19 
20 template<class T>
21 struct BatterySpeciesVC : public FloatVarDict<T>
22 {
24  {
25  this->defineVar("massDiffusivity",T(1.e-9));
26  this->defineVar("initialConcentration",T(1.0));
27  }
28  string vcType;
29 };
30 
31 template<class T>
32 struct BatteryPotentialBC : public FloatVarDict<T>
33 {
35  {
36  this->defineVar("specifiedPotential",T(300.0));
37  this->defineVar("specifiedPotentialFlux",T(0.0));
38  }
39  string bcType;
40 };
41 
42 template<class T>
43 struct BatteryPotentialVC : public FloatVarDict<T>
44 {
46  {
47  this->defineVar("conductivity",T(1.0));
48  this->defineVar("initialPotential",T(0.0));
49  }
50  string vcType;
51 };
52 
53 template<class T>
54 struct BatteryThermalBC : public FloatVarDict<T>
55 {
57  {
58  this->defineVar("specifiedTemperature",T(300.0));
59  this->defineVar("specifiedHeatFlux",T(0.0));
60  }
61  string bcType;
62 };
63 
64 template<class T>
65 struct BatteryThermalVC : public FloatVarDict<T>
66 {
68  {
69  this->defineVar("thermalConductivity",T(1.0));
70  this->defineVar("density", T(1.0));
71  this->defineVar("specificHeat", T(1.0));
72  this->defineVar("initialTemperature",T(300.0));
73  }
74  string vcType;
75 };
76 
77 template<class T>
79 {
81  {
82  this->defineVar("ButlerVolmerRRConstant",T(5.0e-7));
83  this->defineVar("ButlerVolmerAnodeShellMeshID", int(-1));
84  this->defineVar("ButlerVolmerCathodeShellMeshID", int(-1));
85  this->defineVar("BatteryElectrolyteMeshID", int(-1));
86  this->defineVar("timeStep",T(0.1));
87  this->defineVar("interfaceSpeciesUnderRelax",T(1.0));
88  this->relativeTolerance=1e-8;
89  this->absoluteTolerance=1e-16;
90  this->relativeSpeciesTolerance=1e-8;
91  this->absoluteSpeciesTolerance=1e-16;
92  this->relativePotentialTolerance=1e-8;
93  this->absolutePotentialTolerance=1e-16;
94  this->relativeThermalTolerance=1e-8;
95  this->absoluteThermalTolerance=1e-16;
96  this->relativePCTolerance=1e-8;
97  this->absolutePCTolerance=1e-16;
98  this->linearSolver = 0;
99  this->linearSolverSpecies = 0;
100  this->linearSolverPotential = 0;
101  this->linearSolverThermal = 0;
102  this->linearSolverPC = 0;
103  this->useCentralDifference=false;
104  this->transient = true;
105  this->ButlerVolmer = false;
106  this->thermalModelPC = true;
107  this->timeDiscretizationOrder=2;
108  this->advanceVerbosity=1;
109  }
126  bool transient;
131 
132 #ifndef SWIG
134  {
135  if (this->linearSolver == 0)
136  {
137  LinearSolver* ls(new AMG());
138  ls->relativeTolerance = 1e-1;
139  ls->nMaxIterations = 20;
140  ls->verbosity=0;
141  this->linearSolver = ls;
142  }
143  return *this->linearSolver ;
144  }
145 
147  {
148  if (this->linearSolverSpecies == 0)
149  {
150  LinearSolver* ls(new AMG());
151  ls->relativeTolerance = 1e-1;
152  ls->nMaxIterations = 20;
153  ls->verbosity=0;
154  this->linearSolverSpecies = ls;
155  }
156  return *this->linearSolverSpecies ;
157  }
159  {
160  if (this->linearSolverPotential == 0)
161  {
162  LinearSolver* ls(new AMG());
163  ls->relativeTolerance = 1e-1;
164  ls->nMaxIterations = 20;
165  ls->verbosity=0;
166  this->linearSolverPotential = ls;
167  }
168  return *this->linearSolverPotential ;
169  }
170 
172  {
173  if (this->linearSolverThermal == 0)
174  {
175  LinearSolver* ls(new AMG());
176  ls->relativeTolerance = 1e-1;
177  ls->nMaxIterations = 20;
178  ls->verbosity=0;
179  this->linearSolverThermal = ls;
180  }
181  return *this->linearSolverThermal ;
182  }
183 
185  {
186  if (this->linearSolverPC == 0)
187  {
188  LinearSolver* ls(new AMG());
189  ls->relativeTolerance = 1e-1;
190  ls->nMaxIterations = 20;
191  ls->verbosity=0;
192  this->linearSolverPC = ls;
193  }
194  return *this->linearSolverPC ;
195  }
196 #endif
197 };
198 
LinearSolver & getLinearSolverSpecies()
Definition: BatteryBC.h:146
double relativeThermalTolerance
Definition: BatteryBC.h:116
LinearSolver & getLinearSolverPC()
Definition: BatteryBC.h:184
double relativeTolerance
Definition: BatteryBC.h:110
LinearSolver * linearSolverPotential
Definition: BatteryBC.h:123
double absolutePotentialTolerance
Definition: BatteryBC.h:115
Definition: AMG.h:27
double absoluteSpeciesTolerance
Definition: BatteryBC.h:113
double absolutePCTolerance
Definition: BatteryBC.h:119
void defineVar(const string varName, const T defaultValue)
Definition: FloatVarDict.h:94
double absoluteTolerance
Definition: BatteryBC.h:111
LinearSolver * linearSolverThermal
Definition: BatteryBC.h:124
double relativePotentialTolerance
Definition: BatteryBC.h:114
int nMaxIterations
Definition: LinearSolver.h:31
LinearSolver * linearSolverSpecies
Definition: BatteryBC.h:122
double relativeTolerance
Definition: LinearSolver.h:33
double absoluteThermalTolerance
Definition: BatteryBC.h:117
LinearSolver * linearSolver
Definition: BatteryBC.h:121
double relativePCTolerance
Definition: BatteryBC.h:118
LinearSolver * linearSolverPC
Definition: BatteryBC.h:125
LinearSolver & getLinearSolver()
Definition: BatteryBC.h:133
LinearSolver & getLinearSolverThermal()
Definition: BatteryBC.h:171
double relativeSpeciesTolerance
Definition: BatteryBC.h:112
LinearSolver & getLinearSolverPotential()
Definition: BatteryBC.h:158