From cecd27a301c19b24625e1a82ccc3d822f082f236 Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Wed, 27 Oct 2021 13:16:39 +0200
Subject: [PATCH] [fcstaggered] Make sure scvfs on processor boundary are not
 considered in assembly

---
 dumux/assembly/fclocalassembler.hh                       | 9 ++++++++-
 .../facecentered/staggered/connectivitymap.hh            | 7 +++++--
 .../facecentered/staggered/elementvolumevariables.hh     | 2 +-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dumux/assembly/fclocalassembler.hh b/dumux/assembly/fclocalassembler.hh
index c58f85ba12..78050f1320 100644
--- a/dumux/assembly/fclocalassembler.hh
+++ b/dumux/assembly/fclocalassembler.hh
@@ -385,7 +385,8 @@ public:
 
             auto evalFlux = [&](ElementResidualVector& residual, const SubControlVolumeFace& scvf)
             {
-                this->localResidual().evalFlux(residual, problem, element, fvGeometry, curElemVolVars, this->elemBcTypes(), this->elemFluxVarsCache(), scvf);
+                if (!scvf.processorBoundary())
+                    this->localResidual().evalFlux(residual, problem, element, fvGeometry, curElemVolVars, this->elemBcTypes(), this->elemFluxVarsCache(), scvf);
             };
 
             // derivative w.r.t. own DOF
@@ -470,6 +471,9 @@ public:
 
                         for (const auto& scvf : scvfs(fvGeometry, scv))
                         {
+                            if (scvf.processorBoundary())
+                                continue;
+
                             if (scvf.outsideScvIdx() == scvJ.index())
                             {
                                 evalFlux(residual, scvf);
@@ -502,6 +506,9 @@ public:
 
                         for (const auto& scvf : scvfs(fvGeometry, scv))
                         {
+                            if (scvf.processorBoundary())
+                                continue;
+
                             if (scvf.outsideScvIdx() == scvJ.index())
                             {
                                 evalFlux(result, scvf);
diff --git a/dumux/discretization/facecentered/staggered/connectivitymap.hh b/dumux/discretization/facecentered/staggered/connectivitymap.hh
index b6cd81092e..8450a287dc 100644
--- a/dumux/discretization/facecentered/staggered/connectivitymap.hh
+++ b/dumux/discretization/facecentered/staggered/connectivitymap.hh
@@ -58,16 +58,18 @@ public:
             if (element.partitionType() == Dune::InteriorEntity)
                 continue;
 
+            assert(element.partitionType() == Dune::OverlapEntity);
+
             // restrict the FvGeometry locally and bind to the element
             fvGeometry.bind(element);
             // loop over sub control faces
             for (const auto& scvf : scvfs(fvGeometry))
             {
-                if (scvf.isFrontal() && !scvf.boundary())
+                if (scvf.isFrontal() && !scvf.boundary() && !scvf.processorBoundary())
                 {
                     const auto& ownScv = fvGeometry.scv(scvf.insideScvIdx());
                     const auto& facet = element.template subEntity <1> (ownScv.indexInElement());
-                    if (facet.partitionType() == 1)
+                    if (facet.partitionType() == Dune::BorderEntity)
                     {
                         const auto& oppositeScv =  fvGeometry.scv(scvf.outsideScvIdx());
                         map_[ownScv.index()].push_back(oppositeScv.index());
@@ -83,6 +85,7 @@ public:
             // loop over sub control faces
             for (const auto& scvf : scvfs(fvGeometry))
             {
+                assert(!scvf.processorBoundary());
                 const auto& ownScv = fvGeometry.scv(scvf.insideScvIdx());
                 const auto ownDofIndex = ownScv.dofIndex();
                 const auto ownScvIndex = ownScv.index();
diff --git a/dumux/discretization/facecentered/staggered/elementvolumevariables.hh b/dumux/discretization/facecentered/staggered/elementvolumevariables.hh
index 32ca10c61d..0c7cd0c598 100644
--- a/dumux/discretization/facecentered/staggered/elementvolumevariables.hh
+++ b/dumux/discretization/facecentered/staggered/elementvolumevariables.hh
@@ -111,7 +111,7 @@ public:
 
         for (const auto& scvf : scvfs(fvGeometry))
         {
-            if (!scvf.boundary() || scvf.isFrontal())
+            if (!scvf.boundary() || scvf.isFrontal() || scvf.processorBoundary())
                 continue;
 
             // check if boundary is a pure dirichlet boundary
-- 
GitLab