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: requires \c Q
32  - Fixed heat flux: requires \c q
33  - Fixed heat transfer coefficient: requires \c h and \c Ta
34 
35  where:
36  \vartable
37  Q | Power Function1 of time [W]
38  q | Heat flux Function1 of time [W/m^2]
39  h | Heat transfer coefficient Function1 of time [W/m^2/K]
40  Ta | Ambient temperature Function1 of time [K]
41  \endvartable
42 
43  Only one of \c Q or \c q may be specified, if \c h and \c Ta are also
44  specified the corresponding heat-flux is added.
45 
46  If the heat transfer coefficient \c h is specified an optional thin thermal
47  layer resistances can also be specified through thicknessLayers and
48  kappaLayers entries.
49 
50  The patch thermal conductivity \c kappa is obtained from the region
51  thermophysicalTransportModel so that this boundary condition can be applied
52  directly to either fluid or solid regions.
53 
54 Usage
55  \table
56  Property | Description | Required | Default value
57  Q | Power [W] | no |
58  q | Heat flux [W/m^2] | no |
59  h | Heat transfer coefficient [W/m^2/K] | no |
60  Ta | Ambient temperature [K] | if h is given |
61  thicknessLayers | Layer thicknesses [m] | no |
62  kappaLayers | Layer thermal conductivities [W/m/K] | no |
63  relaxation | Relaxation for the wall temperature | no | 1
64  emissivity | Surface emissivity for radiative flux to ambient | no | 0
65  qr | Name of the radiative field | no | none
66  qrRelaxation | Relaxation factor for radiative field | no | 1
67  \endtable
68 
69  Example of the boundary condition specification:
70  \verbatim
71  <patchName>
72  {
73  type externalTemperature;
74 
75  Ta constant 300.0;
76  h uniform 10.0;
77  thicknessLayers (0.1 0.2 0.3 0.4);
78  kappaLayers (1 2 3 4);
79 
80  value $internalField;
81  }
82  \endverbatim
83 
84 See also
85  Foam::mixedFvPatchScalarField
86  Foam::Function1
87 
88 SourceFiles
89  externalTemperatureFvPatchScalarField.C
90 
91 \*---------------------------------------------------------------------------*/
92 
93 #ifndef externalTemperatureFvPatchScalarField_H
94 #define externalTemperatureFvPatchScalarField_H
95 
96 #include "mixedFvPatchFields.H"
97 #include "Function1.H"
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 namespace Foam
102 {
103 
104 /*---------------------------------------------------------------------------*\
105  Class externalTemperatureFvPatchScalarField Declaration
106 \*---------------------------------------------------------------------------*/
107 
108 class externalTemperatureFvPatchScalarField
109 :
110  public mixedFvPatchScalarField
111 {
112  // Private Data
113 
114  // Heat power
115 
116  //- Do we have a heat power?
117  bool haveQ_;
118 
119  //- Heat power [W]
120  autoPtr<Function1<scalar>> Q_;
121 
122 
123  // Heat flux
124 
125  //- Do we have a heat flux?
126  bool haveq_;
127 
128  //- Heat flux [W/m^2]
129  autoPtr<Function1<scalar>> q_;
130 
131 
132  // Heat transfer coefficient
133 
134  //- Do we have a heat transfer coefficient?
135  bool haveh_;
136 
137  //- Heat transfer coefficient [W/m^2K]
138  autoPtr<Function1<scalar>> h_;
139 
140  //- Ambient temperature [K]
141  autoPtr<Function1<scalar>> Ta_;
142 
143  //- Optional surface emissivity for radiative transfer to ambient
144  scalar emissivity_;
145 
146  //- Thickness of layers
147  scalarList thicknessLayers_;
148 
149  //- Conductivity of layers
150  scalarList kappaLayers_;
151 
152 
153  //- Relaxation factor for the wall temperature (thermal inertia)
154  scalar relax_;
155 
156 
157  // Radiation
158 
159  //- Name of the radiative heat flux
160  const word qrName_;
161 
162  //- Relaxation factor for qr
163  scalar qrRelax_;
164 
165  //- Cache qr for relaxation
166  scalarField qrPrevious_;
167 
168 
169 protected:
170 
171  // Protected Member Functions
172 
173  //- Get the patch kappa, kappa*Tc/delta, kappa/delta,
174  // reference T, current wall T and also the
175  // heat-flux/delta obtained from the sum heat-flux provided
176  virtual void getKappa
177  (
179  scalarField& sumKappaTByDelta,
180  scalarField& sumKappaByDelta,
181  scalarField& Tref,
182  scalarField& Tw,
183  scalarField& sumq,
184  scalarField& qByKappa
185  ) const;
186 
187 
188 public:
189 
190  //- Runtime type information
191  TypeName("externalTemperature");
192 
193 
194  // Constructors
195 
196  //- Construct from patch, internal field and dictionary
198  (
199  const fvPatch&,
201  const dictionary&
202  );
203 
204  //- Construct by mapping given
205  // externalTemperatureFvPatchScalarField
206  // onto a new patch
208  (
210  const fvPatch&,
212  const fieldMapper&
213  );
214 
215  //- Disallow copy without setting internal field reference
217  (
219  ) = delete;
220 
221  //- Copy constructor setting internal field reference
223  (
226  );
227 
228  //- Construct and return a clone setting internal field reference
230  (
232  ) const
233  {
235  (
237  );
238  }
239 
240 
241  // Member Functions
242 
243  // Access
244 
245  //- Disallow manipulation of the boundary values
246  // The boundary temperature is evaluated only by
247  // this boundary condition
248  virtual bool fixesValue() const
249  {
250  return true;
251  }
252 
253 
254  // Mapping functions
255 
256  //- Map the given fvPatchField onto this fvPatchField
257  virtual void map(const fvPatchScalarField&, const fieldMapper&);
258 
259  //- Reset the fvPatchField to the given fvPatchField
260  // Used for mesh to mesh mapping
261  virtual void reset(const fvPatchScalarField&);
262 
263 
264  // Evaluation functions
265 
266  //- Update the coefficients associated with the patch field
267  virtual void updateCoeffs();
268 
269 
270  // I-O
271 
272  //- Write
273  void write(Ostream&) const;
274 };
275 
276 
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 
279 } // End namespace Foam
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 #endif
284 
285 // ************************************************************************* //
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:162
This boundary condition applies a heat flux condition to temperature on an external wall....
virtual bool fixesValue() const
Disallow 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.
virtual void map(const fvPatchScalarField &, const fieldMapper &)
Map the given fvPatchField onto this fvPatchField.
TypeName("externalTemperature")
Runtime type information.
virtual void getKappa(scalarField &kappa, scalarField &sumKappaTByDelta, scalarField &sumKappaByDelta, scalarField &Tref, scalarField &Tw, scalarField &sumq, scalarField &qByKappa) const
Get the patch kappa, kappa*Tc/delta, kappa/delta,.
externalTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
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