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 compressible
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& rho = lesModel.rho();
00056     const volScalarField& mu = lesModel.mu();
00057     tmp<volScalarField> muSgs = lesModel.muSgs();
00058 
00059     volScalarField ystar
00060     (
00061         IOobject
00062         (
00063             "ystar",
00064             mesh_.time().constant(),
00065             mesh_
00066         ),
00067         mesh_,
00068         dimensionedScalar("ystar", dimLength, GREAT)
00069     );
00070 
00071     const fvPatchList& patches = mesh_.boundary();
00072     forAll(patches, patchi)
00073     {
00074         if (isType<wallFvPatch>(patches[patchi]))
00075         {
00076             const fvPatchVectorField& Uw = U.boundaryField()[patchi];
00077             const scalarField& rhow = rho.boundaryField()[patchi];
00078             const scalarField& muw = mu.boundaryField()[patchi];
00079             const scalarField& muSgsw = muSgs().boundaryField()[patchi];
00080 
00081             ystar.boundaryField()[patchi] =
00082                 muw/(rhow*sqrt((muw + muSgsw)*mag(Uw.snGrad())/rhow + VSMALL));
00083         }
00084     }
00085 
00086     wallPointYPlus::yPlusCutOff = 500;
00087     wallDistData<wallPointYPlus> y(mesh_, ystar);
00088 
00089     delta_ = min
00090     (
00091         static_cast<const volScalarField&>(geometricDelta_()),
00092         (kappa_/Cdelta_)*((scalar(1) + SMALL) - exp(-y/ystar/Aplus_))*y
00093     );
00094 }
00095 
00096 
00097 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00098 
00099 vanDriestDelta::vanDriestDelta
00100 (
00101     const word& name,
00102     const fvMesh& mesh,
00103     const dictionary& dd
00104 )
00105 :
00106     LESdelta(name, mesh),
00107     geometricDelta_
00108     (
00109         LESdelta::New("geometricDelta", mesh, dd.subDict(type() + "Coeffs"))
00110     ),
00111     kappa_(dd.lookupOrDefault<scalar>("kappa", 0.41)),
00112     Aplus_
00113     (
00114         dd.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Aplus", 26.0)
00115     ),
00116     Cdelta_
00117     (
00118         dd.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cdelta", 0.158)
00119     ),
00120     calcInterval_
00121     (
00122         dd.subDict(type() + "Coeffs").lookupOrDefault<label>("calcInterval", 1)
00123     )
00124 {
00125     delta_ = geometricDelta_();
00126 }
00127 
00128 
00129 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00130 
00131 void vanDriestDelta::read(const dictionary& d)
00132 {
00133     const dictionary& dd(d.subDict(type() + "Coeffs"));
00134 
00135     geometricDelta_().read(dd);
00136     d.readIfPresent<scalar>("kappa", kappa_);
00137     dd.readIfPresent<scalar>("Aplus", Aplus_);
00138     dd.readIfPresent<scalar>("Cdelta", Cdelta_);
00139     dd.readIfPresent<label>("calcInterval", calcInterval_);
00140     calcDelta();
00141 }
00142 
00143 
00144 void vanDriestDelta::correct()
00145 {
00146     if (mesh().time().timeIndex() % calcInterval_ == 0)
00147     {
00148         geometricDelta_().correct();
00149         calcDelta();
00150     }
00151 }
00152 
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 } // End namespace LESModels
00157 } // End namespace compressible
00158 } // End namespace Foam
00159 
00160 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd