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

vanDriestDelta.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 "vanDriestDelta.H"
00028 #include "LESModel.H"
00029 #include "wallFvPatch.H"
00030 #include "wallDistData.H"
00031 #include "wallPointYPlus.H"
00032 #include "addToRunTimeSelectionTable.H"
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 namespace Foam
00037 {
00038 namespace incompressible
00039 {
00040 namespace LESModels
00041 {
00042 
00043 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00044 
00045 defineTypeNameAndDebug(vanDriestDelta, 0);
00046 addToRunTimeSelectionTable(LESdelta, vanDriestDelta, dictionary);
00047 
00048 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00049 
00050 void vanDriestDelta::calcDelta()
00051 {
00052     const LESModel& lesModel = mesh_.lookupObject<LESModel>("LESProperties");
00053 
00054     const volVectorField& U = lesModel.U();
00055     const volScalarField& nu = lesModel.nu();
00056     tmp<volScalarField> nuSgs = lesModel.nuSgs();
00057 
00058     volScalarField ystar
00059     (
00060         IOobject
00061         (
00062             "ystar",
00063             mesh_.time().constant(),
00064             mesh_
00065         ),
00066         mesh_,
00067         dimensionedScalar("ystar", dimLength, GREAT)
00068     );
00069 
00070     const fvPatchList& patches = mesh_.boundary();
00071     forAll(patches, patchi)
00072     {
00073         if (isType<wallFvPatch>(patches[patchi]))
00074         {
00075             const fvPatchVectorField& Uw = U.boundaryField()[patchi];
00076             const scalarField& nuw = nu.boundaryField()[patchi];
00077             const scalarField& nuSgsw = nuSgs().boundaryField()[patchi];
00078 
00079             ystar.boundaryField()[patchi] =
00080                 nuw/sqrt((nuw + nuSgsw)*mag(Uw.snGrad()) + VSMALL);
00081         }
00082     }
00083 
00084     wallPointYPlus::yPlusCutOff = 500;
00085     wallDistData<wallPointYPlus> y(mesh_, ystar);
00086 
00087     delta_ = min
00088     (
00089         static_cast<const volScalarField&>(geometricDelta_()),
00090         (kappa_/Cdelta_)*((scalar(1) + SMALL) - exp(-y/ystar/Aplus_))*y
00091     );
00092 }
00093 
00094 
00095 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00096 
00097 vanDriestDelta::vanDriestDelta
00098 (
00099     const word& name,
00100     const fvMesh& mesh,
00101     const dictionary& dd
00102 )
00103 :
00104     LESdelta(name, mesh),
00105     geometricDelta_
00106     (
00107         LESdelta::New("geometricDelta", mesh, dd.subDict(type() + "Coeffs"))
00108     ),
00109     kappa_(dd.lookupOrDefault<scalar>("kappa", 0.41)),
00110     Aplus_
00111     (
00112         dd.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Aplus", 26.0)
00113     ),
00114     Cdelta_
00115     (
00116         dd.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cdelta", 0.158)
00117     ),
00118     calcInterval_
00119     (
00120         dd.subDict(type() + "Coeffs").lookupOrDefault<label>("calcInterval", 1)
00121     )
00122 {
00123     delta_ = geometricDelta_();
00124 }
00125 
00126 
00127 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00128 
00129 void vanDriestDelta::read(const dictionary& d)
00130 {
00131     const dictionary& dd(d.subDict(type() + "Coeffs"));
00132 
00133     geometricDelta_().read(dd);
00134     d.readIfPresent<scalar>("kappa", kappa_);
00135     dd.readIfPresent<scalar>("Aplus", Aplus_);
00136     dd.readIfPresent<scalar>("Cdelta", Cdelta_);
00137     dd.readIfPresent<label>("calcInterval", calcInterval_);
00138     calcDelta();
00139 }
00140 
00141 
00142 void vanDriestDelta::correct()
00143 {
00144     if (mesh().time().timeIndex() % calcInterval_ == 0)
00145     {
00146         geometricDelta_().correct();
00147         calcDelta();
00148     }
00149 }
00150 
00151 
00152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00153 
00154 } // End namespace LESModels
00155 } // End namespace incompressible
00156 } // End namespace Foam
00157 
00158 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd