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-2025 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  const bool haveh_;
136 
137  //- Heat transfer coefficient [W/m^2K]
138  autoPtr<Function1<scalar>> h_;
139 
140  //- Do we have an emissivity?
141  const bool haveEmissivity_;
142 
143  //- Optional surface emissivity for radiative transfer to ambient
144  scalar emissivity_;
145 
146  //- Do we have layers?
147  const bool haveLayers_;
148 
149  //- Thickness of layers
150  scalarList thicknessLayers_;
151 
152  //- Conductivity of layers
153  scalarList kappaLayers_;
154 
155  //- Ambient temperature [K]
156  autoPtr<Function1<scalar>> Ta_;
157 
158 
159  //- Relaxation factor for the wall temperature (thermal inertia)
160  scalar relax_;
161 
162 
163  // Radiation
164 
165  //- Name of the radiative heat flux
166  const word qrName_;
167 
168  //- Relaxation factor for qr
169  scalar qrRelax_;
170 
171  //- Cache qr for relaxation
172  scalarField qrPrevious_;
173 
174 
175 protected:
176 
177  // Protected Member Functions
178 
179  //- Plus-equals op for a tmp field. Will initialise the tmp if empty.
180  void plusEqOp(tmp<scalarField>& tf, const scalar d) const;
181 
182  //- Plus-equals op for a tmp field. Will initialise the tmp if empty.
183  void plusEqOp(tmp<scalarField>& tf, const tmp<scalarField>& tdf) const;
184 
185  //- Get the patch kappa, kappa*Tc/delta, kappa/delta,
186  // reference T, current wall T and also the
187  // heat-flux/delta obtained from the sum heat-flux provided
188  virtual void getKappa
189  (
191  tmp<scalarField>& sumKappaTcByDelta,
192  tmp<scalarField>& sumKappaByDelta,
194  tmp<scalarField>& sumq
195  ) const;
196 
197 
198 public:
199 
200  //- Runtime type information
201  TypeName("externalTemperature");
202 
203 
204  // Constructors
205 
206  //- Construct from patch, internal field and dictionary
208  (
209  const fvPatch&,
211  const dictionary&
212  );
213 
214  //- Construct by mapping given
215  // externalTemperatureFvPatchScalarField
216  // onto a new patch
218  (
220  const fvPatch&,
222  const fieldMapper&
223  );
224 
225  //- Disallow copy without setting internal field reference
227  (
229  ) = delete;
230 
231  //- Copy constructor setting internal field reference
233  (
236  );
237 
238  //- Construct and return a clone setting internal field reference
240  (
242  ) const
243  {
245  (
247  );
248  }
249 
250 
251  // Member Functions
252 
253  // Access
254 
255  //- Disallow manipulation of the boundary values
256  // The boundary temperature is evaluated only by
257  // this boundary condition
258  virtual bool fixesValue() const
259  {
260  return true;
261  }
262 
263 
264  // Mapping functions
265 
266  //- Map the given fvPatchField onto this fvPatchField
267  virtual void map(const fvPatchScalarField&, const fieldMapper&);
268 
269  //- Reset the fvPatchField to the given fvPatchField
270  // Used for mesh to mesh mapping
271  virtual void reset(const fvPatchScalarField&);
272 
273 
274  // Evaluation functions
275 
276  //- Update the coefficients associated with the patch field
277  virtual void updateCoeffs();
278 
279 
280  // I-O
281 
282  //- Write
283  void write(Ostream&) const;
284 };
285 
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 } // End namespace Foam
290 
291 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292 
293 #endif
294 
295 // ************************************************************************* //
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
This boundary condition applies a heat flux condition to temperature on an external wall....
virtual void getKappa(scalarField &kappa, tmp< scalarField > &sumKappaTcByDelta, tmp< scalarField > &sumKappaByDelta, tmp< scalarField > &T, tmp< scalarField > &sumq) const
Get the patch kappa, kappa*Tc/delta, kappa/delta,.
virtual bool fixesValue() const
Disallow manipulation of the boundary values.
void plusEqOp(tmp< scalarField > &tf, const scalar d) const
Plus-equals op for a tmp field. Will initialise the tmp if empty.
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.
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:91
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
const tensorField & tf
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Namespace for OpenFOAM.
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
List< scalar > scalarList
A List of scalars.
Definition: scalarList.H:50
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
fvPatchField< scalar > fvPatchScalarField