effectivenessHeatExchangerSource.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) 2013-2017 OpenFOAM Foundation
9 Copyright (C) 2016-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::fv::effectivenessHeatExchangerSource
29
30Group
31 grpFvOptionsSources
32
33Description
34 Heat exchanger source model for compressible flows, where the heat
35 exchanger is modelled as an energy source using a selection of cells.
36
37 The total heat exchange source is given by:
38 \f[
39 Q_t = e(\phi, \dot{m}_2) (T_2 - T_1) \phi c_p
40 \f]
41
42 where:
43 \vartable
44 Q_t | Total heat exchange source [J/s]
45 e(\phi,\dot{m}_2) | Effectivenes table [-]
46 \phi | Net mass flux entering heat exchanger [kg/s]
47 \dot{m}_2 | Secondary flow mass flow rate [kg/s]
48 T_1 | Primary flow inlet temperature [K]
49 T_2 | Secondary flow inlet temperature [K]
50 c_p | Primary flow specific heat capacity [J/kg/K]
51 \endvartable
52
53
54 The distribution inside the heat exchanger is given by:
55 \f[
56 Q_c = \frac{V_c |U_c| (T_c - T_{ref})}{\sum(V_c |U_c| (T_c - T_{ref}))}
57 \f]
58
59 where:
60 \vartable
61 Q_c | Source for cell
62 V_c | Volume of the cell [m3]
63 U_c | Local cell velocity [m/s]
64 T_c | Local cell temperature [K]
65 T_{ref} | Min or max(T) in cell zone depending on the sign of Qt [K]
66 \endvartable
67
68 Sources applied to either of the below, if exist:
69 \verbatim
70 e | Internal energy [m2/s2]
71 h | Enthalphy [m2/s2]
72 \endverbatim
73
74 Required fields:
75 \verbatim
76 T | Temperature [K]
77 U | Velocity [m/s]
78 phi | Mass flux [kg/s]
79 \endverbatim
80
81Usage
82 Minimal example by using \c constant/fvOptions:
83 \verbatim
84 effectivenessHeatExchangerSource1
85 {
86 // Mandatory entries
87 type effectivenessHeatExchangerSource;
88 faceZone <faceZoneName>;
89 secondaryMassFlowRate <scalar>;
90 secondaryInletT <scalar>;
91 file "effectivenessTable";
92 outOfBounds clamp;
93
94 // Optional entries
95 U <word>;
96 T <word>;
97 phi <word>;
98
99 // Conditional optional entries
100
101 // when the total heat exchange is calculated with primary inlet T
102 primaryInletT <scalar>;
103
104 // when the total heat exchange is calculated with a given target
105 targetQdot <scalar>;
106 targetQdotCalcInterval <label>;
107 targetQdotRelax <scalar>;
108
109 // when secondary outlet temperature is requested
110 secondaryCp <Function1<scalar>>;
111
112 // Inherited entries
113 ...
114 }
115 \endverbatim
116
117 where the entries mean:
118 \table
119 Property | Description | Type | Reqd | Deflt
120 type | Type name: effectivenessHeatExchangerSource <!--
121 --> | word | yes | -
122 secondaryMassFlowRate | Secondary flow mass rate [kg/s] <!--
123 --> | scalar | yes | -
124 secondaryInletT | Secondary flow inlet temperature [K] <!--
125 --> | scalar | yes | -
126 faceZone | Name of the faceZone at the heat exchanger inlet <!--
127 --> | word | yes | -
128 file | 2D effectiveness table = function of primary <!--
129 --> and secondary mass flow rates [kg/s] | file | yes | -
130 primaryInletT | Primary flow temperature at the heat exchanger inlet <!--
131 --> | scalar | no | -
132 targetQdot | Target heat rejection | scalar | no | -
133 targetQdotCalcInterval | Target heat rejection calculation interval <!--
134 --> | label | no | -
135 targetQdotRelax | Target heat rejection temperature <!--
136 --> under-relaxation coefficient | scalar | no | -
137 secondaryCp | Secondary flow specific heat capacity <!--
138 --> | Function1<scalar> | no | -
139 U | Name of operand velocity field | word | no | U
140 T | Name of operand temperature field | word | no | T
141 phi | Name of operand flux field | word | no | phi
142 \endtable
143
144 The inherited entries are elaborated in:
145 - \link fvOption.H \endlink
146 - \link cellSetOption.H \endlink
147 - \link writeFile.H \endlink
148 - \link Function1.H \endlink
149
150 The effectiveness table is described in terms of the primary and secondary
151 mass flow rates. For example, the table:
152
153 \verbatim
154 secondary MFR
155 | 0.1 0.2 0.3
156 -----+-----------------
157 0.02 | A B C
158 primary MFR 0.04 | D E F
159 0.06 | G H I
160 \endverbatim
161
162 is specified by the following:
163
164 \verbatim
165 (
166 (
167 0.02
168 (
169 (0.1 A)
170 (0.2 B)
171 (0.3 C)
172 )
173 )
174 (
175 0.04
176 (
177 (0.1 D)
178 (0.2 E)
179 (0.3 F)
180 )
181 )
182 (
183 0.06
184 (
185 (0.1 G)
186 (0.2 H)
187 (0.3 I)
188 )
189 )
190 );
191 \endverbatim
192
193Note
194 - Primary flow indicates the CFD flow region and
195 secondary flow the non-CFD-model region.
196 - The table with name \c file should have the same units as the
197 secondary mass flow rate and kg/s for \c phi.
198 - \c faceZone is the faces at the inlet of the \c cellZone, it needs to be
199 created with flip map flags. It is used to integrate the net mass flow
200 rate into the heat exchanger.
201 - \c primaryInletT sets the primary inlet temperature. If not set, the
202 flux-averaged temperature is used.
203
204SourceFiles
205 effectivenessHeatExchangerSource.C
206
207\*---------------------------------------------------------------------------*/
208
209#ifndef fv_effectivenessHeatExchangerSource_H
210#define fv_effectivenessHeatExchangerSource_H
211
212#include "cellSetOption.H"
213#include "autoPtr.H"
214#include "interpolation2DTable.H"
215#include "writeFile.H"
216#include "Function1.H"
217
218// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219
220namespace Foam
221{
222namespace fv
223{
224
225/*---------------------------------------------------------------------------*\
226 Class effectivenessHeatExchangerSource Declaration
227\*---------------------------------------------------------------------------*/
228
229class effectivenessHeatExchangerSource
230:
231 public fv::cellSetOption,
232 public functionObjects::writeFile
233{
234 // Private Data
235
236 //- Flag to use a user-specified primary flow inlet temperature
237 bool userPrimaryInletT_;
238
239 //- Flag to use target heat rejection
240 bool targetQdotActive_;
241
242 //- Secondary flow specific heat capacity [J/kg/K]
243 autoPtr<Function1<scalar>> secondaryCpPtr_;
244
245 //- 2D effectiveness table = function of primary and secondary
246 //- mass flow rates [kg/s]
247 autoPtr<interpolation2DTable<scalar>> eTable_;
248
249 //- Target heat rejection calculation interval
250 label targetQdotCalcInterval_;
251
252 //- Secondary flow mass rate [kg/s]
253 scalar secondaryMassFlowRate_;
254
255 //- Secondary flow inlet temperature [K]
256 scalar secondaryInletT_;
257
258 //- Primary flow temperature at the heat exchanger inlet [K]
259 scalar primaryInletT_;
260
261 //- Target heat rejection
262 scalar targetQdot_;
263
264 //- Target heat rejection temperature under-relaxation coefficient
265 scalar targetQdotRelax_;
266
267 //- Name of operand velocity field
268 word UName_;
269
270 //- Name of operand temperature field
271 word TName_;
272
273 //- Name of operand flux field
274 word phiName_;
275
276 //- Name of the faceZone at the heat exchanger inlet
277 word faceZoneName_;
278
279 //- Local list of face IDs
280 labelList faceId_;
281
282 //- Local list of patch IDs per face
283 labelList facePatchId_;
284
285 //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
286 labelList faceSign_;
287
288
289 // Private Member Functions
290
291 //- Initialise heat exchanger source model
292 void initialise();
293
294 //- Output file header information
295 virtual void writeFileHeader(Ostream& os);
296
297
298public:
299
300 //- Runtime type information
301 TypeName("effectivenessHeatExchangerSource");
302
303
304 // Constructors
305
306 //- Construct from components
308 (
309 const word& name,
310 const word& modelType,
311 const dictionary& dict,
312 const fvMesh& mesh
313 );
314
315 //- No copy construct
317 (
318 const effectivenessHeatExchangerSource&
319 ) = delete;
320
321 //- No copy assignment
322 void operator=(const effectivenessHeatExchangerSource&) = delete;
323
324
325 //- Destructor
326 virtual ~effectivenessHeatExchangerSource() = default;
327
328
329 // Member Functions
330
331 //- Add explicit/implicit contribution to momentum equation
332 virtual void addSup
333 (
334 fvMatrix<scalar>& eqn,
335 const label fieldi
336 )
337 {
339 }
340
341 //- Add explicit/implicit contribution
342 //- to compressible momentum equation
343 virtual void addSup
344 (
345 const volScalarField& rho,
346 fvMatrix<scalar>& eqn,
347 const label fieldi
348 );
349
350
351 // I-O
352
353 //- Read dictionary
354 virtual bool read(const dictionary& dict);
355};
356
357
358// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
359
360} // End namespace fv
361} // End namespace Foam
362
363// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
364
365#endif
366
367// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Heat exchanger source model for compressible flows, where the heat exchanger is modelled as an energy...
TypeName("effectivenessHeatExchangerSource")
Runtime type information.
virtual ~effectivenessHeatExchangerSource()=default
Destructor.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Add explicit/implicit contribution to momentum equation.
effectivenessHeatExchangerSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
void operator=(const effectivenessHeatExchangerSource &)=delete
No copy assignment.
effectivenessHeatExchangerSource(const effectivenessHeatExchangerSource &)=delete
No copy construct.
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
labelList fv(nPoints)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73