Loading...
Searching...
No Matches
energyTransport.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) 2017-2020 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::energyTransport
28
29Group
30 grpSolversFunctionObjects
31
32Description
33 Computes the simplified energy transport equation in single-phase or
34 two-phase flow, considering incompressible cases:
35
36 \f[
37 \frac{\partial \rho \, C_p \, T}{\partial t}
38 + \nabla \cdot \left(\rho \, C_p \, \phi \, T \right)
39 - \nabla \cdot \left(\rho \, C_p \, \phi \right) \, T
40 - \nabla \cdot \left(\kappa_{eff} \, \nabla T \right)
41 = S_T
42 \f]
43
44 where:
45 \vartable
46 T | Scalar field
47 \rho | (Generic) Fluid density which is unity when not specified
48 C_p | Specific heat capacity at constant pressure
49 \phi | (Generic) Flux field
50 \kappa_{eff} | Effective thermal conductivity
51 S_T | Scalar field source term
52 \endvartable
53
54Usage
55 Minimal example in \c system/controlDict.functions:
56 \verbatim
57 energyTransportFO
58 {
59 // Mandatory entries
60 type energyTransport;
61 libs (solverFunctionObjects);
62
63 // Optional entries
64 field <word>;
65 phi <word>;
66 rho <word>;
67 Cp <scalar>;
68 kappa <scalar>;
69 rhoInf <scalar>;
70 Prt <scalar>;
71 schemesField <word>;
72 tolerance <scalar>;
73 nCorr <int>;
74 fvOptions <dict>;
75 phaseThermos <dict>;
76
77 // Inherited entries
78 ...
79 }
80 \endverbatim
81
82 where:
83 \table
84 Property | Description | Type | Reqd | Deflt
85 type | Type name: energyTransport | word | yes | -
86 libs | Library name: solverFunctionObjects | word | yes | -
87 field | Name of the passive-scalar field | word | no | s
88 phi | Name of flux field | word | no | phi
89 rho | Name of density field | word | no | rho
90 Cp | Specific heat capacity at constant pressure | scalar | no | 0
91 kappa | Thermal conductivity | scalar | no | 0
92 rhoInf | Fluid density | scalar | no | 0
93 Prt | Turbulent Prandtl number | scalar | no | 1
94 schemesField | Name of field to specify schemes | word | no | field
95 tolerance | Outer-loop initial-residual tolerance | scalar | no | 1
96 nCorr | Number of outer-loop correctors | int | no | 0
97 fvOptions | List of finite-volume options | dict | no | -
98 phaseThermos | Dictionary for multi-phase thermo | dict | no | null
99 \endtable
100
101 The inherited entries are elaborated in:
102 - \link functionObject.H \endlink
103 - \link fvOption.H \endlink
104
105 An example of function object specification to solve a energy transport
106 equation for a single phase flow plus a source term:
107 \verbatim
108 energyTransport1
109 {
110 // Mandatory entries
111 type energyTransport;
112 libs (solverFunctionObjects);
113
114 // Optional entries
115 field T;
116 phi phi;
117 Cp Cp [J/kg/K] 1e3;
118 kappa kappa [W/m/K] 0.0257;
119 rhoInf rho [kg/m^3] 1.2;
120 fvOptions
121 {
122 viscousDissipation
123 {
124 type viscousDissipation;
125 enabled true;
126
127 viscousDissipationCoeffs
128 {
129 fields (T);
130 rhoInf $....rhoInf;
131 }
132 }
133 }
134
135 // Inherited entries
136 enabled true;
137 writeControl writeTime;
138 writeInterval 1;
139 }
140 \endverbatim
141
142 An example of function object specification to solve a energy transport
143 equation for a multiphase phase flow plus a source term:
144 \verbatim
145 energyTransport1
146 {
147 // Mandatory entries
148 type energyTransport;
149 libs (solverFunctionObjects);
150
151 // Optional entries
152 field T;
153 rho rho;
154 phi rhoPhi;
155
156 // Thermal properties of the phases
157 phaseThermos
158 {
159 alpha.air
160 {
161 Cp 1e3;
162 kappa 0.0243;
163 }
164 alpha.mercury
165 {
166 Cp 140;
167 kappa 8.2;
168 }
169 alpha.oil
170 {
171 Cp 2e3;
172 kappa 0.2;
173 }
174 alpha.water
175 {
176 Cp 4e3;
177 kappa 0.6;
178 }
179 }
180
181 fvOptions
182 {
183 viscousDissipation
184 {
185 type viscousDissipation;
186 enabled true;
187
188 viscousDissipationCoeffs
189 {
190 fields (T);
191 rho rho;
192 }
193 }
194 }
195
196 // Inherited entries
197 enabled true;
198 writeControl writeTime;
199 writeInterval 1;
200 }
201 \endverbatim
202
203Note
204 - The field name must be temperature and its boundary conditions
205 specified in the time directory.
206 - The turbulence model should be incompressible.
207
208SourceFiles
209 energyTransport.C
210
211\*---------------------------------------------------------------------------*/
212
213#ifndef Foam_functionObjects_energyTransport_H
214#define Foam_functionObjects_energyTransport_H
215
216#include "fvMeshFunctionObject.H"
217#include "volFields.H"
218#include "fvOptionList.H"
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222namespace Foam
223{
224namespace functionObjects
225{
226
227/*---------------------------------------------------------------------------*\
228 Class energyTransport Declaration
229\*---------------------------------------------------------------------------*/
230
231class energyTransport
232:
234{
235 // Private Data
236
237 //- Volumetric heat capacity field [J/m^3/K]
238 volScalarField rhoCp_;
239
240 //- Run-time selectable finite volume options, e.g. sources, constraints
241 fv::optionList fvOptions_;
242
243 //- Dictionary for multiphase thermos
244 dictionary multiphaseThermo_;
245
246 //- List of phase names
247 wordList phaseNames_;
248
249 //- List of phase specific heat capacities at constant pressure
250 PtrList<dimensionedScalar> Cps_;
251
252 //- List of phase thermal diffusivity for temperature [J/m/s/K]
253 PtrList<dimensionedScalar> kappas_;
254
255 //- Unallocated phase list
256 UPtrList<volScalarField> phases_;
257
258 //- Specific heat capacity at constant pressure for single phase flows
260
261 //- Thermal diffusivity for temperature for single phase flows
262 dimensionedScalar kappa_;
263
264 //- Density for single phase flows
266
267 //- Turbulent Prandt number
269
270 //- Name of the transport field
271 word fieldName_;
272
273 //- Name of field whose schemes are used
274 word schemesField_;
275
276 //- Name of flux field
277 word phiName_;
278
279 //- Name of density field
280 word rhoName_;
281
282 //- Outer-loop initial-residual tolerance
283 scalar tol_;
284
285 //- Number of corrector iterations
286 int nCorr_;
287
288
289 // Private Member Functions
290
291 //- Return reference to registered transported field
292 volScalarField& transportedField();
293
294 //- Return the diffusivity field
295 tmp<volScalarField> kappaEff() const;
296
297 //- Return the density field, rho
298 tmp<volScalarField> rho() const;
299
300 //- Return the specific heat capacity at constant pressure field, Cp
301 tmp<volScalarField> Cp() const;
302
303 //- Return the thermal diffusivity field
304 tmp<volScalarField> kappa() const;
305
306
307public:
308
309 //- Runtime type information
310 TypeName("energyTransport");
311
312
313 // Constructors
314
315 //- Construct from name, Time and dictionary
317 (
318 const word& name,
319 const Time& runTime,
320 const dictionary& dict
321 );
322
323
324 //- Destructor
325 virtual ~energyTransport() = default;
326
327
328 // Member Functions
329
330 //- Read the function-object dictionary
331 virtual bool read(const dictionary&);
332
333 //- Execute the function-object operations
334 virtual bool execute();
335
336 //- Write the function object output
337 // The volScalarField is registered and written automatically
338 virtual bool write();
339};
341
342// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
343
344} // End namespace functionObjects
345} // End namespace Foam
346
347// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
348
349#endif
350
351// ************************************************************************* //
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 simplified energy transport equation in single-phase or two-phase flow,...
virtual ~energyTransport()=default
Destructor.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function object output.
energyTransport(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual bool read(const dictionary &)
Read the function-object dictionary.
TypeName("energyTransport")
Runtime type information.
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
const volScalarField & Cp
Definition EEqn.H:7
engineTime & runTime
kappaEff
Definition TEqn.H:10
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