PrandtlDelta.C
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-2021 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 \*---------------------------------------------------------------------------*/
28 
29 #include "PrandtlDelta.H"
30 #include "wallDist.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace LESModels
38 {
39  defineTypeNameAndDebug(PrandtlDelta, 0);
40  addToRunTimeSelectionTable(LESdelta, PrandtlDelta, dictionary);
41 }
42 }
43 
44 
45 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
46 
47 void Foam::LESModels::PrandtlDelta::calcDelta()
48 {
49  delta_ = min
50  (
51  static_cast<const volScalarField&>(geometricDelta_()),
52  (kappa_/Cdelta_)*wallDist::New(turbulenceModel_.mesh()).y()
53  );
54 }
55 
56 
57 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58 
59 Foam::LESModels::PrandtlDelta::PrandtlDelta
60 (
61  const word& name,
63  const dictionary& dict
64 )
65 :
67  geometricDelta_
68  (
69  LESdelta::New
70  (
71  IOobject::groupName("geometricDelta", turbulence.U().group()),
72  turbulence,
73  dict.optionalSubDict(type() + "Coeffs")
74  )
75  ),
76  kappa_(dict.getOrDefault<scalar>("kappa", 0.41)),
77  Cdelta_
78  (
79  dict.optionalSubDict(type() + "Coeffs").getOrDefault<scalar>
80  (
81  "Cdelta",
82  0.158
83  )
84  )
85 {
86  calcDelta();
87 }
88 
89 
90 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
91 
93 {
94  const dictionary& coeffDict(dict.optionalSubDict(type() + "Coeffs"));
95 
96  geometricDelta_().read(coeffDict);
97  dict.readIfPresent<scalar>("kappa", kappa_);
98  coeffDict.readIfPresent<scalar>("Cdelta", Cdelta_);
99  calcDelta();
100 }
101 
102 
104 {
105  geometricDelta_().correct();
106 
107  if (turbulenceModel_.mesh().changing())
108  {
109  calcDelta();
110  }
111 }
112 
113 
114 // ************************************************************************* //
const fvMesh & mesh() const
dictionary dict
addToRunTimeSelectionTable(LESfluidThermoCompressibleTurbulenceModel, SmagorinskyLESfluidThermoCompressibleTurbulenceModel, dictionary)
bool read(Istream &is)
Read dictionary from Istream (discards the header). Reads entries until EOF or when the first token i...
Definition: dictionaryIO.C:134
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
static const wallDist & New(const fvMesh &mesh, Args &&... args)
Get existing or create a new MeshObject. Registered with typeName.
Definition: MeshObject.C:53
Abstract base class for LES deltas.
Definition: LESdelta.H:49
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Abstract base class for turbulence models (RAS, LES and laminar).
Macros for easy insertion into run-time selection tables.
constexpr const char *const group
Group name for atomic constants.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
scalar y
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
volScalarField delta_
Definition: LESdelta.H:57
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
defineTypeNameAndDebug(cubeRootVolDelta, 0)
U
Definition: pEqn.H:72
virtual void read(const dictionary &)
Read the LESdelta dictionary.
Definition: PrandtlDelta.C:85
const turbulenceModel & turbulenceModel_
Definition: LESdelta.H:55
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.