externalTemperatureFvPatchScalarField.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-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::externalTemperatureFvPatchScalarField
26 
27 Description
28  This boundary condition applies a heat flux condition to temperature
29  on an external wall. Heat flux can be specified in the following ways:
30 
31  - fixed power: supply Q
32  - fixed heat flux: supply q
33  - fixed heat transfer coefficient: supply h and Ta
34 
35  where:
36  \vartable
37  Q | Power [W]
38  q | Heat flux [W/m^2]
39  h | Heat transfer coefficient [W/m^2/K]
40  Ta | Ambient temperature [K]
41  \endvartable
42 
43  If more than one parameter is given then the heat fluxes are summed.
44 
45  If a heat transfer coefficient is given optional thin thermal layer
46  resistances can be specified through thicknessLayers and kappaLayers
47  entries.
48 
49  The patch thermal conductivity \c kappa is obtained from the region
50  thermophysicalTransportModel so that this boundary condition can be applied
51  directly to either fluid or solid regions.
52 
53  The ambient temperature Ta is specified as a Foam::Function1 of time but
54  uniform is space.
55 
56 Usage
57  \table
58  Property | Description | Required | Default value
59  Q | Power [W] | no | 0
60  q | Heat flux [W/m^2] | no | 0
61  h | Heat transfer coefficient [W/m^2/K] | no | 0
62  Ta | Ambient temperature [K] | if h is given |
63  thicknessLayers | Layer thicknesses [m] | no |
64  kappaLayers | Layer thermal conductivities [W/m/K] | no |
65  relaxation | Relaxation for the wall temperature | no | 1
66  emissivity | Surface emissivity for radiative flux to ambient | no | 0
67  qr | Name of the radiative field | no | none
68  qrRelaxation | Relaxation factor for radiative field | no | 1
69  \endtable
70 
71  Example of the boundary condition specification:
72  \verbatim
73  <patchName>
74  {
75  type externalTemperature;
76 
77  Ta constant 300.0;
78  h uniform 10.0;
79  thicknessLayers (0.1 0.2 0.3 0.4);
80  kappaLayers (1 2 3 4);
81 
82  value $internalField;
83  }
84  \endverbatim
85 
86 See also
87  Foam::patchKappa
88  Foam::mixedFvPatchScalarField
89 
90 SourceFiles
91  externalTemperatureFvPatchScalarField.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef externalTemperatureFvPatchScalarField_H
96 #define externalTemperatureFvPatchScalarField_H
97 
98 #include "mixedFvPatchFields.H"
99 #include "Function1.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 
106 /*---------------------------------------------------------------------------*\
107  Class externalTemperatureFvPatchScalarField Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 class externalTemperatureFvPatchScalarField
111 :
112  public mixedFvPatchScalarField
113 {
114  // Private Data
115 
116  // Heat power
117 
118  //- Do we have a heat power?
119  bool haveQ_;
120 
121  //- Heat power [W]
122  scalar Q_;
123 
124 
125  // Heat flux
126 
127  //- Do we have a heat flux?
128  bool haveq_;
129 
130  //- Heat flux [W/m^2]
131  scalarField q_;
132 
133 
134  // Heat transfer coefficient
135 
136  //- Do we have a heat transfer coefficient?
137  bool haveh_;
138 
139  //- Heat transfer coefficient [W/m^2K]
140  scalarField h_;
141 
142  //- Ambient temperature [K]
143  autoPtr<Function1<scalar>> Ta_;
144 
145  //- Optional surface emissivity for radiative transfer to ambient
146  scalar emissivity_;
147 
148  //- Thickness of layers
149  scalarList thicknessLayers_;
150 
151  //- Conductivity of layers
152  scalarList kappaLayers_;
153 
154 
155  //- Relaxation for the wall temperature (thermal inertia)
156  scalar relaxation_;
157 
158 
159  // Radiation
160 
161  //- Name of the radiative heat flux
162  const word qrName_;
163 
164  //- Relaxation for qr
165  scalar qrRelaxation_;
166 
167  //- Cache qr for relaxation
168  scalarField qrPrevious_;
169 
170 
171 public:
172 
173  //- Runtime type information
174  TypeName("externalTemperature");
175 
176 
177  // Constructors
178 
179  //- Construct from patch, internal field and dictionary
181  (
182  const fvPatch&,
184  const dictionary&
185  );
186 
187  //- Construct by mapping given
188  // externalTemperatureFvPatchScalarField
189  // onto a new patch
191  (
193  const fvPatch&,
195  const fvPatchFieldMapper&
196  );
197 
198  //- Disallow copy without setting internal field reference
200  (
202  ) = delete;
203 
204  //- Copy constructor setting internal field reference
206  (
209  );
210 
211  //- Construct and return a clone setting internal field reference
213  (
215  ) const
216  {
218  (
220  );
221  }
222 
223 
224  // Member Functions
225 
226  // Access
227 
228  //- Allow manipulation of the boundary values
229  virtual bool fixesValue() const
230  {
231  return false;
232  }
233 
234 
235  // Mapping functions
236 
237  //- Map the given fvPatchField onto this fvPatchField
238  virtual void map
239  (
240  const fvPatchScalarField&,
241  const fvPatchFieldMapper&
242  );
243 
244  //- Reset the fvPatchField to the given fvPatchField
245  // Used for mesh to mesh mapping
246  virtual void reset(const fvPatchScalarField&);
247 
248 
249  // Evaluation functions
250 
251  //- Update the coefficients associated with the patch field
252  virtual void updateCoeffs();
253 
254 
255  // I-O
256 
257  //- Write
258  void write(Ostream&) const;
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #endif
269 
270 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
This boundary condition applies a heat flux condition to temperature on an external wall....
virtual bool fixesValue() const
Allow manipulation of the boundary values.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("externalTemperature")
Runtime type information.
virtual void map(const fvPatchScalarField &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
externalTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
List< scalar > scalarList
A List of scalars.
Definition: scalarList.H:50
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
fvPatchField< scalar > fvPatchScalarField