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

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