externalWallHeatFluxTemperatureFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::externalWallHeatFluxTemperatureFvPatchScalarField
29 
30 Group
31  grpThermoBoundaryConditions grpWallBoundaryConditions
32 
33 Description
34  This boundary condition applies a heat flux condition to temperature
35  on an external wall in one of three modes:
36 
37  - fixed power: supply Q
38  - fixed heat flux: supply q
39  - fixed heat transfer coefficient: supply h and Ta
40 
41  where:
42  \vartable
43  Q | Power [W]
44  q | Heat flux [W/m^2]
45  h | Heat transfer coefficient [W/m^2/K]
46  Ta | Ambient temperature [K]
47  \endvartable
48 
49  For heat transfer coefficient mode optional thin thermal layer resistances
50  can be specified through thicknessLayers and kappaLayers entries.
51 
52  The thermal conductivity \c kappa can either be retrieved from various
53  possible sources, as detailed in the class temperatureCoupledBase.
54 
55  The ambient temperature Ta is specified as a Foam::Function1 of time but
56  uniform in space.
57 
58 Usage
59  \table
60  Property | Description | Required | Default
61  mode | 'power', 'flux' or 'coefficient' | yes |
62  Q | Power [W] | for mode 'power' |
63  q | Heat flux [W/m^2] | for mode 'flux' |
64  h | Heat transfer coefficient [W/m^2/K] | for mode 'coefficient' |
65  Ta | Ambient temperature [K] | for mode 'coefficient' |
66  thicknessLayers | Layer thicknesses [m] | no |
67  kappaLayers | Layer thermal conductivities [W/m/K] | no |
68  relaxation | Relaxation for the wall temperature | no | 1
69  emissivity | Surface emissivity for radiative flux to ambient | no | 0
70  qr | Name of the radiative field | no | none
71  qrRelaxation | Relaxation factor for radiative field | no | 1
72  kappaMethod | Inherited from temperatureCoupledBase | inherited |
73  kappa | Inherited from temperatureCoupledBase | inherited |
74  \endtable
75 
76  Example of the boundary condition specification:
77  \verbatim
78  <patchName>
79  {
80  type externalWallHeatFluxTemperature;
81 
82  mode coefficient;
83 
84  Ta constant 300.0;
85  h constant 10.0;
86  thicknessLayers (0.1 0.2 0.3 0.4);
87  kappaLayers (1 2 3 4);
88 
89  kappaMethod fluidThermo;
90 
91  value $internalField;
92  }
93  \endverbatim
94 
95 Note
96  Quantities that are considered "global" (eg, power, ambient temperature)
97  can be specified as Function1 types.
98  Quantities that may have local variations (eg, htc, heat-flux)
99  can be specified as PatchFunction1 types.
100 
101 See also
102  Foam::temperatureCoupledBase
103  Foam::mixedFvPatchScalarField
104 
105 SourceFiles
106  externalWallHeatFluxTemperatureFvPatchScalarField.C
107 
108 \*---------------------------------------------------------------------------*/
109 
110 #ifndef externalWallHeatFluxTemperatureFvPatchScalarField_H
111 #define externalWallHeatFluxTemperatureFvPatchScalarField_H
112 
113 #include "mixedFvPatchFields.H"
114 #include "temperatureCoupledBase.H"
115 #include "PatchFunction1.H"
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 namespace Foam
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class externalWallHeatFluxTemperatureFvPatchScalarField Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 class externalWallHeatFluxTemperatureFvPatchScalarField
127 :
128  public mixedFvPatchScalarField,
129  public temperatureCoupledBase
130 {
131 public:
132 
133  // Public Data
134 
135  //- Operation mode enumeration
136  enum operationMode
137  {
138  fixedPower,
139  fixedHeatFlux,
141  };
142 
143  static const Enum<operationMode> operationModeNames;
144 
145 
146 private:
147 
148  // Private Data
149 
150  //- Operation mode
151  operationMode mode_;
152 
153  //- Heat power [W]
154  autoPtr<Function1<scalar>> Q_;
155 
156  //- Heat flux [W/m2]
157  autoPtr<PatchFunction1<scalar>> q_;
158 
159  //- Heat transfer coefficient [W/m2K]
160  autoPtr<PatchFunction1<scalar>> h_;
161 
162  //- Ambient temperature [K]
163  autoPtr<Function1<scalar>> Ta_;
164 
165  //- Relaxation for the wall temperature (thermal inertia)
166  scalar relaxation_;
167 
168  //- Optional surface emissivity for radiative transfer to ambient
169  scalar emissivity_;
170 
171  //- Cache qr for relaxation
172  scalarField qrPrevious_;
173 
174  //- Relaxation for qr
175  scalar qrRelaxation_;
176 
177  //- Name of the radiative heat flux
178  const word qrName_;
179 
180  //- Thickness of layers
181  scalarList thicknessLayers_;
182 
183  //- Conductivity of layers
184  scalarList kappaLayers_;
185 
186 
187 public:
188 
189  //- Runtime type information
190  TypeName("externalWallHeatFluxTemperature");
191 
192 
193  // Constructors
194 
195  //- Construct from patch and internal field
197  (
198  const fvPatch&,
199  const DimensionedField<scalar, volMesh>&
200  );
201 
202  //- Construct from patch, internal field and dictionary
204  (
205  const fvPatch&,
206  const DimensionedField<scalar, volMesh>&,
207  const dictionary&
208  );
209 
210  //- Construct by mapping given
211  // externalWallHeatFluxTemperatureFvPatchScalarField
212  // onto a new patch
214  (
216  const fvPatch&,
218  const fvPatchFieldMapper&
219  );
220 
221  //- Construct as copy
223  (
225  );
226 
227  //- Construct and return a clone
229  {
231  (
233  );
234  }
235 
236  //- Construct as copy setting internal field reference
238  (
241  );
242 
243  //- Construct and return a clone setting internal field reference
245  (
247  ) const
248  {
250  (
252  );
253  }
254 
255 
256  // Member functions
257 
258  // Access
259 
260  //- Allow manipulation of the boundary values
261  virtual bool fixesValue() const
262  {
263  return false;
264  }
265 
266 
267  // Mapping functions
268 
269  //- Map (and resize as needed) from self given a mapping object
270  virtual void autoMap
271  (
272  const fvPatchFieldMapper&
273  );
274 
275  //- Reverse map the given fvPatchField onto this fvPatchField
276  virtual void rmap
277  (
278  const fvPatchScalarField&,
279  const labelList&
280  );
281 
282 
283  // Evaluation functions
284 
285  //- Update the coefficients associated with the patch field
286  virtual void updateCoeffs();
287 
288 
289  // I-O
290 
291  //- Write
292  void write(Ostream&) const;
293 };
294 
295 
296 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
297 
298 } // End namespace Foam
299 
300 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 
302 #endif
303 
304 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::fvPatchScalarField
fvPatchField< scalar > fvPatchScalarField
Definition: fvPatchFieldsFwd.H:40
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::scalarList
List< scalar > scalarList
A List of scalars.
Definition: scalarList.H:64
Foam::Enum< operationMode >
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::fixedHeatFlux
Heat flux [W/m2].
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:224
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::TypeName
TypeName("externalWallHeatFluxTemperature")
Runtime type information.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.C:259
PatchFunction1.H
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.C:283
Foam::temperatureCoupledBase
Common functions used in temperature coupled boundaries.
Definition: temperatureCoupledBase.H:135
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:313
Foam::Field< scalar >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::fixedHeatTransferCoeff
Heat transfer coefficient [W/m^2/K].
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:225
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::fixesValue
virtual bool fixesValue() const
Allow manipulation of the boundary values.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:346
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationMode
operationMode
Operation mode enumeration.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:221
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
temperatureCoupledBase.H
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::fixedPower
Heat power [W].
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:223
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
mixedFvPatchFields.H
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::externalWallHeatFluxTemperatureFvPatchScalarField
externalWallHeatFluxTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.C:55
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames
static const Enum< operationMode > operationModeNames
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:228
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
void write(Ostream &) const
Write.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.C:455
Foam::List< scalar >
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::externalWallHeatFluxTemperatureFvPatchScalarField
This boundary condition applies a heat flux condition to temperature on an external wall in one of th...
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.H:211
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: externalWallHeatFluxTemperatureFvPatchScalarField.C:312
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54