From b3da2d5126ae0759c5a3df4feae4c5304280805d Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Tue, 6 Dec 2016 17:09:16 +0100
Subject: [PATCH] [staggeredGrid] Minor improvements

*Comment-out boundary scvs in globalVolumeVariables (may be needed later)
*Renaming in localJacobian to make clear we deflect volVars of element J
---
 .../staggered/globalvolumevariables.hh        | 40 +++++++++----------
 dumux/implicit/staggered/localjacobian.hh     |  8 ++--
 2 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/dumux/discretization/staggered/globalvolumevariables.hh b/dumux/discretization/staggered/globalvolumevariables.hh
index cbc1b32ea2..a41f5ce88b 100644
--- a/dumux/discretization/staggered/globalvolumevariables.hh
+++ b/dumux/discretization/staggered/globalvolumevariables.hh
@@ -70,9 +70,9 @@ public:
         problemPtr_ = &problem;
 
         auto numScv = problem.model().globalFvGeometry().numScv();
-        auto numBoundaryScvf = problem.model().globalFvGeometry().numBoundaryScvf();
+//         auto numBoundaryScvf = problem.model().globalFvGeometry().numBoundaryScvf();
 
-        volumeVariables_.resize(numScv + numBoundaryScvf);
+        volumeVariables_.resize(numScv /*+ numBoundaryScvf*/);
         for (const auto& element : elements(problem.gridView()))
         {
             auto fvGeometry = localView(problem.model().globalFvGeometry());
@@ -81,24 +81,24 @@ public:
             for (auto&& scv : scvs(fvGeometry))
                 volumeVariables_[scv.index()].update(sol[cellCenterIdx][scv.dofIndex()], problem, element, scv);
 
-            // handle the boundary volume variables
-            for (auto&& scvf : scvfs(fvGeometry))
-            {
-                // if we are not on a boundary, skip the rest
-                if (!scvf.boundary())
-                    continue;
-
-                // check if boundary is a pure dirichlet boundary
-                const auto bcTypes = problem.boundaryTypes(element, scvf);
-                if (bcTypes.hasOnlyDirichlet())
-                {
-                    const auto insideScvIdx = scvf.insideScvIdx();
-                    const auto& insideScv = fvGeometry.scv(insideScvIdx);
-                    const auto dirichletPriVars = problem.ccDirichlet(element, scvf);
-
-                    volumeVariables_[scvf.outsideScvIdx()].update(dirichletPriVars, problem, element, insideScv);
-                }
-            }
+//             // handle the boundary volume variables
+//             for (auto&& scvf : scvfs(fvGeometry))
+//             {
+//                 // if we are not on a boundary, skip the rest
+//                 if (!scvf.boundary())
+//                     continue;
+//
+//                 // check if boundary is a pure dirichlet boundary
+//                 const auto bcTypes = problem.boundaryTypes(element, scvf);
+//                 if (bcTypes.hasOnlyDirichlet())
+//                 {
+//                     const auto insideScvIdx = scvf.insideScvIdx();
+//                     const auto& insideScv = fvGeometry.scv(insideScvIdx);
+//                     const auto dirichletPriVars = problem.ccDirichlet(element, scvf);
+//
+//                     volumeVariables_[scvf.outsideScvIdx()].update(dirichletPriVars, problem, element, insideScv);
+//                 }
+//             }
         }
     }
 
diff --git a/dumux/implicit/staggered/localjacobian.hh b/dumux/implicit/staggered/localjacobian.hh
index f705d9ca2c..8c217005e8 100644
--- a/dumux/implicit/staggered/localjacobian.hh
+++ b/dumux/implicit/staggered/localjacobian.hh
@@ -228,10 +228,9 @@ private:
         for(const auto& globalJ : cellCenterToCellCenterStencil)
         {
             // get the volVars of the element with respect to which we are going to build the derivative
-            auto&& scv = fvGeometry.scv(globalJ);
+            auto&& scvJ = fvGeometry.scv(globalJ);
             const auto elementJ = fvGeometry.globalFvGeometry().element(globalJ);
-            curElemVolVars.bind(elementJ, fvGeometry, this->model_().curSol());
-            auto& curVolVars = getCurVolVars(curElemVolVars, scv);
+            auto& curVolVars = getCurVolVars(curElemVolVars, scvJ);
             VolumeVariables origVolVars(curVolVars);
 
             for(int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
@@ -240,7 +239,7 @@ private:
                 CellCenterPrimaryVariables priVars(this->model_().curSol()[cellCenterIdx][globalJ]);
 
                 priVars[pvIdx] += eps;
-                curVolVars.update(priVars, this->problem_(), elementJ, scv);
+                curVolVars.update(priVars, this->problem_(), elementJ, scvJ);
 
                 this->localResidual().eval(element, fvGeometry,
                                         prevElemVolVars, curElemVolVars,
@@ -287,7 +286,6 @@ private:
             auto origFaceVars = curGlobalFaceVars.faceVars(globalJ);
             auto& curFaceVars = curGlobalFaceVars.faceVars(globalJ);
 
-
             for(int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
             {
                 const Scalar eps = 1e-4; // TODO: do properly
-- 
GitLab