OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

LRRDiffStress.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "LRRDiffStress.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 namespace incompressible
00035 {
00036 namespace LESModels
00037 {
00038 
00039 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00040 
00041 defineTypeNameAndDebug(LRRDiffStress, 0);
00042 addToRunTimeSelectionTable(LESModel, LRRDiffStress, dictionary);
00043 
00044 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00045 
00046 void LRRDiffStress::updateSubGridScaleFields(const volScalarField& K)
00047 {
00048     nuSgs_ = ck_*sqrt(K)*delta();
00049     nuSgs_.correctBoundaryConditions();
00050 }
00051 
00052 
00053 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00054 
00055 LRRDiffStress::LRRDiffStress
00056 (
00057     const volVectorField& U,
00058     const surfaceScalarField& phi,
00059     transportModel& transport
00060 )
00061 :
00062     LESModel(typeName, U, phi, transport),
00063     GenSGSStress(U, phi, transport),
00064 
00065     ck_
00066     (
00067         dimensioned<scalar>::lookupOrAddToDict
00068         (
00069             "ck",
00070             coeffDict_,
00071             0.09
00072         )
00073     ),
00074     c1_
00075     (
00076         dimensioned<scalar>::lookupOrAddToDict
00077         (
00078             "c1",
00079             coeffDict_,
00080             1.8
00081         )
00082     ),
00083     c2_
00084     (
00085         dimensioned<scalar>::lookupOrAddToDict
00086         (
00087             "c2",
00088             coeffDict_,
00089             0.6
00090         )
00091     )
00092 {
00093     updateSubGridScaleFields(0.5*tr(B_));
00094 
00095     printCoeffs();
00096 }
00097 
00098 
00099 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00100 
00101 void LRRDiffStress::correct(const tmp<volTensorField>& tgradU)
00102 {
00103     const volTensorField& gradU = tgradU();
00104 
00105     GenSGSStress::correct(gradU);
00106 
00107     volSymmTensorField D = symm(gradU);
00108 
00109     volSymmTensorField P = -twoSymm(B_ & gradU);
00110 
00111     volScalarField K = 0.5*tr(B_);
00112     volScalarField Epsilon = 2*nuEff()*magSqr(D);
00113 
00114     fvSymmTensorMatrix BEqn
00115     (
00116         fvm::ddt(B_)
00117       + fvm::div(phi(), B_)
00118       - fvm::laplacian(DBEff(), B_)
00119       + fvm::Sp(c1_*Epsilon/K, B_)
00120      ==
00121         P
00122       - (0.667*(1.0 - c1_)*I)*Epsilon
00123       - c2_*(P - 0.333*I*tr(P))
00124       - (0.667 - 2*c1_)*I*pow(K, 1.5)/delta()
00125     );
00126 
00127     BEqn.relax();
00128     BEqn.solve();
00129 
00130     // Bounding the component kinetic energies
00131 
00132     forAll(B_, celli)
00133     {
00134         B_[celli].component(symmTensor::XX) =
00135             max(B_[celli].component(symmTensor::XX), k0().value());
00136         B_[celli].component(symmTensor::YY) =
00137             max(B_[celli].component(symmTensor::YY), k0().value());
00138         B_[celli].component(symmTensor::ZZ) =
00139             max(B_[celli].component(symmTensor::ZZ), k0().value());
00140     }
00141 
00142     K = 0.5*tr(B_);
00143     bound(K, k0());
00144 
00145     updateSubGridScaleFields(K);
00146 }
00147 
00148 
00149 bool LRRDiffStress::read()
00150 {
00151     if (GenSGSStress::read())
00152     {
00153         ck_.readIfPresent(coeffDict());
00154         c1_.readIfPresent(coeffDict());
00155         c2_.readIfPresent(coeffDict());
00156 
00157         return true;
00158     }
00159     else
00160     {
00161         return false;
00162     }
00163 }
00164 
00165 
00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00167 
00168 } // End namespace LESModels
00169 } // End namespace incompressible
00170 } // End namespace Foam
00171 
00172 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd