Loading...
Searching...
No Matches
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-2025 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 If the \c sigma entry is present, the electrical conductivity is specified
119 as a function of temperature using a \c Function1 type, otherwise
120 the \c sigma field will be read from file.
121 When the \c anisotropicElectricalConductivity flag is set to \c true,
122 \c sigma should be specified as a \em tensor quantity instead of as
123 an isotropic \em scalar quantity.
124
125 BREAKING Naming changes from 2056 and earlier for the fields:
126 \table
127 Field | Scoped names | Scoped names (old)
128 V | <scope>:V (suffix) | <scope>:V_ + regionName
129 sigma | <scope>:sigma (suffix) | <scope>:sigma_ + regionName
130 \endtable
131
132 It is possible to replicate the older naming by specifying
133 the \c suffixing to ('_' + regionName).
134
135See also
136 - Foam::Function1
137 - Foam::fv::jouleHeatingSource
138
139SourceFiles
140 jouleHeatingSource.cxx
141 jouleHeatingSourceImpl.cxx
142
143\*---------------------------------------------------------------------------*/
144
145#ifndef Foam_fa_jouleHeatingSource_H
146#define Foam_fa_jouleHeatingSource_H
147
148#include "areaFields.H"
149#include "Function1.H"
150#include "faceSetOption.H"
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154namespace Foam
155{
156namespace fa
157{
158
159/*---------------------------------------------------------------------------*\
160 Class jouleHeatingSource Declaration
161\*---------------------------------------------------------------------------*/
162
164:
165 public fa::faceSetOption
166{
167 // Private Data
168
169 //- Name of temperature field
170 word TName_;
171
172 //- Electrical potential field / [V]
174
175 //- Electrical conductivity as a scalar function of temperature
176 autoPtr<Function1<scalar>> scalarSigmaVsTPtr_;
177
178 //- Electrical conductivity as a tensor function of temperature
179 autoPtr<Function1<tensor>> tensorSigmaVsTPtr_;
180
181 //- Current time index (used for updating)
182 label curTimeIndex_;
183
184 //- Number of iterations for electrical potential equation solution
185 label nIter_;
186
187 //- Flag to indicate that the electrical conductivity is anisotropic
188 bool anisotropicElectricalConductivity_;
189
190
191 // Private Member Functions
192
193 //- Initialise the electrical conductivity field
194 template<class Type>
195 void initialiseSigma
196 (
197 const dictionary& dict,
198 autoPtr<Function1<Type>>& sigmaFunctionPtr
199 );
200
201 //- Update the electrical conductivity field
202 template<class Type>
203 const GeometricField<Type, faPatchField, areaMesh>&
204 updateSigma(const autoPtr<Function1<Type>>& sigmaFunctionPtr) const;
205
206
207public:
208
209 //- Runtime type information
210 TypeName("jouleHeatingSource");
211
212
213 // Constructors
215 //- Construct from explicit source name and mesh
217 (
218 const word& sourceName,
219 const word& modelType,
220 const dictionary& dict,
221 const fvMesh& mesh,
223 const word& defaultAreaName = word()
224 );
225
226 //- No copy construct
227 jouleHeatingSource(const jouleHeatingSource&) = delete;
228
229 //- No copy assignment
230 void operator=(const jouleHeatingSource&) = delete;
231
232
233 //- Destructor
234 virtual ~jouleHeatingSource() = default;
235
236
237 // Member Functions
238
239 // Evaluation
240
241 //- Add explicit contribution to energy equation
242 virtual void addSup
243 (
244 const areaScalarField& h,
245 const areaScalarField& rho,
246 faMatrix<scalar>& eqn,
247 const label fieldi
248 );
249
250
251 // IO
252
253 //- Read source dictionary
254 virtual bool read(const dictionary& dict);
255};
256
257
258// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259
260} // End namespace fa
261} // End namespace Foam
262
263// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264
265#endif
266
267// ************************************************************************* //
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition Function1.H:92
Generic GeometricField class.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition faMatrix.H:108
Intermediate abstract class for handling face-set options for the derived faOptions.
Evolves an electrical potential equation.
virtual bool read(const dictionary &dict)
Read source dictionary.
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 energy equation.
TypeName("jouleHeatingSource")
Runtime type information.
jouleHeatingSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh, const word &defaultAreaName=word())
Construct from explicit source name and mesh.
const fvMesh & mesh() const noexcept
Return const access to the volume mesh.
Definition faOption.H:385
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for finite-area.
Definition limitHeight.C:30
Namespace for OpenFOAM.
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
dictionary dict
volScalarField & h
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68