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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::fv::interRegionHeatTransferModel
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
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 
43 Usage
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 
78 See also
79  - Foam::fv::constantHeatTransfer
80  - Foam::fv::tabulatedHeatTransfer
81  - Foam::fv::tabulatedNTUHeatTransfer
82  - Foam::fv::variableHeatTransfer
83 
84 SourceFiles
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 
98 namespace Foam
99 {
100 namespace fv
101 {
102 
103 /*---------------------------------------------------------------------------*\
104  Class interRegionHeatTransferModel Declaration
105 \*---------------------------------------------------------------------------*/
106 
107 class interRegionHeatTransferModel
108 :
109  public interRegionOption
110 {
111 protected:
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>
154  (
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
169  (
171  const Field<Type>& field,
172  Field<Type>& result
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 
184 public:
185 
186  //- Runtime type information
187  TypeName("interRegionHeatTransferModel");
188 
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 // ************************************************************************* //
Foam::fv::option::correct
virtual void correct(volScalarField &field)
Definition: fvOption.C:318
volFields.H
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::fv::interRegionHeatTransferModel::nbrRegionName
const word & nbrRegionName() const
Return const access to the neighbour region name.
Definition: interRegionHeatTransferModelI.H:32
interRegionHeatTransferModelI.H
Foam::fv::interRegionHeatTransferModel::correct
void correct()
Correct to calculate the inter-region heat transfer coefficient.
Definition: interRegionHeatTransferModel.C:90
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::interRegionHeatTransferModel::timeIndex_
label timeIndex_
Time index - used for updating htc.
Definition: interRegionHeatTransferModel.H:163
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fv::interRegionHeatTransferModel::TName_
word TName_
Name of operand temperature field.
Definition: interRegionHeatTransferModel.H:169
Foam::fv::interRegionHeatTransferModel
Intermediate class for handling inter-region heat exchanges.
Definition: interRegionHeatTransferModel.H:142
rho
rho
Definition: readInitialConditions.H:88
Foam::fv::interRegionHeatTransferModel::nbrModel_
interRegionHeatTransferModel * nbrModel_
Pointer to neighbour interRegionHeatTransferModel.
Definition: interRegionHeatTransferModel.H:154
Foam::meshToMesh
Class to calculate the cell-addressing between two overlapping meshes.
Definition: meshToMesh.H:64
Foam::fv::interRegionHeatTransferModel::TypeName
TypeName("interRegionHeatTransferModel")
Runtime type information.
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::fv::interRegionOption
Intermediate class for handling inter-region exchanges.
Definition: interRegionOption.H:107
interRegionOption.H
Foam::fv::interRegionHeatTransferModel::calculateHtc
virtual void calculateHtc()=0
Calculate heat transfer coefficient.
Foam::fv::interRegionHeatTransferModel::nbrModel
const interRegionHeatTransferModel & nbrModel() const
Return const access to the neighbour model.
Definition: interRegionHeatTransferModelI.H:60
Foam::fv::interRegionHeatTransferModel::nbrModelName_
word nbrModelName_
Name of the model in the neighbour mesh.
Definition: interRegionHeatTransferModel.H:151
Foam::fv::interRegionHeatTransferModel::interpolate
tmp< Field< Type > > interpolate(const interRegionHeatTransferModel &nbrModel, const Field< Type > &field) const
Interpolate field with nbrModel specified.
Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
interRegionHeatTransferModel(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from dictionary.
Definition: interRegionHeatTransferModel.C:111
Foam::fv::interRegionHeatTransferModel::htc
const volScalarField & htc() const
Return the heat transfer coefficient.
Definition: interRegionHeatTransferModelI.H:53
field
rDeltaTY field()
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::fv::interRegionHeatTransferModel::htc_
volScalarField htc_
Heat transfer coefficient [W/m2/k] times area/volume [1/m].
Definition: interRegionHeatTransferModel.H:166
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fv::interRegionHeatTransferModel::~interRegionHeatTransferModel
virtual ~interRegionHeatTransferModel()=default
Destructor.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::interRegionHeatTransferModel::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Source term to energy equation.
Definition: interRegionHeatTransferModel.C:159
Foam::fv::interRegionHeatTransferModel::firstIter_
bool firstIter_
Flag to determine the first iteration.
Definition: interRegionHeatTransferModel.H:157
Foam::fv::interRegionHeatTransferModel::setNbrModel
void setNbrModel()
Set the neighbour interRegionHeatTransferModel.
Definition: interRegionHeatTransferModel.C:49
Foam::fv::interRegionHeatTransferModel::TNbrName_
word TNbrName_
Name of operand neighbour temperature field.
Definition: interRegionHeatTransferModel.H:172
fv
labelList fv(nPoints)
interRegionHeatTransferModelTemplates.C
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fv::interRegionHeatTransferModel::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: interRegionHeatTransferModel.C:264
Foam::fv::interRegionHeatTransferModel::meshInterp
const meshToMesh & meshInterp() const
Return const access to the mapToMap pointer.
Definition: interRegionHeatTransferModelI.H:39
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::interRegionHeatTransferModel::semiImplicit_
bool semiImplicit_
Flag to activate semi-implicit coupling.
Definition: interRegionHeatTransferModel.H:160