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

limitedSnGrad.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 Class
00025     Foam::fv::limitedSnGrad
00026 
00027 Description
00028     Central-difference snGrad scheme with limited non-orthogonal correction.
00029 
00030     The limiter is controlled by a coefficient with a value between 0 and 1
00031     which when 0 switches the correction off and the scheme behaves as
00032     uncorrectedSnGrad, when set to 1 the full correction is applied and the
00033     scheme behaves as correctedSnGrad and when set to 0.5 the limiter is
00034     calculated such that the non-orthogonal contribution does not exceed the
00035     orthogonal part.
00036 
00037 SourceFiles
00038     limitedSnGrad.C
00039 
00040 \*---------------------------------------------------------------------------*/
00041 
00042 #ifndef limitedSnGrad_H
00043 #define limitedSnGrad_H
00044 
00045 #include <finiteVolume/snGradScheme.H>
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00053 
00054 namespace fv
00055 {
00056 
00057 /*---------------------------------------------------------------------------*\
00058                  Class limitedSnGrad Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 template<class Type>
00062 class limitedSnGrad
00063 :
00064     public snGradScheme<Type>
00065 {
00066     // Private data
00067 
00068         scalar limitCoeff_;
00069 
00070 
00071     // Private Member Functions
00072 
00073         //- Disallow default bitwise assignment
00074         void operator=(const limitedSnGrad&);
00075 
00076 
00077 public:
00078 
00079     //- Runtime type information
00080     TypeName("limited");
00081 
00082 
00083     // Constructors
00084 
00085         //- Construct from mesh
00086         limitedSnGrad(const fvMesh& mesh)
00087         :
00088             snGradScheme<Type>(mesh)
00089         {}
00090 
00091 
00092         //- Construct from mesh and data stream
00093         limitedSnGrad(const fvMesh& mesh, Istream& is)
00094         :
00095             snGradScheme<Type>(mesh),
00096             limitCoeff_(readScalar(is))
00097         {
00098             if (limitCoeff_ < 0 || limitCoeff_ > 1)
00099             {
00100                 FatalIOErrorIn
00101                 (
00102                     "limitedSnGrad(const fvMesh& mesh, Istream& is) : ",
00103                     is
00104                 )   << "limitCoeff is specified as " << limitCoeff_
00105                     << " but should be >= 0 && <= 1"
00106                     << exit(FatalIOError);
00107             }
00108         }
00109 
00110 
00111     // Destructor
00112 
00113         virtual ~limitedSnGrad();
00114 
00115 
00116     // Member Functions
00117 
00118         //- Return the interpolation weighting factors for the given field
00119         virtual tmp<surfaceScalarField> deltaCoeffs
00120         (
00121             const GeometricField<Type, fvPatchField, volMesh>&
00122         ) const
00123         {
00124             return this->mesh().deltaCoeffs();
00125         }
00126 
00127         //- Return true if this scheme uses an explicit correction
00128         virtual bool corrected() const
00129         {
00130             return !this->mesh().orthogonal();
00131         }
00132 
00133         //- Return the explicit correction to the limitedSnGrad
00134         //  for the given field
00135         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00136         correction(const GeometricField<Type, fvPatchField, volMesh>&) const;
00137 };
00138 
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 } // End namespace fv
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 } // End namespace Foam
00147 
00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00149 
00150 #ifdef NoRepository
00151 #   include <finiteVolume/limitedSnGrad.C>
00152 #endif
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 #endif
00157 
00158 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines