diff --git a/dumux/common/intersectionmapper.hh b/dumux/common/intersectionmapper.hh
index 73e87d3140800e3b94dd3d8287e5b2a61ac34bcc..c04dc5738495280fff94eb53848f3dcda21b3bff 100644
--- a/dumux/common/intersectionmapper.hh
+++ b/dumux/common/intersectionmapper.hh
@@ -201,8 +201,15 @@ class IntersectionMapper
 
 public:
     IntersectionMapper(const GridView& gridview)
-    : gridView_(gridview), elementMapper_(gridView_), size_(gridView_.size(1)),
-      intersectionMapGlobal_(gridView_.size(0)), intersectionMapLocal_(gridView_.size(0))
+    : gridView_(gridview)
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    , elementMapper_(gridView_, Dune::mcmgElementLayout())
+#else
+    , elementMapper_(gridView_)
+#endif
+    , size_(gridView_.size(1))
+    , intersectionMapGlobal_(gridView_.size(0))
+    , intersectionMapLocal_(gridView_.size(0))
     {
         const auto element = *gridView_.template begin<0>();
 
diff --git a/dumux/discretization/box/boxgeometryhelper.hh b/dumux/discretization/box/boxgeometryhelper.hh
index 9f97fe0ab68a55d4bdb10fb0a61787e98ab5be07..0f2792ef4086efe4b4abea73f2d10336b2a73d02 100644
--- a/dumux/discretization/box/boxgeometryhelper.hh
+++ b/dumux/discretization/box/boxgeometryhelper.hh
@@ -25,6 +25,7 @@
 #define DUMUX_DISCRETIZATION_BOX_GEOMETRY_HELPER_HH
 
 #include <array>
+#include <dune/common/version.hh>
 #include <dune/geometry/multilineargeometry.hh>
 #include <dune/geometry/referenceelements.hh>
 
@@ -139,7 +140,11 @@ public:
     : elementGeometry_(geometry), corners_(geometry.corners())
     {
         // extract the corners of the sub control volumes
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(geometry.type());
+#else
         const auto& referenceElement = ReferenceElements::general(geometry.type());
+#endif
 
         // the element center
         p[0] = geometry.center();
@@ -354,7 +359,11 @@ public:
     : elementGeometry_(geometry), corners_(geometry.corners())
     {
         // extract the corners of the sub control volumes
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(geometry.type());
+#else
         const auto& referenceElement = ReferenceElements::general(geometry.type());
+#endif
 
         // the element center
         p[0] = geometry.center();
@@ -499,7 +508,11 @@ public:
                                              unsigned int indexInIntersection) const
     {
         // extract the corners of the sub control volumes
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = FaceReferenceElements::general(geometry.type());
+#else
         const auto& referenceElement = FaceReferenceElements::general(geometry.type());
+#endif
 
         GlobalPosition pi[9];
         auto corners = geometry.corners();
diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh
index 52f4f9342826243f2e24f33854abd8806739e344..e0639746b5c43a45212ddb8ef6d6d29a2da5c1b2 100644
--- a/dumux/discretization/box/fvelementgeometry.hh
+++ b/dumux/discretization/box/fvelementgeometry.hh
@@ -25,6 +25,7 @@
 #ifndef DUMUX_DISCRETIZATION_BOX_FV_ELEMENT_GEOMETRY_HH
 #define DUMUX_DISCRETIZATION_BOX_FV_ELEMENT_GEOMETRY_HH
 
+#include <dune/common/version.hh>
 #include <dune/geometry/referenceelements.hh>
 #include <dune/localfunctions/lagrange/pqkfactory.hh>
 
@@ -278,7 +279,11 @@ private:
 
         // get the element geometry
         auto elementGeometry = element.geometry();
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(elementGeometry.type());
+#else
         const auto& referenceElement = ReferenceElements::general(elementGeometry.type());
+#endif
 
         // get the sub control volume geometries of this element
         GeometryHelper geometryHelper(elementGeometry);
diff --git a/dumux/discretization/box/fvgridgeometry.hh b/dumux/discretization/box/fvgridgeometry.hh
index 9a33eaa1bdc0dc60b5818fe82c8cc436484c28f1..e3b457bebea5fa0230ab8c757d40cc9884fdf58f 100644
--- a/dumux/discretization/box/fvgridgeometry.hh
+++ b/dumux/discretization/box/fvgridgeometry.hh
@@ -126,7 +126,11 @@ public:
 
             // get the element geometry
             auto elementGeometry = element.geometry();
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto referenceElement = ReferenceElements::general(elementGeometry.type());
+#else
             const auto& referenceElement = ReferenceElements::general(elementGeometry.type());
+#endif
 
             // instantiate the geometry helper
             GeometryHelper geometryHelper(elementGeometry);
@@ -303,7 +307,11 @@ public:
             numScvf_ += element.subEntities(dim-1);
 
             const auto elementGeometry = element.geometry();
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto referenceElement = ReferenceElements::general(elementGeometry.type());
+#else
             const auto& referenceElement = ReferenceElements::general(elementGeometry.type());
+#endif
 
             // store the sub control volume face indices on the domain boundary
             for (const auto& intersection : intersections(this->gridView(), element))
diff --git a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
index fc4cdb07a16fd8f6b155a6daf26ac4b82ab8ff7c..f3fbca56476ed92c90b1194dbb6e5c5f1e1e73ff 100644
--- a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
+++ b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
@@ -26,6 +26,7 @@
 #ifndef DUMUX_DISCRETIZATION_CCMPFA_FV_ELEMENT_GEOMETRY_HH
 #define DUMUX_DISCRETIZATION_CCMPFA_FV_ELEMENT_GEOMETRY_HH
 
+#include <dune/common/version.hh>
 #include <dune/common/exceptions.hh>
 #include <dune/common/iteratorrange.hh>
 #include <dune/geometry/referenceelements.hh>
@@ -375,7 +376,11 @@ private:
             const auto& e = useNeighbor ? is.outside() : element;
             const auto indexInElement = useNeighbor ? is.indexInOutside() : is.indexInInside();
             const auto eg = e.geometry();
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto refElement = ReferenceElements::general(eg.type());
+#else
             const auto& refElement = ReferenceElements::general(eg.type());
+#endif
 
             // Set up a container with all relevant positions for scvf corner computation
             const auto numCorners = is.geometry().corners();
@@ -455,7 +460,11 @@ private:
             const auto& e = useNeighbor ? is.outside() : element;
             const auto indexInElement = useNeighbor ? is.indexInOutside() : is.indexInInside();
             const auto eg = e.geometry();
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto refElement = ReferenceElements::general(eg.type());
+#else
             const auto& refElement = ReferenceElements::general(eg.type());
+#endif
 
             // Set up a container with all relevant positions for scvf corner computation
             const auto numCorners = is.geometry().corners();
diff --git a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
index 6570faf63e0fefc9bdc36783619684bc6250d49a..c46f7d686f24d2c7a07532d2e05be488f3be1277 100644
--- a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
+++ b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
@@ -219,7 +219,11 @@ public:
                 const auto& e = useNeighbor ? is.outside() : element;
                 const auto indexInElement = useNeighbor ? is.indexInOutside() : indexInInside;
                 const auto eg = e.geometry();
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                const auto refElement = ReferenceElements::general(eg.type());
+#else
                 const auto& refElement = ReferenceElements::general(eg.type());
+#endif
 
                 // Set up a container with all relevant positions for scvf corner computation
                 const auto numCorners = is.geometry().corners();
@@ -569,7 +573,11 @@ public:
                 const auto& e = useNeighbor ? is.outside() : element;
                 const auto indexInElement = useNeighbor ? is.indexInOutside() : indexInInside;
                 const auto eg = e.geometry();
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                const auto refElement = ReferenceElements::general(eg.type());
+#else
                 const auto& refElement = ReferenceElements::general(eg.type());
+#endif
 
                 // evaluate if vertices on this intersection use primary/secondary IVs
                 const bool isBranchingPoint = dim < dimWorld ? outsideIndices[indexInInside].size() > 1 : false;
diff --git a/dumux/discretization/cellcentered/mpfa/helper.hh b/dumux/discretization/cellcentered/mpfa/helper.hh
index 9532272f5065706036614457c2ad2889c377c112..a5d6e7fc828476e7d223ba93dba76a9d0f7c90dc 100644
--- a/dumux/discretization/cellcentered/mpfa/helper.hh
+++ b/dumux/discretization/cellcentered/mpfa/helper.hh
@@ -624,7 +624,11 @@ public:
             {
                 if (!is.neighbor() && !is.boundary())
                 {
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                    const auto refElement = ReferenceElements::general(element.geometry().type());
+#else
                     const auto& refElement = ReferenceElements::general(element.geometry().type());
+#endif
                     for (int isVertex = 0; isVertex < is.geometry().corners(); ++isVertex)
                     {
                         const auto vIdxLocal = refElement.subEntity(is.indexInInside(), 1, isVertex, dim);
diff --git a/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh b/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh
index 891f3e0d5d0ceca7eabee96d8f6e53a82dbd211f..72d3f4119f2c91e742769012cf49fd995cc0c119 100644
--- a/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh
+++ b/dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh
@@ -293,7 +293,11 @@ private:
 
     void setPairInfo_(const int isIdx, const Element& element, const bool isParallel)
     {
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(element_.geometry().type());
+#else
         const auto& referenceElement = ReferenceElements::general(element_.geometry().type());
+#endif
 
         // iterate over facets sub-entities
         for(int i = 0; i < numFacetSubEntities; ++i)
diff --git a/dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/velocity.hh b/dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/velocity.hh
index 7db21b8c1dffbd16d253eb8208572baf5a2409ac..e046a33ec47c1ebabe7cd0c974e33500ca089ca0 100644
--- a/dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/velocity.hh
+++ b/dumux/porousmediumflow/1p/sequential/diffusion/cellcentered/velocity.hh
@@ -19,7 +19,8 @@
 #ifndef DUMUX_FVVELOCITY1P_HH
 #define DUMUX_FVVELOCITY1P_HH
 
-#include<dumux/porousmediumflow/1p/sequential/properties.hh>
+#include <dune/common/version.hh>
+#include <dumux/porousmediumflow/1p/sequential/properties.hh>
 
 /*!
  * \file
@@ -123,9 +124,12 @@ public:
             const typename Element::Geometry& geometry = element.geometry();
             // get corresponding reference element
             using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-            const Dune::ReferenceElement< Scalar , dim > & refElement =
-                    ReferenceElements::general( geometry.type() );
-            const int numberOfFaces=refElement.size(1);
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto refElement = ReferenceElements::general(geometry.type());
+#else
+            const auto& refElement = ReferenceElements::general(geometry.type());
+#endif
+            const int numberOfFaces = refElement.size(1);
 
             std::vector<Scalar> flux(numberOfFaces,0);
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocity.hh b/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocity.hh
index 3bcd0105b5d41e1c41bba39252f1d08a5f172a85..620fc9748367bae252af7d34b13de18c3ad31a13 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocity.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/cellcentered/velocity.hh
@@ -24,6 +24,7 @@
 #ifndef DUMUX_FVVELOCITY2P_HH
 #define DUMUX_FVVELOCITY2P_HH
 
+#include <dune/common/version.hh>
 #include <dune/common/float_cmp.hh>
 #include <dune/grid/common/gridenums.hh>
 #include <dumux/porousmediumflow/2p/sequential/diffusion/properties.hh>
@@ -201,8 +202,11 @@ public:
                 const typename Element::Geometry& geometry = element.geometry();
                 // get corresponding reference element
                 using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-                const Dune::ReferenceElement< Scalar , dim > & refElement =
-                        ReferenceElements::general( geometry.type() );
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                const auto refElement = ReferenceElements::general(geometry.type());
+#else
+                const auto& refElement = ReferenceElements::general(geometry.type());
+#endif
                 const int numberOfFaces=refElement.size(1);
 
                 std::vector<Scalar> fluxW(numberOfFaces,0);
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/croperator.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/croperator.hh
index 6d36ea85be0dc81d312e32f8d8a589d773d9bb67..baa92746d4faa916817cf200990087bd8e026465 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/croperator.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/croperator.hh
@@ -83,7 +83,11 @@ class CROperatorAssemblerTwoP
     using coliterator = typename MatrixType::ColIterator;
     using BCBlockType = std::array<BoundaryConditions::Flags, 1>;     // componentwise boundary conditions
     using SatType = Dune::BlockVector< Dune::FieldVector<double, 1> >;
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    using FaceMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
+#else
     using FaceMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, FaceLayout>;
+#endif
 
     using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
     enum
@@ -101,8 +105,15 @@ public:
     using RepresentationType = MatrixType;
 
     CROperatorAssemblerTwoP (const GridView& gridview)
-    : gridView_(gridview), faceMapper_(gridView_), size_(faceMapper_.size()),
-      A_(size_, size_, nnz(), RepresentationType::random)
+    : gridView_(gridview)
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    , faceMapper_(gridView_, Dune::mcmgLayout(Dune::Codim<dim - 1>()))
+#else
+    , faceMapper_(gridView_)
+#endif
+    , size_(faceMapper_.size())
+    , A_(size_, size_, nnz()
+    , RepresentationType::random)
     {}
 
     //! initialize the CR operator assembler
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh
index d4fe5f641d9c5155c6a83bdc98b7a43281133909..c3ea9d82ed53739915c216c47b0cab0e17ff72d6 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressure.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_MIMETICPRESSURE2P_HH
 #define DUMUX_MIMETICPRESSURE2P_HH
 
+#include <dune/common/version.hh>
+
 // dumux environment
 #include <dumux/porousmediumflow/sequential/mimetic/properties.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/pressure.hh>
@@ -116,9 +118,6 @@ template<class TypeTag> class MimeticPressure2P
 
     using DimVector = Dune::FieldVector<Scalar, dim>;
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     //! initializes the matrix to store the system of equations
     void initializeMatrix();
 
@@ -292,8 +291,11 @@ public:
                 const typename Element::Geometry& geometry = element.geometry();
                 // get corresponding reference element
                 using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-                const Dune::ReferenceElement< Scalar , dim > & refElement =
-                        ReferenceElements::general( geometry.type() );
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                const auto refElement = ReferenceElements::general(geometry.type());
+#else
+                const auto& refElement = ReferenceElements::general(geometry.type());
+#endif
                 const int numberOfFaces=refElement.size(1);
 
                 std::vector<Scalar> fluxW(numberOfFaces,0);
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh
index 652e6fb907767823eb3d020247aba1a000e1176c..55dda8279bbd987d92a6e80b7109a51824884657 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mimetic/pressureadaptive.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_MIMETICPRESSURE2PADAPTIVE_HH
 #define DUMUX_MIMETICPRESSURE2PADAPTIVE_HH
 
+#include <dune/common/version.hh>
+
 // dumux environment
 #include <dumux/porousmediumflow/sequential/mimetic/properties.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/pressure.hh>
@@ -117,9 +119,6 @@ template<class TypeTag> class MimeticPressure2PAdaptive
     using Matrix = typename GET_PROP_TYPE(TypeTag, PressureCoefficientMatrix);
     using Vector = typename GET_PROP_TYPE(TypeTag, PressureRHSVector);
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     //! initializes the matrix to store the system of equations
     void initializeMatrix();
 
@@ -307,8 +306,11 @@ public:
                 const typename Element::Geometry& geometry = element.geometry();
                 // get corresponding reference element
                 using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-                const Dune::ReferenceElement< Scalar , dim > & refElement =
-                        ReferenceElements::general( geometry.type() );
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                const auto refElement = ReferenceElements::general(geometry.type());
+#else
+                const auto& refElement = ReferenceElements::general(geometry.type());
+#endif
                 const int numberOfFaces=refElement.size(1);
 
                 std::vector<Scalar> fluxW(numberOfFaces,0);
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh
index 9809f16218dcbcbf0d7eb07fa93758ac29f3b19e..94707f6f2b95d4810068bc064ac593eece00faf8 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressure.hh
@@ -22,6 +22,8 @@
 #ifndef DUMUX_FVMPFAL2DPRESSURE2P_HH
 #define DUMUX_FVMPFAL2DPRESSURE2P_HH
 
+#include <dune/common/version.hh>
+
 // dumux environment
 #include <dumux/porousmediumflow/sequential/cellcentered/pressure.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/mpfa/linteractionvolume.hh>
@@ -82,7 +84,6 @@ class FvMpfaL2dPressure2p: public FVPressure<TypeTag>
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
@@ -732,7 +733,11 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
 
             // get the intersection node /bar^{x_3} between 'intersection12'
             // and 'intersection14', denoted as 'corner1234'
-            const ReferenceElement& referenceElement = ReferenceElements::general(element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+            const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
             GlobalPosition corner1234(0);
 
@@ -1634,8 +1639,11 @@ void FvMpfaL2dPressure2p<TypeTag>::assemble()
                         {
                             int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
 
-                            const ReferenceElement& referenceElement = ReferenceElements::general(
-                                    element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                            const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+                            const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
                             const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh
index f520afc38b5d24416b451b17a7428b0136d8730f..63da4411f6938977a453f9a9784bfa22cd7adfb7 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressureadaptive.hh
@@ -22,6 +22,8 @@
 #ifndef DUMUX_FVMPFAL2DPRESSURE2P_ADAPTIVE_HH
 #define DUMUX_FVMPFAL2DPRESSURE2P_ADAPTIVE_HH
 
+#include <dune/common/version.hh>
+
 // dumux environment
 #include <dumux/porousmediumflow/sequential/cellcentered/pressure.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/mpfa/linteractionvolume.hh>
@@ -85,7 +87,6 @@ class FvMpfaL2dPressure2pAdaptive: public FVPressure<TypeTag>
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
@@ -777,7 +778,11 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::storeInteractionVolumeInfo()
         // get index
         int eIdxGlobal1 = problem_.variables().index(element);
 
-        const ReferenceElement& referenceElement = ReferenceElements::general(element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+        const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
         const auto isEndIt12 = problem_.gridView().iend(element);
         for (auto isIt12 = problem_.gridView().ibegin(element); isIt12 != isEndIt12; ++isIt12)
@@ -2351,8 +2356,11 @@ void FvMpfaL2dPressure2pAdaptive<TypeTag>::assemble()
                         {
                             int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
 
-                            const ReferenceElement& referenceElement = ReferenceElements::general(
-                                    element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                            const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+                            const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
                             const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocity.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocity.hh
index ae5d9dfdfa0ec7f47b42c92993122f9c38b4b994..7b5ce2693074babd1ed03fee39378a05d90e230d 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocity.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocity.hh
@@ -22,6 +22,7 @@
 #ifndef DUMUX_MPFAL2DPRESSUREVELOCITY2P_HH
 #define DUMUX_MPFAL2DPRESSUREVELOCITY2P_HH
 
+#include <dune/common/version.hh>
 #include <dune/common/float_cmp.hh>
 
 #include "2dpressure.hh"
@@ -61,7 +62,6 @@ template<class TypeTag> class FvMpfaL2dPressureVelocity2p: public FvMpfaL2dPress
     using PrimaryVariables = typename SolutionTypes::PrimaryVariables;
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
@@ -304,7 +304,11 @@ void FvMpfaL2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection&
 
     CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ);
 
-    const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    const auto referenceElement = ReferenceElements::general(elementI.geometry().type());
+#else
+    const auto& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#endif
 
     int indexInInside = intersection.indexInInside();
     int indexInOutside = intersection.indexInOutside();
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocityadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocityadaptive.hh
index dd145160117ff9781cc9edbb6638bc31d2a541d3..b9859bd3e127135990a014106697301b7d18c433 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocityadaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dpressurevelocityadaptive.hh
@@ -22,6 +22,7 @@
 #ifndef DUMUX_MPFAL2DPRESSUREVELOCITIES2P_ADAPTIVE_HH
 #define DUMUX_MPFAL2DPRESSUREVELOCITIES2P_ADAPTIVE_HH
 
+#include <dune/common/version.hh>
 #include <dune/common/float_cmp.hh>
 
 #include "2dpressureadaptive.hh"
@@ -63,7 +64,6 @@ template<class TypeTag> class FvMpfaL2dPressureVelocity2pAdaptive: public FvMpfa
     using PrimaryVariables = typename SolutionTypes::PrimaryVariables;
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
@@ -342,7 +342,11 @@ void FvMpfaL2dPressureVelocity2pAdaptive<TypeTag>::calculateVelocity(const Inter
 
     CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ);
 
-    const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    const auto referenceElement = ReferenceElements::general(elementI.geometry().type());
+#else
+    const auto& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#endif
 
     int indexInInside = intersection.indexInInside();
     int indexInOutside = intersection.indexInOutside();
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocity.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocity.hh
index acd72b616c4107ff175737dd1cba5471d9d36c88..998e88be0b843f5f0576dbc51347c9ccb4e9c0b1 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocity.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocity.hh
@@ -24,6 +24,7 @@
 #ifndef DUMUX_FVMPFAL2DVELOCITY2P_HH
 #define DUMUX_FVMPFAL2DVELOCITY2P_HH
 
+#include <dune/common/version.hh>
 #include <dune/grid/common/gridenums.hh>
 #include <dumux/porousmediumflow/2p/sequential/diffusion/properties.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/mpfa/properties.hh>
@@ -66,7 +67,6 @@ template<class TypeTag> class FvMpfaL2dVelocity2p
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
@@ -754,8 +754,11 @@ void FvMpfaL2dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In
                 {
                     int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
 
-                    const ReferenceElement& referenceElement = ReferenceElements::general(
-                            element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                    const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+                    const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
                     const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
 
@@ -864,8 +867,11 @@ void FvMpfaL2dVelocity2p<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In
                 {
                     int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
 
-                    const ReferenceElement& referenceElement = ReferenceElements::general(
-                            element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                    const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+                    const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
                     const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocityadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocityadaptive.hh
index 6d2247ab38ed592e142eea1d6cd0323c72b74f5a..90ef25484fd15efeca490ac3b74b3d909a401e3a 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocityadaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/2dvelocityadaptive.hh
@@ -62,9 +62,6 @@ template<class TypeTag> class FvMpfaL2dVelocity2pAdaptive : public FvMpfaL2dVelo
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontainer.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontainer.hh
index 93496b563a3bae707f6e44653681e26c2a7190b3..d075810f447f1ca0ff6a0eaa15d8aeae733930b6 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontainer.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontainer.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH
 #define DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH
 
+#include <dune/common/version.hh>
+
 // dumux environment
 #include <dumux/porousmediumflow/sequential/pressureproperties.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/mpfa/properties.hh>
@@ -61,7 +63,6 @@ class FvMpfaL3dInteractionVolumeContainer
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
 
@@ -380,7 +381,11 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeIntersectionInfo(const E
 
     const ElementGeometry& geometry = element.geometry();
 
-    const ReferenceElement& referenceElement = ReferenceElements::general(geometry.type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    const auto referenceElement = ReferenceElements::general(geometry.type());
+#else
+    const auto& referenceElement = ReferenceElements::general(geometry.type());
+#endif
 
     int levelI = element.level();
 
@@ -1356,7 +1361,11 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeInnerInteractionVolume(I
         const ElementGeometry& geometry1 = element1.geometry();
         const ElementGeometry& geometry8 = element8.geometry();
 
-        const ReferenceElement& referenceElement = ReferenceElements::general(geometry1.type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(geometry1.type());
+#else
+        const auto& referenceElement = ReferenceElements::general(geometry1.type());
+#endif
 
         DimVector edgeCoord(geometry1.global(referenceElement.position(9, dim - 1)));
         interactionVolume.setEdgePosition(edgeCoord, 2);
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontaineradaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontaineradaptive.hh
index 0691163ebc53c66f304ba0270d67a7d2308c3977..7a802f5f19544a331920f530e17c39c2bf6cedb5 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontaineradaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dinteractionvolumecontaineradaptive.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_ADAPTIVE_HH
 #define DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_ADAPTIVE_HH
 
+#include <dune/common/version.hh>
+
 // dumux environment
 #include <dumux/porousmediumflow/sequential/pressureproperties.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/mpfa/properties.hh>
@@ -58,7 +60,6 @@ class FvMpfaL3dInteractionVolumeContainerAdaptive: public FvMpfaL3dInteractionVo
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
 
@@ -189,7 +190,11 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeInnerInteraction
 
             const ElementGeometry& geometry = element.geometry();
 
-            const ReferenceElement& referenceElement = ReferenceElements::general(geometry.type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto referenceElement = ReferenceElements::general(geometry.type());
+#else
+            const auto& referenceElement = ReferenceElements::general(geometry.type());
+#endif
 
             switch (idx)
             {
@@ -350,7 +355,11 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter
 
         const ElementGeometry& geometry = element.geometry();
 
-        const ReferenceElement& referenceElement = ReferenceElements::general(geometry.type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(geometry.type());
+#else
+        const auto& referenceElement = ReferenceElements::general(geometry.type());
+#endif
 
         switch (idx)
         {
@@ -1122,7 +1131,11 @@ void FvMpfaL3dInteractionVolumeContainerAdaptive<TypeTag>::storeHangingNodeInter
 
                 const ElementGeometry& geometry = element5.geometry();
 
-                const ReferenceElement& referenceElement = ReferenceElements::general(geometry.type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                const auto referenceElement = ReferenceElements::general(geometry.type());
+#else
+                const auto& referenceElement = ReferenceElements::general(geometry.type());
+#endif
 
                 int oldSubVolumElemIdx = IndexTranslator::getOldElemIdxFromNewFaceIdxto0(zeroFaceIdx, 4);
                 int oldEdgeIdx = IndexTranslator::getOldEdgeIdxFromNewFaceIdxto0(zeroFaceIdx, 1);
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh
index aa2b5b0e6f668be79e00741e545b3fa6bb745599..7ae3e9514a95cc40b228ba6dbd7974446f7d97c5 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressure.hh
@@ -84,9 +84,6 @@ class FvMpfaL3dPressure2p: public FVPressure<TypeTag>
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressureadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressureadaptive.hh
index 972d3119f0b7485715cfcb9b277771c1543c409c..38ed04730eaa9923b7affa39b45b501e0ebfba2e 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressureadaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressureadaptive.hh
@@ -88,9 +88,6 @@ class FvMpfaL3dPressure2pAdaptive: public FvMpfaL3dPressure2p<TypeTag>
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocity.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocity.hh
index 02100c3a9ecd31c2b2f84fa3aed0a52ee0563408..f7b58f2dc8632699a56c461a7c5e4fc9f0f974e4 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocity.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocity.hh
@@ -24,6 +24,7 @@
 #ifndef DUMUX_FVMPFAL2PFABOUND3DVELOCITIES2P_HH
 #define DUMUX_FVMPFAL2PFABOUND3DVELOCITIES2P_HH
 
+#include <dune/common/version.hh>
 #include <dune/common/float_cmp.hh>
 #include "3dpressure.hh"
 #include "3dvelocity.hh"
@@ -81,7 +82,6 @@ template<class TypeTag> class FvMpfaL3dPressureVelocity2p: public FvMpfaL3dPress
     using MaterialLaw = typename SpatialParams::MaterialLaw;
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using InteractionVolume = typename GET_PROP_TYPE(TypeTag, MPFAInteractionVolume);
     using Intersection = typename GridView::Intersection;
@@ -305,7 +305,11 @@ void FvMpfaL3dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection&
 
     CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ);
 
-    const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    const auto referenceElement = ReferenceElements::general(elementI.geometry().type());
+#else
+    const auto& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#endif
 
     int indexInInside = intersection.indexInInside();
     int indexInOutside = intersection.indexInOutside();
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocityadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocityadaptive.hh
index a858c74b445e34c56f798bebfac037b6562f66be..1a57242a9872e04c9f8a7aba8ed824ba2d2ee923 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocityadaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dpressurevelocityadaptive.hh
@@ -81,9 +81,6 @@ template<class TypeTag> class FvMpfaL3dPressureVelocity2pAdaptive: public FvMpfa
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     using InteractionVolume = typename GET_PROP_TYPE(TypeTag, MPFAInteractionVolume);
     using Intersection = typename GridView::Intersection;
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocity.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocity.hh
index 31f20732b2487bce7871ae7d08f0f1833f7397bd..40b12f82048bb9e732bf861c14ac9b22b388290f 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocity.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocity.hh
@@ -63,7 +63,6 @@ template<class TypeTag> class FvMpfaL3dVelocity2p
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocityadaptive.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocityadaptive.hh
index b262a71b73c8c11fe56211875631257060082d2f..345bff361472adb916c5afdafeafaf3318426c50 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocityadaptive.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/lmethod/3dvelocityadaptive.hh
@@ -64,9 +64,6 @@ template<class TypeTag> class FvMpfaL3dVelocity2pAdaptive: public FvMpfaL3dVeloc
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressure.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressure.hh
index 82991be6ec4b8e961e82a77bd1f944a83319b785..80985a990218b7763863cbf314165d8a6d854374 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressure.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressure.hh
@@ -22,6 +22,8 @@
 #ifndef DUMUX_FVMPFAO2DPRESSURE2P_HH
 #define DUMUX_FVMPFAO2DPRESSURE2P_HH
 
+#include <dune/common/version.hh>
+
 // dumux environment
 #include <dumux/porousmediumflow/sequential/cellcentered/pressure.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/mpfa/ointeractionvolume.hh>
@@ -78,7 +80,6 @@ class FvMpfaO2dPressure2p: public FVPressure<TypeTag>
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
@@ -730,7 +731,11 @@ void FvMpfaO2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
             // get the intersection node /bar^{x_3} between 'isIt12' and 'isIt14', denoted as 'corner1234'
             // initialization of corner1234
 
-            const ReferenceElement& referenceElement = ReferenceElements::general(element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+            const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
             GlobalPosition corner1234(0);
 
@@ -1731,8 +1736,11 @@ void FvMpfaO2dPressure2p<TypeTag>::assemble()
                         {
                             int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
 
-                            const ReferenceElement& referenceElement = ReferenceElements::general(
-                                    element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                            const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+                            const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
                             const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
 
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressurevelocity.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressurevelocity.hh
index 1ddea79dd0b791f9e48881cb66b15bcca8e91ab3..f8ac3bb18f61363e8998c99f6a6ddb41a865a075 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressurevelocity.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dpressurevelocity.hh
@@ -22,6 +22,7 @@
 #ifndef DUMUX_MPFAO2DPRESSUREVELOCITIES2P_HH
 #define DUMUX_MPFAO2DPRESSUREVELOCITIES2P_HH
 
+#include <dune/common/version.hh>
 #include <dune/common/float_cmp.hh>
 #include "2dpressure.hh"
 #include "2dvelocity.hh"
@@ -69,7 +70,6 @@ template<class TypeTag> class FvMpfaO2dPressureVelocity2p: public FvMpfaO2dPress
     using Intersection = typename GridView::Intersection;
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using InteractionVolume = FVMPFAOInteractionVolume<TypeTag>;
 
@@ -303,7 +303,11 @@ void FvMpfaO2dPressureVelocity2p<TypeTag>::calculateVelocity(const Intersection&
 
     CellData& cellDataJ = problem_.variables().cellData(eIdxGlobalJ);
 
-    const ReferenceElement& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    const auto referenceElement = ReferenceElements::general(elementI.geometry().type());
+#else
+    const auto& referenceElement = ReferenceElements::general(elementI.geometry().type());
+#endif
 
     int indexInInside = intersection.indexInInside();
     int indexInOutside = intersection.indexInOutside();
diff --git a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dvelocity.hh b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dvelocity.hh
index eb4cb9a2d654d2bb5d365dd73d04538a0837fe40..f36b890bee16e49bc4c69cc9538f53afddb6daf0 100644
--- a/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dvelocity.hh
+++ b/dumux/porousmediumflow/2p/sequential/diffusion/mpfa/omethod/2dvelocity.hh
@@ -24,6 +24,7 @@
 #ifndef DUMUX_FVMPFAO2DVELOCITY2P_HH
 #define DUMUX_FVMPFAO2DVELOCITY2P_HH
 
+#include <dune/common/version.hh>
 #include <dune/grid/common/gridenums.hh>
 #include <dumux/porousmediumflow/2p/sequential/diffusion/properties.hh>
 #include <dumux/porousmediumflow/sequential/cellcentered/mpfa/properties.hh>
@@ -65,7 +66,6 @@ template<class TypeTag> class FvMpfaO2dVelocity2P
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
     using MaterialLaw = typename SpatialParams::MaterialLaw;
@@ -587,8 +587,11 @@ void FvMpfaO2dVelocity2P<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In
                 {
                     int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
 
-                    const ReferenceElement& referenceElement = ReferenceElements::general(
-                            element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                    const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+                    const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
                     const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
 
@@ -697,8 +700,11 @@ void FvMpfaO2dVelocity2P<TypeTag>::calculateBoundaryInteractionVolumeVelocity(In
                 {
                     int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
 
-                    const ReferenceElement& referenceElement = ReferenceElements::general(
-                            element.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+                    const auto referenceElement = ReferenceElements::general(element.geometry().type());
+#else
+                    const auto& referenceElement = ReferenceElements::general(element.geometry().type());
+#endif
 
                     const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
 
diff --git a/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh b/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh
index 79d2fa839bd776d99b6a6a149fa6ff9a4dc2287b..2557018bb9af1f63d703a7c549bc1ae54c4d42a1 100644
--- a/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh
+++ b/dumux/porousmediumflow/2p/sequential/impes/gridadaptionindicatorlocalflux.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_GRIDADAPTIONINDICATOR2PLOCALFLUX_HH
 #define DUMUX_GRIDADAPTIONINDICATOR2PLOCALFLUX_HH
 
+#include <dune/common/version.hh>
+
 #include <dumux/porousmediumflow/sequential/impetproperties.hh>
 #include <dumux/porousmediumflow/2p/sequential/properties.hh>
 
@@ -75,7 +77,6 @@ private:
         numPhases = GET_PROP_VALUE(TypeTag, NumPhases)
     };
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
     using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
     using DimVector = Dune::FieldVector<Scalar, dim>;
     using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
@@ -191,8 +192,11 @@ public:
             const typename Element::Geometry& geometry = element.geometry();
             // get corresponding reference element
             using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-            const Dune::ReferenceElement< Scalar , dim > & refElement =
-                    ReferenceElements::general( geometry.type() );
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+            const auto refElement = ReferenceElements::general(geometry.type());
+#else
+            const auto& refElement = ReferenceElements::general(geometry.type());
+#endif
             const int numberOfFaces=refElement.size(1);
 
             std::vector<Scalar> flux(numberOfFaces,0);
diff --git a/dumux/porousmediumflow/2p2c/sequential/fv3dpressureadaptive.hh b/dumux/porousmediumflow/2p2c/sequential/fv3dpressureadaptive.hh
index 4b34485e70f047897ea0eb264c35e363838d93a5..2e3950b6307a9beeefe5fe20647acd95762b2e3b 100644
--- a/dumux/porousmediumflow/2p2c/sequential/fv3dpressureadaptive.hh
+++ b/dumux/porousmediumflow/2p2c/sequential/fv3dpressureadaptive.hh
@@ -20,6 +20,7 @@
 #define DUMUX_FV3DPRESSURE2P2C_ADAPTIVE_HH
 
 // dune environent:
+#include <dune/common/version.hh>
 #include <dune/istl/bvector.hh>
 #include <dune/istl/operators.hh>
 #include <dune/istl/solvers.hh>
@@ -125,7 +126,6 @@ template<class TypeTag> class FV3dPressure2P2CAdaptive
     using Vertex = typename GridView::Traits::template Codim<dim>::Entity;
     using Element = typename GridView::Traits::template Codim<0>::Entity;
     using ReferenceElementContainer = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
 
     using Grid = typename GridView::Grid;
     using Intersection = typename GridView::Intersection;
@@ -1430,7 +1430,11 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect
     int localFace24 = face24->indexInInside();
     int localFace26 = face26->indexInInside();
 
-    const ReferenceElement& referenceElement = ReferenceElementContainer::general(neighbor.geometry().type());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+    const auto referenceElement = ReferenceElementContainer::general(neighbor.geometry().type());
+#else
+    const auto& referenceElement = ReferenceElementContainer::general(neighbor.geometry().type());
+#endif
     //find 'x'5 = edgeCoord1226
     int edge1226;
     // search through edges of face 12
diff --git a/dumux/porousmediumflow/2p2c/sequential/fvmpfal3dinteractionvolumecontaineradaptive.hh b/dumux/porousmediumflow/2p2c/sequential/fvmpfal3dinteractionvolumecontaineradaptive.hh
index 25813496be713e069229caa762456af0e094c6eb..8e6b068b7ceb6604d65e6c4e0fd268af41951b94 100644
--- a/dumux/porousmediumflow/2p2c/sequential/fvmpfal3dinteractionvolumecontaineradaptive.hh
+++ b/dumux/porousmediumflow/2p2c/sequential/fvmpfal3dinteractionvolumecontaineradaptive.hh
@@ -56,9 +56,6 @@ class FvMpfaL3d2P2CInteractionVolumeContainerAdaptive : public FvMpfaL3dInteract
 
     using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
-    using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
-    using ReferenceElement = Dune::ReferenceElement<Scalar, dim>;
-
     using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
 
     using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
diff --git a/dumux/porousmediumflow/velocityoutput.hh b/dumux/porousmediumflow/velocityoutput.hh
index a91d33d477e912e73b224b04698e7aadce955b7f..8443c62105c21f2e897febe820c36158e39d9e7c 100644
--- a/dumux/porousmediumflow/velocityoutput.hh
+++ b/dumux/porousmediumflow/velocityoutput.hh
@@ -24,6 +24,7 @@
 #ifndef DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
 #define DUMUX_POROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
 
+#include <dune/common/version.hh>
 #include <dune/common/fvector.hh>
 #include <dune/istl/bvector.hh>
 #include <dune/geometry/referenceelements.hh>
@@ -184,7 +185,11 @@ public:
         }
 
         // get the transposed Jacobian of the element mapping
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        const auto referenceElement = ReferenceElements::general(geomType);
+#else
         const auto& referenceElement = ReferenceElements::general(geomType);
+#endif
         const auto& localPos = referenceElement.position(0, 0);
         const auto jacobianT2 = geometry.jacobianTransposed(localPos);
 
diff --git a/test/porousmediumflow/1p/sequential/resultevaluation3d.hh b/test/porousmediumflow/1p/sequential/resultevaluation3d.hh
index 1595aed2d7de855eadcfe982d5f9bf9dcfe7ed28..adf46f0b9bff7c97e9742512ab2a9ef1d03d885a 100644
--- a/test/porousmediumflow/1p/sequential/resultevaluation3d.hh
+++ b/test/porousmediumflow/1p/sequential/resultevaluation3d.hh
@@ -86,8 +86,12 @@ public:
         using Geometry = typename Entity::Geometry;
         using GV = typename Grid::LevelGridView;
         using IS = typename GV::IndexSet;
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GV>;
+#else
         using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GV, Dune::MCMGElementLayout>;
         using FaceMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GV, FaceLayout>;
+#endif
         using ct = typename Grid::ctype;
 
         enum{dim = Grid::dimension};
@@ -96,8 +100,13 @@ public:
         using ReferenceElements = Dune::ReferenceElements<ct, dim>;
         const GV& gridview(grid.levelGridView(grid.maxLevel()));
         const IS& indexset(gridview.indexSet());
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        Mapper elementMapper(gridview, Dune::mcmgElementLayout());
+        Mapper faceMapper(gridview, Dune::mcmgLayout(Dune::Codim<dim - 1>()));
+#else
         ElementMapper elementMapper(gridview);
         FaceMapper faceMapper(gridview);
+#endif
         SolutionType& exactSol(grid.levelGridView(grid.maxLevel()));
 
         uMean = 0;
@@ -423,12 +432,20 @@ public:
         enum {dim=Grid::dimension};
         using Element = typename Grid::template Codim<0>::Entity;
         using Geometry = typename Element::Geometry;
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
+#else
         using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
+#endif
         using SolVector = Dune::BlockVector<Dune::FieldVector<Scalar, 1> >;
         using JacobianInverseTransposed = typename Geometry::JacobianInverseTransposed;
         using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
 
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        ElementMapper elementMapper(gridView, Dune::mcmgElementLayout());
+#else
         ElementMapper elementMapper(gridView);
+#endif
         SolVector exactSol(gridView.size(0));
 
 
@@ -709,11 +726,19 @@ public:
         enum {dim=Grid::dimension, maxIntersections = 12};
         using Element = typename Grid::template Codim<0>::Entity;
         using Geometry = typename Element::Geometry;
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
+#else
         using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
+#endif
         using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
         using ReferenceFaces = Dune::ReferenceElements<Scalar, dim-1>;
 
+#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
+        ElementMapper elementMapper(gridView, Dune::mcmgElementLayout());
+#else
         ElementMapper elementMapper(gridView);
+#endif
 
         uMinExact = 1e100;
         uMaxExact = -1e100;