effectivenessHeatExchanger.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-2024 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::effectivenessHeatExchanger
26 
27 Description
28  Heat exchanger model, based on an effectiveness
29 
30  The total heat exchange source is given by:
31  \f[
32  Q_t = e(\phi, \dot{m}_2) (T_2 - T_1) \phi c_p
33  \f]
34 
35  where:
36  \vartable
37  Q_t | total heat source
38  e(\phi,\dot{m}_2) | effectiveness table
39  \phi | net mass flux entering heat exchanger [kg/s]
40  \dot{m}_2 | secondary mass flow rate [kg/s]
41  T_1 | primary inlet temperature [K]
42  T_2 | secondary inlet temperature [K]
43  c_p | specific heat capacity [J/kg/K]
44  \endvartable
45 
46  The distribution inside the hear exchanger is given by:
47  \f[
48  Q_c = \frac{V_c |U_c| (T_c - T_{ref})}{\sum(V_c |U_c| (T_c - T_{ref}))}
49  \f]
50 
51  where:
52  \vartable
53  Q_c | source for cell
54  V_c | volume of the cell [m^3]
55  U_c | local cell velocity [m/s]
56  T_c | local call temperature [K]
57  T_{ref} | min or max(T) in cell zone depending on the sign of Q_t [K]
58  \endvartable
59 
60 Usage
61  Example usage:
62  \verbatim
63  effectivenessHeatExchanger1
64  {
65  type effectivenessHeatExchanger;
66 
67  select cellZone;
68  cellZone porosity;
69 
70  secondaryMassFlowRate 1.0;
71  secondaryInletT 336;
72  primaryInletT 293;
73 
74  faceZone facesZoneInletOriented;
75 
76  effectiveness <function2>;
77  }
78  \endverbatim
79 
80  Note:
81  - The effectiveness Function2 is described in terms of the primary and
82  secondary mass flow rates and has the same units as the secondary mass
83  flow rate and kg/s for phi.
84  - faceZone is the faces at the inlet of the cellzone, it needs to be
85  created with flip map flags. It is used to integrate the net mass flow
86  rate into the heat exchanger
87 
88 SourceFiles
89  effectivenessHeatExchanger.C
90 
91 \*---------------------------------------------------------------------------*/
92 
93 #ifndef effectivenessHeatExchanger_H
94 #define effectivenessHeatExchanger_H
95 
96 #include "fvModel.H"
97 #include "fvCellSet.H"
98 #include "Function2.H"
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 namespace Foam
103 {
104 namespace fv
105 {
106 
107 /*---------------------------------------------------------------------------*\
108  Class effectivenessHeatExchanger Declaration
109 \*---------------------------------------------------------------------------*/
110 
111 class effectivenessHeatExchanger
112 :
113  public fvModel
114 {
115  // Private data
116 
117  //- The set of cells the fvConstraint applies to
118  fvCellSet set_;
119 
120  //- Secondary flow mass rate [kg/s]
121  scalar secondaryMassFlowRate_;
122 
123  //- Inlet secondary temperature [K]
124  scalar secondaryInletT_;
125 
126  //- Primary air temperature at the heat exchanger inlet [K]
127  scalar primaryInletT_;
128 
129  //- 2D function for effectiveness [kg/s]
130  // function of primary and secondary mass flow rates [kg/s]
131  autoPtr<Function2<scalar>> eTable_;
132 
133  //- Name of velocity field; default = U
134  word UName_;
135 
136  //- Name of temperature field; default = T
137  word TName_;
138 
139  //- Name of the flux
140  word phiName_;
141 
142  //- Name of the faceZone at the heat exchange inlet
143  word faceZoneName_;
144 
145  //- Id for the face zone
146  label zoneIndex_;
147 
148  //- Local list of face IDs
149  labelList faceId_;
150 
151  //- Local list of patch ID per face
152  labelList facePatchId_;
153 
154  //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
155  labelList faceSign_;
156 
157  //- Area of the face zone
158  scalar faceZoneArea_;
159 
160 
161 private:
162 
163  // Private Member Functions
164 
165  //- Non-virtual read
166  void readCoeffs();
167 
168  //- Set the zone information
169  void setZone();
170 
171  //- Calculate total area of faceZone across processors
172  void calculateTotalArea(scalar& area) const;
173 
174 
175 public:
176 
177  //- Runtime type information
178  TypeName("effectivenessHeatExchanger");
179 
180 
181  // Constructors
182 
183  //- Construct from components
185  (
186  const word& name,
187  const word& modelType,
188  const fvMesh& mesh,
189  const dictionary& dict
190  );
191 
192  //- Disallow default bitwise copy construction
194  (
196  ) = delete;
197 
198 
199  //- Destructor
201  {}
202 
203 
204  // Member Functions
205 
206  //- Return the list of fields for which the fvModel adds source term
207  // to the transport equation
208  virtual wordList addSupFields() const;
209 
210  //- Explicit and implicit source for compressible equation
211  virtual void addSup
212  (
213  const volScalarField& rho,
214  const volScalarField& he,
215  fvMatrix<scalar>& eqn
216  ) const;
217 
218 
219  // Mesh changes
220 
221  //- Update for mesh motion
222  virtual bool movePoints();
223 
224  //- Update topology using the given map
225  virtual void topoChange(const polyTopoChangeMap&);
226 
227  //- Update from another mesh using the given map
228  virtual void mapMesh(const polyMeshMap&);
229 
230  //- Redistribute or update using the given distribution map
231  virtual void distribute(const polyDistributionMap&);
232 
233 
234  // IO
235 
236  //- Read dictionary
237  virtual bool read(const dictionary& dict);
238 
239 
240  // Member Operators
241 
242  //- Disallow default bitwise assignment
243  void operator=(const effectivenessHeatExchanger&) = delete;
244 };
245 
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 } // End namespace fv
250 } // End namespace Foam
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #endif
255 
256 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Heat exchanger model, based on an effectiveness.
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
void operator=(const effectivenessHeatExchanger &)=delete
Disallow default bitwise assignment.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
effectivenessHeatExchanger(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
TypeName("effectivenessHeatExchanger")
Runtime type information.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void addSup(const volScalarField &rho, const volScalarField &he, fvMatrix< scalar > &eqn) const
Explicit and implicit source for compressible equation.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: labelList.H:56
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
thermo he()
labelList fv(nPoints)
dictionary dict