FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "Smagorinsky2.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 namespace incompressible
00034 {
00035 namespace LESModels
00036 {
00037 
00038 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00039 
00040 defineTypeNameAndDebug(Smagorinsky2, 0);
00041 addToRunTimeSelectionTable(LESModel, Smagorinsky2, dictionary);
00042 
00043 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00044 
00045 Smagorinsky2::Smagorinsky2
00046 (
00047     const volVectorField& U,
00048     const surfaceScalarField& phi,
00049     transportModel& transport
00050 )
00051 :
00052     LESModel(typeName, U, phi, transport),
00053     Smagorinsky(U, phi, transport),
00054 
00055     cD2_
00056     (
00057         dimensioned<scalar>::lookupOrAddToDict
00058         (
00059             "cD2",
00060             coeffDict_,
00061             0.02
00062         )
00063     )
00064 {
00065     printCoeffs();
00066 }
00067 
00068 
00069 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00070 
00071 // Evaluate B (from the definition of an eddy viscosity model) and
00072 // return it.
00073 
00074 tmp<volSymmTensorField> Smagorinsky2::B() const
00075 {
00076     volSymmTensorField D = dev(symm(fvc::grad(U())));
00077 
00078     return (((2.0/3.0)*I)*k() - 2.0*nuSgs_*D - (2.0*cD2_)*delta()*(D&D));
00079 }
00080 
00081 
00082 tmp<fvVectorMatrix> Smagorinsky2::divDevBeff
00083 (
00084     volVectorField& U
00085 ) const
00086 {
00087     volTensorField gradU = fvc::grad(U);
00088 
00089     volSymmTensorField aniNuEff
00090     (
00091         "aniNuEff",
00092         I*nuEff() + cD2_*delta()*symm(gradU)
00093     );
00094 
00095     return
00096     (
00097       - fvm::laplacian(aniNuEff, U) - fvc::div(nuEff()*dev(fvc::grad(U)().T()))
00098     );
00099 }
00100 
00101 
00102 bool Smagorinsky2::read()
00103 {
00104     if (Smagorinsky::read())
00105     {
00106         cD2.readIfPresent(coeffDict());
00107 
00108         return true;
00109     }
00110     else
00111     {
00112         return false;
00113     }
00114 }
00115 
00116 
00117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00118 
00119 } // End namespace LESModels
00120 } // End namespace incompressible
00121 } // End namespace Foam
00122 
00123 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines