initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / turbulenceModels / LES / incompressible / spectEddyVisc / spectEddyVisc.C
blobcda43a2ccf4f5230e409e7c2003a1118d37cdd26
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
46 // from components
47 spectEddyVisc::spectEddyVisc
49     const volVectorField& U,
50     const surfaceScalarField& phi,
51     transportModel& transport
54     LESModel(typeName, U, phi, transport),
55     GenEddyVisc(U, phi, transport),
58     cB_
59     (
60         dimensioned<scalar>::lookupOrAddToDict
61         (
62             "cB",
63             coeffDict(),
64             8.22
65         )
66     ),
67     cK1_
68     (
69         dimensioned<scalar>::lookupOrAddToDict
70         (
71             "cK1",
72             coeffDict(),
73             0.83
74         )
75     ),
76     cK2_
77     (
78         dimensioned<scalar>::lookupOrAddToDict
79         (
80             "cK2",
81             coeffDict(),
82             1.03
83         )
84     ),
85     cK3_
86     (
87         dimensioned<scalar>::lookupOrAddToDict
88         (
89             "cK3",
90             coeffDict(),
91             4.75
92         )
93     ),
94     cK4_
95     (
96         dimensioned<scalar>::lookupOrAddToDict
97         (
98             "cK4",
99             coeffDict(),
100             2.55
101         )
102     )
104     printCoeffs();
108 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
110 tmp<volScalarField> spectEddyVisc::k() const
112     volScalarField Eps = 2*nuEff()*magSqr(symm(fvc::grad(U())));
114     return
115         cK1_*pow(delta(), 2.0/3.0)*pow(Eps, 2.0/3.0)
116         *exp(-cK2_*pow(delta(), -4.0/3.0)*nu()/pow(Eps, 1.0/3.0))
117       - cK3_*pow(Eps*nu(), 1.0/2.0)
118        *erfc(cK4_*pow(delta(), -2.0/3.0)*pow(Eps, -1.0/6.0));
122 void spectEddyVisc::correct(const tmp<volTensorField>& gradU)
124     GenEddyVisc::correct(gradU);
126     volScalarField Re = sqr(delta())*mag(symm(gradU))/nu();
128     for (label i=0; i<5; i++)
129     {
130         nuSgs_ =
131             nu()
132            /(
133                scalar(1)
134                - exp(-cB_*pow(nu()/(nuSgs_ + nu()), 1.0/3.0)*pow(Re, -2.0/3.0))
135             );
136     }
138     nuSgs_.correctBoundaryConditions();
142 bool spectEddyVisc::read()
144     if (GenEddyVisc::read())
145     {
146         cB_.readIfPresent(coeffDict());
147         cK1_.readIfPresent(coeffDict());
148         cK2_.readIfPresent(coeffDict());
149         cK3_.readIfPresent(coeffDict());
150         cK4_.readIfPresent(coeffDict());
152         return true;
153     }
154     else
155     {
156         return false;
157     }
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 } // End namespace LESModels
164 } // End namespace incompressible
165 } // End namespace Foam
167 // ************************************************************************* //