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 | Copyright (C) 2011-2015 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::interRegionHeatTransferModel
26 
27 Description
28  Base class for inter region heat exchange. The derived classes must
29  provide the heat transfer coeffisine (htc) which is used as follows
30  in the energy equation.
31 
32  \f[
33  -htc*Tmapped + Sp(htc, T)
34  \f]
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef interRegionHeatTransferModel_H
39 #define interRegionHeatTransferModel_H
40 
41 #include "interRegionOption.H"
42 #include "volFields.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 namespace fv
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class interRegionHeatTransferModel Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public interRegionOption
58 {
59 protected:
60 
61  // Protected data
62 
63  //- Name of the model in the neighbour mesh
65 
66  //- Pointer to neighbour interRegionHeatTransferModel
68 
69  //- First iteration
70  bool firstIter_;
71 
72  //- Time index - used for updating htc
74 
75  //- Heat transfer coefficient [W/m2/k] times area/volume [1/m]
77 
78  //- Flag to activate semi-implicit coupling
79  bool semiImplicit_;
80 
81  //- Name of temperature field; default = "T"
82  word TName_;
83 
84  //- Name of neighbour temperature field; default = "T"
86 
87 
88  // Protected member functions
89 
90  //- Set the neighbour interRegionHeatTransferModel
91  void setNbrModel();
92 
93  //- Inherit correct from interRegionOption
95 
96  //- Correct to calculate the inter-region heat transfer coefficient
97  void correct();
98 
99  //- Interpolate field with nbrModel specified
100  template<class Type>
102  (
104  const Field<Type>& field
105  ) const;
106 
107  //- Interpolate field without nbrModel specified
108  template<class Type>
110  (
111  const Field<Type>& field
112  ) const;
113 
114  //- Interpolate field with nbrModel specified
115  template<class Type>
116  void interpolate
117  (
119  const Field<Type>& field,
120  Field<Type>& result
121  ) const;
122 
123  //- Interpolate field without nbrModel specified
124  template<class Type>
125  void interpolate
126  (
127  const Field<Type>& field,
128  Field<Type>& result
129  ) const;
130 
131 
132 public:
133 
134  //- Runtime type information
135  TypeName("interRegionHeatTransferModel");
136 
137 
138  // Constructors
139 
140  //- Construct from dictionary
142  (
143  const word& name,
144  const word& modelType,
145  const dictionary& dict,
146  const fvMesh& mesh
147  );
148 
149 
150  //- Destructor
152 
153 
154  // Member Functions
155 
156  // Access
157 
158  //- Return const access to the neighbour region name
159  inline const word& nbrRegionName() const;
160 
161  //- Return const access to the mapToMap pointer
162  inline const meshToMesh& meshInterp() const;
163 
164  //- Return the heat transfer coefficient
165  inline const volScalarField& htc() const;
166 
167  //- Return const access to the neighbour model
168  inline const interRegionHeatTransferModel& nbrModel() const;
169 
170  //- Return access to the neighbour model
172 
173  //- Source term to energy equation
174  virtual void addSup
175  (
176  fvMatrix<scalar>& eqn,
177  const label fieldI
178  );
179 
180  //- Source term to compressible energy equation
181  virtual void addSup
182  (
183  const volScalarField& rho,
184  fvMatrix<scalar>& eqn,
185  const label fieldI
186  );
187 
188  //- Calculate heat transfer coefficient
189  virtual void calculateHtc() = 0;
190 
191 
192  // IO
193 
194  //- Read dictionary
195  virtual bool read(const dictionary& dict);
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace fv
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #ifdef NoRepository
212 #endif
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
volScalarField htc_
Heat transfer coefficient [W/m2/k] times area/volume [1/m].
tmp< Field< Type > > interpolate(const interRegionHeatTransferModel &nbrModel, const Field< Type > &field) const
Interpolate field with nbrModel specified.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
interRegionHeatTransferModel * nbrModel_
Pointer to neighbour interRegionHeatTransferModel.
interRegionHeatTransferModel(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from dictionary.
TypeName("interRegionHeatTransferModel")
Runtime type information.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void calculateHtc()=0
Calculate heat transfer coefficient.
word TNbrName_
Name of neighbour temperature field; default = "T".
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldI)
Source term to energy equation.
A class for handling words, derived from string.
Definition: word.H:59
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
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:68
const interRegionHeatTransferModel & nbrModel() const
Return const access to the neighbour model.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
label timeIndex_
Time index - used for updating htc.
Base class for inter-region exchange.
dictionary dict
virtual void correct(volScalarField &field)
Definition: fvOption.C:301
word TName_
Name of temperature field; default = "T".
void setNbrModel()
Set the neighbour interRegionHeatTransferModel.
const volScalarField & htc() const
Return the heat transfer coefficient.
bool semiImplicit_
Flag to activate semi-implicit coupling.
Pre-declare SubField and related Field type.
Definition: Field.H:57
const meshToMesh & meshInterp() const
Return const access to the mapToMap pointer.
void correct()
Correct to calculate the inter-region heat transfer coefficient.
labelList fv(nPoints)
const word & nbrRegionName() const
Return const access to the neighbour region name.
Base class for inter region heat exchange. The derived classes must provide the heat transfer coeffis...
word nbrModelName_
Name of the model in the neighbour mesh.
A class for managing temporary objects.
Definition: PtrList.H:118
Class to calculate the cell-addressing between two overlapping meshes.
Definition: meshToMesh.H:60