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

oneEqEddy.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 "oneEqEddy.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 namespace compressible
00035 {
00036 namespace LESModels
00037 {
00038 
00039 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00040 
00041 defineTypeNameAndDebug(oneEqEddy, 0);
00042 addToRunTimeSelectionTable(LESModel, oneEqEddy, dictionary);
00043 
00044 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00045 
00046 void oneEqEddy::updateSubGridScaleFields()
00047 {
00048     muSgs_ = ck_*rho()*sqrt(k_)*delta();
00049     muSgs_.correctBoundaryConditions();
00050 
00051     alphaSgs_ = muSgs_/Prt_;
00052     alphaSgs_.correctBoundaryConditions();
00053 }
00054 
00055 
00056 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00057 
00058 oneEqEddy::oneEqEddy
00059 (
00060     const volScalarField& rho,
00061     const volVectorField& U,
00062     const surfaceScalarField& phi,
00063     const basicThermo& thermoPhysicalModel
00064 )
00065 :
00066     LESModel(typeName, rho, U, phi, thermoPhysicalModel),
00067     GenEddyVisc(rho, U, phi, thermoPhysicalModel),
00068 
00069     ck_
00070     (
00071         dimensioned<scalar>::lookupOrAddToDict
00072         (
00073             "ck",
00074             coeffDict_,
00075             0.094
00076         )
00077     )
00078 {
00079     updateSubGridScaleFields();
00080 
00081     printCoeffs();
00082 }
00083 
00084 
00085 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00086 
00087 void oneEqEddy::correct(const tmp<volTensorField>& tgradU)
00088 {
00089     const volTensorField& gradU = tgradU();
00090 
00091     GenEddyVisc::correct(gradU);
00092 
00093     volScalarField divU = fvc::div(phi()/fvc::interpolate(rho()));
00094     volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU)));
00095 
00096     fvScalarMatrix kEqn
00097     (
00098         fvm::ddt(rho(), k_)
00099       + fvm::div(phi(), k_)
00100       - fvm::laplacian(DkEff(), k_)
00101      ==
00102         G
00103       - fvm::SuSp(2.0/3.0*rho()*divU, k_)
00104       - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_)
00105     );
00106 
00107     kEqn.relax();
00108     kEqn.solve();
00109 
00110     bound(k_, k0());
00111 
00112     updateSubGridScaleFields();
00113 }
00114 
00115 
00116 bool oneEqEddy::read()
00117 {
00118     if (GenEddyVisc::read())
00119     {
00120         ck_.readIfPresent(coeffDict());
00121 
00122         return true;
00123     }
00124     else
00125     {
00126         return false;
00127     }
00128 }
00129 
00130 
00131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00132 
00133 } // End namespace LESModels
00134 } // End namespace compressible
00135 } // End namespace Foam
00136 
00137 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd