diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H index 81b7cdf0efec4da3e13539f9fd44b08b440b5091..7a7a80366c326535868a7f0ed2836349e52187b6 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/CentredFitSnGrad/CentredFitSnGradScheme.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -109,7 +110,7 @@ public: } //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return true; } diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C index 174d11bbb9496c9c75b24b9902924c084b3bb1fa..ab5d7f406334c07ff0be26eed131193a5a1e1400 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,13 +33,6 @@ License #include "fvcGrad.H" #include "gaussGrad.H" -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::fv::correctedSnGrad<Type>::~correctedSnGrad() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -96,7 +90,7 @@ Foam::fv::correctedSnGrad<Type>::correction GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf.ref(); ssf.setOriented(); - for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++) + for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt) { ssf.replace ( diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H index 8f0b7c3abeaab2879104c66101a5d9b65b4326ab..4533778dc8de53cb2dc6f607859893a879d8c481 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/correctedSnGrad/correctedSnGrad.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,7 +31,16 @@ Group grpFvSnGradSchemes Description - Simple central-difference snGrad scheme with non-orthogonal correction. + Surface gradient scheme with full explicit non-orthogonal correction. + +Usage + Minimal example by using \c system/fvSchemes: + \verbatim + snGradSchemes + { + snGrad(<term>) corrected; + } + \endverbatim SourceFiles correctedSnGrad.C @@ -53,7 +63,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class correctedSnGrad Declaration + Class correctedSnGrad Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -81,7 +91,6 @@ public: snGradScheme<Type>(mesh) {} - //- Construct from mesh and data stream correctedSnGrad(const fvMesh& mesh, Istream&) : @@ -90,7 +99,7 @@ public: //- Destructor - virtual ~correctedSnGrad(); + virtual ~correctedSnGrad() = default; // Member Functions @@ -105,13 +114,13 @@ public: } //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return true; } //- Return the explicit correction to the correctedSnGrad - // for the given field using the gradient of the field + //- for the given field using the gradient of the field tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fullGradCorrection ( @@ -119,7 +128,7 @@ public: ) const; //- Return the explicit correction to the correctedSnGrad - // for the given field using the gradients of the field components + //- for the given field using the gradients of the field components virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> correction(const GeometricField<Type, fvPatchField, volMesh>&) const; }; diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C index 913af1e61bfd25bad4a9f0c53dcdfac094dc443e..46982ebda83ab17a9000c7342188b8e02249de90 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,13 +30,6 @@ License #include "volPointInterpolation.H" #include "triangle.H" -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::fv::faceCorrectedSnGrad<Type>::~faceCorrectedSnGrad() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -89,18 +83,18 @@ Foam::fv::faceCorrectedSnGrad<Type>::fullGradCorrection const face& fi = faces[facei]; - vector nf(Sf[facei]/magSf[facei]); + const vector nf(Sf[facei]/magSf[facei]); - for (label pi=0; pi<fi.size(); pi++) + for (label pi = 0; pi < fi.size(); ++pi) { // Next point index - label pj = (pi+1)%fi.size(); + const label pj = fi.fcIndex(pi); // Edge normal in plane of face - vector edgen(nf^(points[fi[pj]] - points[fi[pi]])); + const vector edgen(nf^(points[fi[pj]] - points[fi[pi]])); // Edge centre field value - Type pvfe(0.5*(pvf[fi[pj]] + pvf[fi[pi]])); + const Type pvfe(0.5*(pvf[fi[pj]] + pvf[fi[pi]])); // Integrate face gradient fgrad += edgen*pvfe; @@ -113,8 +107,6 @@ Foam::fv::faceCorrectedSnGrad<Type>::fullGradCorrection vector dCorr(C[neighbour[facei]] - C[owner[facei]]); dCorr /= (nf & dCorr); - // if (mag(dCorr) > 2) dCorr *= 2/mag(dCorr); - sfCorr[facei] = dCorr&fgrad; } @@ -152,7 +144,7 @@ Foam::fv::faceCorrectedSnGrad<Type>::correction ); GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf.ref(); - for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++) + for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt) { ssf.replace ( diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.H index 13bb2774646526e03dc7df0da2f34ba2a3aa0f6d..f4540ba0c0f2cbdf894bc3828b57a858ec66d3aa 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,7 +31,16 @@ Group grpFvSnGradSchemes Description - Simple central-difference snGrad scheme with non-orthogonal correction. + Surface gradient scheme with full explicit non-orthogonal correction. + +Usage + Minimal example by using \c system/fvSchemes: + \verbatim + snGradSchemes + { + snGrad(<term>) faceCorrected; + } + \endverbatim SourceFiles faceCorrectedSnGrad.C @@ -53,7 +63,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class faceCorrectedSnGrad Declaration + Class faceCorrectedSnGrad Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -81,7 +91,6 @@ public: snGradScheme<Type>(mesh) {} - //- Construct from mesh and data stream faceCorrectedSnGrad(const fvMesh& mesh, Istream&) : @@ -90,7 +99,7 @@ public: //- Destructor - virtual ~faceCorrectedSnGrad(); + virtual ~faceCorrectedSnGrad() = default; // Member Functions @@ -105,13 +114,13 @@ public: } //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return true; } //- Return the explicit correction to the faceCorrectedSnGrad - // for the given field using the gradient of the field + //- for the given field using the gradient of the field tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fullGradCorrection ( @@ -119,7 +128,7 @@ public: ) const; //- Return the explicit correction to the faceCorrectedSnGrad - // for the given field using the gradients of the field components + //- for the given field using the gradients of the field components virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> correction(const GeometricField<Type, fvPatchField, volMesh>&) const; }; diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C index babc458a20b0d8c0fd1ba7cb4f6aec34b644c1d6..6f0f95ee35047cb51aff0de8332d4ae629863b0c 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,13 +43,6 @@ namespace Foam namespace fv { -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -limitedSnGrad<Type>::~limitedSnGrad() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H index b14abfa5cfaecb5980b3b23242603c09ca80f49a..1922fe14d8efb51bf2ac1ab54a2e31a5136e6c91 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,20 +31,26 @@ Group grpFvSnGradSchemes Description - Run-time selected snGrad scheme with limited non-orthogonal correction. + Surface gradient scheme with limited explicit 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 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 \<corrected scheme\> \<coefficient\>; - - or - - limited \<coefficient\>; // Backward compatibility + \c uncorrected \c snGrad, when set to 1 the full correction of the + selected scheme is used and the scheme behaves as \c corrected \c snGrad, + and when set to 0.5 the limiter is calculated such that the non-orthogonal + component does not exceed the orthogonal component. + +Usage + Minimal example by using \c system/fvSchemes: + \verbatim + snGradSchemes + { + snGrad(<term>) limited <corrected scheme> <coefficient>; + + // Backward compatibility + snGrad(<term>) limited <coefficient>; + } + \endverbatim SourceFiles limitedSnGrad.C @@ -66,7 +73,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class limitedSnGrad Declaration + Class limitedSnGrad Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -74,10 +81,12 @@ class limitedSnGrad : public snGradScheme<Type> { - // Private data + // Private Data + //- Type of correction scheme tmp<snGradScheme<Type>> correctedScheme_; + //- Limiter coefficient scalar limitCoeff_; @@ -87,7 +96,7 @@ class limitedSnGrad void operator=(const limitedSnGrad&) = delete; //- Lookup function for the corrected to support backward compatibility - // of dictionary specification + //- of dictionary specification tmp<snGradScheme<Type>> lookupCorrectedScheme(Istream& schemeData) { token nextToken(schemeData); @@ -131,7 +140,6 @@ public: limitCoeff_(1) {} - //- Construct from mesh and data stream limitedSnGrad(const fvMesh& mesh, Istream& schemeData) : @@ -149,7 +157,7 @@ public: //- Destructor - virtual ~limitedSnGrad(); + virtual ~limitedSnGrad() = default; // Member Functions @@ -164,13 +172,13 @@ public: } //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return true; } //- Return the explicit correction to the limitedSnGrad - // for the given field + //- for the given field virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> correction(const GeometricField<Type, fvPatchField, volMesh>&) const; }; diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrads.C index ef02a344a545a6c1f1f8d4d6f96a72c9596a65eb..5a385681bff583a03fb1b3a9ec86bfc07e047251 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrads.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrads.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,13 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Central-difference snGrad scheme with limited non-orthogonal correction. - The limiter is controlled by a coefficient with a value between 0 and 1 - which when zero switches the limiter off and the scheme behaves as - correctedSnGrad, and when set to 1 the limiter is calculated such that the - non-orthogonal contribution does not exceed the orthogonal part. - \*---------------------------------------------------------------------------*/ #include "limitedSnGrad.H" diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C index 1ea8894bbfb6bbd1fff601188738bb8369f61a2c..64380af3adde7f89228d1650b2a4857f49bdb911 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,9 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Simple central-difference snGrad scheme without non-orthogonal correction. - \*---------------------------------------------------------------------------*/ #include "orthogonalSnGrad.H" @@ -42,13 +40,6 @@ namespace Foam namespace fv { -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -orthogonalSnGrad<Type>::~orthogonalSnGrad() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H index 747870a911d376a28c07625b56025cf86f086a68..c242628b84323e32b803c0b28ef8e286d3a084a8 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,8 +31,21 @@ Group grpFvSnGradSchemes Description - Simple central-difference snGrad scheme using the cell-centre to cell-centre - delta-coefficients. + Surface gradient scheme with no non-orthogonal correction. + +Usage + Minimal example by using \c system/fvSchemes: + \verbatim + snGradSchemes + { + snGrad(<term>) orthogonal; + } + \endverbatim + +Note + - Interpolation weighting factors (i.e. delta coefficients) are based + on the \c deltaCoeffs function rather than the \c nonOrthDeltaCoeffs + function, which is used by the \c uncorrected scheme. SourceFiles orthogonalSnGrad.C @@ -54,7 +68,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class orthogonalSnGrad Declaration + Class orthogonalSnGrad Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -82,7 +96,6 @@ public: snGradScheme<Type>(mesh) {} - //- Construct from mesh and data stream orthogonalSnGrad(const fvMesh& mesh, Istream&) : @@ -91,7 +104,7 @@ public: //- Destructor - virtual ~orthogonalSnGrad(); + virtual ~orthogonalSnGrad() = default; // Member Functions @@ -106,13 +119,13 @@ public: } //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return false; } //- Return the explicit correction to the orthogonalSnGrad - // for the given field + //- for the given field virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> correction(const GeometricField<Type, fvPatchField, volMesh>&) const; }; diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C index b52a70ca6b6aa737f77fbf4e99acf4f122f6f07d..9f350c0bf21c3d1bbc3f15603163fce649f814fe 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,9 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Simple central-difference snGrad scheme without non-orthogonal correction. - \*---------------------------------------------------------------------------*/ #include "orthogonalSnGrad.H" diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.C index 7138197f6940f58028e8363d14e24951b61350ba..5faffa76f5db6248e4ec046905dc205ada92aa57 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2019 Zeljko Tukovic, FSB Zagreb. + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,8 +73,6 @@ Foam::fv::skewCorrectedSnGrad<Type>::fullGradCorrection const vectorField& Sf = mesh.Sf().internalField(); const scalarField& magSf = mesh.magSf().internalField(); - vectorField nf(Sf/magSf); - const vectorField& Cf = mesh.Cf().internalField(); const vectorField& C = mesh.C().internalField(); diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.H index 1ab2e696a9de2015b896eca46f8b65263f208763..5e2919c25056b3ccc3559d65dbf5dd4e85514413 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/skewCorrectedSnGrad/skewCorrectedSnGrad.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2019 Zeljko Tukovic, FSB Zagreb. + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,7 +31,17 @@ Group grpFvSnGradSchemes Description - Simple central-difference snGrad scheme with non-orthogonal correction. + Surface gradient scheme with skewness and full + explicit non-orthogonal corrections. + +Usage + Minimal example by using \c system/fvSchemes: + \verbatim + snGradSchemes + { + snGrad(<term>) skewCorrected; + } + \endverbatim SourceFiles skewCorrectedSnGrad.C @@ -81,7 +92,6 @@ public: snGradScheme<Type>(mesh) {} - //- Construct from mesh and data stream skewCorrectedSnGrad(const fvMesh& mesh, Istream&) : @@ -105,7 +115,7 @@ public: } //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return true; } diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C index 0dc584dcfb1ba357e0f9c4f1fc2bc2cbdfdb5989..e507d053c88c56bab7045da169f3183a9ee07e67 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C @@ -60,8 +60,8 @@ tmp<snGradScheme<Type>> snGradScheme<Type>::New { FatalIOErrorInFunction(schemeData) << "Discretisation scheme not specified" - << endl << endl - << "Valid schemes are :" << endl + << nl << nl + << "Valid schemes are :" << nl << MeshConstructorTablePtr_->sortedToc() << exit(FatalIOError); } diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.H b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.H index 324fd03a6998f92a0306002c73c05e924d9aeb14..d19a63bf3fe0d63460e3ab3a2ef36c9aa84e974a 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,7 +31,17 @@ Group grpFvSnGradSchemes Description - Abstract base class for snGrad schemes. + Abstract base class for runtime selected \c snGrad surface + normal gradient schemes. + + A surface normal gradient is evaluated at a cell face. It + is the normal-to-face component of the gradient of + values at the centres of two cells that the face connects. + + Unit-surface-normal vector decomposition is based on the + so-called over-relaxed approach. Orthogonal components are + treated implicitly and non-orthogonal components are treated + explicitly with (or without) various limiters. SourceFiles snGradScheme.C @@ -59,7 +70,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class snGradScheme Declaration + Class snGradScheme Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -67,9 +78,9 @@ class snGradScheme : public refCount { - // Private data + // Private Data - //- Hold reference to mesh + //- Hold const reference to mesh const fvMesh& mesh_; @@ -125,14 +136,14 @@ public: // Member Functions - //- Return mesh reference + //- Return const reference to mesh const fvMesh& mesh() const { return mesh_; } - - //- Return the snGrad of the given cell field with the given deltaCoeffs + //- Return the snGrad of the given cell field + //- by using the given deltaCoeffs static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> snGrad ( @@ -156,13 +167,13 @@ public: ) const = 0; //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return false; } //- Return the explicit correction to the snGrad - // for the given field + //- for the given field virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> correction(const GeometricField<Type, fvPatchField, volMesh>&) const { @@ -173,12 +184,12 @@ public: } //- Return the snGrad of the given cell field - // with explicit correction + //- with explicit correction virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> snGrad(const GeometricField<Type, fvPatchField, volMesh>&) const; //- Return the snGrad of the given tmp cell field - // with explicit correction + //- with explicit correction tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> snGrad ( diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradSchemes.C b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradSchemes.C index 1f5c316d22a00b5728f5e7196d6c2866d3ae629f..d03fe44c7af357ceecaf648d77cfd253e67b7ce2 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradSchemes.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradSchemes.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,9 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Abstract base class for snGrad schemes. - \*---------------------------------------------------------------------------*/ #include "snGradScheme.H" diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.C index e8af0a09fe14b45c72186ce3eb8bfe3ebe04039c..793e16a563dc757af067f007162bac859e4a8865 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,9 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Simple central-difference snGrad scheme without non-orthogonal correction. - \*---------------------------------------------------------------------------*/ #include "uncorrectedSnGrad.H" @@ -42,13 +40,6 @@ namespace Foam namespace fv { -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -uncorrectedSnGrad<Type>::~uncorrectedSnGrad() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H index 72d9c8748154bbc9542541dd66abbe06fda101b4..afdd1d8b9448c660a815932d1ca89ff2f9c76430 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrad.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,8 +31,21 @@ Group grpFvSnGradSchemes Description - Simple central-difference snGrad scheme using the non-orthogonal mesh - delta-coefficients but without non-orthogonal correction. + Surface gradient scheme with no non-orthogonal correction. + +Usage + Minimal example by using \c system/fvSchemes: + \verbatim + snGradSchemes + { + snGrad(<term>) uncorrected; + } + \endverbatim + +Note + - Interpolation weighting factors (i.e. delta coefficients) are based + on the \c nonOrthDeltaCoeffs function rather than the \c deltaCoeffs + function, which is used by the \c orthogonal scheme. SourceFiles uncorrectedSnGrad.C @@ -54,7 +68,7 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class uncorrectedSnGrad Declaration + Class uncorrectedSnGrad Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -82,7 +96,6 @@ public: snGradScheme<Type>(mesh) {} - //- Construct from mesh and data stream uncorrectedSnGrad(const fvMesh& mesh, Istream&) : @@ -91,7 +104,7 @@ public: //- Destructor - virtual ~uncorrectedSnGrad(); + virtual ~uncorrectedSnGrad() = default; // Member Functions @@ -106,13 +119,13 @@ public: } //- Return true if this scheme uses an explicit correction - virtual bool corrected() const + virtual bool corrected() const noexcept { return false; } //- Return the explicit correction to the uncorrectedSnGrad - // for the given field + //- for the given field virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> correction(const GeometricField<Type, fvPatchField, volMesh>&) const; }; diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrads.C index c8fc0c122f818aa03a8d81898d3fd2fb283c1cbf..284a991eac612d738d762bd8410e076e74aa82e4 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrads.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/uncorrectedSnGrad/uncorrectedSnGrads.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,9 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - Simple central-difference snGrad scheme without non-orthogonal correction. - \*---------------------------------------------------------------------------*/ #include "uncorrectedSnGrad.H"