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 "LRRDiffStress.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace incompressible
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(LRRDiffStress, 0);
41 addToRunTimeSelectionTable(LESModel, LRRDiffStress, dictionary);
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 void LRRDiffStress::updateSubGridScaleFields(const volScalarField& K)
47 nuSgs_ = ck_*sqrt(K)*delta();
48 nuSgs_.correctBoundaryConditions();
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 LRRDiffStress::LRRDiffStress
56 const volVectorField& U,
57 const surfaceScalarField& phi,
58 transportModel& transport,
59 const word& turbulenceModelName,
63 LESModel(modelName, U, phi, transport, turbulenceModelName),
64 GenSGSStress(U, phi, transport),
68 dimensioned<scalar>::lookupOrAddToDict
77 dimensioned<scalar>::lookupOrAddToDict
86 dimensioned<scalar>::lookupOrAddToDict
94 volScalarField K(0.5*tr(B_));
97 updateSubGridScaleFields(K);
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 void LRRDiffStress::correct(const tmp<volTensorField>& tgradU)
107 const volTensorField& gradU = tgradU();
109 GenSGSStress::correct(gradU);
111 const volSymmTensorField D(symm(gradU));
113 const volSymmTensorField P(-twoSymm(B_ & gradU));
115 volScalarField K(0.5*tr(B_));
116 const volScalarField Epsilon(2*nuEff()*magSqr(D));
118 tmp<fvSymmTensorMatrix> BEqn
121 + fvm::div(phi(), B_)
122 - fvm::laplacian(DBEff(), B_)
123 + fvm::Sp(c1_*Epsilon/K, B_)
126 - (0.667*(1.0 - c1_)*I)*Epsilon
127 - c2_*(P - 0.333*I*tr(P))
128 - (0.667 - 2*c1_)*I*pow(K, 1.5)/delta()
134 // Bounding the component kinetic energies
138 B_[celli].component(symmTensor::XX) =
139 max(B_[celli].component(symmTensor::XX), kMin_.value());
140 B_[celli].component(symmTensor::YY) =
141 max(B_[celli].component(symmTensor::YY), kMin_.value());
142 B_[celli].component(symmTensor::ZZ) =
143 max(B_[celli].component(symmTensor::ZZ), kMin_.value());
149 updateSubGridScaleFields(K);
153 bool LRRDiffStress::read()
155 if (GenSGSStress::read())
157 ck_.readIfPresent(coeffDict());
158 c1_.readIfPresent(coeffDict());
159 c2_.readIfPresent(coeffDict());
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace LESModels
173 } // End namespace incompressible
174 } // End namespace Foam
176 // ************************************************************************* //