effectivenessHeatExchangerSource.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) 2013-2019 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::fv::effectivenessHeatExchangerSource
26 
27 Description
28  Heat exchanger source model, in which the heat exchanger is defined as a
29  selection of cells.
30 
31  The total heat exchange source is given by:
32  \f[
33  Q_t = e(\phi, \dot{m}_2) (T_2 - T_1) \phi c_p
34  \f]
35 
36  where:
37  \vartable
38  Q_t | total heat source
39  e(\phi,\dot{m}_2) | effectivenes table
40  \phi | net mass flux entering heat exchanger [kg/s]
41  \dot{m}_2 | secondary mass flow rate [kg/s]
42  T_1 | primary inlet temperature [K]
43  T_2 | secondary inlet temperature [K]
44  c_p | specific heat capacity [J/kg/K]
45  \endvartable
46 
47 
48  The distribution inside the hear exchanger is given by:
49  \f[
50  Q_c = \frac{V_c |U_c| (T_c - T_{ref})}{\sum(V_c |U_c| (T_c - T_{ref}))}
51  \f]
52 
53  where:
54  \vartable
55  Q_c | source for cell
56  V_c | volume of the cell [m^3]
57  U_c | local cell velocity [m/s]
58  T_c | local call temperature [K]
59  T_{ref} | min or max(T) in cell zone depending on the sign of Q_t [K]
60  \endvartable
61 
62 Usage
63  Example usage:
64  \verbatim
65  effectivenessHeatExchangerSource1
66  {
67  type effectivenessHeatExchangerSource;
68  active yes;
69 
70  selectionMode cellZone;
71  cellZone porosity;
72 
73  secondaryMassFlowRate 1.0;
74  secondaryInletT 336;
75  primaryInletT 293;
76  faceZone facesZoneInletOriented;
77  outOfBounds clamp;
78  file "effTable";
79  }
80  \endverbatim
81 
82  The effectiveness table is described in terms of the primary and secondary
83  mass flow rates. For example, the table:
84 
85  secondary MFR
86  | 0.1 0.2 0.3
87  -----+-----------------
88  0.02 | A B C
89  primary MFR 0.04 | D E F
90  0.06 | G H I
91 
92 
93  Is specified by the following:
94 
95  (
96  0.02
97  (
98  (0.1 A)
99  (0.2 B)
100  (0.3 C)
101  ),
102  0.04
103  (
104  (0.1 D)
105  (0.2 E)
106  (0.3 F)
107  ),
108  0.06
109  (
110  (0.1 G)
111  (0.2 H)
112  (0.3 I)
113  )
114  );
115 
116 Note
117  - the table with name "file" should have the same units as the
118  secondary mass flow rate and kg/s for phi
119  - faceZone is the faces at the inlet of the cellzone, it needs to be
120  created with flip map flags. It is used to integrate the net mass flow
121  rate into the heat exchanger
122 
123 SourceFiles
124  effectivenessHeatExchangerSource.C
125 
126 \*---------------------------------------------------------------------------*/
127 
128 #ifndef effectivenessHeatExchangerSource_H
129 #define effectivenessHeatExchangerSource_H
130 
131 #include "cellSetOption.H"
132 #include "autoPtr.H"
133 #include "interpolation2DTable.H"
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 namespace Foam
138 {
139 namespace fv
140 {
141 
142 /*---------------------------------------------------------------------------*\
143  Class effectivenessHeatExchangerSource Declaration
144 \*---------------------------------------------------------------------------*/
145 
146 class effectivenessHeatExchangerSource
147 :
148  public cellSetOption
149 {
150 
151 protected:
152 
153  // Protected data
154 
155  //- Secondary flow mass rate [kg/s]
156  scalar secondaryMassFlowRate_;
157 
158  //- Inlet secondary temperature [K]
159  scalar secondaryInletT_;
160 
161  //- Primary air temperature at the heat exchanger inlet [K]
162  scalar primaryInletT_;
163 
164  //- 2D look up table efficiency = function of primary and secondary
165  // mass flow rates [kg/s]
166  autoPtr<interpolation2DTable<scalar>> eTable_;
167 
168  //- Name of velocity field; default = U
169  word UName_;
170 
171  //- Name of temperature field; default = T
172  word TName_;
173 
174  //- Name of the flux
175  word phiName_;
176 
177  //- Name of the faceZone at the heat exchange inlet
178  word faceZoneName_;
179 
180  //- Id for the face zone
181  label zoneID_;
182 
183  //- Local list of face IDs
185 
186  //- Local list of patch ID per face
188 
189  //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
191 
192  //- Area of the face zone
194 
195 
196 private:
197 
198  // Private Member Functions
199 
200  //- Initialise heat exchanger source model
201  void initialise();
202 
203  //- Calculate total area of faceZone across processors
204  void calculateTotalArea(scalar& area);
205 
207 public:
208 
209  //- Runtime type information
210  TypeName("effectivenessHeatExchangerSource");
211 
212 
213  // Constructors
214 
215  //- Construct from components
217  (
218  const word& name,
219  const word& modelType,
220  const dictionary& dict,
221  const fvMesh& mesh
222  );
223 
224  //- Disallow default bitwise copy construction
226  (
228  );
229 
230 
231  //- Destructor
233  {}
235 
236  // Member Functions
238  // Explicit and implicit source
239 
240  //- Scalar
241  virtual void addSup
242  (
243  fvMatrix<scalar>& eqn,
244  const label fieldi
245  )
246  {
248  }
249 
250 
251  // Explicit and implicit source for compressible equation
252 
253  //- Scalar
254  virtual void addSup
255  (
256  const volScalarField& rho,
257  fvMatrix<scalar>& eqn,
258  const label fieldi
259  );
260 
261 
262  // IO
263 
264  //- Read dictionary
265  virtual bool read(const dictionary& dict);
266 
267 
268  // Member Operators
269 
270  //- Disallow default bitwise assignment
271  void operator=(const effectivenessHeatExchangerSource&) = delete;
272 };
273 
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 } // End namespace fv
278 } // End namespace Foam
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #endif
283 
284 // ************************************************************************* //
effectivenessHeatExchangerSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
scalar secondaryInletT_
Inlet secondary temperature [K].
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
void operator=(const effectivenessHeatExchangerSource &)=delete
Disallow default bitwise assignment.
virtual bool read(const dictionary &dict)
Read dictionary.
word TName_
Name of temperature field; default = T.
word faceZoneName_
Name of the faceZone at the heat exchange inlet.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
scalar primaryInletT_
Primary air temperature at the heat exchanger inlet [K].
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
List< label > labelList
A List of labels.
Definition: labelList.H:56
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
TypeName("effectivenessHeatExchangerSource")
Runtime type information.
Heat exchanger source model, in which the heat exchanger is defined as a selection of cells...
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
labelList faceSign_
List of +1/-1 representing face flip map (1 use as is, -1 negate)
autoPtr< interpolation2DTable< scalar > > eTable_
2D look up table efficiency = function of primary and secondary
labelList facePatchId_
Local list of patch ID per face.
scalar secondaryMassFlowRate_
Secondary flow mass rate [kg/s].
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:366
word UName_
Name of velocity field; default = U.
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Scalar.
Namespace for OpenFOAM.