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-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::fv::effectivenessHeatExchangerSource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Heat exchanger source model for compressible flows, in which the heat
35  exchanger is defined 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 source
45  e(\phi,\dot{m}_2) | effectivenes table
46  \phi | net mass flux entering heat exchanger [kg/s]
47  \dot{m}_2 | secondary mass flow rate [kg/s]
48  T_1 | primary inlet temperature [K]
49  T_2 | secondary inlet temperature [K]
50  c_p | 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 call temperature [K]
65  T_{ref} | min or max(T) in cell zone depending on the sign of Q_t [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 
81 Usage
82  Minimal example by using \c constant/fvOptions:
83  \verbatim
84  effectivenessHeatExchangerSource1
85  {
86  // Mandatory entries (unmodifiable)
87  type effectivenessHeatExchangerSource;
88 
89  // Mandatory entries (runtime modifiable)
90  faceZone <faceZoneName>;
91  secondaryMassFlowRate 1.0;
92  secondaryInletT 336;
93 
94  outOfBounds clamp;
95  file "effTable";
96 
97  // Optional entries (runtime modifiable)
98  primaryInletT 293;
99  targetQdot 1500;
100  U <Uname>;
101  T <Tname>;
102  phi <phiName>;
103 
104  // Conditional optional entries (runtime modifiable)
105 
106  // when the entry "targetQdot" is present
107  targetQdotCalcInterval 1;
108  targetQdotRelax 1.0;
109 
110  // Mandatory/Optional (inherited) entries
111  ...
112  }
113  \endverbatim
114 
115  where the entries mean:
116  \table
117  Property | Description | Type | Reqd | Dflt
118  type | Type name: effectivenessHeatExchangerSource <!--
119  --> | word | yes | -
120  secondaryMassFlowRate | Secondary flow mass rate [kg/s] <!--
121  --> | scalar | yes | -
122  secondaryInletT | Inlet secondary temperature [K] <!--
123  --> | scalar | yes | -
124  faceZone | Name of the faceZone at the heat exchange inlet <!--
125  --> | word | yes | -
126  file | 2D look up table efficiency = function of primary <!--
127  --> and secondary mass flow rates [kg/s] | file | yes | -
128  primaryInletT | Primary air temperature at the heat exchanger inlet <!--
129  --> | scalar | no | -
130  targetQdot | Target heat rejection | scalar | no | -
131  targetQdotCalcInterval | Target heat rejection calculation interval <!--
132  --> | label | no | -
133  targetQdotRelax | Target heat rejection temperature <!--
134  --> under-relaxation coefficient | scalar | no | -
135  U | Name of operand velocity field | word | no | U
136  T | Name of operand temperature field | word | no | T
137  phi | Name of operand flux field | word | no | phi
138  \endtable
139 
140  The inherited entries are elaborated in:
141  - \link fvOption.H \endlink
142  - \link cellSetOption.H \endlink
143 
144  The effectiveness table is described in terms of the primary and secondary
145  mass flow rates. For example, the table:
146 
147  \verbatim
148  secondary MFR
149  | 0.1 0.2 0.3
150  -----+-----------------
151  0.02 | A B C
152  primary MFR 0.04 | D E F
153  0.06 | G H I
154  \endverbatim
155 
156  is specified by the following:
157 
158  \verbatim
159  (
160  (
161  0.02
162  (
163  (0.1 A)
164  (0.2 B)
165  (0.3 C)
166  )
167  )
168  (
169  0.04
170  (
171  (0.1 D)
172  (0.2 E)
173  (0.3 F)
174  )
175  )
176  (
177  0.06
178  (
179  (0.1 G)
180  (0.2 H)
181  (0.3 I)
182  )
183  )
184  );
185  \endverbatim
186 
187 Note
188  - The table with name \c file should have the same units as the
189  secondary mass flow rate and kg/s for \c phi.
190  - \c faceZone is the faces at the inlet of the \c cellZone, it needs to be
191  created with flip map flags. It is used to integrate the net mass flow
192  rate into the heat exchanger.
193  - \c primaryInletT sets the primary inlet temperature. If not set, the
194  flux-averaged temperature is used.
195 
196 SourceFiles
197  effectivenessHeatExchangerSource.C
198 
199 \*---------------------------------------------------------------------------*/
200 
201 #ifndef fv_effectivenessHeatExchangerSource_H
202 #define fv_effectivenessHeatExchangerSource_H
203 
204 #include "cellSetOption.H"
205 #include "autoPtr.H"
206 #include "interpolation2DTable.H"
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 namespace Foam
211 {
212 namespace fv
213 {
214 
215 /*---------------------------------------------------------------------------*\
216  Class effectivenessHeatExchangerSource Declaration
217 \*---------------------------------------------------------------------------*/
218 
219 class effectivenessHeatExchangerSource
220 :
221  public fv::cellSetOption
222 {
223 protected:
224 
225  // Protected Data
226 
227  //- Secondary flow mass rate [kg/s]
228  scalar secondaryMassFlowRate_;
229 
230  //- Inlet secondary temperature [K]
231  scalar secondaryInletT_;
232 
233  //- Primary air temperature at the heat exchanger inlet [K]
234  scalar primaryInletT_;
235 
236  //- Flag to use a user-specified primary inlet temperature
237  bool userPrimaryInletT_;
238 
239  //- Flag to use target heat rejection
240  bool targetQdotActive_;
241 
242  //- Target heat rejection
243  scalar targetQdot_;
244 
245  //- Target heat rejection calculation interval
247 
248  //- Target heat rejection temperature under-relaxation coefficient
249  scalar targetQdotRelax_;
250 
251  //- 2D look up table efficiency = function of primary and secondary
252  //- mass flow rates [kg/s]
253  autoPtr<interpolation2DTable<scalar>> eTable_;
254 
255  //- Name of velocity field; default = U
256  word UName_;
257 
258  //- Name of temperature field; default = T
259  word TName_;
260 
261  //- Name of the flux
262  word phiName_;
263 
264  //- Name of the faceZone at the heat exchange inlet
265  word faceZoneName_;
266 
267  //- Local list of face IDs
269 
270  //- Local list of patch ID per face
272 
273  //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
275 
276 
277 private:
278 
279  // Private Member Functions
280 
281  //- Initialise heat exchanger source model
282  void initialise();
283 
284  //- Calculate total area of faceZone across processors
285  void calculateTotalArea(scalar& area);
286 
287 
288 public:
289 
290  //- Runtime type information
291  TypeName("effectivenessHeatExchangerSource");
292 
293 
294  // Constructors
295 
296  //- Construct from components
298  (
299  const word& name,
300  const word& modelType,
301  const dictionary& dict,
302  const fvMesh& mesh
303  );
304 
305  //- No copy construct
307  (
309  ) = delete;
310 
311  //- No copy assignment
312  void operator=(const effectivenessHeatExchangerSource&) = delete;
313 
314 
315  //- Destructor
316  virtual ~effectivenessHeatExchangerSource() = default;
317 
318 
319  // Member Functions
320 
321  //- Add explicit/implicit contribution to momentum equation
322  virtual void addSup
323  (
324  fvMatrix<scalar>& eqn,
325  const label fieldi
326  )
327  {
329  }
330 
331  //- Add explicit/implicit contribution
332  //- to compressible momentum equation
333  virtual void addSup
334  (
335  const volScalarField& rho,
336  fvMatrix<scalar>& eqn,
337  const label fieldi
338  );
339 
340 
341  // IO
342 
343  //- Read dictionary
344  virtual bool read(const dictionary& dict);
345 };
346 
347 
348 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
349 
350 } // End namespace fv
351 } // End namespace Foam
352 
353 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354 
355 #endif
356 
357 // ************************************************************************* //
Foam::fv::effectivenessHeatExchangerSource::UName_
word UName_
Name of velocity field; default = U.
Definition: effectivenessHeatExchangerSource.H:397
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Foam::fv::effectivenessHeatExchangerSource::userPrimaryInletT_
bool userPrimaryInletT_
Flag to use a user-specified primary inlet temperature.
Definition: effectivenessHeatExchangerSource.H:378
Foam::fv::effectivenessHeatExchangerSource::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: effectivenessHeatExchangerSource.C:307
Foam::fv::effectivenessHeatExchangerSource::secondaryMassFlowRate_
scalar secondaryMassFlowRate_
Secondary flow mass rate [kg/s].
Definition: effectivenessHeatExchangerSource.H:369
Foam::fv::effectivenessHeatExchangerSource::~effectivenessHeatExchangerSource
virtual ~effectivenessHeatExchangerSource()=default
Destructor.
Foam::fv::effectivenessHeatExchangerSource::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Add explicit/implicit contribution to momentum equation.
Definition: effectivenessHeatExchangerSource.H:464
Foam::fv::effectivenessHeatExchangerSource::operator=
void operator=(const effectivenessHeatExchangerSource &)=delete
No copy assignment.
interpolation2DTable.H
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::fv::effectivenessHeatExchangerSource::primaryInletT_
scalar primaryInletT_
Primary air temperature at the heat exchanger inlet [K].
Definition: effectivenessHeatExchangerSource.H:375
Foam::fv::effectivenessHeatExchangerSource::TName_
word TName_
Name of temperature field; default = T.
Definition: effectivenessHeatExchangerSource.H:400
Foam::fv::effectivenessHeatExchangerSource
Heat exchanger source model for compressible flows, in which the heat exchanger is defined as an ener...
Definition: effectivenessHeatExchangerSource.H:360
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::fv::effectivenessHeatExchangerSource::faceId_
labelList faceId_
Local list of face IDs.
Definition: effectivenessHeatExchangerSource.H:409
Foam::fv::effectivenessHeatExchangerSource::targetQdotActive_
bool targetQdotActive_
Flag to use target heat rejection.
Definition: effectivenessHeatExchangerSource.H:381
Foam::fv::effectivenessHeatExchangerSource::faceSign_
labelList faceSign_
List of +1/-1 representing face flip map (1 use as is, -1 negate)
Definition: effectivenessHeatExchangerSource.H:415
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::fv::effectivenessHeatExchangerSource::faceZoneName_
word faceZoneName_
Name of the faceZone at the heat exchange inlet.
Definition: effectivenessHeatExchangerSource.H:406
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fv::effectivenessHeatExchangerSource::phiName_
word phiName_
Name of the flux.
Definition: effectivenessHeatExchangerSource.H:403
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::effectivenessHeatExchangerSource::TypeName
TypeName("effectivenessHeatExchangerSource")
Runtime type information.
fv
labelList fv(nPoints)
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::fv::effectivenessHeatExchangerSource::targetQdotRelax_
scalar targetQdotRelax_
Target heat rejection temperature under-relaxation coefficient.
Definition: effectivenessHeatExchangerSource.H:390
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fv::effectivenessHeatExchangerSource::eTable_
autoPtr< interpolation2DTable< scalar > > eTable_
Definition: effectivenessHeatExchangerSource.H:394
Foam::List< label >
Foam::fv::effectivenessHeatExchangerSource::secondaryInletT_
scalar secondaryInletT_
Inlet secondary temperature [K].
Definition: effectivenessHeatExchangerSource.H:372
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fieldTypes::area
const wordList area
Standard area field types (scalar, vector, tensor, etc)
Foam::fv::effectivenessHeatExchangerSource::facePatchId_
labelList facePatchId_
Local list of patch ID per face.
Definition: effectivenessHeatExchangerSource.H:412
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
effectivenessHeatExchangerSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: effectivenessHeatExchangerSource.C:131
Foam::fv::effectivenessHeatExchangerSource::targetQdotCalcInterval_
label targetQdotCalcInterval_
Target heat rejection calculation interval.
Definition: effectivenessHeatExchangerSource.H:387
Foam::fv::effectivenessHeatExchangerSource::targetQdot_
scalar targetQdot_
Target heat rejection.
Definition: effectivenessHeatExchangerSource.H:384
autoPtr.H