turbulentTemperatureRadCoupledMixedFvPatchScalarField.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) 2017-2023 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::compressible::turbulentTemperatureRadCoupledMixedFvPatchScalarField
29 
30 Description
31  Mixed boundary condition for temperature and radiation heat transfer,
32  suitable for multiregion cases. The optional specification of
33  thin thermal layer resistances can be made using the entries
34  \c thicknessLayers and \c kappaLayers.
35 
36  The thermal conductivity \c kappa can be obtained from a variety
37  of sources, as explained in the \c temperatureCoupledBase class.
38 
39 Usage
40  Example of the boundary condition specification:
41  \verbatim
42  <patchName>
43  {
44  // Mandatory entries
45  type compressible::turbulentTemperatureRadCoupledMixed;
46 
47  // Optional entries
48  Tnbr <word>;
49  qrNbr <word>;
50  qr <word>;
51  logInterval <scalar>;
52  thermalInertia <bool>;
53  verbose <bool>;
54  prefix <word>;
55 
56  // Conditional entries
57 
58  // Option-1
59  thicknessLayers <scalarList>;
60  kappaLayers <scalarList>;
61 
62  // Option-2
63  thicknessLayer <PatchFunction1<scalar>>;
64  kappaLayer <PatchFunction1<scalar>>;
65 
66  // Inherited entries
67  kappaMethod <word>;
68  kappa <word>;
69  ...
70  }
71  \endverbatim
72 
73  For example:
74  \verbatim
75  <patchName>
76  {
77  type compressible::turbulentTemperatureRadCoupledMixed;
78  Tnbr T;
79  qrNbr qr; // or none. Name of qr field on neighbour region
80  qr qr; // or none. Name of qr field on this region
81  thicknessLayers (0.1 0.2 0.3 0.4);
82  kappaLayers (1 2 3 4);
83  thermalInertia false/true;
84  kappaMethod lookup;
85  kappa kappa;
86  value uniform 300;
87  }
88  \endverbatim
89 
90  where the entries mean:
91  \table
92  Property | Description | Type | Reqd | Deflt
93  type | Type name: compressible::turbulentTemperatureRadCoupledMixed <!--
94  --> | word | yes | -
95  Tnbr | Name of the nbr temperature field | word | no | T
96  qrNbr | Name of the radiative flux in the nbr region | word | no | none
97  qr | Name of the radiative flux in this region | word | no | none
98  logInterval | Log-file output frequency [s] | scalar | no | -1
99  thermalInertia | Flag to add thermal inertia to wall node | bool | no <!--
100  --> | false
101  verbose | Flag to enable verbose output with extra fields | bool | no <!--
102  --> | false
103  prefix | Name of output-field prefix (in verbose mode) <!--
104  --> | word | no | multiWorld
105  thicknessLayers | List of thicknesses per layer [m] | scalarList <!--
106  --> | choice | -
107  kappaLayers | List of thermal conductivites per layer [W/m/K] <!--
108  --> | scalarList | choice | -
109  thicknessLayer | Single thickness of layer [m] <!--
110  --> | PatchFunction1<scalar>| choice | -
111  kappaLayer | Corresponding thermal conductivity [W/m/K] <!--
112  --> | PatchFunction1<scalar>| choice | -
113  \endtable
114 
115  The inherited entries are elaborated in:
116  - \link mixedFvPatchFields.H \endlink
117  - \link temperatureCoupledBase.H \endlink
118  - \link mappedPatchFieldBase.H \endlink
119  - \link writeFile.H \endlink
120 
121 Note
122  - Needs to be on underlying \c mapped(Wall)FvPatch.
123 
124 SourceFiles
125  turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
126 
127 \*---------------------------------------------------------------------------*/
128 
129 #ifndef Foam_turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
130 #define Foam_turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
131 
132 #include "mixedFvPatchFields.H"
133 #include "temperatureCoupledBase.H"
134 #include "scalarList.H"
135 #include "mappedPatchFieldBase.H"
136 #include "writeFile.H"
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 namespace Foam
141 {
142 namespace compressible
143 {
144 
145 /*---------------------------------------------------------------------------*\
146  Class turbulentTemperatureRadCoupledMixedFvPatchScalarField Declaration
147 \*---------------------------------------------------------------------------*/
148 
149 class turbulentTemperatureRadCoupledMixedFvPatchScalarField
150 :
151  public mixedFvPatchScalarField,
152  public temperatureCoupledBase,
153  public mappedPatchFieldBase<scalar>,
154  public functionObjects::writeFile
155 {
156  // Private Data
157 
158  //- Name of temperature field on the neighbour region
159  const word TnbrName_;
160 
161  //- Name of the radiative heat flux in the neighbour region
162  const word qrNbrName_;
163 
164  //- Name of the radiative heat flux in this region
165  const word qrName_;
166 
167  //- Thickness of layers (either scalarList or a single PatchFunction1)
168  scalarList thicknessLayers_;
169  autoPtr<PatchFunction1<scalar>> thicknessLayer_;
170 
171  //- Conductivity of layers
172  scalarList kappaLayers_;
173  autoPtr<PatchFunction1<scalar>> kappaLayer_;
174 
175  //- Log-file output frequency
176  scalar logInterval_;
177 
178  //- Index of previous execution
179  label executionIndex_;
180 
181  //- Flag to enable thermal inertia term
182  const Switch thermalInertia_;
183 
184  //- Flag to enable verbose output with extra fields
185  const bool verbose_;
186 
187  //- Name of output-field prefix (in verbose mode)
188  const word prefix_;
189 
190 
191  // Private Functions
192 
193  //- Return local alphaSfDelta
194  tmp<scalarField> alphaSfDelta() const;
195 
196  //- Return delta enthalpy between regions
197  tmp<scalarField> deltaH() const;
198 
199  //- Return the sum of deltaCoeff*alpha from nbr and local
200  tmp<scalarField> beta() const;
201 
202  //- Calculate coefficients for assembly matrix
203  tmp<Field<scalar>> coeffs
204  (
205  fvMatrix<scalar>& matrix,
206  const Field<scalar>&,
207  const label
208  ) const;
209 
210  //- Return requested field from the object registry
211  //- or create+register the field to the object registry
212  volScalarField& getOrCreateField(const word& fieldName) const;
213 
214  //- Store heat-transfer coeff fields to facilitate postprocessing
215  void storeHTCFields
216  (
217  const word& prefix,
218  const scalarField& htc,
219  const scalarField& htcPatch
220  ) const;
221 
222  //- Flag to allow writing to file
223  bool writeFile();
224 
225 
226  // functionObjects::writeFile
227 
228  //- Write file header information
229  void writeFileHeader(Ostream& os);
230 
231 
232 public:
233 
234  //- Runtime type information
235  TypeName("compressible::turbulentTemperatureRadCoupledMixed");
236 
237 
238  // Constructors
239 
240  //- Construct from patch and internal field
242  (
243  const fvPatch&,
245  );
246 
247  //- Construct from patch, internal field and dictionary
249  (
250  const fvPatch&,
252  const dictionary&
253  );
254 
255  //- Construct by mapping given
256  //- turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
257  //- new patch
259  (
260  const
262  const fvPatch&,
264  const fvPatchFieldMapper&
265  );
266 
267  //- Construct as copy
269  (
271  );
272 
273  //- Construct as copy setting internal field reference
275  (
278  );
279 
280  //- Return a clone
281  virtual tmp<fvPatchField<scalar>> clone() const
282  {
283  return fvPatchField<scalar>::Clone(*this);
284  }
285 
286  //- Clone with an internal field reference
288  (
290  ) const
291  {
292  return fvPatchField<scalar>::Clone(*this, iF);
293  }
294 
295 
296  // Member Functions
297 
298  // Mapping
299 
300  //- Map (and resize as needed) from self given a mapping object
301  virtual void autoMap
302  (
303  const fvPatchFieldMapper&
304  );
305 
306  //- Reverse map the given fvPatchField onto this fvPatchField
307  virtual void rmap
308  (
309  const fvPatchField<scalar>&,
310  const labelList&
311  );
312 
313 
314  // Evaluation
315 
316  //- Given patch temperature calculate corresponding K field. Override
317  //- temperatureCoupledBase::kappa to includes effect of any
318  //- explicit kappaThickness
319  virtual tmp<scalarField> kappa(const scalarField& Tp) const;
320 
321  //- Update the coefficients associated with the patch field
322  virtual void updateCoeffs();
323 
324  //- Manipulate matrix
325  virtual void manipulateMatrix
326  (
327  fvMatrix<scalar>& m,
328  const label iMatrix,
329  const direction cmpt
330  );
331 
332 
333  // I-O
334 
335  //- Write
336  virtual void write(Ostream& os) const;
337 };
338 
339 
340 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
341 
342 } // End namespace compressible
343 } // End namespace Foam
344 
345 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
346 
347 #endif
348 
349 // ************************************************************************* //
List< scalar > scalarList
List of scalar.
Definition: scalarList.H:32
virtual void rmap(const fvPatchField< scalar > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
uint8_t direction
Definition: direction.H:46
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
Mixed boundary condition for temperature and radiation heat transfer, suitable for multiregion cases...
TypeName("compressible::turbulentTemperatureRadCoupledMixed")
Runtime type information.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:72
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
virtual void manipulateMatrix(fvMatrix< scalar > &m, const label iMatrix, const direction cmpt)
Manipulate matrix.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
A FieldMapper for finite-volume patch fields.
turbulentTemperatureRadCoupledMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:64
virtual tmp< scalarField > kappa(const scalarField &Tp) const
Given patch temperature calculate corresponding K field. Override temperatureCoupledBase::kappa to in...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
bool compressible
Definition: pEqn.H:2
OBJstream os(runTime.globalPath()/outputName)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.