Loading...
Searching...
No Matches
electricPotential.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2021-2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::functionObjects::electricPotential
28
29Group
30 grpSolversFunctionObjects
31
32Description
33 Computes the steady-state equation of charge conservation to obtain
34 the electric potential by strictly assuming a quasi-static electrostatic
35 field for single-phase and multiphase applications.
36
37 The steady-state equation of the charge conservation:
38
39 \f[
40 \nabla \cdot \left( \sigma \nabla V \right) = 0
41 \f]
42
43 where
44 \vartable
45 V | Electric potential [volt = kg m^2/(A s^3)]
46 \sigma | Isotropic conductivity of mixture [S/m = A^2 s^3/(kg m^3)]
47 \endvartable
48
49 Optionally, electric field, current density and free-charge
50 density fields can be written out by using the following equations:
51
52 \f[
53 \vec{E} = - \nabla V
54 \f]
55
56 \f[
57 \vec{J} = \sigma \vec{E} = - \sigma \nabla V
58 \f]
59
60 \f[
61 \rho_E = \nabla \cdot \left(\epsilon_m \vec{E} \right)
62 = \nabla \cdot \left(\epsilon_0 \epsilon_r \vec{E} \right)
63 \f]
64
65 where
66 \vartable
67 \vec{E} | Electric field [m kg/(s^3 A)]
68 \vec{J} | Current density [A/m^2]
69 \rho_E | Volume charge density [C/m^3 = A s/m^3]
70 \epsilon_m | Isotropic permittivity of mixture [F/m = A^2 s^4/(kg m^3)]
71 \epsilon_0 | Isotropic vacuum permittivity [F/m = A^2 s^4/(kg m^3)]
72 \epsilon_r | Isotropic relative permittivity of mixture [-]
73 \endvartable
74
75 For multiphase applications, \c sigma and \c epsilonr are blended
76 (to consider their interface values) by using the simple weighted
77 arithmetic mean interpolation, for example:
78
79 \f[
80 \sigma = \alpha_1 \sigma_1 + \alpha_2 \sigma_2
81 = \alpha_1 \sigma_1 + (1 - \alpha_1) \sigma_2
82 \f]
83
84Usage
85 Minimal example by using \c system/controlDict.functions:
86 \verbatim
87 electricPotentialFO
88 {
89 // Mandatory entries
90 type electricPotential;
91 libs (solverFunctionObjects);
92
93 // Conditional entries
94
95 // Option-1: single-phase
96 sigma <scalar>;
97 epsilonr <scalar>;
98
99 // Option-2: multiphase
100 phases
101 {
102 alpha.air
103 {
104 sigma <scalar>;
105 epsilonr <scalar>;
106 }
107 alpha.water
108 {
109 sigma <scalar>;
110 epsilonr <scalar>;
111 }
112 alpha.mercury
113 {
114 sigma <scalar>;
115 epsilonr <scalar>;
116 }
117 ...
118 }
119
120 // Optional entries
121 nCorr <int>;
122 writeDerivedFields <bool>;
123 V <word>;
124 electricField <bool>;
125 E <word>;
126 fvOptions <dict>;
127 tolerance <scalar>;
128
129 // Inherited entries
130 ...
131 }
132 \endverbatim
133
134 where the entries mean:
135 \table
136 Property | Description | Type | Reqd | Deflt
137 type | Type name: electricPotential | word | yes | -
138 libs | Library name: solverFunctionObjects | word | yes | -
139 sigma | Isotropic electrical conductivity of phase | scalar | yes | -
140 epsilonr | Isotropic relative permittivity of phase | scalar | no | -
141 nCorr | Number of corrector iterations | int | no | 1
142 writeDerivedFields | Flag to write extra fields | bool | no | false
143 V | Name of electric potential field | word | no | electricPotential:V
144 electricField | Flag to calculate electric field | bool | no | false
145 E | Name of electric field | word | no | electricPotential:E
146 fvOptions | List of finite-volume options | dict | no | -
147 tolerance | Outer-loop initial-residual tolerance | scalar | no | 1
148 \endtable
149
150 The inherited entries are elaborated in:
151 - \link functionObject.H \endlink
152 - \link fvOption.H \endlink
153
154 Fields written out when the \c writeDerivedFields entry is \c true:
155 \table
156 Operand | Type | Location
157 Current density | volVectorField | <time>/electricPotential:J
158 Charge density | volScalarField | <time>/electricPotential:rho
159 \endtable
160
161Note
162 - Only constraint-type finite-volume options can be used.
163
164SourceFiles
165 electricPotential.C
166
167\*---------------------------------------------------------------------------*/
168
169#ifndef Foam_functionObjects_electricPotential_H
170#define Foam_functionObjects_electricPotential_H
171
172#include "fvMeshFunctionObject.H"
173#include "volFields.H"
174#include "fvOptionList.H"
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178namespace Foam
179{
180namespace functionObjects
181{
182
183/*---------------------------------------------------------------------------*\
184 Class electricPotential Declaration
185\*---------------------------------------------------------------------------*/
186
188:
190{
191 // Private Data
192
193 //- Dictionary of phase data
194 dictionary phasesDict_;
195
196 //- List of phase names
197 wordList phaseNames_;
198
199 //- Unallocated list of phase fields
200 UPtrList<volScalarField> phases_;
201
202 //- List of isotropic electrical conductivity of phases
203 PtrList<dimensionedScalar> sigmas_;
204
205 //- Isotropic electrical conductivity of a single phase
206 dimensionedScalar sigma_;
207
208 //- List of isotropic relative permittivity of phases
209 PtrList<dimensionedScalar> epsilonrs_;
210
211 //- Isotropic relative permittivity of a single phase
212 dimensionedScalar epsilonr_;
213
214 //- Name of electric potential field
215 word Vname_;
216
217 //- Name of electric field
218 word Ename_;
219
220 //- Run-time selectable finite volume options
221 fv::optionList fvOptions_;
222
223 //- Outer-loop initial-residual tolerance
224 scalar tol_;
225
226 //- Number of corrector iterations
227 int nCorr_;
228
229 //- Flag to write derived fields of
230 //- electric field, current density and free-charge density
231 bool writeDerivedFields_;
232
233 //- Flag to calculate electric field
234 bool electricField_;
235
236
237 // Private Member Functions
238
239 //- Return requested field from the object registry
240 //- or read+register the field to the object registry
241 volScalarField& getOrReadField(const word& fieldName) const;
242
243
244 //- Return the isotropic electrical conductivity field of the mixture
245 tmp<volScalarField> sigma() const;
246
247 //- Return the isotropic permittivity field of the mixture
248 tmp<volScalarField> epsilonm() const;
249
250
251 //- No copy construct
252 electricPotential(const electricPotential&) = delete;
253
254 //- No copy assignment
255 void operator=(const electricPotential&) = delete;
256
257
258public:
259
260 //- Runtime type information
261 TypeName("electricPotential");
262
263
264 // Constructors
265
266 //- Construct from name, Time and dictionary
267 electricPotential
268 (
269 const word& name,
270 const Time& runTime,
271 const dictionary& dict
272 );
273
274
275 //- Destructor
276 virtual ~electricPotential() = default;
277
278
279 // Member Functions
280
281 //- Read the function-object dictionary
282 virtual bool read(const dictionary& dict);
283
284 //- Execute the function-object operations
285 virtual bool execute();
286
287 //- Write the function-object results
288 virtual bool write();
289};
290
291
292// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
293
294} // End namespace functionObjects
295} // End namespace Foam
296
297// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299#endif
300
301// ************************************************************************* //
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Computes the steady-state equation of charge conservation to obtain the electric potential by strictl...
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
virtual ~electricPotential()=default
Destructor.
TypeName("electricPotential")
Runtime type information.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
List of finite volume options.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
GeometricField< scalar, fvPatchField, volMesh > volScalarField
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68