heatExchangerModel.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) 2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Namespace
27  Foam::heatExchangerModels
28 
29 Description
30  A namespace for various heat exchanger model implementations.
31 
32 Class
33  Foam::heatExchangerModel
34 
35 Description
36  Base class for heat exchanger models to handle various
37  characteristics for the \c heatExchangerSource fvOption.
38 
39 SourceFiles
40  heatExchangerModel.C
41  heatExchangerModelNew.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef Foam_heatExchangerModel_H
46 #define Foam_heatExchangerModel_H
47 
48 #include "fvMesh.H"
49 #include "writeFile.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class heatExchangerModel Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
63 {
64 protected:
65 
66  // Protected Data
67 
68  //- Reference to the mesh
69  const fvMesh& mesh_;
70 
71  //- Dictionary containing coefficients specific to the chosen model
73 
74  //- Reference to the name of the fvOption source
75  const word& name_;
76 
77  //- Name of operand velocity field
78  word UName_;
79 
80  //- Name of operand temperature field
81  word TName_;
82 
83  //- Name of operand flux field
84  word phiName_;
85 
86  //- Name of the faceZone at the heat exchanger inlet
88 
89  //- Local list of face IDs
91 
92  //- Local list of patch IDs per face
94 
95  //- List of +1/-1 representing face flip map (1 use as is, -1 negate)
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("heatExchangerModel");
103 
104 
105  // Declare runtime constructor selection table
106 
108  (
109  autoPtr,
111  dictionary,
112  (
113  const fvMesh& mesh,
114  const word& name,
115  const dictionary& coeffs
116  ),
117  (mesh, name, coeffs)
118  );
119 
120 
121  // Selectors
122 
123  //- Return a reference to the selected heat exchanger model
125  (
126  const fvMesh& mesh,
127  const word& name,
128  const dictionary& coeffs
129  );
130 
131 
132  // Constructors
133 
134  //- Construct from components
136  (
137  const fvMesh& mesh,
138  const word& name,
139  const dictionary& coeffs
140  );
141 
142  //- No copy construct
143  heatExchangerModel(const heatExchangerModel&) = delete;
144 
145  //- No copy assignment
146  void operator=(const heatExchangerModel&) = delete;
147 
148 
149  //- Destructor
150  virtual ~heatExchangerModel() = default;
151 
152 
153  // Member Functions
154 
155  // Access
156 
157  //- Return const reference to the name of velocity field
158  virtual const word& U() const
159  {
160  return UName_;
161  }
162 
163 
164  // Evaluation
165 
166  //- Initialise data members of the model
167  virtual void initialise();
168 
169  //- Return energy density per unit length [J/m3/m]
170  virtual tmp<scalarField> energyDensity(const labelList& cells) = 0;
171 
172 
173  // I-O
174 
175  //- Read top-level dictionary
176  virtual bool read(const dictionary& dict) = 0;
177 
178  //- Write data to stream and files
179  virtual void write(const bool log) = 0;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 #endif
190 
191 // ************************************************************************* //
declareRunTimeSelectionTable(autoPtr, heatExchangerModel, dictionary,(const fvMesh &mesh, const word &name, const dictionary &coeffs),(mesh, name, coeffs))
labelList faceId_
Local list of face IDs.
dictionary dict
TypeName("heatExchangerModel")
Runtime type information.
dimensionedScalar log(const dimensionedScalar &ds)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
word faceZoneName_
Name of the faceZone at the heat exchanger inlet.
static autoPtr< heatExchangerModel > New(const fvMesh &mesh, const word &name, const dictionary &coeffs)
Return a reference to the selected heat exchanger model.
virtual void initialise()
Initialise data members of the model.
labelList faceSign_
List of +1/-1 representing face flip map (1 use as is, -1 negate)
void operator=(const heatExchangerModel &)=delete
No copy assignment.
Base class for heat exchanger models to handle various characteristics for the heatExchangerSource fv...
word phiName_
Name of operand flux field.
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
const cellShapeList & cells
A class for handling words, derived from Foam::string.
Definition: word.H:63
const word & name_
Reference to the name of the fvOption source.
heatExchangerModel(const fvMesh &mesh, const word &name, const dictionary &coeffs)
Construct from components.
const fvMesh & mesh_
Reference to the mesh.
word TName_
Name of operand temperature field.
virtual ~heatExchangerModel()=default
Destructor.
word UName_
Name of operand velocity field.
virtual bool read(const dictionary &dict)=0
Read top-level dictionary.
labelList facePatchId_
Local list of patch IDs per face.
virtual tmp< scalarField > energyDensity(const labelList &cells)=0
Return energy density per unit length [J/m3/m].
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual const word & U() const
Return const reference to the name of velocity field.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Base class for writing single files from the function objects.
Definition: writeFile.H:112
virtual void write(const bool log)=0
Write data to stream and files.
const dictionary & coeffs_
Dictionary containing coefficients specific to the chosen model.
Namespace for OpenFOAM.