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

SpalartAllmarasIDDES.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) 2008-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 "SpalartAllmarasIDDES.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(SpalartAllmarasIDDES, 0);
00041 addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary);
00042 
00043 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
00044 
00045 tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
00046 {
00047     return max
00048     (
00049         0.25 - y_/static_cast<const volScalarField&>(hmax_()),
00050         scalar(-5)
00051     );
00052 }
00053 
00054 
00055 tmp<volScalarField> SpalartAllmarasIDDES::ft
00056 (
00057     const volScalarField& S
00058 ) const
00059 {
00060     return tanh(pow3(sqr(ct_)*rd(nuSgs_, S)));
00061 }
00062 
00063 
00064 tmp<volScalarField> SpalartAllmarasIDDES::fl
00065 (
00066     const volScalarField& S
00067 ) const
00068 {
00069     return tanh(pow(sqr(cl_)*rd(nu(), S), 10));
00070 }
00071 
00072 
00073 tmp<volScalarField> SpalartAllmarasIDDES::rd
00074 (
00075     const volScalarField& visc,
00076     const volScalarField& S
00077 ) const
00078 {
00079     return min
00080     (
00081         visc
00082        /(
00083            max
00084            (
00085                S,
00086                dimensionedScalar("SMALL", S.dimensions(), SMALL)
00087            )*sqr(kappa_*y_)
00088          + dimensionedScalar
00089            (
00090                "ROOTVSMALL",
00091                dimensionSet(0, 2 , -1, 0, 0),
00092                ROOTVSMALL
00093            )
00094        ),
00095        scalar(10)
00096     );
00097 }
00098 
00099 
00100 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
00101 
00102 tmp<volScalarField> SpalartAllmarasIDDES::fd(const volScalarField& S) const
00103 {
00104     return 1 - tanh(pow3(8*rd(nuEff(), S)));
00105 }
00106 
00107 
00108 tmp<volScalarField> SpalartAllmarasIDDES::dTilda(const volScalarField& S) const
00109 {
00110     volScalarField alpha = this->alpha();
00111     volScalarField expTerm = exp(sqr(alpha));
00112 
00113     volScalarField fHill =
00114         2*(pos(alpha)*pow(expTerm, -11.09) + neg(alpha)*pow(expTerm, -9.0));
00115 
00116     volScalarField fStep = min(2*pow(expTerm, -9.0), scalar(1));
00117     volScalarField fHyb = max(1 - fd(S), fStep);
00118     volScalarField fAmp = 1 - max(ft(S), fl(S));
00119     volScalarField fRestore = max(fHill - 1, scalar(0))*fAmp;
00120 
00121     // IGNORING ft2 terms
00122     volScalarField Psi = sqrt
00123     (
00124         min
00125         (
00126             scalar(100),
00127             (1 - Cb1_/(Cw1_*sqr(kappa_)*fwStar_)*fv2())/max(SMALL, fv1())
00128         )
00129     );
00130 
00131     return max
00132     (
00133         dimensionedScalar("SMALL", dimLength, SMALL),
00134         fHyb*(1 + fRestore*Psi)*y_
00135       + (1 - fHyb)*CDES_*Psi*delta()
00136     );
00137 }
00138 
00139 
00140 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00141 
00142 SpalartAllmarasIDDES::SpalartAllmarasIDDES
00143 (
00144     const volVectorField& U,
00145     const surfaceScalarField& phi,
00146     transportModel& transport
00147 )
00148 :
00149     SpalartAllmaras(U, phi, transport, typeName),
00150     hmax_
00151     (
00152         LESdelta::New
00153         (
00154             "hmax",
00155             mesh_,
00156             *this
00157         )
00158     ),
00159     IDDESDelta_
00160     (
00161         LESdelta::New
00162         (
00163             "IDDESDelta",
00164             mesh_,
00165             this->subDict(typeName + "Coeffs")
00166         )
00167     ),
00168     fwStar_
00169     (
00170         dimensioned<scalar>::lookupOrAddToDict
00171         (
00172             "fwStar",
00173             coeffDict_,
00174             0.424
00175         )
00176     ),
00177     cl_
00178     (
00179         dimensioned<scalar>::lookupOrAddToDict
00180         (
00181             "cl",
00182             coeffDict_,
00183             3.55
00184         )
00185     ),
00186     ct_
00187     (
00188         dimensioned<scalar>::lookupOrAddToDict
00189         (
00190             "ct",
00191             coeffDict_,
00192             1.63
00193         )
00194     )
00195 
00196 {}
00197 
00198 
00199 bool SpalartAllmarasIDDES::read()
00200 {
00201     if (SpalartAllmaras::read())
00202     {
00203         fwStar_.readIfPresent(coeffDict());
00204         cl_.readIfPresent(coeffDict());
00205         ct_.readIfPresent(coeffDict());
00206 
00207         return true;
00208     }
00209     else
00210     {
00211         return false;
00212     }
00213 }
00214 
00215 
00216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00217 
00218 } // End namespace LESModels
00219 } // End namespace incompressible
00220 } // End namespace Foam
00221 
00222 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines