Loading...
Searching...
No Matches
wallHeatFlux_gauge.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) 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::wallHeatFluxModels::gauge
28
29Description
30 This model computes the wall-heat flux at a selected patch using
31 imaginary heat-flux gauges.
32
33 Heat-flux gauges are measurement tools that are placed on walls. The
34 temperature of the gauges is usually different from that of the surrounding
35 wall - an order of magnitude lower. The model allows the user to
36 specify the gauge temperature and other gauge properties such as
37 absorptivity or emissivity without creating separate patches.
38 The model calculates the net convective and radiative heat fluxes at the
39 gauge locations, combines them, and writes the results to the output files.
40
41Usage
42 Minimal example by using \c system/controlDict.functions:
43 \verbatim
44 wallHeatFlux1
45 {
46 // Mandatory entries
47 type wallHeatFlux;
48 libs (fieldFunctionObjects);
49
50 model gauge;
51
52 Tgauge <scalar>;
53 patch <word>;
54
55 // Optional entries
56 absorptivity <scalar>;
57 emissivity <scalar>;
58 T <word>;
59 qin <word>;
60 alphat <word>;
61 convective <bool>;
62 radiative <bool>;
63 writeFields <bool>;
64
65 // Inherited entries
66 ...
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Reqd | Deflt
73 type | Type name: wallHeatFlux | word | yes | -
74 libs | Library name: fieldFunctionObjects | word | yes | -
75 model | Model name: gauge | word | no | wall
76 Tgauge | Gauge temperature (K) | scalar | yes | -
77 patch | Name of the patch to probe | word | yes | -
78 absorptivity | Absorptivity of the gauge | scalar | no | 1
79 emissivity | Emissivity of the gauge | scalar | no | 1
80 T | Name of the temperature field | word | no | T
81 qin | Name of the incident radiative heat flux field | word | no | qin
82 alphat | Name of turbulent thermal diffusivity field | word | no | alphat
83 convective | Calculate convective heat flux | bool | no | false
84 radiative | Calculate radiative heat flux | bool | no | false
85 writeFields | Write the fields to file | bool | no | false
86 \endtable
87
88 The inherited entries are elaborated in:
89 - \link fvMeshFunctionObject.H \endlink
90 - \link writeFile.H \endlink
91 - \link probeModel.H \endlink
92 - \link patchFieldProbe.H \endlink
93
94SourceFiles
95 wallHeatFlux_gauge.cxx
96
97\*---------------------------------------------------------------------------*/
98
99#ifndef wallHeatFluxModels_gauge_H
100#define wallHeatFluxModels_gauge_H
101
102#include "wallHeatFluxModel.H"
103#include "writeFile.H"
104#include "patchFieldProbe.H"
105#include "wallDist.H"
107#include "scalarIOField.H"
108
109// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110
111namespace Foam
112{
113namespace wallHeatFluxModels
114{
115
116/*---------------------------------------------------------------------------*\
117 Class gauge Declaration
118\*---------------------------------------------------------------------------*/
119
120class gauge
121:
122 public wallHeatFluxModel,
123 public patchFieldProbe
124{
125 // Private Data
126
127 //- Const reference to the thermo database
128 const fluidThermo& thermo_;
129
130 //- Net convective gauge heat flux at patch-probe locations
131 std::unique_ptr<scalarIOField> qConvPtr_;
132
133 //- Net radiative gauge heat flux at patch-probe locations
134 std::unique_ptr<scalarIOField> qRadPtr_;
135
136 //- Flag to output the net convective heat flux data
137 autoPtr<OFstream> convectiveFilePtr_;
138
139 //- Flag to output the net radiative heat flux data
140 autoPtr<OFstream> radiativeFilePtr_;
141
142 //- Indices of the patch cells that will be probed
143 labelField cells_;
144
145 //- Identifier of the faces that are actively sampled
146 boolList activeFaces_;
147
148 //- Name of the incident radiative heat-flux field
149 word qinName_;
150
151 //- Name of the temperature field
152 word Tname_;
153
154 //- Name of the turbulent thermal diffusivity field
155 word alphatName_;
156
157 //- Common and constant temperature of the gauges
158 scalar Tgauge_;
159
160 //- Radiant exitance
161 scalar Me_;
162
163 //- Absorptivity of the gauge surfaces
164 scalar a_;
165
166 //- Emissivity of the gauge surfaces
167 scalar e_;
168
169 //- Index of the operand patch
170 label patchID_;
171
172 //- Number of specified patch probes
173 label szProbes_;
174
175 //- Flag to output the net convective/radiative heat flux fields
176 bool writeFields_;
177
178
179 // Private Member Functions
180
181 //- Return the radiant-exitance term of the radiative heat flux
182 scalar calcRadiantExitance() const;
183
184 //- Return the indices of the cells that contain the probed patch faces
185 tmp<labelField> identifyProbeCells() const;
186
187 //- Write the file-header information
188 bool writeFileHeader(Ostream& os);
189
190 //- Calculate the net convective heat flux
191 bool calcConvectiveHeatFlux();
193 //- Return the dT/dn term of the convective heat flux
194 tmp<scalarField> calcdTdn() const;
195
196 //- Calculate the net radiative heat flux
197 bool calcRadiativeHeatFlux();
198
200public:
201
202 //- Runtime type information
203 TypeName("gauge");
204
205
206 // Constructors
207
208 //- Construct from components
209 gauge
210 (
211 const dictionary& dict,
212 const fvMesh& mesh,
213 const word& name,
214 const word objName,
216 );
217
218
219 //- Destructor
220 virtual ~gauge() = default;
221
222
223 // Member Functions
224
225 // Evaluation
226
227 //- Read the settings
228 virtual bool read(const dictionary& dict);
229
230 //- Calculate the heat-flux data
231 virtual bool execute();
232
233 //- Write the heat-flux data
234 virtual bool write();
235};
236
237
238// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239
240} // End namespace wallHeatFluxModels
241} // End namespace Foam
242
243// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244
245#endif
246
247// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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
Fundamental fluid thermodynamic properties.
Definition fluidThermo.H:52
Base class for function objects, adding functionality to read/write state information (data required ...
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
patchFieldProbe(const fvMesh &mesh, const dictionary &dict)
Construct from Time and dictionary.
A class for managing temporary objects.
Definition tmp.H:75
const fvMesh & mesh() const noexcept
Return const reference to the mesh.
const word & objName() const noexcept
Return const reference to the function-object name.
functionObjects::stateFunctionObject & state() const noexcept
Return const reference to the state function object.
wallHeatFluxModel(const wallHeatFluxModel &)=delete
No copy construct.
This model computes the wall-heat flux at a selected patch using imaginary heat-flux gauges.
virtual bool read(const dictionary &dict)
Read the settings.
gauge(const dictionary &dict, const fvMesh &mesh, const word &name, const word objName, functionObjects::stateFunctionObject &state)
Construct from components.
virtual ~gauge()=default
Destructor.
virtual bool execute()
Calculate the heat-flux data.
virtual bool write()
Write the heat-flux data.
TypeName("gauge")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
A namespace for various heat-flux model implementations.
Namespace for OpenFOAM.
Field< label > labelField
Specialisation of Field<T> for label.
Definition labelField.H:48
List< bool > boolList
A List of bools.
Definition List.H:60
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68