From ed4345faf8f8ea75c0c34866ae75f4e3816483c8 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Sat, 9 Apr 2016 23:33:55 +0200 Subject: [PATCH 1/2] Backport orthogonal snGrad scheme from vanilla 3.0.1 --- src/finiteVolume/Make/files | 1 + .../orthogonalSnGrad/orthogonalSnGrad.C | 76 ++++++++++ .../orthogonalSnGrad/orthogonalSnGrad.H | 133 ++++++++++++++++++ .../orthogonalSnGrad/orthogonalSnGrads.C | 42 ++++++ .../icoFoam/cavity/system/fvSchemes | 6 +- 5 files changed, 254 insertions(+), 4 deletions(-) create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H create mode 100644 src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 3fb994320..4fff15bdd 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -365,6 +365,7 @@ $(snGradSchemes)/snGradScheme/snGradSchemes.C $(snGradSchemes)/correctedSnGrad/correctedSnGrads.C $(snGradSchemes)/limitedSnGrad/limitedSnGrads.C $(snGradSchemes)/uncorrectedSnGrad/uncorrectedSnGrads.C +$(snGradSchemes)/orthogonalSnGrad/orthogonalSnGrads.C $(snGradSchemes)/skewCorrectedSnGrad/skewCorrectedSnGrads.C $(snGradSchemes)/fourthSnGrad/fourthSnGrads.C /* diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C new file mode 100644 index 000000000..39866b78a --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Simple central-difference snGrad scheme without non-orthogonal correction. + +\*---------------------------------------------------------------------------*/ + +#include "orthogonalSnGrad.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +orthogonalSnGrad::~orthogonalSnGrad() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +tmp > +orthogonalSnGrad::correction +( + const GeometricField& +) const +{ + notImplemented + ( + "orthogonalSnGrad::correction" + "(const GeometricField&)" + ); + return tmp >(NULL); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H new file mode 100644 index 000000000..b90329816 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrad.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fv::orthogonalSnGrad + +Description + Simple central-difference snGrad scheme without non-orthogonal correction. + +SourceFiles + orthogonalSnGrad.C + +\*---------------------------------------------------------------------------*/ + +#ifndef orthogonalSnGrad_H +#define orthogonalSnGrad_H + +#include "snGradScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class orthogonalSnGrad Declaration +\*---------------------------------------------------------------------------*/ + +template +class orthogonalSnGrad +: + public snGradScheme +{ + // Private Member Functions + + //- Disallow default bitwise assignment + void operator=(const orthogonalSnGrad&); + + +public: + + //- Runtime type information + TypeName("orthogonal"); + + + // Constructors + + //- Construct from mesh + orthogonalSnGrad(const fvMesh& mesh) + : + snGradScheme(mesh) + {} + + + //- Construct from mesh and data stream + orthogonalSnGrad(const fvMesh& mesh, Istream&) + : + snGradScheme(mesh) + {} + + + //- Destructor + virtual ~orthogonalSnGrad(); + + + // Member Functions + + //- Return the interpolation weighting factors for the given field + virtual tmp deltaCoeffs + ( + const GeometricField& + ) const + { + return this->mesh().deltaCoeffs(); + } + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return false; + } + + //- Return the explicit correction to the orthogonalSnGrad + // for the given field + virtual tmp > + correction(const GeometricField&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "orthogonalSnGrad.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C new file mode 100644 index 000000000..f48bbffe4 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/orthogonalSnGrad/orthogonalSnGrads.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Simple central-difference snGrad scheme without non-orthogonal correction. + +\*---------------------------------------------------------------------------*/ + +#include "orthogonalSnGrad.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + makeSnGradScheme(orthogonalSnGrad) +} +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/cavity/system/fvSchemes b/tutorials/incompressible/icoFoam/cavity/system/fvSchemes index e807e470c..f2da7785f 100644 --- a/tutorials/incompressible/icoFoam/cavity/system/fvSchemes +++ b/tutorials/incompressible/icoFoam/cavity/system/fvSchemes @@ -33,9 +33,7 @@ divSchemes laplacianSchemes { - default none; - laplacian(nu,U) Gauss linear corrected; - laplacian((1|A(U)),p) Gauss linear corrected; + default Gauss linear orthogonal; } interpolationSchemes @@ -46,7 +44,7 @@ interpolationSchemes snGradSchemes { - default corrected; + default orthogonal; } // ************************************************************************* // From 41ea052e7a9cb02df5d3f6cb72bdb6b5b3395883 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Tue, 12 Apr 2016 09:31:33 +0200 Subject: [PATCH 2/2] Fixing compilation --- applications/solvers/basic/potentialDyMFoam/correctPhi.H | 2 +- applications/solvers/engine/icoDyMEngineFoam/correctPhi.H | 2 +- applications/solvers/engine/turbDyMEngineFoam/correctPhi.H | 2 +- applications/solvers/immersedBoundary/interIbFoam/correctPhi.H | 2 +- applications/solvers/incompressible/icoDyMFoam/correctPhi.H | 2 +- .../solvers/incompressible/icoDyMSimpleFoam/correctPhi.H | 2 +- applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H | 2 +- .../solvers/multiphase/compressibleInterDyMFoam/correctPhi.H | 2 +- applications/solvers/multiphase/interDyMFoam/correctPhi.H | 2 +- applications/solvers/multiphase/interFoam/correctPhi.H | 2 +- .../solvers/multiphase/interPhaseChangeFoam/correctPhi.H | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/applications/solvers/basic/potentialDyMFoam/correctPhi.H b/applications/solvers/basic/potentialDyMFoam/correctPhi.H index 6c78a0960..ba21e24cc 100644 --- a/applications/solvers/basic/potentialDyMFoam/correctPhi.H +++ b/applications/solvers/basic/potentialDyMFoam/correctPhi.H @@ -34,7 +34,7 @@ fvc::makeAbsolute(phi, U); } - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H b/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H index 15ce43ec7..5a8dc6a33 100644 --- a/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H +++ b/applications/solvers/engine/icoDyMEngineFoam/correctPhi.H @@ -26,7 +26,7 @@ phi = fvc::interpolate(U) & mesh.Sf(); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H b/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H index 15ce43ec7..5a8dc6a33 100644 --- a/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H +++ b/applications/solvers/engine/turbDyMEngineFoam/correctPhi.H @@ -26,7 +26,7 @@ phi = fvc::interpolate(U) & mesh.Sf(); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H b/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H index 9945bf708..bce66493e 100644 --- a/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H +++ b/applications/solvers/immersedBoundary/interIbFoam/correctPhi.H @@ -36,7 +36,7 @@ immersedBoundaryAdjustPhi(phi, U); adjustPhi(phi, U, pcorr); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/incompressible/icoDyMFoam/correctPhi.H b/applications/solvers/incompressible/icoDyMFoam/correctPhi.H index 6c78a0960..ba21e24cc 100644 --- a/applications/solvers/incompressible/icoDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/icoDyMFoam/correctPhi.H @@ -34,7 +34,7 @@ fvc::makeAbsolute(phi, U); } - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H b/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H index 3f9a190d4..2cb0bff0a 100644 --- a/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H +++ b/applications/solvers/incompressible/icoDyMSimpleFoam/correctPhi.H @@ -24,7 +24,7 @@ pcorrTypes ); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H index 27d7c9113..aa99200c4 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleDyMFoam/correctPhi.H @@ -35,7 +35,7 @@ adjustPhi(phi, U, pcorr); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/compressibleInterDyMFoam/correctPhi.H index dd3ddc486..5a114050d 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/correctPhi.H @@ -42,7 +42,7 @@ adjustPhi(phi, U, pcorr); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/multiphase/interDyMFoam/correctPhi.H b/applications/solvers/multiphase/interDyMFoam/correctPhi.H index 33f3f08a6..78a616422 100644 --- a/applications/solvers/multiphase/interDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/interDyMFoam/correctPhi.H @@ -27,7 +27,7 @@ adjustPhi(phi, U, pcorr); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/multiphase/interFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/correctPhi.H index f8988a54c..a1cb1bf0a 100644 --- a/applications/solvers/multiphase/interFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/correctPhi.H @@ -34,7 +34,7 @@ adjustPhi(phi, U, pcorr); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H index f8988a54c..a1cb1bf0a 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H @@ -34,7 +34,7 @@ adjustPhi(phi, U, pcorr); - mesh.setFluxRequired(pcorr.name()); + mesh.schemesDict().setFluxRequired(pcorr.name()); for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) {