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

kOmega.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 "kOmega.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(kOmega, 0);
00044 addToRunTimeSelectionTable(RASModel, kOmega, dictionary);
00045 
00046 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00047 
00048 kOmega::kOmega
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             "betaStar",
00062             coeffDict_,
00063             0.09
00064         )
00065     ),
00066     beta_
00067     (
00068         dimensioned<scalar>::lookupOrAddToDict
00069         (
00070             "beta",
00071             coeffDict_,
00072             0.072
00073         )
00074     ),
00075     alpha_
00076     (
00077         dimensioned<scalar>::lookupOrAddToDict
00078         (
00079             "alpha",
00080             coeffDict_,
00081             0.52
00082         )
00083     ),
00084     alphaK_
00085     (
00086         dimensioned<scalar>::lookupOrAddToDict
00087         (
00088             "alphaK",
00089             coeffDict_,
00090             0.5
00091         )
00092     ),
00093     alphaOmega_
00094     (
00095         dimensioned<scalar>::lookupOrAddToDict
00096         (
00097             "alphaOmega",
00098             coeffDict_,
00099             0.5
00100         )
00101     ),
00102 
00103     k_
00104     (
00105         IOobject
00106         (
00107             "k",
00108             runTime_.timeName(),
00109             mesh_,
00110             IOobject::NO_READ,
00111             IOobject::AUTO_WRITE
00112         ),
00113         autoCreateK("k", mesh_)
00114     ),
00115     omega_
00116     (
00117         IOobject
00118         (
00119             "omega",
00120             runTime_.timeName(),
00121             mesh_,
00122             IOobject::NO_READ,
00123             IOobject::AUTO_WRITE
00124         ),
00125         autoCreateOmega("omega", mesh_)
00126     ),
00127     nut_
00128     (
00129         IOobject
00130         (
00131             "nut",
00132             runTime_.timeName(),
00133             mesh_,
00134             IOobject::NO_READ,
00135             IOobject::AUTO_WRITE
00136         ),
00137         autoCreateNut("nut", mesh_)
00138     )
00139 {
00140     nut_ = k_/(omega_ + omegaSmall_);
00141     nut_.correctBoundaryConditions();
00142 
00143     printCoeffs();
00144 }
00145 
00146 
00147 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00148 
00149 tmp<volSymmTensorField> kOmega::R() const
00150 {
00151     return tmp<volSymmTensorField>
00152     (
00153         new volSymmTensorField
00154         (
00155             IOobject
00156             (
00157                 "R",
00158                 runTime_.timeName(),
00159                 mesh_,
00160                 IOobject::NO_READ,
00161                 IOobject::NO_WRITE
00162             ),
00163             ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
00164             k_.boundaryField().types()
00165         )
00166     );
00167 }
00168 
00169 
00170 tmp<volSymmTensorField> kOmega::devReff() const
00171 {
00172     return tmp<volSymmTensorField>
00173     (
00174         new volSymmTensorField
00175         (
00176             IOobject
00177             (
00178                 "devRhoReff",
00179                 runTime_.timeName(),
00180                 mesh_,
00181                 IOobject::NO_READ,
00182                 IOobject::NO_WRITE
00183             ),
00184            -nuEff()*dev(twoSymm(fvc::grad(U_)))
00185         )
00186     );
00187 }
00188 
00189 
00190 tmp<fvVectorMatrix> kOmega::divDevReff(volVectorField& U) const
00191 {
00192     return
00193     (
00194       - fvm::laplacian(nuEff(), U)
00195       - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
00196     );
00197 }
00198 
00199 
00200 bool kOmega::read()
00201 {
00202     if (RASModel::read())
00203     {
00204         Cmu_.readIfPresent(coeffDict());
00205         beta_.readIfPresent(coeffDict());
00206         alphaK_.readIfPresent(coeffDict());
00207         alphaOmega_.readIfPresent(coeffDict());
00208 
00209         return true;
00210     }
00211     else
00212     {
00213         return false;
00214     }
00215 }
00216 
00217 
00218 void kOmega::correct()
00219 {
00220     RASModel::correct();
00221 
00222     if (!turbulence_)
00223     {
00224         return;
00225     }
00226 
00227     volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
00228 
00229     // Update omega and G at the wall
00230     omega_.boundaryField().updateCoeffs();
00231 
00232     // Turbulence specific dissipation rate equation
00233     tmp<fvScalarMatrix> omegaEqn
00234     (
00235         fvm::ddt(omega_)
00236       + fvm::div(phi_, omega_)
00237       - fvm::Sp(fvc::div(phi_), omega_)
00238       - fvm::laplacian(DomegaEff(), omega_)
00239      ==
00240         alpha_*G*omega_/k_
00241       - fvm::Sp(beta_*omega_, omega_)
00242     );
00243 
00244     omegaEqn().relax();
00245 
00246     omegaEqn().boundaryManipulate(omega_.boundaryField());
00247 
00248     solve(omegaEqn);
00249     bound(omega_, omega0_);
00250 
00251 
00252     // Turbulent kinetic energy equation
00253     tmp<fvScalarMatrix> kEqn
00254     (
00255         fvm::ddt(k_)
00256       + fvm::div(phi_, k_)
00257       - fvm::Sp(fvc::div(phi_), k_)
00258       - fvm::laplacian(DkEff(), k_)
00259      ==
00260         G
00261       - fvm::Sp(Cmu_*omega_, k_)
00262     );
00263 
00264     kEqn().relax();
00265     solve(kEqn);
00266     bound(k_, k0_);
00267 
00268 
00269     // Re-calculate viscosity
00270     nut_ = k_/(omega_ + omegaSmall_);
00271     nut_.correctBoundaryConditions();
00272 }
00273 
00274 
00275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00276 
00277 } // End namespace RASModels
00278 } // End namespace incompressible
00279 } // End namespace Foam
00280 
00281 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd