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-2024 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  inline void add
128  (
129  const AlphaFieldType& alpha,
130  fvMatrix<scalar>& eqn
131  ) const;
132 
133 
134 public:
135 
136  //- Runtime type information
137  TypeName("heatTransfer");
138 
139 
140  // Constructors
141 
142  //- Construct from dictionary
144  (
145  const word& name,
146  const word& modelType,
147  const fvMesh& mesh,
148  const dictionary& dict
149  );
150 
151 
152  //- Destructor
153  virtual ~heatTransfer();
154 
155 
156  // Member Functions
157 
158  // Checks
159 
160  //- Return the list of fields for which the fvModel adds source term
161  // to the transport equation
162  virtual wordList addSupFields() const;
163 
164 
165  // Sources
166 
167  //- Source term to energy equation
168  virtual void addSup
169  (
170  const volScalarField& he,
171  fvMatrix<scalar>& eqn
172  ) const;
173 
174  //- Source term to compressible energy equation
175  virtual void addSup
176  (
177  const volScalarField& rho,
178  const volScalarField& he,
179  fvMatrix<scalar>& eqn
180  ) const;
181 
182  //- Source term to phase energy equation
183  virtual void addSup
184  (
185  const volScalarField& alpha,
186  const volScalarField& rho,
187  const volScalarField& he,
188  fvMatrix<scalar>& eqn
189  ) const;
190 
191 
192  // Correction
193 
194  //- Correct the model
195  virtual void correct();
196 
197 
198  // Mesh changes
199 
200  //- Update for mesh motion
201  virtual bool movePoints();
202 
203  //- Update topology using the given map
204  virtual void topoChange(const polyTopoChangeMap&);
205 
206  //- Update from another mesh using the given map
207  virtual void mapMesh(const polyMeshMap&);
208 
209  //- Redistribute or update using the given distribution map
210  virtual void distribute(const polyDistributionMap&);
211 
212 
213  // IO
214 
215  //- Read dictionary
216  virtual bool read(const dictionary& dict);
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace fv
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
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:162
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:99
Finite volume model abstract base class.
Definition: fvModel.H:59
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
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:201
virtual ~heatTransfer()
Destructor.
Definition: heatTransfer.C:144
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: heatTransfer.C:150
TypeName("heatTransfer")
Runtime type information.
virtual void correct()
Correct the model.
Definition: heatTransfer.C:195
virtual void addSup(const volScalarField &he, fvMatrix< scalar > &eqn) const
Source term to energy equation.
Definition: heatTransfer.C:163
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: heatTransfer.C:208
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: heatTransfer.C:220
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: heatTransfer.C:226
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: heatTransfer.C:214
heatTransfer(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: heatTransfer.C:122
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.
thermo he()
labelList fv(nPoints)
dictionary dict