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-2026 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 DimensionedFieldFunction [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  The patch thermal conductivity \c kappa is obtained from the region
47  thermophysicalTransportModel so that this boundary condition can be applied
48  directly to either fluid or solid regions.
49 
50 Usage
51  \table
52  Property | Description | Required | Default value
53  Q | Power [W] | no |
54  q | Heat flux [W/m^2] | no |
55  h | Heat transfer coefficient [W/m^2/K] | no |
56  Ta | Ambient temperature [K] | if h is given |
57  relaxation | Relaxation for the wall temperature | no | 1
58  emissivity | Surface emissivity for radiative flux to ambient | no | 0
59  qr | Name of the radiative field | no | none
60  qrRelaxation | Relaxation factor for radiative field | no | 1
61  \endtable
62 
63  Example of the boundary condition specification:
64  \verbatim
65  <patchName>
66  {
67  type externalTemperature;
68 
69  Ta constant 300.0;
70  h uniform 10.0;
71 
72  value $internalField;
73  }
74  \endverbatim
75 
76 See also
77  Foam::mixedFvPatchScalarField
78  Foam::Function1
79 
80 SourceFiles
81  externalTemperatureFvPatchScalarField.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef externalTemperatureFvPatchScalarField_H
86 #define externalTemperatureFvPatchScalarField_H
87 
88 #include "mixedFvPatchFields.H"
89 #include "Function1.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class externalTemperatureFvPatchScalarField Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 class externalTemperatureFvPatchScalarField
102 :
103  public mixedFvPatchScalarField
104 {
105  // Private Data
106 
107  // Heat power
108 
109  //- Do we have a heat power?
110  bool haveQ_;
111 
112  //- Heat power [W]
113  autoPtr<Function1<scalar>> Q_;
114 
115 
116  // Heat flux
117 
118  //- Do we have a heat flux?
119  bool haveq_;
120 
121  //- Heat flux [W/m^2]
122  autoPtr<Function1<scalar>> q_;
123 
124 
125  // Heat transfer coefficient
126 
127  //- Heat transfer coefficient [W/m^2K]
128  autoPtr<FunctionalDimensionedField<scalar, fvPatch>> h_;
129 
130  //- Do we have an emissivity?
131  const bool haveEmissivity_;
132 
133  //- Optional surface emissivity for radiative transfer to ambient
134  scalar emissivity_;
135 
136  //- Ambient temperature [K]
137  autoPtr<Function1<scalar>> Ta_;
138 
139 
140  //- Relaxation factor for the wall temperature (thermal inertia)
141  scalar relax_;
142 
143 
144  // Radiation
145 
146  //- Name of the radiative heat flux
147  const word qrName_;
148 
149  //- Relaxation factor for qr
150  scalar qrRelax_;
151 
152  //- Cache qr for relaxation
153  scalarField qrPrevious_;
154 
155 
156 protected:
157 
158  // Protected Member Functions
159 
160  //- Plus-equals op for a tmp field. Will initialise the tmp if empty.
161  void plusEqOp(tmp<scalarField>& tf, const scalar d) const;
162 
163  //- Plus-equals op for a tmp field. Will initialise the tmp if empty.
164  void plusEqOp(tmp<scalarField>& tf, const tmp<scalarField>& tdf) const;
165 
166  //- Get the patch kappa, kappa*Tc/delta, kappa/delta,
167  // reference T, current wall T and also the
168  // heat-flux/delta obtained from the sum heat-flux provided
169  virtual void getKappa
170  (
172  tmp<scalarField>& sumKappaTcByDelta,
173  tmp<scalarField>& sumKappaByDelta,
175  tmp<scalarField>& sumq
176  ) const;
177 
178 
179 public:
180 
181  //- Runtime type information
182  TypeName("externalTemperature");
183 
184 
185  // Constructors
186 
187  //- Construct from patch, internal field and dictionary
189  (
190  const fvPatch&,
192  const dictionary&
193  );
194 
195  //- Construct by mapping given
196  // externalTemperatureFvPatchScalarField
197  // onto a new patch
199  (
201  const fvPatch&,
203  const fieldMapper&
204  );
205 
206  //- Disallow copy without setting internal field reference
208  (
210  ) = delete;
211 
212  //- Copy constructor setting internal field reference
214  (
217  );
218 
219  //- Construct and return a clone setting internal field reference
221  (
223  ) const;
224 
225 
226  //- Destructor
228 
229 
230  // Member Functions
231 
232  // Access
233 
234  //- Disallow manipulation of the boundary values
235  // The boundary temperature is evaluated only by
236  // this boundary condition
237  virtual bool fixesValue() const
238  {
239  return true;
240  }
241 
242 
243  // Mapping functions
244 
245  //- Map the given fvPatchField onto this fvPatchField
246  virtual void map(const fvPatchScalarField&, const fieldMapper&);
247 
248  //- Reset the fvPatchField to the given fvPatchField
249  // Used for mesh to mesh mapping
250  virtual void reset(const fvPatchScalarField&);
251 
252 
253  // Evaluation functions
254 
255  //- Update the coefficients associated with the patch field
256  virtual void updateCoeffs();
257 
258 
259  // I-O
260 
261  //- Write
262  void write(Ostream&) const;
263 
264 
265  // Member Operators
266 
267  //- Inherit assignment
268  using mixedFvPatchScalarField::operator=;
269 };
270 
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 } // End namespace Foam
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #endif
279 
280 // ************************************************************************* //
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 tmp< fvPatchScalarField > clone(const DimensionedField< scalar, fvMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
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, fvMesh > &, 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:90
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:58
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)