energyFlux.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::energyFlux
26 
27 Description
28  These functions calculate the energy-flux and write it as a
29  surfaceScalarField. There are three such functions; energyAdvectiveFlux and
30  heatFlux return the advective and diffusive parts of the energy flux,
31  respectively, and energyFlux returns the total combined flux.
32 
33  Example of function object specification:
34  \verbatim
35  energyFlux
36  {
37  type energyFlux; // energyAdvectiveFlux, heatFlux
38  libs ("libfieldFunctionObjects.so");
39  }
40  \endverbatim
41 
42  Or, using the standard configuration:
43  \verbatim
44  #includeFunc energyFlux
45  \endverbatim
46 
47 Usage
48  \table
49  Property | Description | Required | Default value
50  type | Type name: energyFlux, \\
51  energyAdvectiveFlux, or \\
52  heatFlux | yes |
53  phase | Name of the phase | no |
54  region | Region to be evaluated | no | default region
55  \endtable
56 
57 SourceFiles
58  energyFlux.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef energyFlux_functionObject_H
63 #define energyFlux_functionObject_H
64 
65 #include "fieldExpression.H"
66 #include "surfaceFieldsFwd.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 class thermophysicalTransportModel;
74 
75 namespace functionObjects
76 {
77 
78 /*---------------------------------------------------------------------------*\
79  Class energyFluxBase Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 class energyFluxBase
83 :
84  public fieldExpression
85 {
86  // Protected Data
87 
88  //- Name of field from which schemes are taken
89  const word schemesField_;
90 
91  //- The name of the phase
92  word phaseName_;
93 
94 
95  // Private Member Functions
96 
97  //- Calculate the specie flux field
98  virtual bool calc();
99 
100  //- Calculate the specie flux field
101  virtual tmp<surfaceScalarField> calc
102  (
104  ) const = 0;
105 
106 
107 protected:
108 
109  // Protected Member Functions
110 
111  //- Return the advective energy flux
113  (
115  ) const;
116 
117  //- Return the heat flux
119  (
121  ) const;
122 
123 
124 public:
125 
126  // Constructors
127 
128  //- Construct from Time and dictionary
130  (
131  const word& name,
132  const Time& runTime,
133  const dictionary&,
134  const word& typeName
135  );
136 
137 
138  //- Destructor
139  virtual ~energyFluxBase();
140 
141 
142  // Member Functions
143 
144  //- Read the data
145  virtual bool read(const dictionary&);
146 };
147 
148 
149 /*---------------------------------------------------------------------------*\
150  Class energyFlux Declaration
151 \*---------------------------------------------------------------------------*/
152 
153 class energyFlux
154 :
155  public energyFluxBase
156 {
157 private:
158 
159  // Private Member Functions
160 
161  //- Calculate the energy flux field
162  virtual tmp<surfaceScalarField> calc
163  (
165  ) const;
166 
167 
168 public:
169 
170  //- Runtime type information
171  TypeName("energyFlux");
172 
173 
174  // Constructors
175 
176  //- Construct from Time and dictionary
177  energyFlux
178  (
179  const word& name,
180  const Time& runTime,
181  const dictionary& dict
182  );
183 };
184 
185 
186 /*---------------------------------------------------------------------------*\
187  Class energyAdvectiveFlux Declaration
188 \*---------------------------------------------------------------------------*/
189 
191 :
192  public energyFluxBase
193 {
194 private:
195 
196  // Private Member Functions
197 
198  //- Calculate the energy flux field
199  virtual tmp<surfaceScalarField> calc
200  (
202  ) const;
203 
204 
205 public:
206 
207  //- Runtime type information
208  TypeName("energyAdvectiveFlux");
209 
210 
211  // Constructors
212 
213  //- Construct from Time and dictionary
215  (
216  const word& name,
217  const Time& runTime,
218  const dictionary& dict
219  );
220 };
221 
222 
223 /*---------------------------------------------------------------------------*\
224  Class heatFlux Declaration
225 \*---------------------------------------------------------------------------*/
226 
227 class heatFlux
228 :
229  public energyFluxBase
230 {
231 private:
232 
233  // Private Member Functions
234 
235  //- Calculate the heat flux field
236  virtual tmp<surfaceScalarField> calc
237  (
239  ) const;
240 
241 
242 public:
243 
244  //- Runtime type information
245  TypeName("heatFlux");
246 
247 
248  // Constructors
249 
250  //- Construct from Time and dictionary
251  heatFlux
252  (
253  const word& name,
254  const Time& runTime,
255  const dictionary& dict
256  );
257 };
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace functionObjects
263 } // End namespace Foam
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 #endif
268 
269 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const word & name() const
Return the name of this functionObject.
TypeName("energyAdvectiveFlux")
Runtime type information.
energyAdvectiveFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: energyFlux.C:177
virtual ~energyFluxBase()
Destructor.
Definition: energyFlux.C:200
tmp< surfaceScalarField > calcPhihs(const thermophysicalTransportModel &ttm) const
Return the advective energy flux.
Definition: energyFlux.C:108
tmp< surfaceScalarField > calcQ(const thermophysicalTransportModel &ttm) const
Return the heat flux.
Definition: energyFlux.C:139
energyFluxBase(const word &name, const Time &runTime, const dictionary &, const word &typeName)
Construct from Time and dictionary.
Definition: energyFlux.C:150
virtual bool read(const dictionary &)
Read the data.
Definition: energyFlux.C:207
These functions calculate the energy-flux and write it as a surfaceScalarField. There are three such ...
Definition: energyFlux.H:173
energyFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: energyFlux.C:166
TypeName("energyFlux")
Runtime type information.
TypeName("heatFlux")
Runtime type information.
heatFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: energyFlux.C:188
Abstract base class for all fluid and solid thermophysical transport models.
A class for managing temporary objects.
Definition: tmp.H:55
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
dictionary dict