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 // ************************************************************************* //
Foam::fv::option::correct
virtual void correct(volScalarField &field)
Definition: fvOption.C:299
volFields.H
Foam::fv::interRegionHeatTransferModel::nbrModel
const interRegionHeatTransferModel & nbrModel() const
Return const access to the neighbour model.
Definition: interRegionHeatTransferModelI.H:57
Foam::fv::interRegionHeatTransferModel::nbrRegionName
const word & nbrRegionName() const
Return const access to the neighbour region name.
Definition: interRegionHeatTransferModelI.H:29
interRegionHeatTransferModelI.H
Foam::fv::interRegionHeatTransferModel::correct
void correct()
Correct to calculate the inter-region heat transfer coefficient.
Definition: interRegionHeatTransferModel.C:87
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::interRegionHeatTransferModel::timeIndex_
label timeIndex_
Time index - used for updating htc.
Definition: interRegionHeatTransferModel.H:72
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
Foam::fv::interRegionHeatTransferModel::TName_
word TName_
Name of temperature field; default = "T".
Definition: interRegionHeatTransferModel.H:81
Foam::fv::interRegionHeatTransferModel
Base class for inter region heat exchange. The derived classes must provide the heat transfer coeffis...
Definition: interRegionHeatTransferModel.H:54
Foam::fv::interRegionHeatTransferModel::addSup
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldI)
Source term to energy equation.
Definition: interRegionHeatTransferModel.C:168
Foam::fv::interRegionHeatTransferModel::nbrModel_
interRegionHeatTransferModel * nbrModel_
Pointer to neighbour interRegionHeatTransferModel.
Definition: interRegionHeatTransferModel.H:66
Foam::label
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
Foam::meshToMesh
Class to calculate the cell-addressing between two overlapping meshes.
Definition: meshToMesh.H:61
Foam::fv::interRegionHeatTransferModel::TypeName
TypeName("interRegionHeatTransferModel")
Runtime type information.
Foam::Field< Type >
Foam::fv::interRegionOption
Base class for inter-region exchange.
Definition: interRegionOption.H:51
interRegionOption.H
Foam::fv::interRegionHeatTransferModel::calculateHtc
virtual void calculateHtc()=0
Calculate heat transfer coefficient.
Foam::fv::interRegionHeatTransferModel::nbrModelName_
word nbrModelName_
Name of the model in the neighbour mesh.
Definition: interRegionHeatTransferModel.H:63
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:108
Foam::fv::interRegionHeatTransferModel::htc
const volScalarField & htc() const
Return the heat transfer coefficient.
Definition: interRegionHeatTransferModelI.H:50
Foam::fv::interRegionHeatTransferModel::htc_
volScalarField htc_
Heat transfer coefficient [W/m2/k] times area/volume [1/m].
Definition: interRegionHeatTransferModel.H:75
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::interRegionHeatTransferModel::firstIter_
bool firstIter_
First iteration.
Definition: interRegionHeatTransferModel.H:69
Foam::fv::interRegionHeatTransferModel::setNbrModel
void setNbrModel()
Set the neighbour interRegionHeatTransferModel.
Definition: interRegionHeatTransferModel.C:46
Foam::fv::interRegionHeatTransferModel::TNbrName_
word TNbrName_
Name of neighbour temperature field; default = "T".
Definition: interRegionHeatTransferModel.H:84
rho
rho
Definition: pEqn.H:3
fv
labelList fv(nPoints)
interRegionHeatTransferModelTemplates.C
Foam::fv::interRegionHeatTransferModel::~interRegionHeatTransferModel
virtual ~interRegionHeatTransferModel()
Destructor.
Definition: interRegionHeatTransferModel.C:161
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
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 dictionary.
Definition: interRegionHeatTransferModelIO.C:30
Foam::fv::interRegionHeatTransferModel::meshInterp
const meshToMesh & meshInterp() const
Return const access to the mapToMap pointer.
Definition: interRegionHeatTransferModelI.H:36
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::fv::interRegionHeatTransferModel::semiImplicit_
bool semiImplicit_
Flag to activate semi-implicit coupling.
Definition: interRegionHeatTransferModel.H:78