referenceTemperature.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 Class
27  Foam::heatExchangerModels::referenceTemperature
28 
29 Description
30  A heat exchanger model where heat exchange
31  is calculated via a temperature table.
32 
33 Usage
34  Minimal example by using \c constant/fvOptions:
35  \verbatim
36  <name>
37  {
38  // Inherited entries
39  ...
40 
41  // Mandatory entries
42  model referenceTemperature;
43  targetQdot <Function1<scalar>>;
44 
45  // Conditional mandatory entries
46 
47  // Option-1
48  Tref <scalar>;
49 
50  // Option-2
51  file "<word>";
52  }
53  \endverbatim
54 
55  where the entries mean:
56  \table
57  Property | Description | Type | Reqd | Deflt
58  model | Model name:effectivenessTable | word | yes | -
59  targetQdot | Target heat rejection [J/s] <!--
60  --> | Function1<scalar> | yes | -
61  Tref | Reference temperature [K] | scalar | choice | -
62  file | 2D reference temperature table = function of primary <!--
63  --> mass flow rate [kg/s] and primary flow temperature <!--
64  --> | file | choice | -
65  \endtable
66 
67  The inherited entries are elaborated in:
68  - \link heatExchangerSource.H \endlink
69  - \link interpolation2DTable.H \endlink
70 
71 SourceFiles
72  referenceTemperature.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef Foam_heatExchangerModels_referenceTemperature_H
77 #define Foam_heatExchangerModels_referenceTemperature_H
78 
79 #include "heatExchangerModel.H"
80 #include "interpolation2DTable.H"
81 #include "Function1.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 namespace heatExchangerModels
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class referenceTemperature Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class referenceTemperature
95 :
96  public heatExchangerModel
97 {
98  // Private Data
99 
100  //- Target heat rejection [J/s]
101  autoPtr<Function1<scalar>> targetQdotPtr_;
102 
103  //- 2D reference temperature table
104  //- Function of primary mass flow rate [kg/s]
105  //- and primary flow temperature [K]
106  autoPtr<interpolation2DTable<scalar>> TrefTablePtr_;
107 
108  //- Net mass flux [kg/s]
109  scalar sumPhi_;
110 
111  //- Total heat exchange [J/s]
112  scalar Qt_;
113 
114  //- Reference temperature [K]
115  scalar Tref_;
116 
117 
118  // Private Member Functions
119 
120  // Evaluation
121 
122  //- Return primary-flow net mass flux
123  scalar primaryNetMassFlux() const;
124 
125  //- Return primary-flow inlet temperature
126  scalar primaryInletTemperature() const;
127 
128  //- Return temperature differences
129  scalarField temperatureDifferences(const labelList& cells) const;
130 
131  //- Return interim weights
132  scalar weight
133  (
134  const labelList& cells,
135  const scalarField& deltaTCells
136  ) const;
137 
138 
139  // I-O
140 
141  //- Write file header information
142  void writeFileHeader(Ostream& os) const;
143 
144 
145 public:
146 
147  //- Runtime type information
148  TypeName("referenceTemperature");
149 
150 
151  // Constructors
152 
153  //- Construct from components
155  (
156  const fvMesh& mesh,
157  const word& name,
158  const dictionary& coeffs
159  );
160 
161  //- No copy construct
163 
164  //- No copy assignment
165  void operator=(const referenceTemperature&) = delete;
166 
167 
168  //- Destructor
169  virtual ~referenceTemperature() = default;
170 
171 
172  // Member Functions
173 
174  // Evaluation
175 
176  //- Initialise data members of the model
177  virtual void initialise();
178 
179  //- Return energy density per unit length [J/m3/m]
181 
182 
183  // I-O
184 
185  //- Read top-level dictionary
186  virtual bool read(const dictionary& dict);
187 
188  //- Write data to stream and files
189  virtual void write(const bool log);
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace heatExchangerModels
196 } // End namespace Foam
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #endif
201 
202 // ************************************************************************* //
dictionary dict
dimensionedScalar log(const dimensionedScalar &ds)
A heat exchanger model where heat exchange is calculated via a temperature table. ...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
void operator=(const referenceTemperature &)=delete
No copy assignment.
virtual ~referenceTemperature()=default
Destructor.
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
TypeName("referenceTemperature")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition: word.H:63
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
virtual bool read(const dictionary &dict)
Read top-level dictionary.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual void write(const bool log)
Write data to stream and files.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void initialise()
Initialise data members of the model.
referenceTemperature(const fvMesh &mesh, const word &name, const dictionary &coeffs)
Construct from components.
virtual tmp< scalarField > energyDensity(const labelList &cells)
Return energy density per unit length [J/m3/m].
Namespace for OpenFOAM.