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