SpalartAllmarasDDES.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-2016 OpenFOAM Foundation
9 Copyright (C) 2015-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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 "SpalartAllmarasDDES.H"
30
31// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33namespace Foam
34{
35namespace LESModels
36{
37
38// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
39
40template<class BasicTurbulenceModel>
41tmp<volScalarField> SpalartAllmarasDDES<BasicTurbulenceModel>::rd
42(
43 const volScalarField& magGradU
44) const
45{
46 tmp<volScalarField> tr
47 (
48 min
49 (
50 this->nuEff()
51 /(
52 max
53 (
54 magGradU,
55 dimensionedScalar("SMALL", magGradU.dimensions(), SMALL)
56 )
57 *sqr(this->kappa_*this->y_)
58 ),
59 scalar(10)
60 )
61 );
62 tr.ref().boundaryFieldRef() == 0.0;
63
64 return tr;
65}
66
67
68template<class BasicTurbulenceModel>
69tmp<volScalarField> SpalartAllmarasDDES<BasicTurbulenceModel>::fd
70(
71 const volScalarField& magGradU
72) const
73{
74 return 1 - tanh(pow(Cd1_*rd(magGradU), Cd2_));
75}
76
77
78// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
79
80template<class BasicTurbulenceModel>
82(
83 const volScalarField& chi,
84 const volScalarField& fv1,
85 const volTensorField& gradU
86) const
87{
88 const volScalarField& lRAS(this->y_);
89 const volScalarField lLES(this->psi(chi, fv1)*this->CDES_*this->delta());
90
91 return max
92 (
93 lRAS
94 - fd(mag(gradU))
95 *max
96 (
97 lRAS - lLES,
99 ),
100 dimensionedScalar("small", dimLength, SMALL)
101 );
102}
103
104
105// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
106
107template<class BasicTurbulenceModel>
109(
110 const alphaField& alpha,
111 const rhoField& rho,
112 const volVectorField& U,
113 const surfaceScalarField& alphaRhoPhi,
114 const surfaceScalarField& phi,
115 const transportModel& transport,
116 const word& propertiesName,
117 const word& type
118)
119:
120 SpalartAllmarasDES<BasicTurbulenceModel>
121 (
122 alpha,
123 rho,
124 U,
125 alphaRhoPhi,
126 phi,
127 transport,
128 propertiesName,
129 type
130 ),
131
132 Cd1_
133 (
134 dimensioned<scalar>::getOrAddToDict
135 (
136 "Cd1",
137 this->coeffDict_,
138 8
139 )
140 ),
141 Cd2_
142 (
143 dimensioned<scalar>::getOrAddToDict
144 (
145 "Cd2",
146 this->coeffDict_,
147 3
148 )
149 )
150{
151 if (type == typeName)
152 {
153 this->printCoeffs(type);
154 }
155}
156
157
158// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
159
160template<class BasicTurbulenceModel>
162{
164 {
165 Cd1_.readIfPresent(this->coeffDict());
166 Cd2_.readIfPresent(this->coeffDict());
167
168 return true;
169 }
170
171 return false;
172}
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace LESModels
178} // End namespace Foam
179
180// ************************************************************************* //
scalar delta
surfaceScalarField & phi
SpalartAllmaras DDES turbulence model for incompressible and compressible flows.
BasicTurbulenceModel::alphaField alphaField
BasicTurbulenceModel::rhoField rhoField
BasicTurbulenceModel::transportModel transportModel
virtual tmp< volScalarField > dTilda(const volScalarField &chi, const volScalarField &fv1, const volTensorField &gradU) const
Length scale.
virtual bool read()
Read from dictionary.
SpalartAllmarasDES DES turbulence model for incompressible and compressible flows.
Generic dimensioned Type class.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
U
Definition: pEqn.H:72
const volScalarField & psi
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
dimensionedScalar tanh(const dimensionedScalar &ds)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
volScalarField & alpha