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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::functionObjects::energyTransport
28 
29 Group
30  grpSolversFunctionObjects
31 
32 Description
33  Evolves a simplified energy transport equation for incompressible flows.
34  It takes into account the inertia, conduction and convection terms plus
35  a source.
36 
37  - The field name must be temperature and its BC's specified in the time
38  directory.
39  - The turbulence model should be incompressible
40  - In order to use in a incompressible multi phase a list of thermal
41  properties are needed. See below
42 
43 
44 Usage
45  Example of function object specification to solve a energy transport
46  equation for a single phase flow plus a source term
47  \verbatim
48  functions
49  {
50  energy
51  {
52  type energyTransport;
53  libs (energyTransportFunctionObjects);
54 
55  enabled true;
56  writeControl outputTime;
57  writeInterval 1;
58 
59  field T;
60 
61  // volumetric Flux
62  phi phi;
63 
64  // Thermal properties
65  Cp Cp [J/kg/K] 1e3;
66  kappa kappa [W/m/K] 0.0257;
67  rhoInf rho [kg/m^3] 1.2;
68 
69  write true;
70 
71  fvOptions
72  {
73  viscousDissipation
74  {
75  type viscousDissipation;
76  enabled true;
77 
78  viscousDissipationCoeffs
79  {
80  fields (T);
81  rhoInf $....rhoInf;
82  }
83  }
84  }
85  }
86  }
87  \endverbatim
88 
89  Example of function object specification to solve a energy transport
90  equation for a multiphase phase flow plus a source term
91 
92  equation:
93  \verbatim
94  functions
95  {
96  energy
97  {
98  type energyTransport;
99  libs (energyTransportFunctionObjects);
100 
101  enabled true;
102  writeControl outputTime;
103  writeInterval 1;
104 
105  field T;
106 
107  // rho field name
108  rho rho;
109  // mass flux for multiphase
110  phi rhoPhi;
111 
112  write true;
113 
114  // Thermal properties of the phases
115  phaseThermos
116  {
117  alpha.air
118  {
119  Cp 1e3;
120  kappa 0.0243;
121  }
122  alpha.mercury
123  {
124  Cp 140;
125  kappa 8.2;
126  }
127  alpha.oil
128  {
129  Cp 2e3;
130  kappa 0.2;
131  }
132  alpha.water
133  {
134  Cp 4e3;
135  kappa 0.6;
136  }
137  }
138 
139 
140  fvOptions
141  {
142  viscousDissipation
143  {
144  type viscousDissipation;
145  enabled true;
146 
147  viscousDissipationCoeffs
148  {
149  fields (T);
150  rho rho; //rho Field
151  }
152  }
153  }
154  }
155  }
156  \endverbatim
157 
158  Where the entries comprise:
159  \table
160  Property | Description | Required | Default value
161  type | Type name: energyTransport | yes |
162  field | Name of the scalar field | no | T
163  phi | Name of flux field | no | phi
164  rho | Name of density field | no | rho
165  nCorr | Number of correctors | no | 0
166  schemesField | Name of field to specify schemes | no | field name
167  fvOptions | List of scalar sources | no |
168  Cp | Heat capacity for single phase | no | 0
169  rhoInf | Density for single phase | no | 0
170  kappa | Thermal conductivity for single phase | no | 0
171  Prt | Turbulent Prandlt number | no | 1.0
172  phaseThermos | Dictionary for multi-phase thermo |no | null
173  fvOptions | Opotional extra sources | no | null
174  \endtable
175 
176 See also
177  Foam::functionObjects::fvMeshFunctionObject
178 
179 SourceFiles
180  energyTransport.C
181 
182 \*---------------------------------------------------------------------------*/
183 
184 #ifndef functionObjects_energyTransport_H
185 #define functionObjects_energyTransport_H
186 
187 #include "fvMeshFunctionObject.H"
188 #include "volFields.H"
189 #include "fvOptionList.H"
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 namespace Foam
194 {
195 namespace functionObjects
196 {
197 
198 /*---------------------------------------------------------------------------*\
199  Class energyTransport Declaration
200 \*---------------------------------------------------------------------------*/
201 
202 class energyTransport
203 :
204  public fvMeshFunctionObject
205 {
206  // Private data
207 
208  //- Name of the transport field.
209  word fieldName_;
210 
211  //- Name of flux field
212  word phiName_;
213 
214  //- Name of density field
215  word rhoName_;
216 
217  //- Number of corrector iterations (optional)
218  label nCorr_;
219 
220  //- Name of field whose schemes are used (optional)
221  word schemesField_;
222 
223  //- Run-time selectable finite volume options, e.g. sources, constraints
224  fv::optionList fvOptions_;
225 
226  //- Dictionary for multiphase thermos
227  dictionary multiphaseThermo_;
228 
229  //- List of phase names
230  wordList phaseNames_;
231 
232  //- List of phase heat capacities
233  PtrList<dimensionedScalar> Cps_;
234 
235  //- List of phase thermal diffusivity for temperature [J/m/s/K]
236  PtrList<dimensionedScalar> kappas_;
237 
238  //- Unallocated phase list
239  UPtrList<volScalarField> phases_;
240 
241  //- Heat capacity for single phase flows
242  dimensionedScalar Cp_;
243 
244  //- Thermal diffusivity for temperature for single phase flows
245  dimensionedScalar kappa_;
246 
247  //- Density for single phase flows
248  dimensionedScalar rho_;
249 
250  //- Turbulent Prandt number
251  dimensionedScalar Prt_;
252 
253  //- rhoCp
254  volScalarField rhoCp_;
255 
256 
257  // Private Member Functions
258 
259  //- Return reference to registered transported field
260  volScalarField& transportedField();
261 
262  //- Return the diffusivity field
263  tmp<volScalarField> kappaEff() const;
264 
265  //- Return rho field
266  tmp<volScalarField> rho() const;
267 
268  //- Return Cp
269  tmp<volScalarField> Cp() const;
270 
271  //- Return kappa
272  tmp<volScalarField> kappa() const;
273 
274  //- No copy construct
275  energyTransport(const energyTransport&) = delete;
276 
277  //- No copy assignment
278  void operator=(const energyTransport&) = delete;
279 
280 
281 public:
282 
283  //- Runtime type information
284  TypeName("energyTransport");
285 
286 
287  // Constructors
288 
289  //- Construct from Time and dictionary
291  (
292  const word& name,
293  const Time& runTime,
294  const dictionary& dict
295  );
296 
297 
298  //- Destructor
299  virtual ~energyTransport();
300 
301 
302  // Member Functions
303 
304  //- Read the energyTransport data
305  virtual bool read(const dictionary&);
306 
307  //- Calculate the energyTransport
308  virtual bool execute();
309 
310  //- Do nothing.
311  // The volScalarField is registered and written automatically
312  virtual bool write();
313 };
314 
315 
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 
318 } // End namespace functionObjects
319 } // End namespace Foam
320 
321 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
322 
323 #endif
324 
325 // ************************************************************************* //
volFields.H
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
fvMeshFunctionObject.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::functionObjects::energyTransport::read
virtual bool read(const dictionary &)
Read the energyTransport data.
Definition: energyTransport.C:332
Foam::functionObjects::energyTransport::execute
virtual bool execute()
Calculate the energyTransport.
Definition: energyTransport.C:352
Foam::functionObjects::energyTransport::write
virtual bool write()
Do nothing.
Definition: energyTransport.C:453
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::functionObjects::energyTransport::TypeName
TypeName("energyTransport")
Runtime type information.
fvOptionList.H
Foam::UPtrList
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:62
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::energyTransport
Evolves a simplified energy transport equation for incompressible flows. It takes into account the in...
Definition: energyTransport.H:271
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::List< word >
Foam::functionObjects::energyTransport::~energyTransport
virtual ~energyTransport()
Destructor.
Definition: energyTransport.C:326
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::optionList
List of finite volume options.
Definition: fvOptionList.H:69