jouleHeatingSource.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) 2019-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::fa::jouleHeatingSource
28
29Group
30 grpFaOptionsSources
31
32Description
33 Evolves an electrical potential equation
34
35 \f[
36 \grad \left( \sigma \grad V \right)
37 \f]
38
39 where \f$ V \f$ is electrical potential
40 and \f$\sigma\f$ is the electrical current.
41
42 To provide a Joule heating contribution according to:
43
44 Differential form of Joule heating - power per unit volume:
45
46 \f[
47 \frac{d(P)}{d(V)} = J \cdot E
48 \f]
49
50 where \f$ J \f$ is the current density and \f$ E \f$ the electric field.
51 If no magnetic field is present:
52
53 \f[
54 J = \sigma E
55 \f]
56
57 The electric field given by
58
59 \f[
60 E = \grad V
61 \f]
62
63 Therefore:
64
65 \f[
66 \frac{d(P)}{d(V)} = J \cdot E
67 = (sigma E) \cdot E
68 = (sigma \grad V) \cdot \grad V
69 \f]
70
71Usage
72 Minimal example by using \c constant/faOptions:
73 \verbatim
74 jouleHeatingSource1
75 {
76 // Mandatory entries (unmodifiable)
77 type jouleHeatingSource;
78
79 // Mandatory entries (runtime modifiable)
80 anisotropicElectricalConductivity true;
81
82 // Optional entries (runtime modifiable)
83 T <Tname>;
84 nIter -1;
85
86 // Conditional mandatory entries (runtime modifiable)
87
88 // when the entry "sigma" is present
89 sigma <Function1>;
90
91 // when when the entry "sigma" is not present
92 // read "sigma" from file
93
94 // Mandatory/Optional (inherited) entries
95 ...
96 }
97 \endverbatim
98
99 where the entries mean:
100 \table
101 Property | Description | Type | Reqd | Dflt
102 type | Type name: jouleHeatingSource | word | yes | -
103 anisotropicElectricalConductivity | Flag to indicate that <!--
104 --> if the electrical conductivity is anisotropic <!--
105 --> | bool | yes | -
106 T | Name of operand temperature field | word | no | T
107 sigma | Electrical conductivity as a function of temperature <!--
108 --> | table | no | -
109 nIter | Number of iterations for electrical potential equation <!--
110 --> solution | label | no | -1
111 \endtable
112
113 The inherited entries are elaborated in:
114 - \link faOption.H \endlink
115 - \link faceSetOption.H \endlink
116
117Note
118 - \c anisotropicElectricalConductivity=true enables
119 anisotropic (tensorial) electrical conductivity.
120 - \c anisotropicElectricalConductivity=false enables
121 isotropic (scalar) electrical conductivity.
122 - The electrical conductivity can be specified using either:
123 - If the \c sigma entry is present the electrical conductivity is specified
124 as a function of temperature using a \c Function1 type.
125 - If not present the \c sigma field will be read from file.
126 - If the \c anisotropicElectricalConductivity flag is set to \c true,
127 \c sigma should be specified as a tensor quantity.
128
129See also
130 - Foam::Function1
131
132SourceFiles
133 jouleHeatingSource.C
134 jouleHeatingSourceTemplates.C
135
136\*---------------------------------------------------------------------------*/
137
138#ifndef fa_jouleHeatingSource_H
139#define fa_jouleHeatingSource_H
140
141#include "faOption.H"
142#include "Function1.H"
143#include "areaFields.H"
144#include "faceSetOption.H"
145
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148namespace Foam
149{
150namespace fa
151{
152
153/*---------------------------------------------------------------------------*\
154 Class jouleHeatingSource Declaration
155\*---------------------------------------------------------------------------*/
156
157class jouleHeatingSource
158:
159 public fa::faceSetOption
160{
161 // Private Data
162
163 //- Name of temperature field
164 word TName_;
165
166 //- Electrical potential field / [V]
168
169 //- Electrical conductivity as a scalar function of temperature
170 autoPtr<Function1<scalar>> scalarSigmaVsTPtr_;
171
172 //- Electrical conductivity as a tensor function of temperature
173 autoPtr<Function1<tensor>> tensorSigmaVsTPtr_;
174
175 //- Current time index (used for updating)
176 label curTimeIndex_;
177
178 //- Number of iterations for electrical potential equation solution
179 label nIter_;
180
181 //- Flag to indicate that the electrical conductivity is anisotropic
182 bool anisotropicElectricalConductivity_;
183
184
185 // Private Member Functions
186
187 //- Initialise the electrical conductivity field
188 template<class Type>
189 void initialiseSigma
190 (
191 const dictionary& dict,
192 autoPtr<Function1<Type>>& sigmaVsTPtr
193 );
194
195 //- Update the electrical conductivity field
196 template<class Type>
197 const GeometricField<Type, faPatchField, areaMesh>&
198 updateSigma(const autoPtr<Function1<Type>>& sigmaVsTPtr) const;
199
201public:
202
203 //- Runtime type information
204 TypeName("jouleHeatingSource");
205
206
207 // Constructors
208
209 //- Construct from explicit source name and mesh
211 (
212 const word& sourceName,
213 const word& modelType,
214 const dictionary& dict,
215 const fvPatch& patch
216 );
217
218 //- No copy construct
219 jouleHeatingSource(const jouleHeatingSource&) = delete;
220
221 //- No copy assignment
222 void operator=(const jouleHeatingSource&) = delete;
223
224
225 //- Destructor
226 virtual ~jouleHeatingSource() = default;
227
228
229 // Member Functions
230
231 // Evaluation
232
233 //- Add explicit contribution to compressible momentum equation
234 virtual void addSup
235 (
236 const areaScalarField& h,
237 const areaScalarField& rho,
238 faMatrix<scalar>& eqn,
239 const label fieldi
240 );
241
242
243 // IO
244
245 //- Read source dictionary
246 virtual bool read(const dictionary& dict);
248
249
250// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251
252} // End namespace fa
253} // End namespace Foam
254
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256
257#ifdef NoRepository
258 #include "jouleHeatingSourceTemplates.C"
259#endif
260
261// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263#endif
264
265// ************************************************************************* //
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:96
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition: faMatrix.H:76
Intermediate abstract class for handling face-set options for the derived faOptions.
Evolves an electrical potential equation.
jouleHeatingSource(const jouleHeatingSource &)=delete
No copy construct.
void operator=(const jouleHeatingSource &)=delete
No copy assignment.
virtual ~jouleHeatingSource()=default
Destructor.
virtual void addSup(const areaScalarField &h, const areaScalarField &rho, faMatrix< scalar > &eqn, const label fieldi)
Add explicit contribution to compressible momentum equation.
virtual bool read(const dictionary &dict)
Read source dictionary.
TypeName("jouleHeatingSource")
Runtime type information.
const fvPatch & patch() const noexcept
Return const access to fvPatch.
Definition: faOptionI.H:42
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
Definition: areaFieldsFwd.H:78
dictionary dict
volScalarField & h
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73