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 {
157  typedef mixedFvPatchScalarField parent_bctype;
158 
159  // Private Data
160 
161  //- Name of temperature field on the neighbour region
162  const word TnbrName_;
163 
164  //- Name of the radiative heat flux in the neighbour region
165  const word qrNbrName_;
166 
167  //- Name of the radiative heat flux in this region
168  const word qrName_;
169 
170  //- Thickness of layers (either scalarList or a single PatchFunction1)
171  scalarList thicknessLayers_;
172  autoPtr<PatchFunction1<scalar>> thicknessLayer_;
173 
174  //- Conductivity of layers
175  scalarList kappaLayers_;
176  autoPtr<PatchFunction1<scalar>> kappaLayer_;
177 
178  //- Log-file output frequency
179  scalar logInterval_;
180 
181  //- Index of previous execution
182  label executionIndex_;
183 
184  //- Flag to enable thermal inertia term
185  const Switch thermalInertia_;
186 
187  //- Flag to enable verbose output with extra fields
188  const bool verbose_;
189 
190  //- Name of output-field prefix (in verbose mode)
191  const word prefix_;
192 
193 
194  // Private Functions
195 
196  //- Return local alphaSfDelta
197  tmp<scalarField> alphaSfDelta() const;
198 
199  //- Return delta enthalpy between regions
200  tmp<scalarField> deltaH() const;
201 
202  //- Return the sum of deltaCoeff*alpha from nbr and local
203  tmp<scalarField> beta() const;
204 
205  //- Calculate coefficients for assembly matrix
206  tmp<Field<scalar>> coeffs
207  (
208  fvMatrix<scalar>& matrix,
209  const Field<scalar>&,
210  const label
211  ) const;
212 
213  //- Return requested field from the object registry
214  //- or create+register the field to the object registry
215  volScalarField& getOrCreateField(const word& fieldName) const;
216 
217  //- Store heat-transfer coeff fields to facilitate postprocessing
218  void storeHTCFields
219  (
220  const word& prefix,
221  const scalarField& htc,
222  const scalarField& htcPatch
223  ) const;
224 
225  //- Flag to allow writing to file
226  bool writeFile();
227 
228 
229  // functionObjects::writeFile
230 
231  //- Write file header information
232  void writeFileHeader(Ostream& os);
233 
234 
235 public:
236 
237  //- Runtime type information
238  TypeName("compressible::turbulentTemperatureRadCoupledMixed");
239 
240 
241  // Constructors
242 
243  //- Construct from patch and internal field
245  (
246  const fvPatch&,
248  );
249 
250  //- Construct from patch, internal field and dictionary
252  (
253  const fvPatch&,
255  const dictionary&
256  );
257 
258  //- Construct by mapping onto a new patch
260  (
261  const this_bctype&,
262  const fvPatch&,
264  const fvPatchFieldMapper&
265  );
266 
267  //- Construct as copy setting internal field reference
269  (
270  const this_bctype&,
272  );
273 
274  //- No copy without an internal field
276  (
277  const this_bctype&
278  ) = delete;
279 
280  //- Clone with an internal field reference
282  (
284  ) const
285  {
286  return fvPatchField<scalar>::Clone(*this, iF);
287  }
288 
289 
290  // Member Functions
291 
292  // Mapping
293 
294  //- Map (and resize as needed) from self given a mapping object
295  virtual void autoMap
296  (
297  const fvPatchFieldMapper&
298  );
299 
300  //- Reverse map the given fvPatchField onto this fvPatchField
301  virtual void rmap
302  (
303  const fvPatchField<scalar>&,
304  const labelList&
305  );
306 
307 
308  // Evaluation
309 
310  //- Given patch temperature calculate corresponding K field. Override
311  //- temperatureCoupledBase::kappa to includes effect of any
312  //- explicit kappaThickness
313  virtual tmp<scalarField> kappa(const scalarField& Tp) const;
314 
315  //- Update the coefficients associated with the patch field
316  virtual void updateCoeffs();
317 
318  //- Manipulate matrix
319  virtual void manipulateMatrix
320  (
321  fvMatrix<scalar>& m,
322  const label iMatrix,
323  const direction cmpt
324  );
325 
326 
327  // I-O
328 
329  //- Write
330  virtual void write(Ostream& os) const;
331 
332 
333  // Member Operators
334 
335  //- Inherit assignment
336  using parent_bctype::operator=;
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:130
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:635
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
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.
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
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.