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

LESModel.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::compressible::LESModels
00026 
00027 Description
00028     Namespace for compressible LES models.
00029 
00030 
00031 Class
00032     Foam::compressible::LESModel
00033 
00034 Description
00035     Base class for all compressible flow LES SGS models.
00036 
00037     This class defines the basic interface for a compressible flow SGS
00038     model, and encapsulates data of value to all possible models.
00039     In particular this includes references to all the dependent fields
00040     (rho, U, phi), the physical viscosity mu, and the LESProperties
00041     dictionary, which contains the model selection and model coefficients.
00042 
00043 SourceFiles
00044     LESModel.C
00045 
00046 \*---------------------------------------------------------------------------*/
00047 
00048 #ifndef compressibleLESModel_H
00049 #define compressibleLESModel_H
00050 
00051 #include <compressibleTurbulenceModel/turbulenceModel.H>
00052 #include <LESdeltas/LESdelta.H>
00053 #include <finiteVolume/fvm.H>
00054 #include <finiteVolume/fvc.H>
00055 #include <finiteVolume/fvMatrices.H>
00056 #include <basicThermophysicalModels/basicThermo.H>
00057 #include <finiteVolume/bound.H>
00058 #include <OpenFOAM/autoPtr.H>
00059 #include <OpenFOAM/runTimeSelectionTables.H>
00060 
00061 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00062 
00063 namespace Foam
00064 {
00065 namespace compressible
00066 {
00067 
00068 /*---------------------------------------------------------------------------*\
00069                            Class LESModel Declaration
00070 \*---------------------------------------------------------------------------*/
00071 
00072 class LESModel
00073 :
00074     public turbulenceModel,
00075     public IOdictionary
00076 {
00077 
00078 protected:
00079 
00080     // Protected data
00081 
00082         Switch printCoeffs_;
00083         dictionary coeffDict_;
00084 
00085         dimensionedScalar k0_;
00086 
00087         autoPtr<LESdelta> delta_;
00088 
00089 
00090     // Protected Member Functions
00091 
00092         //- Print model coefficients
00093         virtual void printCoeffs();
00094 
00095 
00096 private:
00097 
00098     // Private Member Functions
00099 
00100         //- Disallow default bitwise copy construct
00101         LESModel(const LESModel&);
00102 
00103         //- Disallow default bitwise assignment
00104         LESModel& operator=(const LESModel&);
00105 
00106 
00107 public:
00108 
00109     //- Runtime type information
00110     TypeName("LESModel");
00111 
00112 
00113     // Declare run-time constructor selection table
00114 
00115         declareRunTimeSelectionTable
00116         (
00117             autoPtr,
00118             LESModel,
00119             dictionary,
00120             (
00121                 const volScalarField& rho,
00122                 const volVectorField& U,
00123                 const surfaceScalarField& phi,
00124                 const basicThermo& thermoPhysicalModel
00125             ),
00126             (rho, U, phi, thermoPhysicalModel)
00127         );
00128 
00129 
00130     // Constructors
00131 
00132         //- Construct from components
00133         LESModel
00134         (
00135             const word& type,
00136             const volScalarField& rho,
00137             const volVectorField& U,
00138             const surfaceScalarField& phi,
00139             const basicThermo& thermoPhysicalModel
00140         );
00141 
00142 
00143     // Selectors
00144 
00145         //- Return a reference to the selected LES model
00146         static autoPtr<LESModel> New
00147         (
00148             const volScalarField& rho,
00149             const volVectorField& U,
00150             const surfaceScalarField& phi,
00151             const basicThermo& thermoPhysicalModel
00152         );
00153 
00154 
00155     //- Destructor
00156     virtual ~LESModel()
00157     {}
00158 
00159 
00160     // Member Functions
00161 
00162         // Access
00163 
00164             //- Const access to the coefficients dictionary,
00165             //  which provides info. about choice of models,
00166             //  and all related data (particularly model coefficients).
00167             inline const dictionary& coeffDict() const
00168             {
00169                 return coeffDict_;
00170             }
00171 
00172             //- Return the value of k0 which k is not allowed to be less than
00173             const dimensionedScalar& k0() const
00174             {
00175                 return k0_;
00176             }
00177 
00178             //- Allow k0 to be changed
00179             dimensionedScalar& k0()
00180             {
00181                 return k0_;
00182             }
00183 
00184             //- Access function to filter width
00185             inline const volScalarField& delta() const
00186             {
00187                 return delta_();
00188             }
00189 
00190 
00191         //- Return the SGS turbulent kinetic energy.
00192         virtual tmp<volScalarField> k() const = 0;
00193 
00194         //- Return the SGS turbulent dissipation.
00195         virtual tmp<volScalarField> epsilon() const = 0;
00196 
00197         //- Return the SGS turbulent viscosity
00198         virtual tmp<volScalarField> muSgs() const = 0;
00199 
00200         //- Return the effective viscosity
00201         virtual tmp<volScalarField> muEff() const
00202         {
00203             return tmp<volScalarField>
00204             (
00205                 new volScalarField("muEff", muSgs() + mu())
00206             );
00207         }
00208 
00209         //- Return the SGS turbulent thermal diffusivity
00210         virtual tmp<volScalarField> alphaSgs() const = 0;
00211 
00212         //- Return the SGS thermal conductivity.
00213         virtual tmp<volScalarField> alphaEff() const = 0;
00214 
00215         //- Return the sub-grid stress tensor.
00216         virtual tmp<volSymmTensorField> B() const = 0;
00217 
00218         //- Return the deviatoric part of the effective sub-grid
00219         //  turbulence stress tensor including the laminar stress
00220         virtual tmp<volSymmTensorField> devRhoBeff() const = 0;
00221 
00222         //- Returns div(rho*dev(B)).
00223         // This is the additional term due to the filtering of the NSE.
00224         virtual tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const = 0;
00225 
00226 
00227         // RAS compatibility functions for the turbulenceModel base class
00228 
00229             //- Return the turbulence viscosity
00230             virtual tmp<volScalarField> mut() const
00231             {
00232                 return muSgs();
00233             }
00234 
00235             //- Return the turbulence thermal diffusivity
00236             virtual tmp<volScalarField> alphat() const
00237             {
00238                 return alphaSgs();
00239             }
00240 
00241             //- Return the Reynolds stress tensor
00242             virtual tmp<volSymmTensorField> R() const
00243             {
00244                 return B();
00245             }
00246 
00247             //- Return the effective stress tensor including the laminar stress
00248             virtual tmp<volSymmTensorField> devRhoReff() const
00249             {
00250                 return devRhoBeff();
00251             }
00252 
00253             //- Return the source term for the momentum equation
00254             virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const
00255             {
00256                 return divDevRhoBeff(U);
00257             }
00258 
00259 
00260         //- Correct Eddy-Viscosity and related properties.
00261         //  This calls correct(const tmp<volTensorField>& gradU) by supplying
00262         //  gradU calculated locally.
00263         void correct();
00264 
00265         //- Correct Eddy-Viscosity and related properties
00266         virtual void correct(const tmp<volTensorField>& gradU);
00267 
00268         //- Read LESProperties dictionary
00269         virtual bool read() = 0;
00270 };
00271 
00272 
00273 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00274 
00275 } // End namespace compressible
00276 } // End namespace Foam
00277 
00278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00279 
00280 #endif
00281 
00282 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines