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

LamBremhorstKE.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 "LamBremhorstKE.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 
00030 #include "backwardsCompatibilityWallFunctions.H"
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 namespace incompressible
00037 {
00038 namespace RASModels
00039 {
00040 
00041 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00042 
00043 defineTypeNameAndDebug(LamBremhorstKE, 0);
00044 addToRunTimeSelectionTable(RASModel, LamBremhorstKE, dictionary);
00045 
00046 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00047 
00048 LamBremhorstKE::LamBremhorstKE
00049 (
00050     const volVectorField& U,
00051     const surfaceScalarField& phi,
00052     transportModel& lamTransportModel
00053 )
00054 :
00055     RASModel(typeName, U, phi, lamTransportModel),
00056 
00057     Cmu_
00058     (
00059         dimensioned<scalar>::lookupOrAddToDict
00060         (
00061             "Cmu",
00062             coeffDict_,
00063             0.09
00064         )
00065     ),
00066     C1_
00067     (
00068         dimensioned<scalar>::lookupOrAddToDict
00069         (
00070             "C1",
00071             coeffDict_,
00072             1.44
00073         )
00074     ),
00075     C2_
00076     (
00077         dimensioned<scalar>::lookupOrAddToDict
00078         (
00079             "C2",
00080             coeffDict_,
00081             1.92
00082         )
00083     ),
00084     sigmaEps_
00085     (
00086         dimensioned<scalar>::lookupOrAddToDict
00087         (
00088             "alphaEps",
00089             coeffDict_,
00090             1.3
00091         )
00092     ),
00093 
00094     k_
00095     (
00096         IOobject
00097         (
00098             "k",
00099             runTime_.timeName(),
00100             mesh_,
00101             IOobject::MUST_READ,
00102             IOobject::AUTO_WRITE
00103         ),
00104         mesh_
00105     ),
00106 
00107     epsilon_
00108     (
00109         IOobject
00110         (
00111             "epsilon",
00112             runTime_.timeName(),
00113             mesh_,
00114             IOobject::MUST_READ,
00115             IOobject::AUTO_WRITE
00116         ),
00117         autoCreateEpsilon("epsilon", mesh_)
00118     ),
00119 
00120     y_(mesh_),
00121 
00122     Rt_(sqr(k_)/(nu()*epsilon_)),
00123 
00124     fMu_
00125     (
00126         sqr(scalar(1) - exp(-0.0165*(sqrt(k_)*y_/nu())))
00127        *(scalar(1) + 20.5/(Rt_ + SMALL))
00128     ),
00129 
00130     nut_
00131     (
00132         IOobject
00133         (
00134             "nut",
00135             runTime_.timeName(),
00136             mesh_,
00137             IOobject::NO_READ,
00138             IOobject::AUTO_WRITE
00139         ),
00140         autoCreateNut("nut", mesh_)
00141     )
00142 {
00143     nut_ = Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_);
00144     nut_.correctBoundaryConditions();
00145 
00146     printCoeffs();
00147 }
00148 
00149 
00150 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00151 
00152 tmp<volSymmTensorField> LamBremhorstKE::R() const
00153 {
00154     return tmp<volSymmTensorField>
00155     (
00156         new volSymmTensorField
00157         (
00158             IOobject
00159             (
00160                 "R",
00161                 runTime_.timeName(),
00162                 mesh_,
00163                 IOobject::NO_READ,
00164                 IOobject::NO_WRITE
00165             ),
00166             ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
00167             k_.boundaryField().types()
00168         )
00169     );
00170 }
00171 
00172 
00173 tmp<volSymmTensorField> LamBremhorstKE::devReff() const
00174 {
00175     return tmp<volSymmTensorField>
00176     (
00177         new volSymmTensorField
00178         (
00179             IOobject
00180             (
00181                 "devRhoReff",
00182                 runTime_.timeName(),
00183                 mesh_,
00184                 IOobject::NO_READ,
00185                 IOobject::NO_WRITE
00186             ),
00187            -nuEff()*dev(twoSymm(fvc::grad(U_)))
00188         )
00189     );
00190 }
00191 
00192 
00193 tmp<fvVectorMatrix> LamBremhorstKE::divDevReff(volVectorField& U) const
00194 {
00195     return
00196     (
00197       - fvm::laplacian(nuEff(), U)
00198       - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
00199     );
00200 }
00201 
00202 
00203 bool LamBremhorstKE::read()
00204 {
00205     if (RASModel::read())
00206     {
00207         Cmu_.readIfPresent(coeffDict());
00208         C1_.readIfPresent(coeffDict());
00209         C2_.readIfPresent(coeffDict());
00210         sigmaEps_.readIfPresent(coeffDict());
00211 
00212         return true;
00213     }
00214     else
00215     {
00216         return false;
00217     }
00218 }
00219 
00220 
00221 void LamBremhorstKE::correct()
00222 {
00223     RASModel::correct();
00224 
00225     if (!turbulence_)
00226     {
00227         return;
00228     }
00229 
00230     if (mesh_.changing())
00231     {
00232         y_.correct();
00233     }
00234 
00235     volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
00236 
00237     // Calculate parameters and coefficients for low-Reynolds number model
00238 
00239     Rt_ = sqr(k_)/(nu()*epsilon_);
00240     volScalarField Ry = sqrt(k_)*y_/nu();
00241 
00242     fMu_ = sqr(scalar(1) - exp(-0.0165*Ry))*(scalar(1) + 20.5/(Rt_ + SMALL));
00243 
00244     volScalarField f1 = scalar(1) + pow(0.05/(fMu_ + SMALL), 3);
00245     volScalarField f2 = scalar(1) - exp(-sqr(Rt_));
00246 
00247     // Update espsilon and G at the wall
00248     epsilon_.boundaryField().updateCoeffs();
00249 
00250     // Dissipation equation
00251 
00252     tmp<fvScalarMatrix> epsEqn
00253     (
00254         fvm::ddt(epsilon_)
00255       + fvm::div(phi_, epsilon_)
00256       - fvm::laplacian(DepsilonEff(), epsilon_)
00257      ==
00258         C1_*f1*G*epsilon_/k_
00259       - fvm::Sp(C2_*f2*epsilon_/k_, epsilon_)
00260     );
00261 
00262     epsEqn().relax();
00263 
00264     epsEqn().boundaryManipulate(epsilon_.boundaryField());
00265 
00266     solve(epsEqn);
00267     bound(epsilon_, epsilon0_);
00268 
00269 
00270     // Turbulent kinetic energy equation
00271 
00272     tmp<fvScalarMatrix> kEqn
00273     (
00274         fvm::ddt(k_)
00275       + fvm::div(phi_, k_)
00276       - fvm::laplacian(DkEff(), k_)
00277      ==
00278         G - fvm::Sp(epsilon_/k_, k_)
00279     );
00280 
00281     kEqn().relax();
00282     solve(kEqn);
00283     bound(k_, k0_);
00284 
00285 
00286     // Re-calculate viscosity
00287     nut_ = Cmu_*fMu_*sqr(k_)/epsilon_;
00288     nut_.correctBoundaryConditions();
00289 }
00290 
00291 
00292 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00293 
00294 } // End namespace RASModels
00295 } // End namespace incompressible
00296 } // End namespace Foam
00297 
00298 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd