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 and return a clone
274  virtual tmp<fvPatchScalarField> clone() const
275  {
277  (
279  (
280  *this
281  )
282  );
283  }
284 
285  //- Construct as copy setting internal field reference
287  (
290  );
291 
292  //- Construct and return a clone setting internal field reference
294  (
296  ) const
297  {
299  (
301  (
302  *this,
303  iF
304  )
305  );
306  }
307 
308 
309  // Member Functions
310 
311  // Mapping
312 
313  //- Map (and resize as needed) from self given a mapping object
314  virtual void autoMap
315  (
316  const fvPatchFieldMapper&
317  );
318 
319  //- Reverse map the given fvPatchField onto this fvPatchField
320  virtual void rmap
321  (
322  const fvPatchField<scalar>&,
323  const labelList&
324  );
325 
326 
327  // Evaluation
328 
329  //- Given patch temperature calculate corresponding K field. Override
330  //- temperatureCoupledBase::kappa to includes effect of any
331  //- explicit kappaThickness
332  virtual tmp<scalarField> kappa(const scalarField& Tp) const;
333 
334  //- Update the coefficients associated with the patch field
335  virtual void updateCoeffs();
336 
337  //- Manipulate matrix
338  virtual void manipulateMatrix
339  (
340  fvMatrix<scalar>& m,
341  const label iMatrix,
342  const direction cmpt
343  );
344 
345 
346  // I-O
347 
348  //- Write
349  virtual void write(Ostream& os) const;
350 };
351 
352 
353 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354 
355 } // End namespace compressible
356 } // End namespace Foam
357 
358 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
359 
360 #endif
361 
362 // ************************************************************************* //
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:81
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...
Definition: areaFieldsFwd.H:42
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.