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 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 electricPotential1
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 <label>;
122 writeDerivedFields <bool>;
123 fieldName <word>;
124
125 // Inherited entries
126 ...
127 }
128 \endverbatim
129
130 where the entries mean:
131 \table
132 Property | Description | Type | Reqd | Deflt
133 type | Type name: electricPotential | word | yes | -
134 libs | Library name: solverFunctionObjects | word | yes | -
135 sigma | Isotropic electrical conductivity of phase | scalar | yes | -
136 epsilonr | Isotropic relative permittivity of phase | scalar | no | -
137 nCorr | Number of corrector iterations | label | no | 1
138 writeDerivedFields | Flag to write extra fields | bool | no | false
139 fieldName | Name of operand field | word | no | electricPotential:V
140 \endtable
141
142 The inherited entries are elaborated in:
143 - \link functionObject.H \endlink
144
145 Fields written out when the \c writeDerivedFields entry is \c true:
146 \table
147 Operand | Type | Location
148 Electric field | volVectorField | <time>/electricPotential:E
149 Current density | volVectorField | <time>/electricPotential:J
150 Charge density | volScalarField | <time>/electricPotential:rho
151 \endtable
152
153SourceFiles
154 electricPotential.C
155
156\*---------------------------------------------------------------------------*/
157
158#ifndef functionObjects_electricPotential_H
159#define functionObjects_electricPotential_H
160
161#include "fvMeshFunctionObject.H"
162#include "volFields.H"
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166namespace Foam
167{
168namespace functionObjects
169{
170
171/*---------------------------------------------------------------------------*\
172 Class electricPotential Declaration
173\*---------------------------------------------------------------------------*/
174
175class electricPotential
176:
177 public fvMeshFunctionObject
178{
179 // Private Data
180
181 //- Dictionary of phase data
182 dictionary phasesDict_;
183
184 //- List of phase names
185 wordList phaseNames_;
186
187 //- Unallocated list of phase fields
188 UPtrList<volScalarField> phases_;
189
190 //- List of isotropic electrical conductivity of phases
191 PtrList<dimensionedScalar> sigmas_;
192
193 //- Isotropic electrical conductivity of a single phase
194 dimensionedScalar sigma_;
195
196 //- List of isotropic relative permittivity of phases
197 PtrList<dimensionedScalar> epsilonrs_;
198
199 //- Isotropic relative permittivity of a single phase
200 dimensionedScalar epsilonr_;
201
202 //- Name of the operand field
203 word fieldName_;
204
205 //- Number of corrector iterations
206 label nCorr_;
207
208 //- Flag to write derived fields of
209 //- electric field, current density and free-charge density
210 bool writeDerivedFields_;
211
212
213 // Private Member Functions
214
215 //- Return reference to the registered operand field
216 volScalarField& operandField();
217
218 //- Return the isotropic electrical conductivity field of the mixture
219 tmp<volScalarField> sigma() const;
220
221 //- Return the isotropic permittivity field of the mixture
222 tmp<volScalarField> epsilonm() const;
223
224
225 //- No copy construct
226 electricPotential(const electricPotential&) = delete;
227
228 //- No copy assignment
229 void operator=(const electricPotential&) = delete;
230
231
232public:
233
234 //- Runtime type information
235 TypeName("electricPotential");
236
237
238 // Constructors
239
240 //- Construct from Time and dictionary
241 electricPotential
242 (
243 const word& name,
244 const Time& runTime,
245 const dictionary& dict
246 );
247
248
249 //- Destructor
250 virtual ~electricPotential() = default;
251
252
253 // Member Functions
254
255 //- Read the function object data
256 virtual bool read(const dictionary& dict);
257
258 //- Calculate the function object
259 virtual bool execute();
260
261 //- Write the function object output
262 virtual bool write();
263};
264
265
266// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267
268} // End namespace functionObjects
269} // End namespace Foam
271// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272
273#endif
274
275// ************************************************************************* //
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:71
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
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 data.
virtual ~electricPotential()=default
Destructor.
TypeName("electricPotential")
Runtime type information.
virtual bool execute()
Calculate the function object.
virtual bool write()
Write the function object output.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
List< word > wordList
A List of words.
Definition: fileName.H:63
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73