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 -------------------------------------------------------------------------------
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 "SpalartAllmarasDDES.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace LESModels
36 {
37 
38 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
39 
40 template<class BasicTurbulenceModel>
41 tmp<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 
68 template<class BasicTurbulenceModel>
69 tmp<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 
80 template<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 
107 template<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 :
121  (
122  alpha,
123  rho,
124  U,
125  alphaRhoPhi,
126  phi,
127  transport,
128  propertiesName,
129  type
130  ),
131 
132  Cd1_
133  (
135  (
136  "Cd1",
137  this->coeffDict_,
138  8
139  )
140  ),
141  Cd2_
142  (
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 
160 template<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 // ************************************************************************* //
SpalartAllmarasDDES.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::LESModels::SpalartAllmarasDDES::dTilda
virtual tmp< volScalarField > dTilda(const volScalarField &chi, const volScalarField &fv1, const volTensorField &gradU) const
Length scale.
Definition: SpalartAllmarasDDES.C:82
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::LESModels::SpalartAllmarasDDES::read
virtual bool read()
Read from dictionary.
Definition: SpalartAllmarasDDES.C:161
Foam::LESModels::SpalartAllmarasDES
SpalartAllmarasDES DES turbulence model for incompressible and compressible flows.
Definition: SpalartAllmarasDES.H:80
Foam::LESModels::DESModel::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: DESModel.H:74
rho
rho
Definition: readInitialConditions.H:88
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::tanh
dimensionedScalar tanh(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:272
delta
scalar delta
Definition: LISASMDCalcMethod2.H:8
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam::LESModels::DESModel::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: DESModel.H:75
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
U
U
Definition: pEqn.H:72
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::LESModels::SpalartAllmarasDDES
SpalartAllmaras DDES turbulence model for incompressible and compressible flows.
Definition: SpalartAllmarasDDES.H:67
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:51
Foam::LESModels::DESModel::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: DESModel.H:73
Foam::GeometricField< scalar, fvPatchField, volMesh >
psi
const volScalarField & psi
Definition: createFieldRefs.H:1