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