interRegionHeatTransferModel.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::fv::interRegionHeatTransferModel
29
30Group
31 grpFvOptionsSources
32
33Description
34 Intermediate class for handling inter-region heat exchanges.
35
36 The derived classes must provide the heat transfer
37 coefficients (htc) which is used as follows in the energy equation.
38
39 \f[
40 -htc*Tmapped + Sp(htc, T)
41 \f]
42
43Usage
44 Minimal example by using \c constant/fvOptions:
45 \verbatim
46 <userDefinedName1>
47 {
48 // Mandatory/Optional (inherited) entries
49 ...
50
51 // Mandatory entries (unmodifiable)
52 fields (<field1> <field2> ... <fieldN>);
53 nbrModel <nbrModelName>;
54 semiImplicit true;
55
56 // Optional entries (unmodifiable)
57 T <Tname>;
58 Tnbr <TnbrName>;
59
60 // Mandatory/Optional (derived) entries
61 ...
62 }
63 \endverbatim
64
65 where the entries mean:
66 \table
67 Property | Description | Type | Reqd | Dflt
68 nbrModel | Name of the model in the neighbour mesh | word | yes | -
69 fields | Names of operand fields | wordList | yes | -
70 semiImplicit | Flag to activate semi-implicit coupling | bool | yes | -
71 T | Name of operand temperature field | word | no | T
72 Tnbr | Name of operand neighbour temperature field | word | no | T
73 \endtable
74
75 The inherited entries are elaborated in:
76 - \link interRegionOption.H \endlink
77
78See also
79 - Foam::fv::constantHeatTransfer
80 - Foam::fv::tabulatedHeatTransfer
81 - Foam::fv::tabulatedNTUHeatTransfer
82 - Foam::fv::variableHeatTransfer
83
84SourceFiles
85 interRegionHeatTransferModel.C
86 interRegionHeatTransferModelTemplates.C
87
88\*---------------------------------------------------------------------------*/
89
90#ifndef interRegionHeatTransferModel_H
91#define interRegionHeatTransferModel_H
92
93#include "interRegionOption.H"
94#include "volFields.H"
95
96// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97
98namespace Foam
99{
100namespace fv
101{
102
103/*---------------------------------------------------------------------------*\
104 Class interRegionHeatTransferModel Declaration
105\*---------------------------------------------------------------------------*/
106
107class interRegionHeatTransferModel
108:
109 public interRegionOption
110{
111protected:
112
113 // Protected Data
114
115 //- Name of the model in the neighbour mesh
116 word nbrModelName_;
117
118 //- Pointer to neighbour interRegionHeatTransferModel
120
121 //- Flag to determine the first iteration
122 bool firstIter_;
123
124 //- Flag to activate semi-implicit coupling
125 bool semiImplicit_;
126
127 //- Time index - used for updating htc
128 label timeIndex_;
129
130 //- Heat transfer coefficient [W/m2/k] times area/volume [1/m]
132
133 //- Name of operand temperature field
134 word TName_;
135
136 //- Name of operand neighbour temperature field
137 word TNbrName_;
138
139
140 // Protected Member Functions
141
142 //- Set the neighbour interRegionHeatTransferModel
143 void setNbrModel();
144
145 //- Inherit correct from interRegionOption
147
148 //- Correct to calculate the inter-region heat transfer coefficient
149 void correct();
150
151 //- Interpolate field with nbrModel specified
152 template<class Type>
156 const Field<Type>& field
157 ) const;
158
159 //- Interpolate field without nbrModel specified
160 template<class Type>
162 (
164 ) const;
165
166 //- Interpolate field with nbrModel specified
167 template<class Type>
168 void interpolate
171 const Field<Type>& field,
173 ) const;
174
175 //- Interpolate field without nbrModel specified
176 template<class Type>
177 void interpolate
178 (
179 const Field<Type>& field,
180 Field<Type>& result
181 ) const;
182
183
184public:
185
186 //- Runtime type information
187 TypeName("interRegionHeatTransferModel");
189
190 // Constructors
191
192 //- Construct from dictionary
194 (
195 const word& name,
196 const word& modelType,
197 const dictionary& dict,
198 const fvMesh& mesh
199 );
200
201
202 //- Destructor
203 virtual ~interRegionHeatTransferModel() = default;
204
205
206 // Member Functions
207
208 // Access
209
210 //- Return const access to the neighbour region name
211 inline const word& nbrRegionName() const;
212
213 //- Return const access to the mapToMap pointer
214 inline const meshToMesh& meshInterp() const;
215
216 //- Return the heat transfer coefficient
217 inline const volScalarField& htc() const;
218
219 //- Return const access to the neighbour model
220 inline const interRegionHeatTransferModel& nbrModel() const;
221
222 //- Return access to the neighbour model
224
225 //- Source term to energy equation
226 virtual void addSup
227 (
228 fvMatrix<scalar>& eqn,
229 const label fieldi
230 );
231
232 //- Source term to compressible energy equation
233 virtual void addSup
234 (
235 const volScalarField& rho,
236 fvMatrix<scalar>& eqn,
237 const label fieldi
238 );
239
240 //- Calculate heat transfer coefficient
241 virtual void calculateHtc() = 0;
242
243
244 // IO
245
246 //- Read source dictionary
247 virtual bool read(const dictionary& dict);
248};
249
250
251// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252
253} // End namespace fv
254} // End namespace Foam
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262#ifdef NoRepository
264#endif
265
266// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267
268#endif
269
270// ************************************************************************* //
Generic templated field type.
Definition: Field.H:82
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Intermediate class for handling inter-region heat exchanges.
tmp< Field< Type > > interpolate(const interRegionHeatTransferModel &nbrModel, const Field< Type > &field) const
Interpolate field with nbrModel specified.
void correct()
Correct to calculate the inter-region heat transfer coefficient.
word TNbrName_
Name of operand neighbour temperature field.
void setNbrModel()
Set the neighbour interRegionHeatTransferModel.
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Source term to energy equation.
virtual bool read(const dictionary &dict)
Read source dictionary.
interRegionHeatTransferModel(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from dictionary.
volScalarField htc_
Heat transfer coefficient [W/m2/k] times area/volume [1/m].
virtual void calculateHtc()=0
Calculate heat transfer coefficient.
const interRegionHeatTransferModel & nbrModel() const
Return const access to the neighbour model.
const word & nbrRegionName() const
Return const access to the neighbour region name.
word nbrModelName_
Name of the model in the neighbour mesh.
virtual ~interRegionHeatTransferModel()=default
Destructor.
const volScalarField & htc() const
Return the heat transfer coefficient.
tmp< Field< Type > > interpolate(const Field< Type > &field) const
Interpolate field without nbrModel specified.
interRegionHeatTransferModel * nbrModel_
Pointer to neighbour interRegionHeatTransferModel.
TypeName("interRegionHeatTransferModel")
Runtime type information.
word TName_
Name of operand temperature field.
label timeIndex_
Time index - used for updating htc.
const meshToMesh & meshInterp() const
Return const access to the mapToMap pointer.
bool semiImplicit_
Flag to activate semi-implicit coupling.
bool firstIter_
Flag to determine the first iteration.
Intermediate class for handling inter-region exchanges.
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Class to calculate the cell-addressing between two overlapping meshes.
Definition: meshToMesh.H:65
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
labelList fv(nPoints)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73