From f03d50e7259bbcd97c76ef1f24a87a6d37002b28 Mon Sep 17 00:00:00 2001
From: DennisGlaeser <dennis.glaeser@iws.uni-stuttgart.de>
Date: Mon, 28 Nov 2016 16:25:47 +0100
Subject: [PATCH] [mpfa][elemvolvars] only make boundary vol vars on dirichlet
 boundaries

---
 .../mpfa/elementvolumevariables.hh            | 51 +++++++++++--------
 1 file changed, 30 insertions(+), 21 deletions(-)

diff --git a/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh b/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh
index 8dc18e813d..03e8db6eb0 100644
--- a/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh
+++ b/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh
@@ -24,6 +24,7 @@
 #define DUMUX_DISCRETIZATION_CCMPFA_ELEMENT_VOLUMEVARIABLES_HH
 
 #include <dumux/implicit/properties.hh>
+#include "facetypes.hh"
 
 namespace Dumux
 {
@@ -171,16 +172,20 @@ public:
                     if (!scvf.boundary())
                         continue;
 
-                    // boundary volume variables
-                    VolumeVariables dirichletVolVars;
-                    const auto dirichletPriVars = problem.dirichlet(element, scvf);
-                    dirichletVolVars.update(dirichletPriVars, problem, element, scvI);
-                    volumeVariables_.emplace_back(std::move(dirichletVolVars));
-
-                    // boundary vol var index
-                    auto bVolVarIdx = scvf.outsideScvIdx();
-                    volVarIndices_.push_back(bVolVarIdx);
-                    finishedBoundaries.push_back(bVolVarIdx);
+                    // only proceed if we are on a dirichlet boundary
+                    if (MpfaHelper::getMpfaFaceType(problem, element, scvf) == MpfaFaceTypes::dirichlet)
+                    {
+                        // boundary volume variables
+                        VolumeVariables dirichletVolVars;
+                        const auto dirichletPriVars = problem.dirichlet(element, scvf);
+                        dirichletVolVars.update(dirichletPriVars, problem, element, scvI);
+                        volumeVariables_.emplace_back(std::move(dirichletVolVars));
+
+                        // boundary vol var index
+                        auto bVolVarIdx = scvf.outsideScvIdx();
+                        volVarIndices_.push_back(bVolVarIdx);
+                        finishedBoundaries.push_back(bVolVarIdx);
+                    }
                 }
             }
 
@@ -202,19 +207,23 @@ public:
 
                     // that means we are on a not yet handled boundary scvf
                     auto insideScvIdx = ivScvf.insideScvIdx();
-                    auto&& ivScv = fvGeometry.scv(insideScvIdx);
                     auto ivElement = globalFvGeometry.element(insideScvIdx);
 
-                    // boundary volume variables
-                    VolumeVariables dirichletVolVars;
-                    const auto dirichletPriVars = problem.dirichlet(ivElement, ivScvf);
-                    dirichletVolVars.update(dirichletPriVars, problem, ivElement, ivScv);
-                    volumeVariables_.emplace_back(std::move(dirichletVolVars));
-
-                    // boundary vol var index
-                    auto bVolVarIdx = ivScvf.outsideScvIdx();
-                    volVarIndices_.push_back(bVolVarIdx);
-                    finishedBoundaries.push_back(bVolVarIdx);
+                    // only proceed if we are on a dirichlet boundary
+                    if (MpfaHelper::getMpfaFaceType(problem, ivElement, ivScvf) == MpfaFaceTypes::dirichlet)
+                    {
+                        // boundary volume variables
+                        VolumeVariables dirichletVolVars;
+                        auto&& ivScv = fvGeometry.scv(insideScvIdx);
+                        const auto dirichletPriVars = problem.dirichlet(ivElement, ivScvf);
+                        dirichletVolVars.update(dirichletPriVars, problem, ivElement, ivScv);
+                        volumeVariables_.emplace_back(std::move(dirichletVolVars));
+
+                        // boundary vol var index
+                        auto bVolVarIdx = ivScvf.outsideScvIdx();
+                        volVarIndices_.push_back(bVolVarIdx);
+                        finishedBoundaries.push_back(bVolVarIdx);
+                    }
                 }
             }
 
-- 
GitLab