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-2017 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, in which the heat exchanger is defined as an
35  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 Usage
69  Example usage:
70  \verbatim
71  effectivenessHeatExchangerSource1
72  {
73  type effectivenessHeatExchangerSource;
74  active yes;
75 
76  selectionMode cellZone;
77  cellZone porosity;
78 
79  secondaryMassFlowRate 1.0;
80  secondaryInletT 336;
81  faceZone facesZoneInletOriented;
82  outOfBounds clamp;
83  file "effTable";
84 
85  // Optional
86  // primaryInletT 293;
87  // targetQdot 1500;
88  }
89  \endverbatim
90 
91  Optional entries:
92  - \c primaryInletT : sets the primary inlet temperature. If not set, the
93  flux-averaged temperature is used.
94  - \c targetQdot : target heat rejection
95 
96  The effectiveness table is described in terms of the primary and secondary
97  mass flow rates. For example, the table:
98 
99  \verbatim
100  secondary MFR
101  | 0.1 0.2 0.3
102  -----+-----------------
103  0.02 | A B C
104  primary MFR 0.04 | D E F
105  0.06 | G H I
106  \endverbatim
107 
108 
109  is specified by the following:
110 
111  \verbatim
112  (
113  (
114  0.02
115  (
116  (0.1 A)
117  (0.2 B)
118  (0.3 C)
119  )
120  )
121  (
122  0.04
123  (
124  (0.1 D)
125  (0.2 E)
126  (0.3 F)
127  )
128  )
129  (
130  0.06
131  (
132  (0.1 G)
133  (0.2 H)
134  (0.3 I)
135  )
136  )
137  );
138  \endverbatim
139 
140 Note
141 - the table with name \c file should have the same units as the
142  secondary mass flow rate and kg/s for phi
143 - \c faceZone is the faces at the inlet of the \c cellzone, it needs to be
144  created with flip map flags. It is used to integrate the net mass flow
145  rate into the heat exchanger
146 
147 
148 SourceFiles
149  effectivenessHeatExchangerSource.C
150 
151 \*---------------------------------------------------------------------------*/
152 
153 #ifndef fv_effectivenessHeatExchangerSource_H
154 #define fv_effectivenessHeatExchangerSource_H
155 
156 #include "cellSetOption.H"
157 #include "autoPtr.H"
158 #include "interpolation2DTable.H"
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 namespace Foam
163 {
164 namespace fv
165 {
166 
167 /*---------------------------------------------------------------------------*\
168  Class effectivenessHeatExchangerSource Declaration
169 \*---------------------------------------------------------------------------*/
170 
171 class effectivenessHeatExchangerSource
172 :
173  public cellSetOption
174 {
175 
176 protected:
177 
178  // Protected data
179 
180  //- Secondary flow mass rate [kg/s]
181  scalar secondaryMassFlowRate_;
182 
183  //- Inlet secondary temperature [K]
184  scalar secondaryInletT_;
185 
186  //- Primary air temperature at the heat exchanger inlet [K]
187  scalar primaryInletT_;
188 
189  //- Flag to use a user-specified primary inlet temperature
190  bool userPrimaryInletT_;
191 
192  //- Flag to use target heat rejection
193  bool targetQdotActive_;
194 
195  //- Target heat rejection
196  scalar targetQdot_;
197 
198  //- Target heat rejection calculation interval
200 
201  //- Target heat rejection temperature under-relaxation coefficient
202  scalar targetQdotRelax_;
203 
204  //- 2D look up table efficiency = function of primary and secondary
205  // mass flow rates [kg/s]
206  autoPtr<interpolation2DTable<scalar>> eTable_;
207 
208  //- Name of velocity field; default = U
209  word UName_;
210 
211  //- Name of temperature field; default = T
212  word TName_;
213 
214  //- Name of the flux
215  word phiName_;
216 
217  //- Name of the faceZone at the heat exchange inlet
219 
220  //- Local list of face IDs
222 
223  //- Local list of patch ID per face
225 
226  //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
228 
229 
230 private:
231 
232  // Private Member Functions
233 
234  //- No copy construct
236  (
238  ) = delete;
239 
240  //- No copy assignment
241  void operator=(const effectivenessHeatExchangerSource&) = delete;
242 
243  //- Initialise heat exchanger source model
244  void initialise();
245 
246  //- Calculate total area of faceZone across processors
247  void calculateTotalArea(scalar& area);
248 
249 
250 public:
251 
252  //- Runtime type information
253  TypeName("effectivenessHeatExchangerSource");
254 
255 
256  // Constructors
257 
258  //- Construct from components
260  (
261  const word& name,
262  const word& modelType,
263  const dictionary& dict,
264  const fvMesh& mesh
265  );
266 
267 
268  //- Destructor
269  virtual ~effectivenessHeatExchangerSource() = default;
270 
271 
272  // Member Functions
273 
274  // Explicit and implicit source
275 
276  //- Scalar
277  virtual void addSup
278  (
279  fvMatrix<scalar>& eqn,
280  const label fieldi
281  )
282  {
284  }
285 
286 
287  // Explicit and implicit source for compressible equation
288 
289  //- Scalar
290  virtual void addSup
291  (
292  const volScalarField& rho,
293  fvMatrix<scalar>& eqn,
294  const label fieldi
295  );
296 
297 
298  // IO
299 
300  //- Read dictionary
301  virtual bool read(const dictionary& dict);
302 };
303 
304 
305 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
306 
307 } // End namespace fv
308 } // End namespace Foam
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 #endif
313 
314 // ************************************************************************* //
Foam::fv::effectivenessHeatExchangerSource::UName_
word UName_
Name of velocity field; default = U.
Definition: effectivenessHeatExchangerSource.H:256
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fv::cellSetOption
Cell-set options abstract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:72
Foam::fv::effectivenessHeatExchangerSource::userPrimaryInletT_
bool userPrimaryInletT_
Flag to use a user-specified primary inlet temperature.
Definition: effectivenessHeatExchangerSource.H:237
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:30
Foam::fv::effectivenessHeatExchangerSource::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: effectivenessHeatExchangerSource.C:315
Foam::fv::effectivenessHeatExchangerSource::secondaryMassFlowRate_
scalar secondaryMassFlowRate_
Secondary flow mass rate [kg/s].
Definition: effectivenessHeatExchangerSource.H:228
Foam::fv::effectivenessHeatExchangerSource::~effectivenessHeatExchangerSource
virtual ~effectivenessHeatExchangerSource()=default
Destructor.
Foam::fv::effectivenessHeatExchangerSource::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Scalar.
Definition: effectivenessHeatExchangerSource.H:325
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:234
Foam::fv::effectivenessHeatExchangerSource::TName_
word TName_
Name of temperature field; default = T.
Definition: effectivenessHeatExchangerSource.H:259
Foam::fv::effectivenessHeatExchangerSource
Heat exchanger source model, in which the heat exchanger is defined as an energy source using a selec...
Definition: effectivenessHeatExchangerSource.H:218
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:436
Foam::fv::effectivenessHeatExchangerSource::faceId_
labelList faceId_
Local list of face IDs.
Definition: effectivenessHeatExchangerSource.H:268
Foam::fv::effectivenessHeatExchangerSource::targetQdotActive_
bool targetQdotActive_
Flag to use target heat rejection.
Definition: effectivenessHeatExchangerSource.H:240
Foam::fv::effectivenessHeatExchangerSource::faceSign_
labelList faceSign_
List of +1/-1 representing face flip map (1 use as is, -1 negate)
Definition: effectivenessHeatExchangerSource.H:274
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:265
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fv::effectivenessHeatExchangerSource::phiName_
word phiName_
Name of the flux.
Definition: effectivenessHeatExchangerSource.H:262
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
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:249
Foam::fv::effectivenessHeatExchangerSource::eTable_
autoPtr< interpolation2DTable< scalar > > eTable_
2D look up table efficiency = function of primary and secondary
Definition: effectivenessHeatExchangerSource.H:253
Foam::List< label >
Foam::fv::effectivenessHeatExchangerSource::secondaryInletT_
scalar secondaryInletT_
Inlet secondary temperature [K].
Definition: effectivenessHeatExchangerSource.H:231
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:36
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
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:271
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::effectivenessHeatExchangerSource::targetQdotCalcInterval_
label targetQdotCalcInterval_
Target heat rejection calculation interval.
Definition: effectivenessHeatExchangerSource.H:246
Foam::fv::effectivenessHeatExchangerSource::targetQdot_
scalar targetQdot_
Target heat rejection.
Definition: effectivenessHeatExchangerSource.H:243
autoPtr.H