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-2015 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  \heading Source usage
63 
64  Example usage:
65  \verbatim
66  effectivenessHeatExchangerSource1
67  {
68  type effectivenessHeatExchangerSource;
69  active yes;
70 
71  effectivenessHeatExchangerSourceCoeffs
72  {
73  selectionMode cellZone;
74  cellZone porosity;
75 
76  secondaryMassFlowRate 1.0;
77  secondaryInletT 336;
78  primaryInletT 293;
79  faceZone facesZoneInletOriented;
80  outOfBounds clamp;
81  fileName "effTable";
82  }
83  }
84  \endverbatim
85 
86  The effectiveness table is described in terms of the primary and secondary
87  mass flow rates. For example, the table:
88 
89  secondary MFR
90  | 0.1 0.2 0.3
91  -----+-----------------
92  0.02 | A B C
93  primary MFR 0.04 | D E F
94  0.06 | G H I
95 
96 
97  Is specified by the following:
98 
99  (
100  0.02
101  (
102  (0.1 A)
103  (0.2 B)
104  (0.3 C)
105  ),
106  0.04
107  (
108  (0.1 D)
109  (0.2 E)
110  (0.3 F)
111  ),
112  0.06
113  (
114  (0.1 G)
115  (0.2 H)
116  (0.3 I)
117  )
118  );
119 
120 
121 Note
122 - the table with name "fileName" should have the same units as the
123  secondary mass flow rate and kg/s for phi
124 - faceZone is the faces at the inlet of the cellzone, it needs to be
125  created with flip map flags. It is used to integrate the net mass flow
126  rate into the heat exchanger
127 
128 
129 SourceFiles
130  effectivenessHeatExchangerSource.C
131 
132 \*---------------------------------------------------------------------------*/
133 
134 #ifndef effectivenessHeatExchangerSource_H
135 #define effectivenessHeatExchangerSource_H
136 
137 #include "cellSetOption.H"
138 #include "autoPtr.H"
139 #include "interpolation2DTable.H"
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 namespace Foam
144 {
145 namespace fv
146 {
147 
148 /*---------------------------------------------------------------------------*\
149  Class effectivenessHeatExchangerSource Declaration
150 \*---------------------------------------------------------------------------*/
151 
152 class effectivenessHeatExchangerSource
153 :
154  public cellSetOption
155 {
156 
157 protected:
158 
159  // Protected data
160 
161  //- Secondary flow mass rate [kg/s]
162  scalar secondaryMassFlowRate_;
163 
164  //- Inlet secondary temperature [K]
165  scalar secondaryInletT_;
166 
167  //- Primary air temperature at the heat exchanger inlet [K]
168  scalar primaryInletT_;
169 
170  //- 2D look up table efficiency = function of primary and secondary
171  // mass flow rates [kg/s]
172  autoPtr<interpolation2DTable<scalar> > eTable_;
173 
174  //- Name of velocity field; default = U
175  word UName_;
176 
177  //- Name of temperature field; default = T
178  word TName_;
179 
180  //- Name of the flux
181  word phiName_;
182 
183  //- Name of the faceZone at the heat exchange inlet
184  word faceZoneName_;
185 
186  //- Id for the face zone
187  label zoneID_;
188 
189  //- Local list of face IDs
191 
192  //- Local list of patch ID per face
194 
195  //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
197 
198  //- Area of the face zone
200 
201 
202 private:
203 
204  // Private Member Functions
205 
206 
207  //- Disallow default bitwise copy construct
209  (
211  );
212 
213  //- Disallow default bitwise assignment
215 
216  //- Initialise heat exchanger source model
217  void initialise();
218 
219  //- Calculate total area of faceZone accross processors
220  void calculateTotalArea(scalar& area);
221 
222 
223 public:
224 
225  //- Runtime type information
226  TypeName("effectivenessHeatExchangerSource");
227 
228 
229  // Constructors
230 
231  //- Construct from components
233  (
234  const word& name,
235  const word& modelType,
236  const dictionary& dict,
237  const fvMesh& mesh
238  );
239 
240 
241  //- Destructor
243  {}
244 
245 
246  // Member Functions
247 
248  // Explicit and implicit source
249 
250  //- Scalar
251  virtual void addSup
252  (
253  fvMatrix<scalar>& eqn,
254  const label fieldI
255  )
256  {
258  }
259 
260 
261  // Explicit and implicit source for compressible equation
262 
263  //- Scalar
264  virtual void addSup
265  (
266  const volScalarField& rho,
267  fvMatrix<scalar>& eqn,
268  const label fieldI
269  );
270 
271 
272  // IO
273 
274  //- Read dictionary
275  virtual bool read(const dictionary& dict);
276 };
277 
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 } // End namespace fv
282 } // End namespace Foam
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 #endif
287 
288 // ************************************************************************* //
Foam::fv::effectivenessHeatExchangerSource::UName_
word UName_
Name of velocity field; default = U.
Definition: effectivenessHeatExchangerSource.H:222
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::cellSetOption
Cell-set options abtract base class. Provides a base set of controls, e.g.
Definition: cellSetOption.H:71
Foam::labelList
List< label > labelList
A List of labels.
Definition: labelList.H:56
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
Foam::fv::effectivenessHeatExchangerSource::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: effectivenessHeatExchangerSource.C:297
Foam::fv::effectivenessHeatExchangerSource::secondaryMassFlowRate_
scalar secondaryMassFlowRate_
Secondary flow mass rate [kg/s].
Definition: effectivenessHeatExchangerSource.H:209
interpolation2DTable.H
Foam::fv::effectivenessHeatExchangerSource::initialise
void initialise()
Initialise heat exchanger source model.
Definition: effectivenessHeatExchangerSource.C:53
cellSetOption.H
Foam::fv::effectivenessHeatExchangerSource::primaryInletT_
scalar primaryInletT_
Primary air temperature at the heat exchanger inlet [K].
Definition: effectivenessHeatExchangerSource.H:215
Foam::fv::effectivenessHeatExchangerSource::TName_
word TName_
Name of temperature field; default = T.
Definition: effectivenessHeatExchangerSource.H:225
Foam::fv::effectivenessHeatExchangerSource::operator=
void operator=(const effectivenessHeatExchangerSource &)
Disallow default bitwise assignment.
Foam::fv::effectivenessHeatExchangerSource
Heat exchanger source model, in which the heat exchanger is defined as a selection of cells.
Definition: effectivenessHeatExchangerSource.H:199
Foam::fv::effectivenessHeatExchangerSource::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldI)
Scalar.
Definition: effectivenessHeatExchangerSource.H:299
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::fv::effectivenessHeatExchangerSource::faceId_
labelList faceId_
Local list of face IDs.
Definition: effectivenessHeatExchangerSource.H:237
Foam::label
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
Foam::fv::effectivenessHeatExchangerSource::~effectivenessHeatExchangerSource
virtual ~effectivenessHeatExchangerSource()
Destructor.
Definition: effectivenessHeatExchangerSource.H:289
Foam::fv::effectivenessHeatExchangerSource::faceSign_
labelList faceSign_
List of +1/-1 representing face flip map (1 use as is, -1 negate)
Definition: effectivenessHeatExchangerSource.H:243
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:231
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fv::effectivenessHeatExchangerSource::phiName_
word phiName_
Name of the flux.
Definition: effectivenessHeatExchangerSource.H:228
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::effectivenessHeatExchangerSource::TypeName
TypeName("effectivenessHeatExchangerSource")
Runtime type information.
Foam::fv::effectivenessHeatExchangerSource::faceZoneArea_
scalar faceZoneArea_
Area of the face zone.
Definition: effectivenessHeatExchangerSource.H:246
rho
rho
Definition: pEqn.H:3
fv
labelList fv(nPoints)
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::fv::effectivenessHeatExchangerSource::calculateTotalArea
void calculateTotalArea(scalar &area)
Calculate total area of faceZone accross processors.
Definition: effectivenessHeatExchangerSource.C:122
Foam::fv::effectivenessHeatExchangerSource::eTable_
autoPtr< interpolation2DTable< scalar > > eTable_
2D look up table efficiency = function of primary and secondary
Definition: effectivenessHeatExchangerSource.H:219
Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
effectivenessHeatExchangerSource(const effectivenessHeatExchangerSource &)
Disallow default bitwise copy construct.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::fv::effectivenessHeatExchangerSource::secondaryInletT_
scalar secondaryInletT_
Inlet secondary temperature [K].
Definition: effectivenessHeatExchangerSource.H:212
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fv::effectivenessHeatExchangerSource::facePatchId_
labelList facePatchId_
Local list of patch ID per face.
Definition: effectivenessHeatExchangerSource.H:240
Foam::fv::effectivenessHeatExchangerSource::zoneID_
label zoneID_
Id for the face zone.
Definition: effectivenessHeatExchangerSource.H:234
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
autoPtr.H