FreeFOAM The Cross-Platform CFD Toolkit
SpalartAllmarasIDDES.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) 2008-2010 OpenCFD Ltd.
6  \\/ M anipulation |
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 "SpalartAllmarasIDDES.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace incompressible
34 {
35 namespace LESModels
36 {
37 
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 
40 defineTypeNameAndDebug(SpalartAllmarasIDDES, 0);
41 addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary);
42 
43 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
44 
45 tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
46 {
47  return max
48  (
49  0.25 - y_/static_cast<const volScalarField&>(hmax_()),
50  scalar(-5)
51  );
52 }
53 
54 
55 tmp<volScalarField> SpalartAllmarasIDDES::ft
56 (
57  const volScalarField& S
58 ) const
59 {
60  return tanh(pow3(sqr(ct_)*rd(nuSgs_, S)));
61 }
62 
63 
64 tmp<volScalarField> SpalartAllmarasIDDES::fl
65 (
66  const volScalarField& S
67 ) const
68 {
69  return tanh(pow(sqr(cl_)*rd(nu(), S), 10));
70 }
71 
72 
73 tmp<volScalarField> SpalartAllmarasIDDES::rd
74 (
75  const volScalarField& visc,
76  const volScalarField& S
77 ) const
78 {
79  return min
80  (
81  visc
82  /(
83  max
84  (
85  S,
86  dimensionedScalar("SMALL", S.dimensions(), SMALL)
87  )*sqr(kappa_*y_)
89  (
90  "ROOTVSMALL",
91  dimensionSet(0, 2 , -1, 0, 0),
92  ROOTVSMALL
93  )
94  ),
95  scalar(10)
96  );
97 }
98 
99 
100 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
101 
102 tmp<volScalarField> SpalartAllmarasIDDES::fd(const volScalarField& S) const
103 {
104  return 1 - tanh(pow3(8*rd(nuEff(), S)));
105 }
106 
107 
109 {
110  volScalarField alpha = this->alpha();
111  volScalarField expTerm = exp(sqr(alpha));
112 
113  volScalarField fHill =
114  2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0));
115 
116  volScalarField fStep = min(2*pow(expTerm, -9.0), scalar(1));
117  volScalarField fHyb = max(1 - fd(S), fStep);
118  volScalarField fAmp = 1 - max(ft(S), fl(S));
119  volScalarField fRestore = max(fHill - 1, scalar(0))*fAmp;
120 
121  // IGNORING ft2 terms
122  volScalarField Psi = sqrt
123  (
124  min
125  (
126  scalar(100),
127  (1 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*fv2())/max(SMALL, fv1())
128  )
129  );
130 
131  return max
132  (
133  dimensionedScalar("SMALL", dimLength, SMALL),
134  fHyb*(1 + fRestore*Psi)*y_
135  + (1 - fHyb)*CDES_*Psi*delta()
136  );
137 }
138 
139 
140 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
141 
142 SpalartAllmarasIDDES::SpalartAllmarasIDDES
143 (
144  const volVectorField& U,
145  const surfaceScalarField& phi,
146  transportModel& transport
147 )
148 :
149  SpalartAllmaras(U, phi, transport, typeName),
150  hmax_
151  (
153  (
154  "hmax",
155  mesh_,
156  *this
157  )
158  ),
159  IDDESDelta_
160  (
162  (
163  "IDDESDelta",
164  mesh_,
165  this->subDict(typeName + "Coeffs")
166  )
167  ),
168  fwStar_
169  (
171  (
172  "fwStar",
173  coeffDict_,
174  0.424
175  )
176  ),
177  cl_
178  (
180  (
181  "cl",
182  coeffDict_,
183  3.55
184  )
185  ),
186  ct_
187  (
189  (
190  "ct",
191  coeffDict_,
192  1.63
193  )
194  )
195 
196 {}
197 
198 
200 {
201  if (SpalartAllmaras::read())
202  {
203  fwStar_.readIfPresent(coeffDict());
204  cl_.readIfPresent(coeffDict());
205  ct_.readIfPresent(coeffDict());
206 
207  return true;
208  }
209  else
210  {
211  return false;
212  }
213 }
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace LESModels
219 } // End namespace incompressible
220 } // End namespace Foam
221 
222 // ************************ vim: set sw=4 sts=4 et: ************************ //