OpenFOAM logo
Open Source CFD Toolkit

turbulenceModel.H

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-2005 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 Class
00026     turbulenceModel
00027 
00028 Description
00029     Abstract base class for incompressible turbulence models.
00030 
00031 SourceFiles
00032     turbulenceModel.C
00033     newTurbulenceModel.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef turbulenceModel_H
00038 #define turbulenceModel_H
00039 
00040 #include "volFields.H"
00041 #include "surfaceFields.H"
00042 #include "nearWallDist.H"
00043 #include "fvm.H"
00044 #include "fvc.H"
00045 #include "fvMatrices.H"
00046 #include "incompressible/transportModel/transportModel.H"
00047 #include "IOdictionary.H"
00048 #include "Switch.H"
00049 #include "bound.H"
00050 #include "autoPtr.H"
00051 #include "runTimeSelectionTables.H"
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class turbulenceModel Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class turbulenceModel
00063 :
00064     public IOdictionary
00065 {
00066 
00067 protected:
00068 
00069     // Protected data
00070 
00071         const Time& runTime_;
00072         const fvMesh& mesh_;
00073 
00074         const volVectorField& U_;
00075         const surfaceScalarField& phi_;
00076 
00077         transportModel& transportModel_;
00078 
00079         Switch turbulence_;
00080         dictionary turbulenceModelCoeffs_;
00081 
00082         scalar kappa_;
00083         scalar E_;
00084 
00085         scalar yPlusLam(const scalar kappa, const scalar E);
00086         scalar yPlusLam_;
00087 
00088         dimensionedScalar k0_;
00089         dimensionedScalar epsilon0_;
00090         dimensionedScalar epsilonSmall_;
00091 
00092         nearWallDist y_;
00093 
00094 
00095 private:
00096 
00097     // Private Member Functions
00098 
00099         //- Disallow default bitwise copy construct
00100         turbulenceModel(const turbulenceModel&);
00101 
00102         //- Disallow default bitwise assignment
00103         void operator=(const turbulenceModel&);
00104 
00105 
00106 public:
00107 
00108     //- Runtime type information
00109     TypeName("turbulenceModel");
00110 
00111 
00112     // Declare run-time constructor selection table
00113 
00114         declareRunTimeSelectionTable
00115         (
00116             autoPtr,
00117             turbulenceModel,
00118             dictionary,
00119             (
00120                 const volVectorField& U,
00121                 const surfaceScalarField& phi,
00122                 transportModel& transport
00123             ),
00124             (U, phi, transport)
00125         );
00126 
00127 
00128     // Constructors
00129 
00130         //- Construct from components
00131         turbulenceModel
00132         (
00133             const word& type,
00134             const volVectorField& U,
00135             const surfaceScalarField& phi,
00136             transportModel& transport
00137         );
00138 
00139 
00140     // Selectors
00141 
00142         //- Return a reference to the selected turbulence model
00143         static autoPtr<turbulenceModel> New
00144         (
00145             const volVectorField& U,
00146             const surfaceScalarField& phi,
00147             transportModel& transport
00148         );
00149 
00150 
00151     // Destructor
00152 
00153         virtual ~turbulenceModel();
00154 
00155 
00156     // Member Functions
00157 
00158         // Access
00159 
00160             //- Return the value of k0 which k is not allowed to be less than
00161             const dimensionedScalar& k0() const
00162             {
00163                 return k0_;
00164             }
00165 
00166             //- Return the value of epsilon0 which epsilon is not allowed to be
00167             //  less than
00168             const dimensionedScalar& epsilon0() const
00169             {
00170                 return epsilon0_;
00171             }
00172 
00173             //- Return the value of epsilonSmall which is added to epsilon when
00174             //  calculating nut
00175             const dimensionedScalar& epsilonSmall() const
00176             {
00177                 return epsilonSmall_;
00178             }
00179 
00180 
00181             //- Allow k0 to be changed
00182             dimensionedScalar& k0()
00183             {
00184                 return k0_;
00185             }
00186 
00187             //- Allow epsilon0 to be changed
00188             dimensionedScalar& epsilon0()
00189             {
00190                 return epsilon0_;
00191             }
00192 
00193             //- Allow epsilonSmall to be changed
00194             dimensionedScalar& epsilonSmall()
00195             {
00196                 return epsilonSmall_;
00197             }
00198 
00199 
00200             //- Return kappa for use in wall-functions
00201             scalar kappa() const
00202             {
00203                 return kappa_;
00204             }
00205 
00206             //- Return E for use in wall-functions
00207             scalar E() const
00208             {
00209                 return E_;
00210             }
00211 
00212             //- Return y+ at the edge of the laminar sublayer
00213             //  for use in wall-functions
00214             scalar yPlusLam() const
00215             {
00216                 return yPlusLam_;
00217             }
00218 
00219 
00220         //- Return the incompressible viscosity
00221         const volScalarField& nu() const
00222         {
00223             return transportModel_.nu();
00224         }
00225 
00226         //- Return the turbulence viscosity
00227         virtual tmp<volScalarField> nut() const = 0;
00228 
00229         //- Return the effective viscosity
00230         virtual tmp<volScalarField> nuEff() const
00231         {
00232             return tmp<volScalarField> 
00233             (
00234                 new volScalarField("nuEff", nut() + nu())
00235             );
00236         }
00237 
00238         //- Return the turbulence kinetic energy
00239         virtual tmp<volScalarField> k() const = 0;
00240 
00241         //- Return the turbulence kinetic energy dissipation rate
00242         virtual tmp<volScalarField> epsilon() const = 0;
00243 
00244         //- Return the Reynolds stress tensor
00245         virtual tmp<volTensorField> R() const = 0;
00246 
00247         //- Return the source term for the momentum equation
00248         virtual tmp<fvVectorMatrix> divR(volVectorField& U) const = 0;
00249 
00250         //- Return yPlus for the given patch
00251         virtual tmp<scalarField> yPlus(const label patchI) const;
00252 
00253         //- Solve the turbulence equations and correct the turbulence viscosity
00254         virtual void correct() = 0;
00255 
00256         //- Read turbulenceProperties dictionary
00257         virtual bool read() = 0;
00258 };
00259 
00260 
00261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00262 
00263 } // End namespace Foam
00264 
00265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00266 
00267 #endif
00268 
00269 // ************************************************************************* //
For further information go to www.openfoam.org