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

spectEddyVisc.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 "spectEddyVisc.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(spectEddyVisc, 0);
00042 addToRunTimeSelectionTable(LESModel, spectEddyVisc, dictionary);
00043 
00044 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00045 
00046 void spectEddyVisc::updateSubGridScaleFields(const volTensorField& gradU)
00047 {
00048     volScalarField Re = sqr(delta())*mag(symm(gradU))/nu();
00049     for (label i=0; i<5; i++)
00050     {
00051         nuSgs_ =
00052             nu()
00053            /(
00054                  scalar(1)
00055                - exp(-cB_*pow(nu()/(nuSgs_ + nu()), 1.0/3.0)*pow(Re, -2.0/3.0))
00056             );
00057     }
00058 
00059     nuSgs_.correctBoundaryConditions();
00060 }
00061 
00062 
00063 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00064 
00065 spectEddyVisc::spectEddyVisc
00066 (
00067     const volVectorField& U,
00068     const surfaceScalarField& phi,
00069     transportModel& transport
00070 )
00071 :
00072     LESModel(typeName, U, phi, transport),
00073     GenEddyVisc(U, phi, transport),
00074 
00075 
00076     cB_
00077     (
00078         dimensioned<scalar>::lookupOrAddToDict
00079         (
00080             "cB",
00081             coeffDict_,
00082             8.22
00083         )
00084     ),
00085     cK1_
00086     (
00087         dimensioned<scalar>::lookupOrAddToDict
00088         (
00089             "cK1",
00090             coeffDict_,
00091             0.83
00092         )
00093     ),
00094     cK2_
00095     (
00096         dimensioned<scalar>::lookupOrAddToDict
00097         (
00098             "cK2",
00099             coeffDict_,
00100             1.03
00101         )
00102     ),
00103     cK3_
00104     (
00105         dimensioned<scalar>::lookupOrAddToDict
00106         (
00107             "cK3",
00108             coeffDict_,
00109             4.75
00110         )
00111     ),
00112     cK4_
00113     (
00114         dimensioned<scalar>::lookupOrAddToDict
00115         (
00116             "cK4",
00117             coeffDict_,
00118             2.55
00119         )
00120     )
00121 {
00122     printCoeffs();
00123 
00124     updateSubGridScaleFields(fvc::grad(U));
00125 }
00126 
00127 
00128 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00129 
00130 tmp<volScalarField> spectEddyVisc::k() const
00131 {
00132     volScalarField eps = 2*nuEff()*magSqr(symm(fvc::grad(U())));
00133 
00134     return
00135         cK1_*pow(delta()*eps, 2.0/3.0)
00136        *exp(-cK2_*pow(delta(), -4.0/3.0)*nu()/pow(eps, 1.0/3.0))
00137       - cK3_*sqrt(eps*nu())
00138        *erfc(cK4_*pow(delta(), -2.0/3.0)*sqrt(nu())*pow(eps, -1.0/6.0));
00139 }
00140 
00141 
00142 void spectEddyVisc::correct(const tmp<volTensorField>& gradU)
00143 {
00144     GenEddyVisc::correct(gradU);
00145     updateSubGridScaleFields(gradU());
00146 }
00147 
00148 
00149 bool spectEddyVisc::read()
00150 {
00151     if (GenEddyVisc::read())
00152     {
00153         cB_.readIfPresent(coeffDict());
00154         cK1_.readIfPresent(coeffDict());
00155         cK2_.readIfPresent(coeffDict());
00156         cK3_.readIfPresent(coeffDict());
00157         cK4_.readIfPresent(coeffDict());
00158 
00159         return true;
00160     }
00161     else
00162     {
00163         return false;
00164     }
00165 }
00166 
00167 
00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00169 
00170 } // End namespace LESModels
00171 } // End namespace incompressible
00172 } // End namespace Foam
00173 
00174 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd