heatTransfer.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2023 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::heatTransfer
26 
27 Description
28  Model for heat exchange. Requires specification of an ambient temperature
29  with which to exchange heat, and a model for the heat transfer coefficient
30  (htc) and the area per unit volume (Av). These are then used to apply the
31  following source to the energy equation:
32 
33  \f[
34  -htc*Av*(T_a - T)
35  \f]
36 
37  If the semiImplicit option is set, then this becomes:
38 
39  \f[
40  -htc*Av*(T_a - T) + htc*Av/Cp*h - Sp(htc*Av/Cp, h);
41  \f]
42 
43 Usage
44  Example usage:
45  \verbatim
46  heatTransfer
47  {
48  type heatTransfer;
49 
50  select cellSet;
51  cellSet c0;
52 
53  semiImplicit no;
54 
55  Ta 300;
56 
57  Av 200;
58 
59  heatTransferCoefficientModel constant;
60 
61  htc 10;
62  }
63  \endverbatim
64 
65 See also
66  Foam::fv::heatTransferCoefficientModel
67 
68 SourceFiles
69  heatTransfer.C
70 
71 \*---------------------------------------------------------------------------*/
72 
73 #ifndef heatTransfer_H
74 #define heatTransfer_H
75 
76 #include "fvModel.H"
77 #include "fvCellSet.H"
79 #include "heatTransferAv.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 namespace fv
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class heatTransfer Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class heatTransfer
93 :
94  public fvModel
95 {
96  // Private data
97 
98  //- The set of cells the model applies to
99  fvCellSet set_;
100 
101  //- Name of the phase
102  word phaseName_;
103 
104  //- Flag to activate semi-implicit coupling
105  bool semiImplicit_;
106 
107  //- Name of temperature field; default = "T"
108  word TName_;
109 
110  //- Ambient temperature
111  dimensionedScalar Ta_;
112 
113  //- The heat transfer area per unit volume
114  autoPtr<heatTransferAv> heatTransferAv_;
115 
116  //- The heat transfer model
117  autoPtr<heatTransferCoefficientModel> heatTransferCoefficientModel_;
118 
119 
120  // Private member functions
121 
122  //- Non-virtual read
123  void readCoeffs();
124 
125  //- Source term to energy equation
126  template<class AlphaFieldType>
127  void add
128  (
129  const AlphaFieldType& alpha,
130  fvMatrix<scalar>& eqn,
131  const word& fieldName
132  ) const;
133 
134 
135 public:
136 
137  //- Runtime type information
138  TypeName("heatTransfer");
139 
140 
141  // Constructors
142 
143  //- Construct from dictionary
145  (
146  const word& name,
147  const word& modelType,
148  const fvMesh& mesh,
149  const dictionary& dict
150  );
151 
152 
153  //- Destructor
154  virtual ~heatTransfer();
155 
156 
157  // Member Functions
158 
159  // Checks
160 
161  //- Return the list of fields for which the fvModel adds source term
162  // to the transport equation
163  virtual wordList addSupFields() const;
164 
165 
166  // Sources
167 
168  //- Source term to energy equation
169  virtual void addSup
170  (
171  fvMatrix<scalar>& eqn,
172  const word& fieldName
173  ) const;
174 
175  //- Source term to compressible energy equation
176  virtual void addSup
177  (
178  const volScalarField& rho,
179  fvMatrix<scalar>& eqn,
180  const word& fieldName
181  ) const;
182 
183  //- Source term to phase energy equation
184  virtual void addSup
185  (
186  const volScalarField& alpha,
187  const volScalarField& rho,
188  fvMatrix<scalar>& eqn,
189  const word& fieldName
190  ) const;
191 
192 
193  // Correction
194 
195  //- Correct the model
196  virtual void correct();
197 
198 
199  // Mesh changes
200 
201  //- Update for mesh motion
202  virtual bool movePoints();
203 
204  //- Update topology using the given map
205  virtual void topoChange(const polyTopoChangeMap&);
206 
207  //- Update from another mesh using the given map
208  virtual void mapMesh(const polyMeshMap&);
209 
210  //- Redistribute or update using the given distribution map
211  virtual void distribute(const polyDistributionMap&);
212 
213 
214  // IO
215 
216  //- Read dictionary
217  virtual bool read(const dictionary& dict);
218 };
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace fv
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
General run-time selected cell set selection class for fvMesh.
Definition: fvCellSet.H:88
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
Model for heat exchange. Requires specification of an ambient temperature with which to exchange heat...
Definition: heatTransfer.H:94
virtual bool movePoints()
Update for mesh motion.
Definition: heatTransfer.C:202
virtual ~heatTransfer()
Destructor.
Definition: heatTransfer.C:145
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: heatTransfer.C:151
TypeName("heatTransfer")
Runtime type information.
virtual void correct()
Correct the model.
Definition: heatTransfer.C:196
virtual void addSup(fvMatrix< scalar > &eqn, const word &fieldName) const
Source term to energy equation.
Definition: heatTransfer.C:164
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: heatTransfer.C:209
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: heatTransfer.C:221
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: heatTransfer.C:227
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: heatTransfer.C:215
heatTransfer(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: heatTransfer.C:123
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict