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 snGrad scheme with limited non-orthogonal correction.
28 The limiter is controlled by a coefficient with a value between 0 and 1
29 which when 0 switches the correction off and the scheme behaves as
30 uncorrectedSnGrad, when set to 1 the full correction is applied and the
31 scheme behaves as correctedSnGrad and when set to 0.5 the limiter is
32 calculated such that the non-orthogonal contribution does not exceed the
35 \*---------------------------------------------------------------------------*/
38 #include "limitedSnGrad.H"
39 #include "volFields.H"
40 #include "surfaceFields.H"
41 #include "correctedSnGrad.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
57 limitedSnGrad<Type>::~limitedSnGrad()
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
65 limitedSnGrad<Type>::correction
67 const GeometricField<Type, fvPatchField, volMesh>& vf
70 GeometricField<Type, fvsPatchField, surfaceMesh> corr =
71 correctedSnGrad<Type>(this->mesh()).correction(vf);
73 surfaceScalarField limiter
78 *mag(snGradScheme<Type>::snGrad(vf, deltaCoeffs(vf), "orthSnGrad"))
80 (1 - limitCoeff_)*mag(corr)
81 + dimensionedScalar("small", corr.dimensions(), SMALL)
83 dimensionedScalar("one", dimless, 1.0)
89 Info<< "limitedSnGrad :: limiter min: " << min(limiter.internalField())
90 << " max: "<< max(limiter.internalField())
91 << " avg: " << average(limiter.internalField()) << endl;
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 } // End namespace fv
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 } // End namespace Foam
106 // ************************************************************************* //