From 5976e79cebc57e283771de0ef9c01370490594c8 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 26 May 2016 14:55:44 +0100 Subject: [PATCH] surfaceInterpolation:localMin,localMax: Add support for consistent interpolation on coupled BCs Resolves bug-report http://bugs.openfoam.org/view.php?id=2100 --- .../schemes/localMax/localMax.H | 35 ++++++++++++++----- .../schemes/localMin/localMin.H | 35 ++++++++++++++----- 2 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMax/localMax.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMax/localMax.H index da72d5285..6dc51cc79 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMax/localMax.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMax/localMax.H @@ -138,14 +138,6 @@ public: ); GeometricField& vff = tvff.ref(); - typename GeometricField:: - Boundary& vffbf = vff.boundaryFieldRef(); - - forAll(vffbf, patchi) - { - vffbf[patchi] = vf.boundaryField()[patchi]; - } - const labelUList& own = mesh.owner(); const labelUList& nei = mesh.neighbour(); @@ -154,6 +146,33 @@ public: vff[facei] = max(vf[own[facei]], vf[nei[facei]]); } + typename GeometricField:: + Boundary& bff = vff.boundaryFieldRef(); + + forAll(bff, patchi) + { + const fvPatchField& pf = vf.boundaryField()[patchi]; + Field& pff = bff[patchi]; + + if (pf.coupled()) + { + tmp> tpif(pf.patchInternalField()); + const Field& pif = tpif(); + + tmp> tpnf(pf.patchNeighbourField()); + const Field& pnf = tpnf(); + + forAll(pff, i) + { + pff[i] = max(pif[i], pnf[i]); + } + } + else + { + pff = pf; + } + } + return tvff; } }; diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMin/localMin.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMin/localMin.H index 35c53ee66..48f008ae7 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMin/localMin.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/localMin/localMin.H @@ -138,14 +138,6 @@ public: ); GeometricField& vff = tvff.ref(); - typename GeometricField:: - Boundary& vffbf = vff.boundaryFieldRef(); - - forAll(vffbf, patchi) - { - vffbf[patchi] = vf.boundaryField()[patchi]; - } - const labelUList& own = mesh.owner(); const labelUList& nei = mesh.neighbour(); @@ -154,6 +146,33 @@ public: vff[facei] = minMod(vf[own[facei]], vf[nei[facei]]); } + typename GeometricField:: + Boundary& bff = vff.boundaryFieldRef(); + + forAll(bff, patchi) + { + const fvPatchField& pf = vf.boundaryField()[patchi]; + Field& pff = bff[patchi]; + + if (pf.coupled()) + { + tmp> tpif(pf.patchInternalField()); + const Field& pif = tpif(); + + tmp> tpnf(pf.patchNeighbourField()); + const Field& pnf = tpnf(); + + forAll(pff, i) + { + pff[i] = minMod(pif[i], pnf[i]); + } + } + else + { + pff = pf; + } + } + return tvff; } };