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

RASModel.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-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 Namespace
00026     Foam::compressible::RASModels
00027 
00028 Description
00029     Namespace for compressible RAS turbulence models.
00030 
00031 
00032 Class
00033     Foam::compressible::RASModel
00034 
00035 Description
00036     Abstract base class for turbulence models for compressible and combusting
00037     flows.
00038 
00039 SourceFiles
00040     RASModel.C
00041     newTurbulenceModel.C
00042 
00043 \*---------------------------------------------------------------------------*/
00044 
00045 #ifndef compressibleRASModel_H
00046 #define compressibleRASModel_H
00047 
00048 #include "compressible/turbulenceModel/turbulenceModel.H"
00049 #include "volFields.H"
00050 #include "surfaceFields.H"
00051 #include "nearWallDist.H"
00052 #include "fvm.H"
00053 #include "fvc.H"
00054 #include "fvMatrices.H"
00055 #include "basicThermo.H"
00056 #include "IOdictionary.H"
00057 #include "Switch.H"
00058 #include "bound.H"
00059 #include "autoPtr.H"
00060 #include "runTimeSelectionTables.H"
00061 
00062 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00063 
00064 namespace Foam
00065 {
00066 namespace compressible
00067 {
00068 
00069 /*---------------------------------------------------------------------------*\
00070                            Class RASModel Declaration
00071 \*---------------------------------------------------------------------------*/
00072 
00073 class RASModel
00074 :
00075     public turbulenceModel,
00076     public IOdictionary
00077 {
00078 
00079 protected:
00080 
00081     // Protected data
00082 
00083         //- Turbulence on/off flag
00084         Switch turbulence_;
00085 
00086         //- Flag to print the model coeffs at run-time
00087         Switch printCoeffs_;
00088 
00089         //- Model coefficients dictionary
00090         dictionary coeffDict_;
00091 
00092         //- Value of y+ at the edge of the laminar sublayer
00093         scalar yPlusLam_;
00094 
00095         //- Lower limit of k
00096         dimensionedScalar k0_;
00097 
00098         //- Lower limit of epsilon
00099         dimensionedScalar epsilon0_;
00100 
00101         //- Small epsilon value used to avoid divide by zero
00102         dimensionedScalar epsilonSmall_;
00103 
00104         //- Lower limit for omega
00105         dimensionedScalar omega0_;
00106 
00107         //- Small omega value used to avoid divide by zero
00108         dimensionedScalar omegaSmall_;
00109 
00110         //- Near wall distance boundary field
00111         nearWallDist y_;
00112 
00113 
00114     // Protected member functions
00115 
00116         //- Print model coefficients
00117         virtual void printCoeffs();
00118 
00119 
00120 private:
00121 
00122     // Private Member Functions
00123 
00124         //- Disallow default bitwise copy construct
00125         RASModel(const RASModel&);
00126 
00127         //- Disallow default bitwise assignment
00128         void operator=(const RASModel&);
00129 
00130 
00131 public:
00132 
00133     //- Runtime type information
00134     TypeName("RASModel");
00135 
00136 
00137     // Declare run-time constructor selection table
00138 
00139         declareRunTimeSelectionTable
00140         (
00141             autoPtr,
00142             RASModel,
00143             dictionary,
00144             (
00145                 const volScalarField& rho,
00146                 const volVectorField& U,
00147                 const surfaceScalarField& phi,
00148                 const basicThermo& thermoPhysicalModel
00149             ),
00150             (rho, U, phi, thermoPhysicalModel)
00151         );
00152 
00153 
00154     // Constructors
00155 
00156         //- Construct from components
00157         RASModel
00158         (
00159             const word& type,
00160             const volScalarField& rho,
00161             const volVectorField& U,
00162             const surfaceScalarField& phi,
00163             const basicThermo& thermoPhysicalModel
00164         );
00165 
00166 
00167     // Selectors
00168 
00169         //- Return a reference to the selected turbulence model
00170         static autoPtr<RASModel> New
00171         (
00172             const volScalarField& rho,
00173             const volVectorField& U,
00174             const surfaceScalarField& phi,
00175             const basicThermo& thermoPhysicalModel
00176         );
00177 
00178 
00179     //- Destructor
00180     virtual ~RASModel()
00181     {}
00182 
00183 
00184     // Member Functions
00185 
00186         // Access
00187 
00188             //- Return the value of k0 which k is not allowed to be less than
00189             const dimensionedScalar& k0() const
00190             {
00191                 return k0_;
00192             }
00193 
00194             //- Return the value of epsilon0 which epsilon is not allowed to be
00195             //  less than
00196             const dimensionedScalar& epsilon0() const
00197             {
00198                 return epsilon0_;
00199             }
00200 
00201             //- Return the value of epsilonSmall which is added to epsilon when
00202             //  calculating nut
00203             const dimensionedScalar& epsilonSmall() const
00204             {
00205                 return epsilonSmall_;
00206             }
00207 
00208             //- Return the value of omega0 which epsilon is not allowed to be
00209             //  less than
00210             const dimensionedScalar& omega0() const
00211             {
00212                 return omega0_;
00213             }
00214 
00215             //- Return the value of omegaSmall which is added to epsilon when
00216             //  calculating nut
00217             const dimensionedScalar& omegaSmall() const
00218             {
00219                 return omegaSmall_;
00220             }
00221 
00222             //- Allow k0 to be changed
00223             dimensionedScalar& k0()
00224             {
00225                 return k0_;
00226             }
00227 
00228             //- Allow epsilon0 to be changed
00229             dimensionedScalar& epsilon0()
00230             {
00231                 return epsilon0_;
00232             }
00233 
00234             //- Allow epsilonSmall to be changed
00235             dimensionedScalar& epsilonSmall()
00236             {
00237                 return epsilonSmall_;
00238             }
00239 
00240             //- Allow omega0 to be changed
00241             dimensionedScalar& omega0()
00242             {
00243                 return omega0_;
00244             }
00245 
00246             //- Allow omegaSmall to be changed
00247             dimensionedScalar& omegaSmall()
00248             {
00249                 return omegaSmall_;
00250             }
00251 
00252             //- Return the near wall distances
00253             const nearWallDist& y() const
00254             {
00255                 return y_;
00256             }
00257 
00258             //- Calculate y+ at the edge of the laminar sublayer
00259             scalar yPlusLam(const scalar kappa, const scalar E) const;
00260 
00261             //- Const access to the coefficients dictionary
00262             const dictionary& coeffDict() const
00263             {
00264                 return coeffDict_;
00265             }
00266 
00267 
00268         //- Return the turbulence viscosity
00269         virtual tmp<volScalarField> mut() const = 0;
00270 
00271         //- Return the effective viscosity
00272         virtual tmp<volScalarField> muEff() const
00273         {
00274             return tmp<volScalarField>
00275             (
00276                 new volScalarField("muEff", mut() + mu())
00277             );
00278         }
00279 
00280         //- Return the effective turbulent thermal diffusivity
00281         virtual tmp<volScalarField> alphaEff() const = 0;
00282 
00283         //- Return the turbulence kinetic energy
00284         virtual tmp<volScalarField> k() const = 0;
00285 
00286         //- Return the turbulence kinetic energy dissipation rate
00287         virtual tmp<volScalarField> epsilon() const = 0;
00288 
00289         //- Return the Reynolds stress tensor
00290         virtual tmp<volSymmTensorField> R() const = 0;
00291 
00292         //- Return the effective stress tensor including the laminar stress
00293         virtual tmp<volSymmTensorField> devRhoReff() const = 0;
00294 
00295         //- Return the source term for the momentum equation
00296         virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0;
00297 
00298         //- Return yPlus for the given patch
00299         virtual tmp<scalarField> yPlus
00300         (
00301             const label patchI,
00302             const scalar Cmu
00303         ) const;
00304 
00305         //- Solve the turbulence equations and correct the turbulence viscosity
00306         virtual void correct() = 0;
00307 
00308         //- Read RASProperties dictionary
00309         virtual bool read() = 0;
00310 };
00311 
00312 
00313 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00314 
00315 } // End namespace compressible
00316 } // End namespace Foam
00317 
00318 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00319 
00320 #endif
00321 
00322 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd