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 | Copyright (C) 2013-2016 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 [m3]
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  effectivenessHeatExchangerSourceCoeffs
71  {
72  selectionMode cellZone;
73  cellZone porosity;
74 
75  secondaryMassFlowRate 1.0;
76  secondaryInletT 336;
77  primaryInletT 293;
78  faceZone facesZoneInletOriented;
79  outOfBounds clamp;
80  fileName "effTable";
81  }
82  }
83  \endverbatim
84 
85  The effectiveness table is described in terms of the primary and secondary
86  mass flow rates. For example, the table:
87 
88  secondary MFR
89  | 0.1 0.2 0.3
90  -----+-----------------
91  0.02 | A B C
92  primary MFR 0.04 | D E F
93  0.06 | G H I
94 
95 
96  Is specified by the following:
97 
98  (
99  0.02
100  (
101  (0.1 A)
102  (0.2 B)
103  (0.3 C)
104  ),
105  0.04
106  (
107  (0.1 D)
108  (0.2 E)
109  (0.3 F)
110  ),
111  0.06
112  (
113  (0.1 G)
114  (0.2 H)
115  (0.3 I)
116  )
117  );
118 
119 
120 Note
121 - the table with name "fileName" should have the same units as the
122  secondary mass flow rate and kg/s for phi
123 - faceZone is the faces at the inlet of the cellzone, it needs to be
124  created with flip map flags. It is used to integrate the net mass flow
125  rate into the heat exchanger
126 
127 
128 SourceFiles
129  effectivenessHeatExchangerSource.C
130 
131 \*---------------------------------------------------------------------------*/
132 
133 #ifndef effectivenessHeatExchangerSource_H
134 #define effectivenessHeatExchangerSource_H
135 
136 #include "cellSetOption.H"
137 #include "autoPtr.H"
138 #include "interpolation2DTable.H"
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 namespace Foam
143 {
144 namespace fv
145 {
146 
147 /*---------------------------------------------------------------------------*\
148  Class effectivenessHeatExchangerSource Declaration
149 \*---------------------------------------------------------------------------*/
150 
151 class effectivenessHeatExchangerSource
152 :
153  public cellSetOption
154 {
155 
156 protected:
157 
158  // Protected data
159 
160  //- Secondary flow mass rate [kg/s]
161  scalar secondaryMassFlowRate_;
162 
163  //- Inlet secondary temperature [K]
164  scalar secondaryInletT_;
165 
166  //- Primary air temperature at the heat exchanger inlet [K]
167  scalar primaryInletT_;
168 
169  //- 2D look up table efficiency = function of primary and secondary
170  // mass flow rates [kg/s]
171  autoPtr<interpolation2DTable<scalar>> eTable_;
172 
173  //- Name of velocity field; default = U
174  word UName_;
175 
176  //- Name of temperature field; default = T
177  word TName_;
178 
179  //- Name of the flux
180  word phiName_;
181 
182  //- Name of the faceZone at the heat exchange inlet
183  word faceZoneName_;
184 
185  //- Id for the face zone
186  label zoneID_;
187 
188  //- Local list of face IDs
190 
191  //- Local list of patch ID per face
193 
194  //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
196 
197  //- Area of the face zone
199 
200 
201 private:
202 
203  // Private Member Functions
204 
205 
206  //- Disallow default bitwise copy construct
208  (
210  );
212  //- Disallow default bitwise assignment
213  void operator=(const effectivenessHeatExchangerSource&);
215  //- Initialise heat exchanger source model
216  void initialise();
217 
218  //- Calculate total area of faceZone accross processors
219  void calculateTotalArea(scalar& area);
220 
222 public:
223 
224  //- Runtime type information
225  TypeName("effectivenessHeatExchangerSource");
226 
228  // Constructors
229 
230  //- Construct from components
232  (
233  const word& name,
234  const word& modelType,
235  const dictionary& dict,
236  const fvMesh& mesh
237  );
238 
240  //- Destructor
242  {}
243 
244 
245  // Member Functions
246 
247  // Explicit and implicit source
248 
249  //- Scalar
250  virtual void addSup
251  (
252  fvMatrix<scalar>& eqn,
253  const label fieldi
254  )
255  {
257  }
258 
259 
260  // Explicit and implicit source for compressible equation
261 
262  //- Scalar
263  virtual void addSup
264  (
265  const volScalarField& rho,
266  fvMatrix<scalar>& eqn,
267  const label fieldi
268  );
269 
270 
271  // IO
272 
273  //- Read dictionary
274  virtual bool read(const dictionary& dict);
275 };
276 
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 } // End namespace fv
281 } // End namespace Foam
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 #endif
286 
287 // ************************************************************************* //
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
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:137
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.
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:71
List< label > labelList
A List of labels.
Definition: labelList.H:56
TypeName("effectivenessHeatExchangerSource")
Runtime type information.
Heat exchanger source model, in which the heat exchanger is defined as a selection of cells...
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
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.