1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "spectEddyVisc.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace incompressible
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(spectEddyVisc, 0);
41 addToRunTimeSelectionTable(LESModel, spectEddyVisc, dictionary);
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 void spectEddyVisc::updateSubGridScaleFields(const volTensorField& gradU)
47 const volScalarField Re(sqr(delta())*mag(symm(gradU))/nu());
48 for (label i=0; i<5; i++)
54 - exp(-cB_*pow(nu()/(nuSgs_ + nu()), 1.0/3.0)*pow(Re, -2.0/3.0))
58 nuSgs_.correctBoundaryConditions();
62 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64 spectEddyVisc::spectEddyVisc
66 const volVectorField& U,
67 const surfaceScalarField& phi,
68 transportModel& transport,
69 const word& turbulenceModelName,
73 LESModel(modelName, U, phi, transport, turbulenceModelName),
74 GenEddyVisc(U, phi, transport),
78 dimensioned<scalar>::lookupOrAddToDict
87 dimensioned<scalar>::lookupOrAddToDict
96 dimensioned<scalar>::lookupOrAddToDict
105 dimensioned<scalar>::lookupOrAddToDict
114 dimensioned<scalar>::lookupOrAddToDict
124 updateSubGridScaleFields(fvc::grad(U));
128 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 tmp<volScalarField> spectEddyVisc::k() const
132 const volScalarField eps(2*nuEff()*magSqr(symm(fvc::grad(U()))));
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())
153 cB_.readIfPresent(coeffDict());
154 cK1_.readIfPresent(coeffDict());
155 cK2_.readIfPresent(coeffDict());
156 cK3_.readIfPresent(coeffDict());
157 cK4_.readIfPresent(coeffDict());
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 } // End namespace LESModels
171 } // End namespace incompressible
172 } // End namespace Foam
174 // ************************************************************************* //