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

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