initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / turbulenceModels / incompressible / LES / spectEddyVisc / spectEddyVisc.C
blob4a16af3576c37166c229ea34e97bc78e2805cda9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "spectEddyVisc.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
34 namespace incompressible
36 namespace LESModels
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(spectEddyVisc, 0);
42 addToRunTimeSelectionTable(LESModel, spectEddyVisc, dictionary);
44 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
46 void spectEddyVisc::updateSubGridScaleFields(const volTensorField& gradU)
48     volScalarField Re = sqr(delta())*mag(symm(gradU))/nu();
49     for (label i=0; i<5; i++)
50     {
51         nuSgs_ =
52             nu()
53            /(
54                  scalar(1)
55                - exp(-cB_*pow(nu()/(nuSgs_ + nu()), 1.0/3.0)*pow(Re, -2.0/3.0))
56             );
57     }
59     nuSgs_.correctBoundaryConditions();
63 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
65 spectEddyVisc::spectEddyVisc
67     const volVectorField& U,
68     const surfaceScalarField& phi,
69     transportModel& transport
72     LESModel(typeName, U, phi, transport),
73     GenEddyVisc(U, phi, transport),
76     cB_
77     (
78         dimensioned<scalar>::lookupOrAddToDict
79         (
80             "cB",
81             coeffDict_,
82             8.22
83         )
84     ),
85     cK1_
86     (
87         dimensioned<scalar>::lookupOrAddToDict
88         (
89             "cK1",
90             coeffDict_,
91             0.83
92         )
93     ),
94     cK2_
95     (
96         dimensioned<scalar>::lookupOrAddToDict
97         (
98             "cK2",
99             coeffDict_,
100             1.03
101         )
102     ),
103     cK3_
104     (
105         dimensioned<scalar>::lookupOrAddToDict
106         (
107             "cK3",
108             coeffDict_,
109             4.75
110         )
111     ),
112     cK4_
113     (
114         dimensioned<scalar>::lookupOrAddToDict
115         (
116             "cK4",
117             coeffDict_,
118             2.55
119         )
120     )
122     printCoeffs();
124     updateSubGridScaleFields(fvc::grad(U));
128 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
130 tmp<volScalarField> spectEddyVisc::k() const
132     volScalarField eps = 2*nuEff()*magSqr(symm(fvc::grad(U())));
134     return
135         cK1_*pow(delta()*eps, 2.0/3.0)
136        *exp(-cK2_*pow(delta(), -4.0/3.0)*nu()/pow(eps, 1.0/3.0))
137       - cK3_*sqrt(eps*nu())
138        *erfc(cK4_*pow(delta(), -2.0/3.0)*sqrt(nu())*pow(eps, -1.0/6.0));
142 void spectEddyVisc::correct(const tmp<volTensorField>& gradU)
144     GenEddyVisc::correct(gradU);
145     updateSubGridScaleFields(gradU());
149 bool spectEddyVisc::read()
151     if (GenEddyVisc::read())
152     {
153         cB_.readIfPresent(coeffDict());
154         cK1_.readIfPresent(coeffDict());
155         cK2_.readIfPresent(coeffDict());
156         cK3_.readIfPresent(coeffDict());
157         cK4_.readIfPresent(coeffDict());
159         return true;
160     }
161     else
162     {
163         return false;
164     }
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 } // End namespace LESModels
171 } // End namespace incompressible
172 } // End namespace Foam
174 // ************************************************************************* //