function2.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) 2011-2021 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::heatTransferModels::function2
26 
27 Description
28  Function2 heat transfer model. The 2D function returns the heat transfer
29  coefficient as a function of the local and neighbouring velocity
30  magnitudes. An area-per-unit-volume [1/m] field (AoV) must be provided in
31  constant.
32 
33 Usage
34  Example usage:
35  \verbatim
36  {
37  type function2;
38 
39  AoV 1e3;
40 
41  htcFunc
42  {
43  type constant;
44  value 1e5;
45  }
46  }
47  \endverbatim
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef function2_H
52 #define function2_H
53 
54 #include "heatTransferModel.H"
55 #include "Function2.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 namespace fv
62 {
63 namespace heatTransferModels
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class function2 Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class function2
71 :
72  public heatTransferModel
73 {
74  // Private Data
75 
76  //- Reference to the inter region model
77  const interRegionModel& model_;
78 
79  //- Name of velocity field; default = U
80  word UName_;
81 
82  //- Name of neighbour velocity field; default = U
83  word UNbrName_;
84 
85  //- Heat transfer coefficient function ptr
86  autoPtr<Function2<scalar>> htcFunc_;
87 
88  //- Heat transfer coefficient [W/m^2/K]
89  volScalarField htc_;
90 
91 
92  // Private Member Functions
93 
94  //- Non-virtual read
95  void readCoeffs();
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("function2");
102 
103 
104  // Constructors
105 
106  //- Construct from dictionary and model
107  function2(const dictionary& dict, const interRegionModel& model);
108 
109 
110  //- Destructor
111  virtual ~function2();
112 
113 
114  // Member Functions
115 
116  //- Get the heat transfer coefficient
117  virtual tmp<volScalarField> htc() const
118  {
119  return htc_;
120  }
121 
122  //- Correct the heat transfer coefficient
123  virtual void correct();
124 
125  //- Read dictionary
126  virtual bool read(const dictionary& dict);
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace heatTransferModels
133 } // End namespace fv
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
virtual ~function2()
Destructor.
Definition: function2.C:90
dictionary dict
virtual tmp< volScalarField > htc() const
Get the heat transfer coefficient.
Definition: function2.H:116
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Base class for heat transfer coefficient modelling used in heat transfer fvModels. Area per unit volume [1/m] (AoV) must be provided as a value in the coefficients dictionary or as a field in constant.
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: function2.C:113
Base class for inter-region exchange.
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
TypeName("function2")
Runtime type information.
virtual void correct()
Correct the heat transfer coefficient.
Definition: function2.C:96
function2(const dictionary &dict, const interRegionModel &model)
Construct from dictionary and model.
Definition: function2.C:59
Function2 heat transfer model. The 2D function returns the heat transfer coefficient as a function of...
Definition: function2.H:69
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.