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 "locDynOneEqEddy.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace incompressible
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(locDynOneEqEddy, 0);
41 addToRunTimeSelectionTable(LESModel, locDynOneEqEddy, dictionary);
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 void locDynOneEqEddy::updateSubGridScaleFields
47 const volSymmTensorField& D,
48 const volScalarField& KK
51 nuSgs_ = ck(D, KK)*sqrt(k_)*delta();
52 nuSgs_.correctBoundaryConditions();
56 volScalarField locDynOneEqEddy::ck
58 const volSymmTensorField& D,
59 const volScalarField& KK
62 const volSymmTensorField LL
64 simpleFilter_(dev(filter_(sqr(U())) - (sqr(filter_(U())))))
67 const volSymmTensorField MM
69 simpleFilter_(-2.0*delta()*pow(KK, 0.5)*filter_(D))
72 const volScalarField ck
74 simpleFilter_(0.5*(LL && MM))
76 simpleFilter_(magSqr(MM))
77 + dimensionedScalar("small", sqr(MM.dimensions()), VSMALL)
81 tmp<volScalarField> tfld = 0.5*(mag(ck) + ck);
86 volScalarField locDynOneEqEddy::ce
88 const volSymmTensorField& D,
89 const volScalarField& KK
92 const volScalarField ce
94 simpleFilter_(nuEff()*(filter_(magSqr(D)) - magSqr(filter_(D))))
95 /simpleFilter_(pow(KK, 1.5)/(2.0*delta()))
98 tmp<volScalarField> tfld = 0.5*(mag(ce) + ce);
103 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
105 locDynOneEqEddy::locDynOneEqEddy
107 const volVectorField& U,
108 const surfaceScalarField& phi,
109 transportModel& transport,
110 const word& turbulenceModelName,
111 const word& modelName
114 LESModel(modelName, U, phi, transport, turbulenceModelName),
115 GenEddyVisc(U, phi, transport),
130 simpleFilter_(U.mesh()),
131 filterPtr_(LESfilter::New(U.mesh(), coeffDict())),
132 filter_(filterPtr_())
136 const volScalarField KK(0.5*(filter_(magSqr(U)) - magSqr(filter_(U))));
137 updateSubGridScaleFields(symm(fvc::grad(U)), KK);
143 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
145 void locDynOneEqEddy::correct(const tmp<volTensorField>& gradU)
147 LESModel::correct(gradU);
149 const volSymmTensorField D(symm(gradU));
151 volScalarField KK(0.5*(filter_(magSqr(U())) - magSqr(filter_(U()))));
152 KK.max(dimensionedScalar("small", KK.dimensions(), SMALL));
154 const volScalarField P(2.0*nuSgs_*magSqr(D));
156 tmp<fvScalarMatrix> kEqn
159 + fvm::div(phi(), k_)
160 - fvm::laplacian(DkEff(), k_)
163 - fvm::Sp(ce(D, KK)*sqrt(k_)/delta(), k_)
171 updateSubGridScaleFields(D, KK);
175 bool locDynOneEqEddy::read()
177 if (GenEddyVisc::read())
179 filter_.read(coeffDict());
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 } // End namespace LESModels
193 } // End namespace incompressible
194 } // End namespace Foam
196 // ************************************************************************* //