initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / finiteVolume / snGradSchemes / limitedSnGrad / limitedSnGrad.H
blob3ab3446f0f36456618b2d80c89ebaac69246bcea
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::fv::limitedSnGrad
28 Description
29     Central-difference snGrad scheme with limited non-orthogonal correction.
31     The limiter is controlled by a coefficient with a value between 0 and 1
32     which when 0 switches the correction off and the scheme behaves as
33     uncorrectedSnGrad, when set to 1 the full correction is applied and the
34     scheme behaves as correctedSnGrad and when set to 0.5 the limiter is
35     calculated such that the non-orthogonal contribution does not exceed the
36     orthogonal part.
38 SourceFiles
39     limitedSnGrad.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef limitedSnGrad_H
44 #define limitedSnGrad_H
46 #include "snGradScheme.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 namespace Foam
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 namespace fv
58 /*---------------------------------------------------------------------------*\
59                  Class limitedSnGrad Declaration
60 \*---------------------------------------------------------------------------*/
62 template<class Type>
63 class limitedSnGrad
65     public snGradScheme<Type>
67     // Private data
69         scalar limitCoeff_;
72     // Private Member Functions
74         //- Disallow default bitwise assignment
75         void operator=(const limitedSnGrad&);
78 public:
80     //- Runtime type information
81     TypeName("limited");
84     // Constructors
86         //- Construct from mesh
87         limitedSnGrad(const fvMesh& mesh)
88         :
89             snGradScheme<Type>(mesh)
90         {}
93         //- Construct from mesh and data stream
94         limitedSnGrad(const fvMesh& mesh, Istream& is)
95         :
96             snGradScheme<Type>(mesh),
97             limitCoeff_(readScalar(is))
98         {
99             if (limitCoeff_ < 0 || limitCoeff_ > 1)
100             {
101                 FatalIOErrorIn
102                 (
103                     "limitedSnGrad(const fvMesh& mesh, Istream& is) : ",
104                     is
105                 )   << "limitCoeff is specified as " << limitCoeff_
106                     << " but should be >= 0 && <= 1"
107                     << exit(FatalIOError);
108             }
109         }
112     // Destructor
114         virtual ~limitedSnGrad();
117     // Member Functions
119         //- Return the interpolation weighting factors for the given field
120         virtual tmp<surfaceScalarField> deltaCoeffs
121         (
122             const GeometricField<Type, fvPatchField, volMesh>&
123         ) const
124         {
125             return this->mesh().deltaCoeffs();
126         }
128         //- Return true if this scheme uses an explicit correction
129         virtual bool corrected() const
130         {
131             return !this->mesh().orthogonal();
132         }
134         //- Return the explicit correction to the limitedSnGrad
135         //  for the given field
136         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
137         correction(const GeometricField<Type, fvPatchField, volMesh>&) const;
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 } // End namespace fv
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 } // End namespace Foam
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 #ifdef NoRepository
152 #   include "limitedSnGrad.C"
153 #endif
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 #endif
159 // ************************************************************************* //