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

Smagorinsky2.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 "Smagorinsky2.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(Smagorinsky2, 0);
00042 addToRunTimeSelectionTable(LESModel, Smagorinsky2, dictionary);
00043 
00044 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00045 
00046 Smagorinsky2::Smagorinsky2
00047 (
00048     const volVectorField& U,
00049     const surfaceScalarField& phi,
00050     transportModel& transport
00051 )
00052 :
00053     LESModel(typeName, U, phi, transport),
00054     Smagorinsky(U, phi, transport),
00055 
00056     cD2_
00057     (
00058         dimensioned<scalar>::lookupOrAddToDict
00059         (
00060             "cD2",
00061             coeffDict_,
00062             0.02
00063         )
00064     )
00065 {
00066     printCoeffs();
00067 }
00068 
00069 
00070 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00071 
00072 // Evaluate B (from the definition of an eddy viscosity model) and
00073 // return it.
00074 
00075 tmp<volSymmTensorField> Smagorinsky2::B() const
00076 {
00077     volSymmTensorField D = dev(symm(fvc::grad(U())));
00078 
00079     return (((2.0/3.0)*I)*k() - 2.0*nuSgs_*D - (2.0*cD2_)*delta()*(D&D));
00080 }
00081 
00082 
00083 tmp<fvVectorMatrix> Smagorinsky2::divDevBeff
00084 (
00085     volVectorField& U
00086 ) const
00087 {
00088     volTensorField gradU = fvc::grad(U);
00089 
00090     volSymmTensorField aniNuEff
00091     (
00092         "aniNuEff",
00093         I*nuEff() + cD2_*delta()*symm(gradU)
00094     );
00095 
00096     return
00097     (
00098       - fvm::laplacian(aniNuEff, U) - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
00099     );
00100 }
00101 
00102 
00103 bool Smagorinsky2::read()
00104 {
00105     if (Smagorinsky::read())
00106     {
00107         cD2.readIfPresent(coeffDict());
00108 
00109         return true;
00110     }
00111     else
00112     {
00113         return false;
00114     }
00115 }
00116 
00117 
00118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00119 
00120 } // End namespace LESModels
00121 } // End namespace incompressible
00122 } // End namespace Foam
00123 
00124 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd