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

LienLeschzinerLowRe.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 "LienLeschzinerLowRe.H"
00028 #include "wallFvPatch.H"
00029 #include "addToRunTimeSelectionTable.H"
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 namespace incompressible
00036 {
00037 namespace RASModels
00038 {
00039 
00040 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00041 
00042 defineTypeNameAndDebug(LienLeschzinerLowRe, 0);
00043 addToRunTimeSelectionTable(RASModel, LienLeschzinerLowRe, dictionary);
00044 
00045 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00046 
00047 LienLeschzinerLowRe::LienLeschzinerLowRe
00048 (
00049     const volVectorField& U,
00050     const surfaceScalarField& phi,
00051     transportModel& lamTransportModel
00052 )
00053 :
00054     RASModel(typeName, U, phi, lamTransportModel),
00055 
00056     C1_
00057     (
00058         dimensioned<scalar>::lookupOrAddToDict
00059         (
00060             "C1",
00061             coeffDict_,
00062             1.44
00063         )
00064     ),
00065     C2_
00066     (
00067         dimensioned<scalar>::lookupOrAddToDict
00068         (
00069             "C2",
00070             coeffDict_,
00071             1.92
00072         )
00073     ),
00074     sigmak_
00075     (
00076         dimensioned<scalar>::lookupOrAddToDict
00077         (
00078             "sigmak",
00079             coeffDict_,
00080             1.0
00081         )
00082     ),
00083     sigmaEps_
00084     (
00085         dimensioned<scalar>::lookupOrAddToDict
00086         (
00087             "sigmaEps",
00088             coeffDict_,
00089             1.3
00090         )
00091     ),
00092     Cmu_
00093     (
00094         dimensioned<scalar>::lookupOrAddToDict
00095         (
00096             "Cmu",
00097             coeffDict_,
00098             0.09
00099         )
00100     ),
00101     kappa_
00102     (
00103         dimensioned<scalar>::lookupOrAddToDict
00104         (
00105             "kappa",
00106             coeffDict_,
00107             0.41
00108         )
00109     ),
00110     Am_
00111     (
00112         dimensioned<scalar>::lookupOrAddToDict
00113         (
00114             "Am",
00115             coeffDict_,
00116             0.016
00117         )
00118     ),
00119     Aepsilon_
00120     (
00121         dimensioned<scalar>::lookupOrAddToDict
00122         (
00123             "Aepsilon",
00124             coeffDict_,
00125             0.263
00126         )
00127     ),
00128     Amu_
00129     (
00130         dimensioned<scalar>::lookupOrAddToDict
00131         (
00132             "Amu",
00133             coeffDict_,
00134             0.00222
00135         )
00136     ),
00137 
00138     k_
00139     (
00140         IOobject
00141         (
00142             "k",
00143             runTime_.timeName(),
00144             mesh_,
00145             IOobject::MUST_READ,
00146             IOobject::AUTO_WRITE
00147         ),
00148         mesh_
00149     ),
00150 
00151     epsilon_
00152     (
00153         IOobject
00154         (
00155             "epsilon",
00156             runTime_.timeName(),
00157             mesh_,
00158             IOobject::MUST_READ,
00159             IOobject::AUTO_WRITE
00160         ),
00161         mesh_
00162     ),
00163 
00164     y_(mesh_),
00165 
00166     yStar_(sqrt(k_)*y_/nu() + SMALL),
00167 
00168     nut_
00169     (
00170         Cmu_*(scalar(1) - exp(-Am_*yStar_))
00171        /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)*sqr(k_)
00172        /(epsilon_ + epsilonSmall_)
00173     )
00174 {
00175     printCoeffs();
00176 }
00177 
00178 
00179 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00180 
00181 tmp<volSymmTensorField> LienLeschzinerLowRe::R() const
00182 {
00183     volTensorField gradU = fvc::grad(U_);
00184 
00185     return tmp<volSymmTensorField>
00186     (
00187         new volSymmTensorField
00188         (
00189             IOobject
00190             (
00191                 "R",
00192                 runTime_.timeName(),
00193                 mesh_,
00194                 IOobject::NO_READ,
00195                 IOobject::NO_WRITE
00196             ),
00197             ((2.0/3.0)*I)*k_ - nut_*twoSymm(gradU),
00198             k_.boundaryField().types()
00199         )
00200     );
00201 }
00202 
00203 
00204 tmp<volSymmTensorField> LienLeschzinerLowRe::devReff() const
00205 {
00206     return tmp<volSymmTensorField>
00207     (
00208         new volSymmTensorField
00209         (
00210             IOobject
00211             (
00212                 "devRhoReff",
00213                 runTime_.timeName(),
00214                 mesh_,
00215                 IOobject::NO_READ,
00216                 IOobject::NO_WRITE
00217             ),
00218            -nuEff()*dev(twoSymm(fvc::grad(U_)))
00219         )
00220     );
00221 }
00222 
00223 
00224 tmp<fvVectorMatrix> LienLeschzinerLowRe::divDevReff(volVectorField& U) const
00225 {
00226     return
00227     (
00228       - fvm::laplacian(nuEff(), U)
00229     //- (fvc::grad(U) & fvc::grad(nuEff()))
00230       - fvc::div(nuEff()*fvc::grad(U)().T())
00231     );
00232 }
00233 
00234 
00235 bool LienLeschzinerLowRe::read()
00236 {
00237     if (RASModel::read())
00238     {
00239         C1_.readIfPresent(coeffDict());
00240         C2_.readIfPresent(coeffDict());
00241         sigmak_.readIfPresent(coeffDict());
00242         sigmaEps_.readIfPresent(coeffDict());
00243         Cmu_.readIfPresent(coeffDict());
00244         Am_.readIfPresent(coeffDict());
00245         Aepsilon_.readIfPresent(coeffDict());
00246         Amu_.readIfPresent(coeffDict());
00247 
00248         return true;
00249     }
00250     else
00251     {
00252         return false;
00253     }
00254 }
00255 
00256 
00257 void LienLeschzinerLowRe::correct()
00258 {
00259     RASModel::correct();
00260 
00261     if (!turbulence_)
00262     {
00263         return;
00264     }
00265 
00266     if (mesh_.changing())
00267     {
00268         y_.correct();
00269     }
00270 
00271     scalar Cmu75 = pow(Cmu_.value(), 0.75);
00272 
00273     volTensorField gradU = fvc::grad(U_);
00274 
00275     // generation term
00276     volScalarField S2 = symm(gradU) && gradU;
00277 
00278     yStar_ = sqrt(k_)*y_/nu() + SMALL;
00279     volScalarField Rt = sqr(k_)/(nu()*epsilon_);
00280 
00281     volScalarField fMu =
00282         (scalar(1) - exp(-Am_*yStar_))
00283        /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL);
00284 
00285     volScalarField f2 = scalar(1) - 0.3*exp(-sqr(Rt));
00286 
00287     volScalarField G = Cmu_*fMu*sqr(k_)/epsilon_*S2;
00288 
00289 
00290     // Dissipation equation
00291     tmp<fvScalarMatrix> epsEqn
00292     (
00293         fvm::ddt(epsilon_)
00294       + fvm::div(phi_, epsilon_)
00295       - fvm::laplacian(DepsilonEff(), epsilon_)
00296       ==
00297         C1_*G*epsilon_/k_
00298         // E-term
00299         + C2_*f2*Cmu75*pow(k_, scalar(0.5))
00300         /(kappa_*y_*(scalar(1) - exp(-Aepsilon_*yStar_)))
00301        *exp(-Amu_*sqr(yStar_))*epsilon_
00302       - fvm::Sp(C2_*f2*epsilon_/k_, epsilon_)
00303     );
00304 
00305     epsEqn().relax();
00306 
00307 #   include "LienLeschzinerLowReSetWallDissipation.H"
00308 #   include "wallDissipationI.H"
00309 
00310     solve(epsEqn);
00311     bound(epsilon_, epsilon0_);
00312 
00313 
00314     // Turbulent kinetic energy equation
00315 
00316     tmp<fvScalarMatrix> kEqn
00317     (
00318         fvm::ddt(k_)
00319       + fvm::div(phi_, k_)
00320       - fvm::laplacian(DkEff(), k_)
00321       ==
00322         G
00323       - fvm::Sp(epsilon_/k_, k_)
00324     );
00325 
00326     kEqn().relax();
00327     solve(kEqn);
00328     bound(k_, k0_);
00329 
00330 
00331     // Re-calculate viscosity
00332     nut_ = Cmu_*fMu*sqr(k_)/epsilon_;
00333 }
00334 
00335 
00336 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00337 
00338 } // End namespace RASModels
00339 } // End namespace incompressible
00340 } // End namespace Foam
00341 
00342 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd