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

DeardorffDiffStress.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 "DeardorffDiffStress.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(DeardorffDiffStress, 0);
00042 addToRunTimeSelectionTable(LESModel, DeardorffDiffStress, dictionary);
00043 
00044 
00045 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00046 
00047 void DeardorffDiffStress::updateSubGridScaleFields(const volScalarField& K)
00048 {
00049     muSgs_ = ck_*rho()*sqrt(K)*delta();
00050     muSgs_.correctBoundaryConditions();
00051 
00052     alphaSgs_ = muSgs_/Prt_;
00053     alphaSgs_.correctBoundaryConditions();
00054 }
00055 
00056 
00057 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00058 
00059 DeardorffDiffStress::DeardorffDiffStress
00060 (
00061     const volScalarField& rho,
00062     const volVectorField& U,
00063     const surfaceScalarField& phi,
00064     const basicThermo& thermoPhysicalModel
00065 )
00066 :
00067     LESModel(typeName, rho, U, phi, thermoPhysicalModel),
00068     GenSGSStress(rho, U, phi, thermoPhysicalModel),
00069 
00070     ck_
00071     (
00072         dimensioned<scalar>::lookupOrAddToDict
00073         (
00074             "ck",
00075             coeffDict_,
00076             0.094
00077         )
00078     ),
00079     cm_
00080     (
00081         dimensioned<scalar>::lookupOrAddToDict
00082         (
00083             "cm",
00084             coeffDict_,
00085             4.13
00086         )
00087     )
00088 {
00089     updateSubGridScaleFields(0.5*tr(B_));
00090 
00091     printCoeffs();
00092 }
00093 
00094 
00095 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00096 
00097 void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU)
00098 {
00099     const volTensorField& gradU = tgradU();
00100 
00101     GenSGSStress::correct(gradU);
00102 
00103     volSymmTensorField D = symm(gradU);
00104 
00105     volSymmTensorField P = -rho()*twoSymm(B_ & gradU);
00106 
00107     volScalarField K = 0.5*tr(B_);
00108 
00109     solve
00110     (
00111         fvm::ddt(rho(), B_)
00112       + fvm::div(phi(), B_)
00113       - fvm::laplacian(DBEff(), B_)
00114       + fvm::Sp(cm_*rho()*sqrt(K)/delta(), B_)
00115      ==
00116         P
00117       + 0.8*rho()*K*D
00118       - (2*ce_ - 0.667*cm_)*I*rho()*epsilon()
00119     );
00120 
00121 
00122     // Bounding the component kinetic energies
00123 
00124     forAll(B_, celli)
00125     {
00126         B_[celli].component(symmTensor::XX) =
00127             max(B_[celli].component(symmTensor::XX), 1.0e-10);
00128         B_[celli].component(symmTensor::YY) =
00129             max(B_[celli].component(symmTensor::YY), 1.0e-10);
00130         B_[celli].component(symmTensor::ZZ) =
00131             max(B_[celli].component(symmTensor::ZZ), 1.0e-10);
00132     }
00133 
00134     K = 0.5*tr(B_);
00135     bound(K, k0());
00136 
00137     updateSubGridScaleFields(K);
00138 }
00139 
00140 
00141 bool DeardorffDiffStress::read()
00142 {
00143     if (GenSGSStress::read())
00144     {
00145         ck_.readIfPresent(coeffDict());
00146         cm_.readIfPresent(coeffDict());
00147 
00148         return true;
00149     }
00150     else
00151     {
00152         return false;
00153     }
00154 }
00155 
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 } // End namespace LESModels
00160 } // End namespace compressible
00161 } // End namespace Foam
00162 
00163 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd