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