From 53fe85e02eb29209d48900254ffb8f3c629e5d8e Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Wed, 18 Nov 2015 17:32:39 +0100
Subject: [PATCH] [dumux, test] fix shadowing of variables

Fix all warnings triggered with -Wshadow.
---
 .../2p/diffusion/fv/fvvelocity2padaptive.hh   |  3 --
 .../fvmpfa/lmethod/fvmpfal2dpressure2p.hh     |  6 ++--
 .../lmethod/fvmpfal2dpressure2padaptive.hh    |  8 ++---
 ...fal3dinteractionvolumecontaineradaptive.hh |  4 +--
 .../lmethod/fvmpfal3dpressure2padaptive.hh    | 20 +++++------
 .../fvmpfal3dpressurevelocity2padaptive.hh    |  4 +--
 .../lmethod/fvmpfal3dvelocity2padaptive.hh    |  1 -
 .../fvmpfa/omethod/fvmpfao2dpressure2p.hh     |  6 ++--
 .../2p/diffusion/mimetic/mimetic2p.hh         | 11 +++----
 .../2p/diffusion/mimetic/mimeticoperator2p.hh |  8 ++---
 .../mimetic/mimeticoperator2padaptive.hh      |  8 ++---
 .../2p2c/fv3dpressure2p2cadaptive.hh          | 33 +++++++++----------
 dumux/decoupled/2p2c/fvpressure2p2c.hh        |  4 +--
 dumux/freeflow/zeroeqnc/zeroeqncmodel.hh      |  8 ++---
 dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh  |  4 +--
 dumux/geomechanics/el1p2c/el1p2cmodel.hh      | 22 ++++++-------
 dumux/geomechanics/el2p/el2plocaloperator.hh  |  4 +--
 dumux/geomechanics/el2p/el2pmodel.hh          | 20 +++++------
 dumux/implicit/box/boxfvelementgeometry.hh    |  8 ++---
 dumux/linear/domesticoverlapfrombcrsmatrix.hh |  4 +--
 dumux/material/constraintsolvers/ncpflash.hh  |  6 ++--
 .../2cnistokes2p2cniproblem.hh                | 28 ++++++++--------
 .../2cstokes2p2c/2cstokes2p2cproblem.hh       | 26 +++++++--------
 .../1p/implicit/1pniconductionproblem.hh      | 14 ++++----
 .../1p/implicit/1pniconvectionproblem.hh      | 12 +++----
 .../1p/sequential/resultevaluation3d.hh       |  4 +--
 .../1p2c/implicit/1p2cniconductionproblem.hh  | 14 ++++----
 .../1p2c/implicit/1p2cniconvectionproblem.hh  | 12 +++----
 .../3p/implicit/3pniconductionproblem.hh      | 14 ++++----
 .../3p/implicit/3pniconvectionproblem.hh      | 12 +++----
 .../implicit/richardsniconductionproblem.hh   | 14 ++++----
 .../implicit/richardsniconvectionproblem.hh   | 12 +++----
 32 files changed, 174 insertions(+), 180 deletions(-)

diff --git a/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh
index ec77a08f74..0308ed943d 100644
--- a/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh
@@ -447,9 +447,6 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters
     }
     else if (elementI.level() > elementJ.level() && dim == 3)
     {
-        auto elementI = intersection.inside();
-        auto elementJ = intersection.outside();
-
         int globalIdxJ = problem_.variables().index(elementJ);
 
         CellData& cellDataJ = problem_.variables().cellData(globalIdxJ);
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh
index 9cc47f8ed2..1becdae0d6 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2p.hh
@@ -974,7 +974,7 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
                                     interactionVolumes_[globalVertIdx1234].setFacePosition(globalPosFace23, 1, 0);
 
                                     problem_.boundaryTypes(bcType, intersection2);
-                                    PrimaryVariables boundValues(0.0);
+                                    boundValues = 0.0;
 
                                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 1);
                                     if (bcType.isNeumann(pressEqIdx))
@@ -1037,7 +1037,7 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
                 if (intersection14.boundary())
                 {
                     problem_.boundaryTypes(bcType, intersection14);
-                    PrimaryVariables boundValues(0.0);
+                    boundValues = 0.0;
 
                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 3);
                     if (bcType.isNeumann(pressEqIdx))
@@ -1105,7 +1105,7 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
                                     interactionVolumes_[globalVertIdx1234].setFacePosition(globalPosFace34, 3, 1);
 
                                     problem_.boundaryTypes(bcType, intersection4);
-                                    PrimaryVariables boundValues(0.0);
+                                    boundValues = 0.0;
 
                                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 2);
                                     if (bcType.isNeumann(pressEqIdx))
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh
index c0378bf53b..c554729413 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2dpressure2padaptive.hh
@@ -1226,7 +1226,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
                     // get outer normal vector scaled with half volume of face 'isIt23'
                     DimVector unitOuterNormal23(0);
 
-                    bool finished = false;
+                    finished = false;
 
                     for (const auto& intersection2
                          : Dune::intersections(problem_.gridView(), element2))
@@ -1256,7 +1256,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
                                     interactionVolumes_[globalVertIdx1234].setFacePosition(globalPosFace23, 1, 0);
 
                                     problem_.boundaryTypes(bcType, intersection2);
-                                    PrimaryVariables boundValues(0.0);
+                                    boundValues = 0.0;
 
                                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 1);
                                     if (bcType.isNeumann(pressEqIdx))
@@ -1415,7 +1415,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
                 if (intersection14.boundary())
                 {
                     problem_.boundaryTypes(bcType, intersection14);
-                    PrimaryVariables boundValues(0.0);
+                    boundValues = 0.0;
 
                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 3);
                     if (bcType.isNeumann(pressEqIdx))
@@ -1488,7 +1488,7 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
                                     interactionVolumes_[globalVertIdx1234].setFacePosition(globalPosFace34, 3, 1);
 
                                     problem_.boundaryTypes(bcType, intersection4);
-                                    PrimaryVariables boundValues(0.0);
+                                    boundValues = 0.0;
 
                                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 2);
                                     if (bcType.isNeumann(pressEqIdx))
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh
index eb62bb8171..23f36091f9 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontaineradaptive.hh
@@ -1037,7 +1037,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter
                                 DimVector normal = intersection.centerUnitOuterNormal();
                                 interactionVolume.setNormal(normal, 4, 2);
                                 interactionVolume.setNormal(normal, 5, 1);
-                                GlobalPosition globalPosFace(intersection.geometry().center());
+                                globalPosFace = intersection.geometry().center();
                                 interactionVolume.setFacePosition(globalPosFace, 5);
                                 interactionVolume.setFacePosition(globalPosFace, 7);
                                 int indexInOutside = intersection.indexInOutside();
@@ -1087,7 +1087,7 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter
                                 DimVector normal = intersection.centerUnitOuterNormal();
                                 interactionVolume.setNormal(normal, 4, 1);
                                 interactionVolume.setNormal(normal, 6, 2);
-                                GlobalPosition globalPosFace(intersection.geometry().center());
+                                globalPosFace = intersection.geometry().center();
                                 interactionVolume.setFacePosition(globalPosFace, 4);
                                 interactionVolume.setFacePosition(globalPosFace, 6);
                                 int indexInOutside = intersection.indexInOutside();
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh
index 24aed8b55b..2cbe5678a6 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressure2padaptive.hh
@@ -293,33 +293,33 @@ void FvMpfaL3dPressure2pAdaptive<TypeTag>::initializeMatrixRowSize()
 
         int numVertices = element.geometry().corners();
 
-        for (int vIdx = 0; vIdx < numVertices; vIdx++)
+        for (int vIdxI = 0; vIdxI < numVertices; vIdxI++)
         {
-            int vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, vIdx, dim);
+            int vIdxIGlobal = problem_.variables().vertexMapper().subIndex(element, vIdxI, dim);
 
-            InteractionVolume& interactionVolume = this->interactionVolumes_.interactionVolume(vIdxGlobal);
+            InteractionVolume& interactionVolume = this->interactionVolumes_.interactionVolume(vIdxIGlobal);
 
             for (int subVolumeIdx = 0; subVolumeIdx < InteractionVolume::subVolumeTotalNum; subVolumeIdx++)
             {
                 if (interactionVolume.hasSubVolumeElement(subVolumeIdx))
                 {
                     auto neighbor = interactionVolume.getSubVolumeElement(subVolumeIdx);
-                    int globalIdxJ = problem_.variables().index(neighbor);
+                    int neighborIdx = problem_.variables().index(neighbor);
 
-                    neighborIndices.insert(globalIdxJ);
+                    neighborIndices.insert(neighborIdx);
 
                     if (!interactionVolume.sameLevel())
                     {
                         if (neighbor.level() == levelI + 2)
                         {
-                            for (int vIdx = 0; vIdx < numVertices; vIdx++)
+                            for (int vIdxJ = 0; vIdxJ < numVertices; vIdxJ++)
                             {
-                                int globalVertIdxJ = problem_.variables().vertexMapper().subIndex(neighbor, vIdx, dim);
+                                int vIdxJGlobal = problem_.variables().vertexMapper().subIndex(neighbor, vIdxJ, dim);
 
-                                if (globalVertIdxJ != vIdxGlobal)
+                                if (vIdxJGlobal != vIdxIGlobal)
                                 {
-                                    InteractionVolume& interactionVolumeJ = this->interactionVolumes_.interactionVolume(
-                                                                                                                        globalVertIdxJ);
+                                    InteractionVolume& interactionVolumeJ
+                                        = this->interactionVolumes_.interactionVolume(vIdxJGlobal);
 
                                     if (interactionVolumeJ.isHangingNodeVolume())
                                     {
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh
index 6072966175..7af74a0f18 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dpressurevelocity2padaptive.hh
@@ -440,9 +440,9 @@ void FvMpfaL3dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter
 
                 if (size > 1)
                 {
-                    for (int i = 0; i < 8; i++)
+                    for (int j = 0; j < 8; j++)
                     {
-                        cellDataTemp[i] = problem_.variables().cellData(eIdxGlobal[i]);
+                        cellDataTemp[j] = problem_.variables().cellData(eIdxGlobal[j]);
                     }
                 }
             }
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh
index 2c0c116ee1..4eaaf02190 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dvelocity2padaptive.hh
@@ -2192,7 +2192,6 @@ void FvMpfaL3dVelocity2pAdaptive<TypeTag>::calculateHangingNodeInteractionVolume
         }
         }
 
-        int hangingNodeType = interactionVolume.getHangingNodeType();
         if (hangingNodeType == InteractionVolume::sixSmallCells)
         {
             vel12 *= flux[0] / (interactionVolumes_().getRealFluxFaceArea(interactionVolume, globalIdx1, 0, 0));
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh
index 3d942fb2bc..842d645390 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2dpressure2p.hh
@@ -1026,7 +1026,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
                                     interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol23, 1, 0);
 
                                     problem_.boundaryTypes(bcType, intersection2);
-                                    PrimaryVariables boundValues(0.0);
+                                    boundValues = 0.0;
 
                                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 1);
                                     if (bcType.isNeumann(pressEqIdx))
@@ -1104,7 +1104,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
                 if (intersection14.boundary())
                 {
                     problem_.boundaryTypes(bcType, intersection14);
-                    PrimaryVariables boundValues(0.0);
+                    boundValues = 0.0;
 
                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 3);
                     if (bcType.isNeumann(pressEqIdx))
@@ -1172,7 +1172,7 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
                                     interactionVolumes_[globalVertIdx1234].setFaceArea(faceVol34, 3, 1);
 
                                     problem_.boundaryTypes(bcType, intersection4);
-                                    PrimaryVariables boundValues(0.0);
+                                    boundValues = 0.0;
 
                                     interactionVolumes_[globalVertIdx1234].setBoundary(bcType, 2);
                                     if (bcType.isNeumann(pressEqIdx))
diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh
index 37136fd9eb..b6a176c61c 100644
--- a/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh
+++ b/dumux/decoupled/2p/diffusion/mimetic/mimetic2p.hh
@@ -471,25 +471,24 @@ void MimeticTwoPLocalStiffness<TypeTag>::assembleElementMatrices(const Element&
 
     Scalar gravPot = (problem_.bBoxMax() - centerGlobal) * problem_.gravity() * (density_[nPhaseIdx] - density_[wPhaseIdx]);
 
-    int i = -1;
     for (const auto& intersection : Dune::intersections(gridView_, element))
     {
         // local number of facet
-        i = intersection.indexInInside();
+        int fIdx = intersection.indexInInside();
 
         Dune::FieldVector<Scalar, dim> faceGlobal = intersection.geometry().center();
-        faceVol[i] = intersection.geometry().volume();
+        faceVol[fIdx] = intersection.geometry().volume();
 
         // get normal vector
         const Dune::FieldVector<Scalar, dim>& unitOuterNormal = intersection.centerUnitOuterNormal();
 
-        N[i] = unitOuterNormal;
+        N[fIdx] = unitOuterNormal;
 
         for (int k = 0; k < dim; k++)
             // move origin to the center of gravity
-            R[i][k] = faceVol[i] * (faceGlobal[k] - centerGlobal[k]);
+            R[fIdx][k] = faceVol[fIdx] * (faceGlobal[k] - centerGlobal[k]);
 
-        gravPotFace[i] = (problem_.bBoxMax() - faceGlobal) * problem_.gravity() * (density_[nPhaseIdx] - density_[wPhaseIdx]);
+        gravPotFace[fIdx] = (problem_.bBoxMax() - faceGlobal) * problem_.gravity() * (density_[nPhaseIdx] - density_[wPhaseIdx]);
     }
 
     // proceed along the lines of Algorithm 1 from
diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh
index 9c285f61a3..3c832e26ca 100644
--- a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh
+++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2p.hh
@@ -99,11 +99,11 @@ public:
         Dune::FieldVector<Scalar, 2 * dim> pressTrace(0);
         Dune::FieldVector<Scalar, 2 * dim> gravPotTrace(0);
 
-        const auto element = *this->gridView_.template begin<0>();
+        const auto firstElement = *this->gridView_.template begin<0>();
         FluidState fluidState;
-        fluidState.setPressure(wPhaseIdx, problem.referencePressure(element));
-        fluidState.setPressure(nPhaseIdx, problem.referencePressure(element));
-        fluidState.setTemperature(problem.temperature(element));
+        fluidState.setPressure(wPhaseIdx, problem.referencePressure(firstElement));
+        fluidState.setPressure(nPhaseIdx, problem.referencePressure(firstElement));
+        fluidState.setTemperature(problem.temperature(firstElement));
         fluidState.setSaturation(wPhaseIdx, 1.);
         fluidState.setSaturation(nPhaseIdx, 0.);
         Scalar densityDiff = FluidSystem::density(fluidState, nPhaseIdx) - FluidSystem::density(fluidState, wPhaseIdx);
diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh
index d17f8037ff..27856e72b9 100644
--- a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh
@@ -98,11 +98,11 @@ public:
         Dune::DynamicVector<Scalar> pressTraceW(2*dim);
         Dune::DynamicVector<Scalar> pressTraceNw(2*dim);
 
-        const auto element = *problem.gridView().template begin<0>();
+        const auto firstElement = *problem.gridView().template begin<0>();
         FluidState fluidState;
-        fluidState.setPressure(wPhaseIdx, problem.referencePressure(element));
-        fluidState.setPressure(nPhaseIdx, problem.referencePressure(element));
-        fluidState.setTemperature(problem.temperature(element));
+        fluidState.setPressure(wPhaseIdx, problem.referencePressure(firstElement));
+        fluidState.setPressure(nPhaseIdx, problem.referencePressure(firstElement));
+        fluidState.setTemperature(problem.temperature(firstElement));
         fluidState.setSaturation(wPhaseIdx, 1.);
         fluidState.setSaturation(nPhaseIdx, 0.);
         Scalar densityDiff = FluidSystem::density(fluidState, nPhaseIdx) - FluidSystem::density(fluidState, wPhaseIdx);
diff --git a/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh b/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh
index b7d09a303d..eb6ac2a5da 100644
--- a/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh
+++ b/dumux/decoupled/2p2c/fv3dpressure2p2cadaptive.hh
@@ -1076,7 +1076,6 @@ void FV3dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator&
                                      + rhoMean[nPhaseIdx] * lambda[nPhaseIdx] * dV[nPhaseIdx]) * gravityContributionAdditonal;
 
             // weithing accounts for the fraction of the subcontrol volume
-            Scalar weightingFactor = volume / perimeter;    // transforms flux through area A -> V * A/perimeter
             if(enableVolumeIntegral_) // switch off volume integral for mpfa case
             {
                 // correct for area integral
@@ -1095,19 +1094,19 @@ void FV3dPressure2P2CAdaptive<TypeTag>::getMpfaFlux(const IntersectionIterator&
             }
 
             // capillary pressure flux
-            Scalar pcGradient = cellDataI.capillaryPressure() * additionalT[0]
-                               + cellDataJ.capillaryPressure() * additionalT[1]
-                               + cellDataA3.capillaryPressure() * additionalT[2]
-                               + cellDataA4.capillaryPressure() * additionalT[3];
+            Scalar addPcGradient = cellDataI.capillaryPressure() * additionalT[0]
+                                 + cellDataJ.capillaryPressure() * additionalT[1]
+                                 + cellDataA3.capillaryPressure() * additionalT[2]
+                                 + cellDataA4.capillaryPressure() * additionalT[3];
 
             if (this->pressureType == pw)
-                pcGradient *= + lambda[nPhaseIdx] * dV[nPhaseIdx]
+                addPcGradient *= + lambda[nPhaseIdx] * dV[nPhaseIdx]
                                - enableVolumeIntegral_ * weightingFactor * lambda[nPhaseIdx] * gV[nPhaseIdx];
             else if (this->pressureType == pn)
-                pcGradient *= - lambda[wPhaseIdx] * dV[wPhaseIdx]
+                addPcGradient *= - lambda[wPhaseIdx] * dV[wPhaseIdx]
                                + enableVolumeIntegral_ * weightingFactor * lambda[wPhaseIdx] * gV[wPhaseIdx];
 
-            this->f_[eIdxGlobalI] += pcGradient;
+            this->f_[eIdxGlobalI] += addPcGradient;
         }
     }
 }
@@ -1743,14 +1742,14 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect
                     if(vSmall != outerCorner
                             && ((vertexOnInterface - vertexOnElement).two_norm()<1e-5))
                     {
-                        int vIdxGlobal = problem().variables().index(vSmall);
+                        int vIdxGlobal2 = problem().variables().index(vSmall);
                         // acess interactionVolume
-                        InteractionVolume& interactionVolume
-                            = interactionVolumesContainer_->interactionVolume(vIdxGlobal);
-                        if(interactionVolume.isBoundaryInteractionVolume())
+                        InteractionVolume& interactionVolume2
+                            = interactionVolumesContainer_->interactionVolume(vIdxGlobal2);
+                        if(interactionVolume2.isBoundaryInteractionVolume())
                             continue;
 
-                        int hangingNodeType = interactionVolume.getHangingNodeType();
+                        int hangingNodeType = interactionVolume2.getHangingNodeType();
                         // reset flux direction indicator
                         properFluxDirection = true;
 
@@ -1762,17 +1761,17 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect
                             {
                                 //TODO determine current localIdxLarge!!!!
                                 Dune::dgrave << " args, noHangingNode on additional interaction region";
-    //                            subVolumeFaceIdx = getMpfaCase8cells_(isIt, localIdxLarge, interactionVolume, properFluxDirection);
+    //                            subVolumeFaceIdx = getMpfaCase8cells_(isIt, localIdxLarge, interactionVolume2, properFluxDirection);
                             }
                             else if(hangingNodeType == InteractionVolume::sixSmallCells)
                                 subVolumeFaceIdx = interactionVolumesContainer_->getMpfaCase6cells(isIt,
-                                                                        interactionVolume, properFluxDirection);
+                                                                        interactionVolume2, properFluxDirection);
                             else
                                 subVolumeFaceIdx = interactionVolumesContainer_->getMpfaCase2or4cells(isIt,
-                                                                        interactionVolume, properFluxDirection);
+                                                                        interactionVolume2, properFluxDirection);
 
                             // b) calculate T, eIdxGlobal3+4
-                            caseL = this->transmissibilityAdapter_(isIt, interactionVolume, subVolumeFaceIdx,
+                            caseL = this->transmissibilityAdapter_(isIt, interactionVolume2, subVolumeFaceIdx,
                                                         properFluxDirection, additional2, additional3, additionalT);
 
                             // c) store it
diff --git a/dumux/decoupled/2p2c/fvpressure2p2c.hh b/dumux/decoupled/2p2c/fvpressure2p2c.hh
index 0ba98e9fb8..d5630000e5 100644
--- a/dumux/decoupled/2p2c/fvpressure2p2c.hh
+++ b/dumux/decoupled/2p2c/fvpressure2p2c.hh
@@ -700,8 +700,8 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en
 
             Scalar lambda = cellDataI.mobility(wPhaseIdx)+cellDataI.mobility(nPhaseIdx);
             entries[matrix] += lambda * faceArea * fabs(permeability * unitOuterNormal) / (dist);
-            Scalar pressBC = primaryVariablesOnBoundary[Indices::pressureEqIdx];
-            entries[rhs] += lambda * faceArea * pressBC * fabs(permeability * unitOuterNormal) / (dist);
+            Scalar pressBoundary = primaryVariablesOnBoundary[Indices::pressureEqIdx];
+            entries[rhs] += lambda * faceArea * pressBoundary * fabs(permeability * unitOuterNormal) / (dist);
             Scalar rightentry = (fractionalWI * cellDataI.density(wPhaseIdx)
                                  + fractionalNWI * cellDataI.density(nPhaseIdx))
                                  * lambda * faceArea * fabs(unitOuterNormal * permeability)
diff --git a/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh b/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh
index a957a24806..5b3daf00db 100644
--- a/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh
+++ b/dumux/freeflow/zeroeqnc/zeroeqncmodel.hh
@@ -323,12 +323,12 @@ public:
         int wallIdx = this->getWallIdx(globalPos, posIdx);
         // mass fraction
         if (this->wall[wallIdx].maxMassFraction[posIdx] < fluxVars.massFraction(transportCompIdx))
-            for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
-                this->wall[wallIdx].maxMassFraction[posIdx] = fluxVars.massFraction(transportCompIdx);
+            for (int wIdx = 0; wIdx < walls; ++wIdx)
+                this->wall[wIdx].maxMassFraction[posIdx] = fluxVars.massFraction(transportCompIdx);
         // mole fraction
         if (this->wall[wallIdx].maxMoleFraction[posIdx] < fluxVars.moleFraction(transportCompIdx))
-            for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
-                this->wall[wallIdx].maxMoleFraction[posIdx] = fluxVars.moleFraction(transportCompIdx);
+            for (int wIdx = 0; wIdx < walls; ++wIdx)
+                this->wall[wIdx].maxMoleFraction[posIdx] = fluxVars.moleFraction(transportCompIdx);
     }
 
     //! \copydoc ZeroEqModel::doInterpolationFluxValues
diff --git a/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh b/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh
index 7e5810823f..b9069258a5 100644
--- a/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh
+++ b/dumux/freeflow/zeroeqncni/zeroeqncnimodel.hh
@@ -345,8 +345,8 @@ public:
         int posIdx = this->getPosIdx(globalPos);
         int wallIdx = this->getWallIdx(globalPos, posIdx);
         if (this->wall[wallIdx].maxTemperature[posIdx] < fluxVars.temperature())
-            for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
-                this->wall[wallIdx].maxTemperature[posIdx] = fluxVars.temperature();
+            for (int wIdx = 0; wIdx < walls; ++wIdx)
+                this->wall[wIdx].maxTemperature[posIdx] = fluxVars.temperature();
     }
 
     //! \copydoc ZeroEqModel::doInterpolationFluxValues
diff --git a/dumux/geomechanics/el1p2c/el1p2cmodel.hh b/dumux/geomechanics/el1p2c/el1p2cmodel.hh
index 8000682926..7af571e864 100644
--- a/dumux/geomechanics/el1p2c/el1p2cmodel.hh
+++ b/dumux/geomechanics/el1p2c/el1p2cmodel.hh
@@ -168,20 +168,20 @@ public:
         typedef Dune::BlockVector<Dune::FieldVector<Scalar, dim> > VectorField;
 
         // create the required scalar and vector fields
-        unsigned numScv = this->gridView_().size(dim);
+        unsigned numVertices = this->gridView_().size(dim);
         unsigned numElements = this->gridView_().size(0);
 
         // create the required fields for vertex data
-        ScalarField &pressure = *writer.allocateManagedBuffer(numScv);
-        ScalarField &moleFraction0 = *writer.allocateManagedBuffer(numScv);
-        ScalarField &moleFraction1 = *writer.allocateManagedBuffer(numScv);
-        ScalarField &massFraction0 = *writer.allocateManagedBuffer(numScv);
-        ScalarField &massFraction1 = *writer.allocateManagedBuffer(numScv);
-        VectorField &displacement = *writer.template allocateManagedBuffer<Scalar, dim>(numScv);
-        ScalarField &density = *writer.allocateManagedBuffer(numScv);
-        ScalarField &viscosity = *writer.allocateManagedBuffer(numScv);
-        ScalarField &porosity = *writer.allocateManagedBuffer(numScv);
-        ScalarField &Kx = *writer.allocateManagedBuffer(numScv);
+        ScalarField &pressure = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &moleFraction0 = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &moleFraction1 = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &massFraction0 = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &massFraction1 = *writer.allocateManagedBuffer(numVertices);
+        VectorField &displacement = *writer.template allocateManagedBuffer<Scalar, dim>(numVertices);
+        ScalarField &density = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &viscosity = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &porosity = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &Kx = *writer.allocateManagedBuffer(numVertices);
 
         // create the required fields for element data
         // effective stresses
diff --git a/dumux/geomechanics/el2p/el2plocaloperator.hh b/dumux/geomechanics/el2p/el2plocaloperator.hh
index acbdb1a783..aebc047c93 100644
--- a/dumux/geomechanics/el2p/el2plocaloperator.hh
+++ b/dumux/geomechanics/el2p/el2plocaloperator.hh
@@ -374,7 +374,7 @@ public:
 
             // select quadrature rule for intersection faces (dim-1)
             Dune::GeometryType gtface = intersection.geometryInInside().type();
-            const Dune::QuadratureRule<DF,dim-1>& rule = Dune::QuadratureRules<DF,dim-1>::rule(gtface,qorder);
+            const Dune::QuadratureRule<DF,dim-1>& faceRule = Dune::QuadratureRules<DF,dim-1>::rule(gtface,qorder);
 
             // get face index of this intersection
             int fIdx = intersection.indexInInside();
@@ -389,7 +389,7 @@ public:
 
             // Treat Neumann boundary conditions
             // loop over quadrature points and integrate normal stress changes (traction changes)
-            for (typename Dune::QuadratureRule<DF,dim-1>::const_iterator it=rule.begin(); it!=rule.end(); ++it)
+            for (typename Dune::QuadratureRule<DF,dim-1>::const_iterator it=faceRule.begin(); it!=faceRule.end(); ++it)
             {
                 // position of quadrature point in local coordinates of element
                 DimVector local = intersection.geometryInInside().global(it->position());
diff --git a/dumux/geomechanics/el2p/el2pmodel.hh b/dumux/geomechanics/el2p/el2pmodel.hh
index 01a3b4cea5..c4d64369b7 100644
--- a/dumux/geomechanics/el2p/el2pmodel.hh
+++ b/dumux/geomechanics/el2p/el2pmodel.hh
@@ -225,19 +225,19 @@ public:
         typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
 
         // create the required scalar and vector fields
-        unsigned numScv = this->gridView_().size(dim);
+        unsigned numVertices = this->gridView_().size(dim);
         unsigned numElements = this->gridView_().size(0);
 
         // create the required fields for vertex data
-        ScalarField &pw = *writer.allocateManagedBuffer(numScv);
-        ScalarField &pn = *writer.allocateManagedBuffer(numScv);
-        ScalarField &pc = *writer.allocateManagedBuffer(numScv);
-        ScalarField &sw = *writer.allocateManagedBuffer(numScv);
-        ScalarField &sn = *writer.allocateManagedBuffer(numScv);
-        VectorField &displacement = *writer.template allocateManagedBuffer<Scalar, dim>(numScv);
-        ScalarField &rhoW = *writer.allocateManagedBuffer(numScv);
-        ScalarField &rhoN = *writer.allocateManagedBuffer(numScv);
-        ScalarField &Te = *writer.allocateManagedBuffer(numScv);
+        ScalarField &pw = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &pn = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &pc = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &sw = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &sn = *writer.allocateManagedBuffer(numVertices);
+        VectorField &displacement = *writer.template allocateManagedBuffer<Scalar, dim>(numVertices);
+        ScalarField &rhoW = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &rhoN = *writer.allocateManagedBuffer(numVertices);
+        ScalarField &Te = *writer.allocateManagedBuffer(numVertices);
 
         // create the required fields for element data
         // effective stresses
diff --git a/dumux/implicit/box/boxfvelementgeometry.hh b/dumux/implicit/box/boxfvelementgeometry.hh
index 38b3ac070e..97fd717b35 100644
--- a/dumux/implicit/box/boxfvelementgeometry.hh
+++ b/dumux/implicit/box/boxfvelementgeometry.hh
@@ -857,11 +857,11 @@ public:
                     JacobianInverseTransposed jacInvT =
                         geometry.jacobianInverseTransposed(bFace.ipLocal);
                     bFace.numFap = numScv;
-                    for (int scvIdx = 0; scvIdx < numScv; scvIdx++)
+                    for (int scvIdx2 = 0; scvIdx2 < numScv; scvIdx2++)
                     {
-                        jacInvT.mv(localJac[scvIdx][0], bFace.grad[scvIdx]);
-                        bFace.shapeValue[scvIdx] = Scalar(shapeVal[scvIdx]);
-                        bFace.fapIndices[scvIdx] = scvIdx;
+                        jacInvT.mv(localJac[scvIdx2][0], bFace.grad[scvIdx2]);
+                        bFace.shapeValue[scvIdx2] = Scalar(shapeVal[scvIdx2]);
+                        bFace.fapIndices[scvIdx2] = scvIdx2;
                     }
                 }
             }
diff --git a/dumux/linear/domesticoverlapfrombcrsmatrix.hh b/dumux/linear/domesticoverlapfrombcrsmatrix.hh
index f3d9b61cfc..661e066255 100644
--- a/dumux/linear/domesticoverlapfrombcrsmatrix.hh
+++ b/dumux/linear/domesticoverlapfrombcrsmatrix.hh
@@ -480,9 +480,9 @@ protected:
             peerRanksRecvBuff.receive(peerRank);
             for (int j = 0; j < numPeers; ++j) {
                 int seenBy = peerRanksRecvBuff[2*j + 0];
-                int borderDistance = peerRanksRecvBuff[2*j + 1];
+                int borderDistance2 = peerRanksRecvBuff[2*j + 1];
                 if (seenBy != myRank_) {
-                    domesticOverlapByIndex_[domesticIdx][seenBy] = borderDistance;
+                    domesticOverlapByIndex_[domesticIdx][seenBy] = borderDistance2;
                     domesticOverlapWithPeer_[seenBy].insert(domesticIdx);
                     peerSet_.insert(seenBy);
                 }
diff --git a/dumux/material/constraintsolvers/ncpflash.hh b/dumux/material/constraintsolvers/ncpflash.hh
index bb455f32d6..ae9148d96a 100644
--- a/dumux/material/constraintsolvers/ncpflash.hh
+++ b/dumux/material/constraintsolvers/ncpflash.hh
@@ -625,9 +625,9 @@ protected:
             // if the phase's fugacity coefficients are composition
             // dependent, update them as well.
             if (!FluidSystem::isIdealMixture(phaseIdx)) {
-                for (int compIdx = 0; compIdx < numComponents; ++compIdx) {
-                    Scalar phi = FluidSystem::fugacityCoefficient(fs, paramCache, phaseIdx, compIdx);
-                    fs.setFugacityCoefficient(phaseIdx, compIdx, phi);
+                for (int compIdx2 = 0; compIdx2 < numComponents; ++compIdx2) {
+                    Scalar phi = FluidSystem::fugacityCoefficient(fs, paramCache, phaseIdx, compIdx2);
+                    fs.setFugacityCoefficient(phaseIdx, compIdx2, phi);
                 }
             }
         }
diff --git a/test/multidomain/2cnistokes2p2cni/2cnistokes2p2cniproblem.hh b/test/multidomain/2cnistokes2p2cni/2cnistokes2p2cniproblem.hh
index fcb994bc0c..4658d35a33 100644
--- a/test/multidomain/2cnistokes2p2cni/2cnistokes2p2cniproblem.hh
+++ b/test/multidomain/2cnistokes2p2cni/2cnistokes2p2cniproblem.hh
@@ -465,16 +465,16 @@ public:
                     << "TotalComponentMassFluxFF;"
                     << "TotalEnergyFluxFF"
                     << std::endl;
-            for (int interfaceVertIdx=0; interfaceVertIdx < numInterfaceVertices; interfaceVertIdx++)
+            for (int vIdxInterface=0; vIdxInterface < numInterfaceVertices; vIdxInterface++)
             {
-                if (outputVector[interfaceVertIdx].count > 2)
+                if (outputVector[vIdxInterface].count > 2)
                     std::cerr << "too often at one node!!";
 
-                if (outputVector[interfaceVertIdx].count==2)
-                    outfile << outputVector[interfaceVertIdx].xCoord << ";"
-                            << outputVector[interfaceVertIdx].residual[massBalanceIdx1] << ";" // total mass flux
-                            << outputVector[interfaceVertIdx].residual[transportEqIdx1] << ";" // total flux of component
-                            << outputVector[interfaceVertIdx].residual[energyEqIdx1] // total flux of heat
+                if (outputVector[vIdxInterface].count==2)
+                    outfile << outputVector[vIdxInterface].xCoord << ";"
+                            << outputVector[vIdxInterface].residual[massBalanceIdx1] << ";" // total mass flux
+                            << outputVector[vIdxInterface].residual[transportEqIdx1] << ";" // total flux of component
+                            << outputVector[vIdxInterface].residual[energyEqIdx1] // total flux of heat
                             << std::endl;
             }
             outfile.close();
@@ -592,16 +592,16 @@ public:
                     << "TotalEnergyFluxPM"
                     << std::endl;
 
-            for (int interfaceVertIdx=0; interfaceVertIdx < numInterfaceVertices; interfaceVertIdx++)
+            for (int vIdxInterface=0; vIdxInterface < numInterfaceVertices; vIdxInterface++)
             {
-                if (outputVector[interfaceVertIdx].count > 2)
+                if (outputVector[vIdxInterface].count > 2)
                     std::cerr << "too often at one node!!";
 
-                if (outputVector[interfaceVertIdx].count==2)
-                    outfile << outputVector[interfaceVertIdx].xCoord << ";"
-                            << outputVector[interfaceVertIdx].residual[contiTotalMassIdx2] << ";" // total mass flux
-                            << outputVector[interfaceVertIdx].residual[contiWEqIdx2] << ";" // total flux of component
-                            << outputVector[interfaceVertIdx].residual[energyEqIdx2] // total heat flux
+                if (outputVector[vIdxInterface].count==2)
+                    outfile << outputVector[vIdxInterface].xCoord << ";"
+                            << outputVector[vIdxInterface].residual[contiTotalMassIdx2] << ";" // total mass flux
+                            << outputVector[vIdxInterface].residual[contiWEqIdx2] << ";" // total flux of component
+                            << outputVector[vIdxInterface].residual[energyEqIdx2] // total heat flux
                             << std::endl;
             }
             outfile.close();
diff --git a/test/multidomain/2cstokes2p2c/2cstokes2p2cproblem.hh b/test/multidomain/2cstokes2p2c/2cstokes2p2cproblem.hh
index 5264684b07..073d1fccac 100644
--- a/test/multidomain/2cstokes2p2c/2cstokes2p2cproblem.hh
+++ b/test/multidomain/2cstokes2p2c/2cstokes2p2cproblem.hh
@@ -448,16 +448,16 @@ public:
                     << "TotalComponentMassFluxFF;"
                     << "CountFF"
                     << std::endl;
-            for (int interfaceVertIdx=0; interfaceVertIdx < numInterfaceVertices; interfaceVertIdx++)
+            for (int vIdxInterface=0; vIdxInterface < numInterfaceVertices; vIdxInterface++)
             {
-                if (outputVector[interfaceVertIdx].count > 2)
+                if (outputVector[vIdxInterface].count > 2)
                     std::cerr << "too often at one node!!";
 
-                if (outputVector[interfaceVertIdx].count==2)
-                    outfile << outputVector[interfaceVertIdx].xCoord << ";"
-                            << outputVector[interfaceVertIdx].residual[massBalanceIdx1] << ";" // total mass flux
-                            << outputVector[interfaceVertIdx].residual[transportEqIdx1] << ";" // total flux of component
-                            << outputVector[interfaceVertIdx].count
+                if (outputVector[vIdxInterface].count==2)
+                    outfile << outputVector[vIdxInterface].xCoord << ";"
+                            << outputVector[vIdxInterface].residual[massBalanceIdx1] << ";" // total mass flux
+                            << outputVector[vIdxInterface].residual[transportEqIdx1] << ";" // total flux of component
+                            << outputVector[vIdxInterface].count
                             << std::endl;
             }
             outfile.close();
@@ -572,15 +572,15 @@ public:
                     << "TotalComponentMassFluxPM"
                     << std::endl;
 
-            for (int interfaceVertIdx=0; interfaceVertIdx < numInterfaceVertices; interfaceVertIdx++)
+            for (int vIdxInterface=0; vIdxInterface < numInterfaceVertices; vIdxInterface++)
             {
-                if (outputVector[interfaceVertIdx].count > 2)
+                if (outputVector[vIdxInterface].count > 2)
                     std::cerr << "too often at one node!!";
 
-                if (outputVector[interfaceVertIdx].count==2)
-                    outfile << outputVector[interfaceVertIdx].xCoord << ";"
-                            << outputVector[interfaceVertIdx].residual[contiTotalMassIdx2] << ";" // total mass flux
-                            << outputVector[interfaceVertIdx].residual[contiWEqIdx2] // total flux of component
+                if (outputVector[vIdxInterface].count==2)
+                    outfile << outputVector[vIdxInterface].xCoord << ";"
+                            << outputVector[vIdxInterface].residual[contiTotalMassIdx2] << ";" // total mass flux
+                            << outputVector[vIdxInterface].residual[contiWEqIdx2] // total flux of component
                             << std::endl;
             }
             outfile.close();
diff --git a/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh b/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh
index bddce1a545..a43a999941 100644
--- a/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh
+++ b/test/porousmediumflow/1p/implicit/1pniconductionproblem.hh
@@ -176,8 +176,8 @@ public:
             FVElementGeometry fvGeometry;
             VolumeVariables volVars;
 
-            const auto element = *this->gridView().template begin<0>();
-            fvGeometry.update(this->gridView(), element);
+            const auto firstElement = *this->gridView().template begin<0>();
+            fvGeometry.update(this->gridView(), firstElement);
             PrimaryVariables initialPriVars(0);
             GlobalPosition globalPos(0);
             initial_(initialPriVars, globalPos);
@@ -185,19 +185,19 @@ public:
             //update the constant volume variables
             volVars.update(initialPriVars,
                            *this,
-                           element,
+                           firstElement,
                            fvGeometry,
                            0,
                            false);
 
-            Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+            Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
             Scalar densityW = volVars.density();
             Scalar heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0);
-            Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+            Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
             Scalar storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity);
             Scalar effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(),
-                                                                                                         element, fvGeometry, 0);
+                                                                                                         firstElement, fvGeometry, 0);
             Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
 
 
diff --git a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh
index 68b8deb982..d59f9abbec 100644
--- a/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh
+++ b/test/porousmediumflow/1p/implicit/1pniconvectionproblem.hh
@@ -184,8 +184,8 @@ public:
             FVElementGeometry fvGeometry;
             VolumeVariables volVars;
 
-            const auto element = *this->gridView().template begin<0>();
-            fvGeometry.update(this->gridView(), element);
+            const auto firstElement = *this->gridView().template begin<0>();
+            fvGeometry.update(this->gridView(), firstElement);
             PrimaryVariables initialPriVars(0);
             GlobalPosition globalPos(0);
             initial_(initialPriVars, globalPos);
@@ -193,17 +193,17 @@ public:
             //update the constant volume variables
             volVars.update(initialPriVars,
                            *this,
-                           element,
+                           firstElement,
                            fvGeometry,
                            0,
                            false);
 
-            Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+            Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
             Scalar densityW = volVars.density();
             Scalar heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0);
             Scalar storageW =  densityW*heatCapacityW*porosity;
-            Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+            Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
             Scalar storageTotal = storageW + densityS*heatCapacityS*(1 - porosity);
             std::cout<<"storage: "<<storageTotal<<std::endl;
             Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
diff --git a/test/porousmediumflow/1p/sequential/resultevaluation3d.hh b/test/porousmediumflow/1p/sequential/resultevaluation3d.hh
index 1eeb304ca3..48ebe23f9f 100644
--- a/test/porousmediumflow/1p/sequential/resultevaluation3d.hh
+++ b/test/porousmediumflow/1p/sequential/resultevaluation3d.hh
@@ -300,8 +300,8 @@ public:
             }
             // cubes
             else if (geometry.type().isCube()){
-                for (int i = 0; i < dim; i++)
-                    refVelocity[i] = 0.5 * (fluxVector[2*i + 1] - fluxVector[2*i]);
+                for (int j = 0; j < dim; j++)
+                    refVelocity[j] = 0.5 * (fluxVector[2*j + 1] - fluxVector[2*j]);
             }
             // 3D prism and pyramids
             else {
diff --git a/test/porousmediumflow/1p2c/implicit/1p2cniconductionproblem.hh b/test/porousmediumflow/1p2c/implicit/1p2cniconductionproblem.hh
index 2d441504a3..461595118a 100644
--- a/test/porousmediumflow/1p2c/implicit/1p2cniconductionproblem.hh
+++ b/test/porousmediumflow/1p2c/implicit/1p2cniconductionproblem.hh
@@ -190,8 +190,8 @@ public:
             FVElementGeometry fvGeometry;
             VolumeVariables volVars;
 
-            const auto element = *this->gridView().template begin<0>();
-            fvGeometry.update(this->gridView(), element);
+            const auto firstElement = *this->gridView().template begin<0>();
+            fvGeometry.update(this->gridView(), firstElement);
             PrimaryVariables initialPriVars(0);
             GlobalPosition globalPos(0);
             initial_(initialPriVars, globalPos);
@@ -199,19 +199,19 @@ public:
             //update the constant volume variables
             volVars.update(initialPriVars,
                            *this,
-                           element,
+                           firstElement,
                            fvGeometry,
                            0,
                            false);
 
-            Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+            Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
             Scalar densityW = volVars.density();
             Scalar heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0);
-            Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+            Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
             Scalar storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity);
             Scalar effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(),
-                                                                                                         element, fvGeometry, 0);
+                                                                                                         firstElement, fvGeometry, 0);
             Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
 
 
diff --git a/test/porousmediumflow/1p2c/implicit/1p2cniconvectionproblem.hh b/test/porousmediumflow/1p2c/implicit/1p2cniconvectionproblem.hh
index bb6158436b..abc9311ea8 100644
--- a/test/porousmediumflow/1p2c/implicit/1p2cniconvectionproblem.hh
+++ b/test/porousmediumflow/1p2c/implicit/1p2cniconvectionproblem.hh
@@ -193,8 +193,8 @@ public:
             FVElementGeometry fvGeometry;
             VolumeVariables volVars;
 
-            const auto element = *this->gridView().template begin<0>();
-            fvGeometry.update(this->gridView(), element);
+            const auto firstElement = *this->gridView().template begin<0>();
+            fvGeometry.update(this->gridView(), firstElement);
             PrimaryVariables initialPriVars(0);
             GlobalPosition globalPos(0);
             initial_(initialPriVars, globalPos);
@@ -202,17 +202,17 @@ public:
             //update the constant volume variables
             volVars.update(initialPriVars,
                            *this,
-                           element,
+                           firstElement,
                            fvGeometry,
                            0,
                            false);
 
-            Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+            Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
             Scalar densityW = volVars.density();
             Scalar heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0);
             Scalar storageW =  densityW*heatCapacityW*porosity;
-            Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+            Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
             Scalar storageTotal = storageW + densityS*heatCapacityS*(1 - porosity);
             std::cout<<"storage: "<<storageTotal<<std::endl;
             Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
diff --git a/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh b/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh
index 90fb48e505..00154753f8 100644
--- a/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh
+++ b/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh
@@ -179,8 +179,8 @@ public:
             FVElementGeometry fvGeometry;
             VolumeVariables volVars;
 
-            const auto element = *this->gridView().template begin<0>();
-            fvGeometry.update(this->gridView(), element);
+            const auto firstElement = *this->gridView().template begin<0>();
+            fvGeometry.update(this->gridView(), firstElement);
             PrimaryVariables initialPriVars(0);
             GlobalPosition globalPos(0);
             initial_(initialPriVars, globalPos);
@@ -188,19 +188,19 @@ public:
             //update the constant volume variables
             volVars.update(initialPriVars,
                            *this,
-                           element,
+                           firstElement,
                            fvGeometry,
                            0,
                            false);
 
-            Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+            Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
             Scalar densityW = volVars.density(swIdx);
             Scalar heatCapacityW = IapwsH2O::liquidHeatCapacity(initialPriVars[temperatureIdx], initialPriVars[pressureIdx]);
-            Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+            Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
             Scalar storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity);
             Scalar effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(),
-                                                                                                         element, fvGeometry, 0);
+                                                                                                         firstElement, fvGeometry, 0);
             Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
 
 
diff --git a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh
index 270f619c2d..3877dfe76c 100644
--- a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh
+++ b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh
@@ -184,8 +184,8 @@ public:
             FVElementGeometry fvGeometry;
             VolumeVariables volVars;
 
-            const auto element = *this->gridView().template begin<0>();
-            fvGeometry.update(this->gridView(), element);
+            const auto firstElement = *this->gridView().template begin<0>();
+            fvGeometry.update(this->gridView(), firstElement);
             PrimaryVariables initialPriVars(0);
             GlobalPosition globalPos(0);
             initial_(initialPriVars, globalPos);
@@ -193,17 +193,17 @@ public:
             //update the constant volume variables
             volVars.update(initialPriVars,
                            *this,
-                           element,
+                           firstElement,
                            fvGeometry,
                            0,
                            false);
 
-            Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+            Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
             Scalar densityW = volVars.density(swIdx);
             Scalar heatCapacityW = IapwsH2O::liquidHeatCapacity(initialPriVars[temperatureIdx], initialPriVars[pressureIdx]);
             Scalar storageW =  densityW*heatCapacityW*porosity;
-            Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+            Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+            Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
             Scalar storageTotal = storageW + densityS*heatCapacityS*(1 - porosity);
             std::cout<<"storage: "<<storageTotal<<std::endl;
             Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
diff --git a/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh b/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh
index 5c0a66809a..2d475928da 100644
--- a/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh
+++ b/test/porousmediumflow/richards/implicit/richardsniconductionproblem.hh
@@ -168,23 +168,23 @@ public:
         FVElementGeometry fvGeometry;
         VolumeVariables volVars;
 
-        const auto element = *this->gridView().template begin<0>();
-        fvGeometry.update(this->gridView(), element);
+        const auto firstElement = *this->gridView().template begin<0>();
+        fvGeometry.update(this->gridView(), firstElement);
         PrimaryVariables initialPriVars(0);
         GlobalPosition globalPos(0);
         initial_(initialPriVars, globalPos);
 
         //update the constant volume variables
-        volVars.update(initialPriVars, *this, element, fvGeometry, 0, false);
+        volVars.update(initialPriVars, *this, firstElement, fvGeometry, 0, false);
 
-        Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+        Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
         Scalar densityW = volVars.density(wPhaseIdx);
         Scalar heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0);
-        Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-        Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+        Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+        Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
         Scalar storage = densityW*heatCapacityW*porosity + densityS*heatCapacityS*(1 - porosity);
         Scalar effectiveThermalConductivity = ThermalConductivityModel::effectiveThermalConductivity(volVars, this->spatialParams(),
-                element, fvGeometry, 0);
+                firstElement, fvGeometry, 0);
         Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
 
         for (const auto& element : Dune::elements(this->gridView()))
diff --git a/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh b/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh
index 1dbde9a8b6..4f5e15c253 100644
--- a/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh
+++ b/test/porousmediumflow/richards/implicit/richardsniconvectionproblem.hh
@@ -177,21 +177,21 @@ public:
         FVElementGeometry fvGeometry;
         VolumeVariables volVars;
 
-        const auto element = *this->gridView().template begin<0>();
-        fvGeometry.update(this->gridView(), element);
+        const auto firstElement = *this->gridView().template begin<0>();
+        fvGeometry.update(this->gridView(), firstElement);
         PrimaryVariables initialPriVars(0);
         GlobalPosition globalPos(0);
         initial_(initialPriVars, globalPos);
 
         //update the constant volume variables
-        volVars.update(initialPriVars, *this, element, fvGeometry, 0, false);
+        volVars.update(initialPriVars, *this, firstElement, fvGeometry, 0, false);
 
-        Scalar porosity = this->spatialParams().porosity(element, fvGeometry, 0);
+        Scalar porosity = this->spatialParams().porosity(firstElement, fvGeometry, 0);
         Scalar densityW = volVars.density(wPhaseIdx);
         Scalar heatCapacityW = FluidSystem::heatCapacity(volVars.fluidState(), 0);
         Scalar storageW =  densityW*heatCapacityW*porosity;
-        Scalar densityS = this->spatialParams().solidDensity(element, fvGeometry, 0);
-        Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(element, fvGeometry, 0);
+        Scalar densityS = this->spatialParams().solidDensity(firstElement, fvGeometry, 0);
+        Scalar heatCapacityS = this->spatialParams().solidHeatCapacity(firstElement, fvGeometry, 0);
         Scalar storageTotal = storageW + densityS*heatCapacityS*(1 - porosity);
         std::cout<<"storage: "<<storageTotal<<std::endl;
         Scalar time = std::max(this->timeManager().time() + this->timeManager().timeStepSize(), 1e-10);
-- 
GitLab