From f9668a803c076bfb32d2a442d95d3db439f65e80 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Tue, 27 Nov 2018 11:05:51 +0100
Subject: [PATCH] [pm][velocityoutput] Use zero velocity on no-flow boundaries

---
 dumux/porousmediumflow/velocityoutput.hh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dumux/porousmediumflow/velocityoutput.hh b/dumux/porousmediumflow/velocityoutput.hh
index a08a86cca3..6df0c47e15 100644
--- a/dumux/porousmediumflow/velocityoutput.hh
+++ b/dumux/porousmediumflow/velocityoutput.hh
@@ -303,8 +303,12 @@ public:
                     auto bcTypes = problemBoundaryTypes_(element, scvf);
                     if (bcTypes.hasNeumann())
                     {
+                        // check if we have Neumann no flow, we can just use 0
+                        const auto neumannFlux = problem_.neumann(element, fvGeometry, elemVolVars, scvf);
+                        if (Dune::FloatCmp::eq<std::decay_t<decltype(neumannFlux)>, Dune::FloatCmp::CmpStyle::absolute>(neumannFlux, 0.0, 1e-30))
+                            scvfFluxes[scvfIndexInInside[localScvfIdx]] = 0;
                         // cubes
-                        if (dim == 1 || geomType.isCube())
+                        else if (dim == 1 || geomType.isCube())
                         {
                             const auto fIdx = scvfIndexInInside[localScvfIdx];
                             const auto fIdxOpposite = fIdx%2 ? fIdx-1 : fIdx+1;
-- 
GitLab