1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace incompressible
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++)
55 - exp(-cB_*pow(nu()/(nuSgs_ + nu()), 1.0/3.0)*pow(Re, -2.0/3.0))
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),
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 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 // ************************************************************************* //