1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-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 "dynOneEqEddy.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace incompressible
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(dynOneEqEddy, 0);
41 addToRunTimeSelectionTable(LESModel, dynOneEqEddy, dictionary);
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 void dynOneEqEddy::updateSubGridScaleFields(const volSymmTensorField& D)
47 nuSgs_ = ck(D)*sqrt(k_)*delta();
48 nuSgs_.correctBoundaryConditions();
52 dimensionedScalar dynOneEqEddy::ck(const volSymmTensorField& D) const
54 volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
56 volSymmTensorField LL = dev(filter_(sqr(U())) - sqr(filter_(U())));
58 volSymmTensorField MM =
59 delta()*(filter_(sqrt(k_)*D) - 2*sqrt(KK + filter_(k_))*filter_(D));
61 dimensionedScalar MMMM = average(magSqr(MM));
63 if (MMMM.value() > VSMALL)
65 return average(LL && MM)/MMMM;
74 dimensionedScalar dynOneEqEddy::ce(const volSymmTensorField& D) const
76 volScalarField KK = 0.5*(filter_(magSqr(U())) - magSqr(filter_(U())));
79 pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta();
84 filter_(sqrt(k_)*magSqr(D))
85 - 2*sqrt(KK + filter_(k_))*magSqr(filter_(D))
88 dimensionedScalar mmmm = average(magSqr(mm));
90 if (mmmm.value() > VSMALL)
92 return average(ee*mm)/mmmm;
101 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
103 dynOneEqEddy::dynOneEqEddy
105 const volVectorField& U,
106 const surfaceScalarField& phi,
107 transportModel& transport
110 LESModel(typeName, U, phi, transport),
111 GenEddyVisc(U, phi, transport),
126 filterPtr_(LESfilter::New(U.mesh(), coeffDict())),
127 filter_(filterPtr_())
129 updateSubGridScaleFields(symm(fvc::grad(U)));
135 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
137 void dynOneEqEddy::correct(const tmp<volTensorField>& gradU)
139 GenEddyVisc::correct(gradU);
141 volSymmTensorField D = symm(gradU);
143 volScalarField P = 2.0*nuSgs_*magSqr(D);
148 + fvm::div(phi(), k_)
149 - fvm::laplacian(DkEff(), k_)
152 - fvm::Sp(ce(D)*sqrt(k_)/delta(), k_)
160 updateSubGridScaleFields(D);
164 bool dynOneEqEddy::read()
166 if (GenEddyVisc::read())
168 filter_.read(coeffDict());
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 } // End namespace LESModels
182 } // End namespace incompressible
183 } // End namespace Foam
185 // ************************************************************************* //