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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "SpalartAllmarasDDES.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace LESModels
33 {
34 
35 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
36 
37 template<class BasicTurbulenceModel>
39 (
40  const volScalarField& magGradU
41 ) const
42 {
44  (
45  min
46  (
47  this->nuEff()
48  /(
49  max
50  (
51  magGradU,
52  dimensionedScalar("SMALL", magGradU.dimensions(), SMALL)
53  )
54  *sqr(this->kappa_*this->y_)
55  ),
56  scalar(10)
57  )
58  );
59  tr().boundaryField() == 0.0;
60 
61  return tr;
62 }
63 
64 
65 template<class BasicTurbulenceModel>
67 (
68  const volScalarField& magGradU
69 ) const
70 {
71  return 1 - tanh(pow(Cd1_*rd(magGradU), Cd2_));
72 }
73 
74 
75 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
76 
77 template<class BasicTurbulenceModel>
79 (
80  const volScalarField& chi,
81  const volScalarField& fv1,
82  const volTensorField& gradU
83 ) const
84 {
85  const volScalarField& lRAS(this->y_);
86  const volScalarField lLES(this->psi(chi, fv1)*this->CDES_*this->delta());
87 
88  return max
89  (
90  lRAS
91  - fd(mag(gradU))
92  *max
93  (
94  lRAS - lLES,
95  dimensionedScalar("zero", dimLength, 0)
96  ),
97  dimensionedScalar("small", dimLength, SMALL)
98  );
99 }
100 
101 
102 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
103 
104 template<class BasicTurbulenceModel>
106 (
107  const alphaField& alpha,
108  const rhoField& rho,
109  const volVectorField& U,
110  const surfaceScalarField& alphaRhoPhi,
111  const surfaceScalarField& phi,
112  const transportModel& transport,
113  const word& propertiesName,
114  const word& type
115 )
116 :
118  (
119  alpha,
120  rho,
121  U,
122  alphaRhoPhi,
123  phi,
124  transport,
125  propertiesName,
126  type
127  ),
128 
129  Cd1_
130  (
132  (
133  "Cd1",
134  this->coeffDict_,
135  8
136  )
137  ),
138  Cd2_
139  (
141  (
142  "Cd2",
143  this->coeffDict_,
144  3
145  )
146  )
147 {
148  if (type == typeName)
149  {
150  this->printCoeffs(type);
151  }
152 }
153 
154 
155 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
156 
157 template<class BasicTurbulenceModel>
159 {
161  {
162  Cd1_.readIfPresent(this->coeffDict());
163  Cd2_.readIfPresent(this->coeffDict());
164 
165  return true;
166  }
167  else
168  {
169  return false;
170  }
171 }
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace LESModels
177 } // End namespace Foam
178 
179 // ************************************************************************* //
SpalartAllmarasDDES.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::LESModels::SpalartAllmarasDDES::rd
tmp< volScalarField > rd(const volScalarField &magGradU) const
Definition: SpalartAllmarasDDES.C:39
Foam::LESModels::SpalartAllmarasDDES::dTilda
virtual tmp< volScalarField > dTilda(const volScalarField &chi, const volScalarField &fv1, const volTensorField &gradU) const
Length scale.
Definition: SpalartAllmarasDDES.C:79
Foam::dimLength
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::LESModels::SpalartAllmarasDDES::read
virtual bool read()
Read from dictionary.
Definition: SpalartAllmarasDDES.C:158
Foam::LESModels::SpalartAllmarasDES
SpalartAllmarasDES DES turbulence model for incompressible and compressible flows.
Definition: SpalartAllmarasDES.H:72
Foam::LESModels::DESModel::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: DESModel.H:71
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
U
U
Definition: pEqn.H:46
Foam::LESModels::SpalartAllmarasDDES::SpalartAllmarasDDES
SpalartAllmarasDDES(const SpalartAllmarasDDES &)
Foam::tanh
dimensionedScalar tanh(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:263
delta
scalar delta
Definition: LISASMDCalcMethod2.H:8
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::LESModels::DESModel::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: DESModel.H:72
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
rho
rho
Definition: pEqn.H:3
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::LESModels::SpalartAllmarasDDES::fd
tmp< volScalarField > fd(const volScalarField &magGradU) const
Definition: SpalartAllmarasDDES.C:67
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
psi
const volScalarField & psi
Definition: setRegionFluidFields.H:13
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:49
Foam::LESModels::DESModel::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: DESModel.H:70
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)