diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C
index a5def7bcc1..63d81a996f 100644
--- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C
+++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -21,23 +21,12 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
-Description
- snGrad scheme with limited non-orthogonal correction.
-
- The limiter is controlled by a coefficient with a value between 0 and 1
- which when 0 switches the correction off and the scheme behaves as
- uncorrectedSnGrad, when set to 1 the full correction is applied and the
- scheme behaves as correctedSnGrad and when set to 0.5 the limiter is
- calculated such that the non-orthogonal contribution does not exceed the
- orthogonal part.
-
\*---------------------------------------------------------------------------*/
#include "fv.H"
#include "limitedSnGrad.H"
#include "volFields.H"
#include "surfaceFields.H"
-#include "correctedSnGrad.H"
#include "localMax.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -68,7 +57,7 @@ limitedSnGrad::correction
{
const GeometricField corr
(
- correctedSnGrad(this->mesh()).correction(vf)
+ correctedScheme_().correction(vf)
);
const surfaceScalarField limiter
@@ -76,7 +65,7 @@ limitedSnGrad::correction
min
(
limitCoeff_
- *mag(snGradScheme::snGrad(vf, deltaCoeffs(vf), "orthSnGrad"))
+ *mag(snGradScheme::snGrad(vf, deltaCoeffs(vf), "SndGrad"))
/(
(1 - limitCoeff_)*mag(corr)
+ dimensionedScalar("small", corr.dimensions(), SMALL)
diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H
index 9dbe0f0114..5d1ffd2b94 100644
--- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H
+++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -25,14 +25,20 @@ Class
Foam::fv::limitedSnGrad
Description
- Central-difference snGrad scheme with limited non-orthogonal correction.
+ Run-time selected snGrad scheme with limited non-orthogonal correction.
The limiter is controlled by a coefficient with a value between 0 and 1
which when 0 switches the correction off and the scheme behaves as
- uncorrectedSnGrad, when set to 1 the full correction is applied and the
- scheme behaves as correctedSnGrad and when set to 0.5 the limiter is
- calculated such that the non-orthogonal contribution does not exceed the
- orthogonal part.
+ uncorrectedSnGrad, when set to 1 the full correction of the selected scheme
+ is used and when set to 0.5 the limiter is calculated such that the
+ non-orthogonal contribution does not exceed the orthogonal part.
+
+ Format:
+ limited ;
+
+ or
+
+ limited ; // Backward compatibility
SourceFiles
limitedSnGrad.C
@@ -42,7 +48,7 @@ SourceFiles
#ifndef limitedSnGrad_H
#define limitedSnGrad_H
-#include "snGradScheme.H"
+#include "correctedSnGrad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -65,6 +71,8 @@ class limitedSnGrad
{
// Private data
+ tmp > correctedScheme_;
+
scalar limitCoeff_;
@@ -73,6 +81,34 @@ class limitedSnGrad
//- Disallow default bitwise assignment
void operator=(const limitedSnGrad&);
+ //- Lookup function for the corrected to support backward compatibility
+ // of dictionary specification
+ tmp > lookupCorrectedScheme(Istream& schemeData)
+ {
+ token nextToken(schemeData);
+
+ if (nextToken.isNumber())
+ {
+ limitCoeff_ = nextToken.number();
+ return tmp >
+ (
+ new correctedSnGrad(this->mesh())
+ );
+ }
+ else
+ {
+ schemeData.putBack(nextToken);
+ tmp > tcorrectedScheme
+ (
+ fv::snGradScheme::New(this->mesh(), schemeData)
+ );
+
+ schemeData >> limitCoeff_;
+
+ return tcorrectedScheme;
+ }
+ }
+
public:
@@ -85,22 +121,24 @@ public:
//- Construct from mesh
limitedSnGrad(const fvMesh& mesh)
:
- snGradScheme(mesh)
+ snGradScheme(mesh),
+ correctedScheme_(new correctedSnGrad(this->mesh())),
+ limitCoeff_(1)
{}
//- Construct from mesh and data stream
- limitedSnGrad(const fvMesh& mesh, Istream& is)
+ limitedSnGrad(const fvMesh& mesh, Istream& schemeData)
:
snGradScheme(mesh),
- limitCoeff_(readScalar(is))
+ correctedScheme_(lookupCorrectedScheme(schemeData))
{
if (limitCoeff_ < 0 || limitCoeff_ > 1)
{
FatalIOErrorIn
(
- "limitedSnGrad(const fvMesh& mesh, Istream& is) : ",
- is
+ "limitedSnGrad(const fvMesh& mesh, Istream& schemeData) : ",
+ schemeData
) << "limitCoeff is specified as " << limitCoeff_
<< " but should be >= 0 && <= 1"
<< exit(FatalIOError);