1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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
26 Foam::fv::limitedSnGrad
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
41 \*---------------------------------------------------------------------------*/
43 #ifndef limitedSnGrad_H
44 #define limitedSnGrad_H
46 #include "snGradScheme.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 /*---------------------------------------------------------------------------*\
59 Class limitedSnGrad Declaration
60 \*---------------------------------------------------------------------------*/
65 public snGradScheme<Type>
72 // Private Member Functions
74 //- Disallow default bitwise assignment
75 void operator=(const limitedSnGrad&);
80 //- Runtime type information
86 //- Construct from mesh
87 limitedSnGrad(const fvMesh& mesh)
89 snGradScheme<Type>(mesh)
93 //- Construct from mesh and data stream
94 limitedSnGrad(const fvMesh& mesh, Istream& is)
96 snGradScheme<Type>(mesh),
97 limitCoeff_(readScalar(is))
99 if (limitCoeff_ < 0 || limitCoeff_ > 1)
103 "limitedSnGrad(const fvMesh& mesh, Istream& is) : ",
105 ) << "limitCoeff is specified as " << limitCoeff_
106 << " but should be >= 0 && <= 1"
107 << exit(FatalIOError);
114 virtual ~limitedSnGrad();
119 //- Return the interpolation weighting factors for the given field
120 virtual tmp<surfaceScalarField> deltaCoeffs
122 const GeometricField<Type, fvPatchField, volMesh>&
125 return this->mesh().deltaCoeffs();
128 //- Return true if this scheme uses an explicit correction
129 virtual bool corrected() const
131 return !this->mesh().orthogonal();
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 # include "limitedSnGrad.C"
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 // ************************************************************************* //