From 9f61cb18b840f276284e6682f5dbb04fa99aabc9 Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Fri, 23 Jan 2015 06:59:29 +0000
Subject: [PATCH] [implicit] complete and test dim < dimWorld capability

All implicit porous-media models except 2pdfm are now able to run on
grids with dim < dimWorld. This still required some replacements of dim
by dimWorld, for example, in the velocity output of all models. In
implicit/1p, four new tests are added that run the 1p test problem on
1d-2d and 1d-3d Alberta grids with box and cell-centered, respectively.
Compilation has been tested also for all other models, but no runtime
testing has been performed.

This completes FS#183. Based upon preliminary work and a patch by
Natalie, thank you.

Reviewed by Natalie.


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14110 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/implicit/1p/1pmodel.hh                  |  5 +-
 dumux/implicit/1p2c/1p2cmodel.hh              |  9 ++-
 dumux/implicit/2p/2pmodel.hh                  | 11 ++-
 dumux/implicit/2p2c/2p2cmodel.hh              |  6 +-
 dumux/implicit/3p/3pmodel.hh                  |  9 +--
 dumux/implicit/3p3c/3p3cmodel.hh              |  8 +--
 dumux/implicit/box/boxfvelementgeometry.hh    | 26 ++++---
 dumux/implicit/common/implicitproblem.hh      |  4 +-
 .../implicit/common/implicitvelocityoutput.hh |  2 +-
 .../energy/mpncfluxvariablesenergykinetic.hh  |  3 +-
 .../mpnc/energy/mpncvtkwriterenergykinetic.hh | 18 ++---
 dumux/implicit/mpnc/mpncvtkwritercommon.hh    |  9 +--
 dumux/implicit/richards/richardsmodel.hh      |  5 +-
 test/implicit/1p/1ptestproblem.hh             | 17 ++++-
 test/implicit/1p/1ptestspatialparams.hh       | 10 +--
 test/implicit/1p/CMakeLists.txt               | 34 +++++++++
 test/implicit/1p/Makefile.am                  | 27 +++++++-
 test/implicit/1p/grids/test_1p_1d3d.dgf       | 18 +++++
 test/implicit/1p/grids/test_1p_2d3d.dgf       | 26 +++++++
 test/implicit/1p/test_box1p1d3d.cc            | 69 +++++++++++++++++++
 test/implicit/1p/test_box1p1d3d.input         | 21 ++++++
 test/implicit/1p/test_box1p2d3d.cc            | 69 +++++++++++++++++++
 test/implicit/1p/test_box1p2d3d.input         | 21 ++++++
 test/implicit/1p/test_cc1p1d3d.cc             | 69 +++++++++++++++++++
 test/implicit/1p/test_cc1p1d3d.input          | 21 ++++++
 test/implicit/1p/test_cc1p2d3d.cc             | 69 +++++++++++++++++++
 test/implicit/1p/test_cc1p2d3d.input          | 21 ++++++
 test/implicit/2p/lensspatialparams.hh         |  2 +-
 test/implicit/2p2c/injectionspatialparams.hh  |  2 +-
 test/implicit/2p2c/waterairspatialparams.hh   |  2 +-
 test/implicit/co2/heterogeneousproblem.hh     |  4 +-
 test/implicit/co2ni/heterogeneousproblemni.hh |  4 +-
 test/implicit/mpnc/combustionproblem1c.hh     |  6 +-
 .../mpnc/evaporationatmosphereproblem.hh      | 10 +--
 .../evaporationatmospherespatialparams.hh     | 22 +++---
 test/implicit/mpnc/forchheimer1pproblem.hh    |  4 +-
 .../richards/richardslensspatialparams.hh     |  2 +-
 test/references/1ptestbox1d3d-reference.vtp   | 34 +++++++++
 test/references/1ptestbox2d3d-reference.vtu   | 39 +++++++++++
 test/references/1ptestcc1d3d-reference.vtp    | 32 +++++++++
 test/references/1ptestcc2d3d-reference.vtu    | 37 ++++++++++
 41 files changed, 719 insertions(+), 88 deletions(-)
 create mode 100644 test/implicit/1p/grids/test_1p_1d3d.dgf
 create mode 100644 test/implicit/1p/grids/test_1p_2d3d.dgf
 create mode 100644 test/implicit/1p/test_box1p1d3d.cc
 create mode 100644 test/implicit/1p/test_box1p1d3d.input
 create mode 100644 test/implicit/1p/test_box1p2d3d.cc
 create mode 100644 test/implicit/1p/test_box1p2d3d.input
 create mode 100644 test/implicit/1p/test_cc1p1d3d.cc
 create mode 100644 test/implicit/1p/test_cc1p1d3d.input
 create mode 100644 test/implicit/1p/test_cc1p2d3d.cc
 create mode 100644 test/implicit/1p/test_cc1p2d3d.input
 create mode 100644 test/references/1ptestbox1d3d-reference.vtp
 create mode 100644 test/references/1ptestbox2d3d-reference.vtu
 create mode 100644 test/references/1ptestcc1d3d-reference.vtp
 create mode 100644 test/references/1ptestcc2d3d-reference.vtu

diff --git a/dumux/implicit/1p/1pmodel.hh b/dumux/implicit/1p/1pmodel.hh
index 2c02cd2633..9e39844e45 100644
--- a/dumux/implicit/1p/1pmodel.hh
+++ b/dumux/implicit/1p/1pmodel.hh
@@ -65,6 +65,7 @@ class OnePModel : public GET_PROP_TYPE(TypeTag, BaseModel)
     typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
     typedef typename GridView::template Codim<0>::Iterator ElementIterator;
     enum { dim = GridView::dimension };
+    enum { dimWorld = GridView::dimensionworld };
 
     enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
     enum { dofCodim = isBox ? dim : 0 };
@@ -81,13 +82,13 @@ public:
                             MultiWriter &writer)
     {
         typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
-        typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
+        typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
 
         // create the required scalar fields
         unsigned numDofs = this->numDofs();
         ScalarField *p = writer.allocateManagedBuffer(numDofs);
         ScalarField *K = writer.allocateManagedBuffer(numDofs);
-        VectorField *velocity = writer.template allocateManagedBuffer<double, dim>(numDofs);
+        VectorField *velocity = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
         ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
 
         if (velocityOutput.enableOutput())
diff --git a/dumux/implicit/1p2c/1p2cmodel.hh b/dumux/implicit/1p2c/1p2cmodel.hh
index 9d789053fc..eb576c4fa7 100644
--- a/dumux/implicit/1p2c/1p2cmodel.hh
+++ b/dumux/implicit/1p2c/1p2cmodel.hh
@@ -81,9 +81,8 @@ class OnePTwoCModel : public GET_PROP_TYPE(TypeTag, BaseModel)
     typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;
 
     typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
-    enum {
-        dim = GridView::dimension
-    };
+    enum { dim = GridView::dimension };
+    enum { dimWorld = GridView::dimensionworld };
     typedef typename GridView::template Codim<0>::Iterator ElementIterator;
 
     typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
@@ -106,7 +105,7 @@ public:
                             MultiWriter &writer)
     {
         typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
-        typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
+        typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
 
         // create the required scalar fields
         unsigned numDofs = this->numDofs();
@@ -118,7 +117,7 @@ public:
         ScalarField &massFraction1 = *writer.allocateManagedBuffer(numDofs);
         ScalarField &rho = *writer.allocateManagedBuffer(numDofs);
         ScalarField &mu = *writer.allocateManagedBuffer(numDofs);
-        VectorField *velocity = writer.template allocateManagedBuffer<double, dim>(numDofs);
+        VectorField *velocity = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
         ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
 
         if (velocityOutput.enableOutput())
diff --git a/dumux/implicit/2p/2pmodel.hh b/dumux/implicit/2p/2pmodel.hh
index ac902213f7..024f4c4ef5 100644
--- a/dumux/implicit/2p/2pmodel.hh
+++ b/dumux/implicit/2p/2pmodel.hh
@@ -85,9 +85,8 @@ class TwoPModel : public GET_PROP_TYPE(TypeTag, BaseModel)
 
     typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
     typedef typename GridView::template Codim<0>::Iterator ElementIterator;
-    enum {
-        dim = GridView::dimension
-    };
+    enum { dim = GridView::dimension };
+    enum { dimWorld = GridView::dimensionworld };
 
     typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
 
@@ -108,7 +107,7 @@ public:
                             MultiWriter &writer)
     {
         typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
-        typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
+        typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
 
         // get the number of degrees of freedom
         unsigned numDofs = this->numDofs();
@@ -125,8 +124,8 @@ public:
         ScalarField *mobN = writer.allocateManagedBuffer(numDofs);
         ScalarField *poro = writer.allocateManagedBuffer(numDofs);
         ScalarField *Te = writer.allocateManagedBuffer(numDofs);
-        VectorField *velocityN = writer.template allocateManagedBuffer<double, dim>(numDofs);
-        VectorField *velocityW = writer.template allocateManagedBuffer<double, dim>(numDofs);
+        VectorField *velocityN = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
+        VectorField *velocityW = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
         ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
 
         if (velocityOutput.enableOutput()) // check if velocity output is demanded
diff --git a/dumux/implicit/2p2c/2p2cmodel.hh b/dumux/implicit/2p2c/2p2cmodel.hh
index 71f8e11a31..d4c6b89f54 100644
--- a/dumux/implicit/2p2c/2p2cmodel.hh
+++ b/dumux/implicit/2p2c/2p2cmodel.hh
@@ -296,7 +296,7 @@ public:
                                 MultiWriter &writer)
     {
         typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
-        typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
+        typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
 
         // get the number of degrees of freedom
         unsigned numDofs = this->numDofs();
@@ -322,8 +322,8 @@ public:
                         moleFrac[phaseIdx][compIdx] = writer.allocateManagedBuffer(numDofs);
         ScalarField *temperature = writer.allocateManagedBuffer(numDofs);
         ScalarField *poro = writer.allocateManagedBuffer(numDofs);
-        VectorField *velocityN = writer.template allocateManagedBuffer<double, dim>(numDofs);
-        VectorField *velocityW = writer.template allocateManagedBuffer<double, dim>(numDofs);
+        VectorField *velocityN = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
+        VectorField *velocityW = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
         ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
 
         if (velocityOutput.enableOutput()) // check if velocity output is demanded
diff --git a/dumux/implicit/3p/3pmodel.hh b/dumux/implicit/3p/3pmodel.hh
index 574c61d6ec..fd153d4bff 100644
--- a/dumux/implicit/3p/3pmodel.hh
+++ b/dumux/implicit/3p/3pmodel.hh
@@ -72,6 +72,7 @@ class ThreePModel: public GET_PROP_TYPE(TypeTag, BaseModel)
 
     enum {
         dim = GridView::dimension,
+        dimWorld = GridView::dimensionworld,
 
         numPhases = GET_PROP_VALUE(TypeTag, NumPhases),
 
@@ -100,7 +101,7 @@ public:
                             MultiWriter &writer)
     {
         typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
-        typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
+        typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
 
         // get the number of degrees of freedom
         unsigned numDofs = this->numDofs();
@@ -119,9 +120,9 @@ public:
         ScalarField *temperature = writer.allocateManagedBuffer (numDofs);
         ScalarField *poro = writer.allocateManagedBuffer(numDofs);
         ScalarField *perm = writer.allocateManagedBuffer(numDofs);
-        VectorField *velocityN = writer.template allocateManagedBuffer<double, dim>(numDofs);
-        VectorField *velocityW = writer.template allocateManagedBuffer<double, dim>(numDofs);
-        VectorField *velocityG = writer.template allocateManagedBuffer<double, dim>(numDofs);
+        VectorField *velocityN = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
+        VectorField *velocityW = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
+        VectorField *velocityG = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
         ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
 
         if (velocityOutput.enableOutput()) // check if velocity output is demanded
diff --git a/dumux/implicit/3p3c/3p3cmodel.hh b/dumux/implicit/3p3c/3p3cmodel.hh
index e39d0d09ed..87bbef18cb 100644
--- a/dumux/implicit/3p3c/3p3cmodel.hh
+++ b/dumux/implicit/3p3c/3p3cmodel.hh
@@ -297,7 +297,7 @@ public:
                             MultiWriter &writer)
     {
         typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
-        typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
+        typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
 
         // get the number of degrees of freedom
         unsigned numDofs = this->numDofs();
@@ -320,9 +320,9 @@ public:
                 moleFraction[i][j] = writer.allocateManagedBuffer (numDofs);
         ScalarField *temperature = writer.allocateManagedBuffer (numDofs);
         ScalarField *poro = writer.allocateManagedBuffer(numDofs);
-        VectorField *velocityN = writer.template allocateManagedBuffer<double, dim>(numDofs);
-        VectorField *velocityW = writer.template allocateManagedBuffer<double, dim>(numDofs);
-        VectorField *velocityG = writer.template allocateManagedBuffer<double, dim>(numDofs);
+        VectorField *velocityN = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
+        VectorField *velocityW = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
+        VectorField *velocityG = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
         ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
 
         if (velocityOutput.enableOutput()) // check if velocity output is demanded
diff --git a/dumux/implicit/box/boxfvelementgeometry.hh b/dumux/implicit/box/boxfvelementgeometry.hh
index 1bd6fe5729..5ec152bed2 100644
--- a/dumux/implicit/box/boxfvelementgeometry.hh
+++ b/dumux/implicit/box/boxfvelementgeometry.hh
@@ -92,10 +92,18 @@ public:
             eg.subContVol[2].volume = eg.elementVolume/3;
             break;
         case 4: // 2D, quadrilinear
-            eg.subContVol[0].volume = eg.quadrilateralArea(eg.subContVol[0].global, edgeCoord[2], eg.elementGlobal, edgeCoord[0]);
-            eg.subContVol[1].volume = eg.quadrilateralArea(eg.subContVol[1].global, edgeCoord[1], eg.elementGlobal, edgeCoord[2]);
-            eg.subContVol[2].volume = eg.quadrilateralArea(eg.subContVol[2].global, edgeCoord[0], eg.elementGlobal, edgeCoord[3]);
-            eg.subContVol[3].volume = eg.quadrilateralArea(eg.subContVol[3].global, edgeCoord[3], eg.elementGlobal, edgeCoord[1]);
+            if (GlobalPosition::dimension == dim) {
+                eg.subContVol[0].volume = eg.quadrilateralArea(eg.subContVol[0].global, edgeCoord[2], eg.elementGlobal, edgeCoord[0]);
+                eg.subContVol[1].volume = eg.quadrilateralArea(eg.subContVol[1].global, edgeCoord[1], eg.elementGlobal, edgeCoord[2]);
+                eg.subContVol[2].volume = eg.quadrilateralArea(eg.subContVol[2].global, edgeCoord[0], eg.elementGlobal, edgeCoord[3]);
+                eg.subContVol[3].volume = eg.quadrilateralArea(eg.subContVol[3].global, edgeCoord[3], eg.elementGlobal, edgeCoord[1]);
+            }
+            else {
+                eg.subContVol[0].volume = eg.quadrilateralArea3D(eg.subContVol[0].global, edgeCoord[2], eg.elementGlobal, edgeCoord[0]);
+                eg.subContVol[1].volume = eg.quadrilateralArea3D(eg.subContVol[1].global, edgeCoord[1], eg.elementGlobal, edgeCoord[2]);
+                eg.subContVol[2].volume = eg.quadrilateralArea3D(eg.subContVol[2].global, edgeCoord[0], eg.elementGlobal, edgeCoord[3]);
+                eg.subContVol[3].volume = eg.quadrilateralArea3D(eg.subContVol[3].global, edgeCoord[3], eg.elementGlobal, edgeCoord[1]);
+            }
             break;
         default:
             DUNE_THROW(Dune::NotImplemented, "_BoxFVElemGeomHelper::fillSubContVolData dim = " << dim << ", numVertices = " << numVertices);
@@ -655,17 +663,17 @@ public:
             // the compiler can optimize away all if
             // cases which don't apply.
             LocalPosition ipLocal;
-            GlobalPosition diffVec;
             if (dim==1) {
-                subContVolFace[k].ipLocal = 0.5;
-                subContVolFace[k].normal = 1.0;
-                ipLocal = subContVolFace[k].ipLocal;
+                ipLocal = 0.5;
+                subContVolFace[k].ipLocal = ipLocal;
+                subContVolFace[k].normal = subContVol[j].global - subContVol[i].global;
+                subContVolFace[k].normal /= subContVolFace[k].normal.two_norm();
             }
             else if (dim==2) {
                 ipLocal = referenceElement.position(k, dim-1) + elementLocal;
                 ipLocal *= 0.5;
                 subContVolFace[k].ipLocal = ipLocal;
-                diffVec = elementGlobal - edgeCoordinates[k];
+                GlobalPosition diffVec = elementGlobal - edgeCoordinates[k];
                 subContVolFace[k].normal[0] = diffVec[1];
                 subContVolFace[k].normal[1] = -diffVec[0];
 
diff --git a/dumux/implicit/common/implicitproblem.hh b/dumux/implicit/common/implicitproblem.hh
index b63f512858..31bc65bc0b 100644
--- a/dumux/implicit/common/implicitproblem.hh
+++ b/dumux/implicit/common/implicitproblem.hh
@@ -103,7 +103,7 @@ public:
         VertexIterator vIt = gridView.template begin<dim>();
         const VertexIterator vEndIt = gridView.template end<dim>();
         for (; vIt!=vEndIt; ++vIt) {
-            for (int i=0; i<dim; i++) {
+            for (int i=0; i<dimWorld; i++) {
                 bBoxMin_[i] = std::min(bBoxMin_[i], vIt->geometry().corner(0)[i]);
                 bBoxMax_[i] = std::max(bBoxMax_[i], vIt->geometry().corner(0)[i]);
             }
@@ -111,7 +111,7 @@ public:
 
         // communicate to get the bounding box of the whole domain
         if (gridView.comm().size() > 1)
-            for (int i = 0; i < dim; ++i) {
+            for (int i = 0; i < dimWorld; ++i) {
                 bBoxMin_[i] = gridView.comm().min(bBoxMin_[i]);
                 bBoxMax_[i] = gridView.comm().max(bBoxMax_[i]);
             }
diff --git a/dumux/implicit/common/implicitvelocityoutput.hh b/dumux/implicit/common/implicitvelocityoutput.hh
index e991038dc6..df04d4277a 100644
--- a/dumux/implicit/common/implicitvelocityoutput.hh
+++ b/dumux/implicit/common/implicitvelocityoutput.hh
@@ -210,7 +210,7 @@ public:
                     int vIdxGlobal = problem_.vertexMapper().map(element, scvIdx, dofCodim);
 #endif
                     // calculate the subcontrolvolume velocity by the Piola transformation
-                    Dune::FieldVector<CoordScalar, dim> scvVelocity(0);
+                    Dune::FieldVector<CoordScalar, dimWorld> scvVelocity(0);
 
                     jacobianT2.mtv(scvVelocities[scvIdx], scvVelocity);
                     scvVelocity /= element.geometry().integrationElement(localPos)*cellNum_[vIdxGlobal];
diff --git a/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh b/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh
index b6526d0a0e..7e6b35db98 100644
--- a/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh
+++ b/dumux/implicit/mpnc/energy/mpncfluxvariablesenergykinetic.hh
@@ -138,12 +138,13 @@ class MPNCFluxVariablesEnergy<TypeTag, /*enableEnergy=*/true, /*numEnergyEquatio
     typedef typename GridView::template Codim<0>::Entity Element;
 
     enum {dim = GridView::dimension};
+    enum {dimWorld = GridView::dimensionworld};
     enum {numEnergyEqs          = Indices::numPrimaryEnergyVars};
     enum {wPhaseIdx             = FluidSystem::wPhaseIdx};
     enum {nPhaseIdx             = FluidSystem::nPhaseIdx};
 
 
-    typedef Dune::FieldVector<CoordScalar, dim>  GlobalPosition;
+    typedef Dune::FieldVector<CoordScalar, dimWorld>  GlobalPosition;
     typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
     typedef typename FVElementGeometry::SubControlVolume SCV;
     typedef typename FVElementGeometry::SubControlVolumeFace SCVFace;
diff --git a/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh b/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh
index 866d61d08b..f929f5430d 100644
--- a/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh
+++ b/dumux/implicit/mpnc/energy/mpncvtkwriterenergykinetic.hh
@@ -58,6 +58,7 @@ class MPNCVtkWriterEnergy<TypeTag, /*enableEnergy = */ true, /* numEnergyEquatio
     typedef typename GridView::template Codim<0>::Entity Element;
 
     enum { dim = GridView::dimension };
+    enum { dimWorld = GridView::dimensionworld };
     enum { numPhases = GET_PROP_VALUE(TypeTag, NumPhases) };
     enum { numEnergyEqs = Indices::numPrimaryEnergyVars};
     enum { velocityAveragingInModel = GET_PROP_VALUE(TypeTag, VelocityAveragingInModel) };
@@ -76,9 +77,9 @@ class MPNCVtkWriterEnergy<TypeTag, /*enableEnergy = */ true, /* numEnergyEquatio
     typedef typename ParentType::ComponentVector ComponentVector;
     typedef Dune::array<ScalarVector, numEnergyEqs> EnergyEqVector;
 
-    typedef Dune::FieldVector<Scalar, dim> DimVector;
-    typedef Dune::BlockVector<DimVector> DimField;
-    typedef Dune::array<DimField, numPhases> PhaseDimField;
+    typedef Dune::FieldVector<Scalar, dimWorld> DimWorldVector;
+    typedef Dune::BlockVector<DimWorldVector> DimWorldField;
+    typedef Dune::array<DimWorldField, numPhases> PhaseDimWorldField;
 
 
 public:
@@ -266,7 +267,7 @@ private:
     PhaseVector prandtlNumber_ ;
     PhaseVector nusseltNumber_ ;
 
-    PhaseDimField  velocity_;
+    PhaseDimWorldField  velocity_;
 
     ScalarVector awn_;
     ScalarVector aws_;
@@ -300,6 +301,7 @@ class MPNCVtkWriterEnergy<TypeTag, /*enableEnergy = */ true, /* numEnergyEquatio
     typedef typename GridView::template Codim<0>::Entity Element;
 
     enum { dim = GridView::dimension };
+    enum { dimWorld = GridView::dimensionworld };
     enum { numPhases = GET_PROP_VALUE(TypeTag, NumPhases) };
     enum { wPhaseIdx        = FluidSystem::wPhaseIdx};
 
@@ -320,9 +322,9 @@ class MPNCVtkWriterEnergy<TypeTag, /*enableEnergy = */ true, /* numEnergyEquatio
     typedef typename ParentType::ComponentVector ComponentVector;
     typedef Dune::array<ScalarVector, numEnergyEqs> EnergyEqVector;
 
-    typedef Dune::FieldVector<Scalar, dim> DimVector;
-    typedef Dune::BlockVector<DimVector> DimField;
-    typedef Dune::array<DimField, numPhases> PhaseDimField;
+    typedef Dune::FieldVector<Scalar, dimWorld> DimWorldVector;
+    typedef Dune::BlockVector<DimWorldVector> DimWorldField;
+    typedef Dune::array<DimWorldField, numPhases> PhaseDimWorldField;
 
 
 public:
@@ -508,7 +510,7 @@ private:
     PhaseVector nusseltNumber_ ;
     ScalarVector qBoil_ ;
     ScalarVector qsf_ ;
-    PhaseDimField  velocity_;
+    PhaseDimWorldField  velocity_;
 };
 
 
diff --git a/dumux/implicit/mpnc/mpncvtkwritercommon.hh b/dumux/implicit/mpnc/mpncvtkwritercommon.hh
index b51a9b4023..898446bdfc 100644
--- a/dumux/implicit/mpnc/mpncvtkwritercommon.hh
+++ b/dumux/implicit/mpnc/mpncvtkwritercommon.hh
@@ -56,13 +56,14 @@ class MPNCVtkWriterCommon : public MPNCVtkWriterModule<TypeTag>
     typedef typename ParentType::PhaseComponentMatrix PhaseComponentMatrix;
 
     enum { dim = GridView::dimension };
+    enum { dimWorld = GridView::dimensionworld };
     enum { numPhases = GET_PROP_VALUE(TypeTag, NumPhases) };
     enum { numComponents = GET_PROP_VALUE(TypeTag, NumComponents) };
     enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) };
 
-    typedef Dune::FieldVector<Scalar, dim> DimVector;
-    typedef Dune::BlockVector<DimVector> DimField;
-    typedef Dune::array<DimField, numPhases> PhaseDimField;
+    typedef Dune::FieldVector<Scalar, dimWorld> DimWorldVector;
+    typedef Dune::BlockVector<DimWorldVector> DimWorldField;
+    typedef Dune::array<DimWorldField, numPhases> PhaseDimWorldField;
     enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
     enum { dofCodim = isBox ? dim : 0 };
 
@@ -239,7 +240,7 @@ private:
     PhaseVector mobility_;
     PhaseVector averageMolarMass_;
 
-    PhaseDimField velocity_;
+    PhaseDimWorldField velocity_;
 
     ScalarVector porosity_;
     ScalarVector permeability_;
diff --git a/dumux/implicit/richards/richardsmodel.hh b/dumux/implicit/richards/richardsmodel.hh
index 7550b292d3..2f4ed78b23 100644
--- a/dumux/implicit/richards/richardsmodel.hh
+++ b/dumux/implicit/richards/richardsmodel.hh
@@ -121,6 +121,7 @@ class RichardsModel : public GET_PROP_TYPE(TypeTag, BaseModel)
     typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
     typedef typename GridView::template Codim<0>::Iterator ElementIterator;
     enum { dim = GridView::dimension };
+    enum { dimWorld = GridView::dimensionworld };
 
     enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
     enum { dofCodim = isBox ? dim : 0 };
@@ -137,7 +138,7 @@ public:
     void addOutputVtkFields(const SolutionVector &sol, MultiWriter &writer)
     {
         typedef Dune::BlockVector<Dune::FieldVector<double, 1> > ScalarField;
-        typedef Dune::BlockVector<Dune::FieldVector<double, dim> > VectorField;
+        typedef Dune::BlockVector<Dune::FieldVector<double, dimWorld> > VectorField;
 
         // get the number of degrees of freedom
         unsigned numDofs = this->numDofs();
@@ -154,7 +155,7 @@ public:
         ScalarField *mobN = writer.allocateManagedBuffer(numDofs);
         ScalarField *poro = writer.allocateManagedBuffer(numDofs);
         ScalarField *Te = writer.allocateManagedBuffer(numDofs);
-        VectorField *velocity = writer.template allocateManagedBuffer<double, dim>(numDofs);
+        VectorField *velocity = writer.template allocateManagedBuffer<double, dimWorld>(numDofs);
         ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
 
         if (velocityOutput.enableOutput())
diff --git a/test/implicit/1p/1ptestproblem.hh b/test/implicit/1p/1ptestproblem.hh
index 472bbeacc3..68f3563224 100644
--- a/test/implicit/1p/1ptestproblem.hh
+++ b/test/implicit/1p/1ptestproblem.hh
@@ -87,6 +87,19 @@ NEW_TYPE_TAG(OnePTestCCProblemWithAMG, INHERITS_FROM(OnePTestCCProblem));
 SET_TYPE_PROP(OnePTestBoxProblemWithAMG, LinearSolver, Dumux::AMGBackend<TypeTag> );
 SET_TYPE_PROP(OnePTestCCProblemWithAMG, LinearSolver, Dumux::AMGBackend<TypeTag> );
 
+// if AlbertaGrid is available, test for dim < dimWorld
+#if HAVE_ALBERTA
+NEW_TYPE_TAG(OnePOneDThreeDTestProblem, INHERITS_FROM(OnePTestProblem));
+NEW_TYPE_TAG(OnePOneDThreeDTestBoxProblem, INHERITS_FROM(BoxModel, OnePOneDThreeDTestProblem));
+NEW_TYPE_TAG(OnePOneDThreeDTestCCProblem, INHERITS_FROM(CCModel, OnePOneDThreeDTestProblem));
+SET_TYPE_PROP(OnePOneDThreeDTestProblem, Grid, Dune::AlbertaGrid<1, 3>);
+
+NEW_TYPE_TAG(OnePTwoDThreeDTestProblem, INHERITS_FROM(OnePTestProblem));
+NEW_TYPE_TAG(OnePTwoDThreeDTestBoxProblem, INHERITS_FROM(BoxModel, OnePTwoDThreeDTestProblem));
+NEW_TYPE_TAG(OnePTwoDThreeDTestCCProblem, INHERITS_FROM(CCModel, OnePTwoDThreeDTestProblem));
+SET_TYPE_PROP(OnePTwoDThreeDTestProblem, Grid, Dune::AlbertaGrid<2, 3>);
+#endif
+
 // Enable gravity
 SET_BOOL_PROP(OnePTestProblem, ProblemEnableGravity, true);
 }
@@ -206,7 +219,7 @@ public:
             const GlobalPosition &globalPos) const
     {
         double eps = 1.0e-3;
-        if (globalPos[dim-1] < eps || globalPos[dim-1] > this->bBoxMax()[dim-1] - eps)
+        if (globalPos[dimWorld-1] < eps || globalPos[dimWorld-1] > this->bBoxMax()[dimWorld-1] - eps)
             values.setAllDirichlet();
         else
             values.setAllNeumann();
@@ -224,7 +237,7 @@ public:
     void dirichletAtPos(PrimaryVariables &values,
                         const GlobalPosition &globalPos) const
     {
-        values[pressureIdx] = 1.0e+5*(2.0 - globalPos[dim-1]);
+        values[pressureIdx] = 1.0e+5*(2.0 - globalPos[dimWorld-1]);
     }
 
     /*!
diff --git a/test/implicit/1p/1ptestspatialparams.hh b/test/implicit/1p/1ptestspatialparams.hh
index 7072a345df..f61a3259b3 100644
--- a/test/implicit/1p/1ptestspatialparams.hh
+++ b/test/implicit/1p/1ptestspatialparams.hh
@@ -61,15 +61,15 @@ public:
         try
         {
             lensLowerLeft_[0] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensLowerLeftX);
-            if (dim > 1)
+            if (dimWorld > 1)
                 lensLowerLeft_[1] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensLowerLeftY);
-            if (dim > 2)
+            if (dimWorld > 2)
                 lensLowerLeft_[2] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensLowerLeftZ);
 
             lensUpperRight_[0] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensUpperRightX);
-            if (dim > 1)
+            if (dimWorld > 1)
                 lensUpperRight_[1] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensUpperRightY);
-            if (dim > 2)
+            if (dimWorld > 2)
                 lensUpperRight_[2] = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.LensUpperRightZ);
 
             permeability_ = GET_RUNTIME_PARAM(TypeTag, Scalar, SpatialParams.Permeability);
@@ -119,7 +119,7 @@ public:
 private:
     bool isInLens_(const GlobalPosition &globalPos) const
     {
-        for (int i = 0; i < dim; ++i) {
+        for (int i = 0; i < dimWorld; ++i) {
             if (globalPos[i] < lensLowerLeft_[i] || globalPos[i] > lensUpperRight_[i])
                 return false;
         }
diff --git a/test/implicit/1p/CMakeLists.txt b/test/implicit/1p/CMakeLists.txt
index 4f2572bcec..29802643a2 100644
--- a/test/implicit/1p/CMakeLists.txt
+++ b/test/implicit/1p/CMakeLists.txt
@@ -55,3 +55,37 @@ add_dumux_test(test_cc1pniconvection test_cc1pniconvection test_cc1pniconvection
   ${CMAKE_SOURCE_DIR}/test/references/1pniccconvection-reference.vtu
   ${CMAKE_CURRENT_BINARY_DIR}/cc1pniconvection-00011.vtu
   ${CMAKE_CURRENT_BINARY_DIR}/test_cc1pniconvection)
+
+# dim < dimWorld tests
+add_dumux_test(test_box1p1d3d test_box1p1d3d test_box1p1d3d.cc
+  ${CMAKE_SOURCE_DIR}/bin/runTest.sh
+  ${CMAKE_SOURCE_DIR}/bin/fuzzycomparevtu.py
+  ${CMAKE_SOURCE_DIR}/test/references/1ptestbox1d3d-reference.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/1ptestbox1d3d-00002.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/test_box1p1d3d)
+add_dune_alberta_flags(test_box1p1d3d GRIDDIM 1 WORLDDIM 3)
+
+add_dumux_test(test_box1p2d3d test_box1p2d3d test_box1p2d3d.cc
+  ${CMAKE_SOURCE_DIR}/bin/runTest.sh
+  ${CMAKE_SOURCE_DIR}/bin/fuzzycomparevtu.py
+  ${CMAKE_SOURCE_DIR}/test/references/1ptestbox2d3d-reference.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/1ptestbox2d3d-00002.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/test_box1p2d3d)
+add_dune_alberta_flags(test_box1p2d3d GRIDDIM 2 WORLDDIM 3)
+
+add_dumux_test(test_cc1p1d3d test_cc1p1d3d test_cc1p1d3d.cc
+  ${CMAKE_SOURCE_DIR}/bin/runTest.sh
+  ${CMAKE_SOURCE_DIR}/bin/fuzzycomparevtu.py
+  ${CMAKE_SOURCE_DIR}/test/references/1ptestcc1d3d-reference.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/1ptestcc1d3d-00002.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/test_cc1p1d3d)
+add_dune_alberta_flags(test_cc1p1d3d GRIDDIM 1 WORLDDIM 3)
+
+add_dumux_test(test_cc1p2d3d test_cc1p2d3d test_cc1p2d3d.cc
+  ${CMAKE_SOURCE_DIR}/bin/runTest.sh
+  ${CMAKE_SOURCE_DIR}/bin/fuzzycomparevtu.py
+  ${CMAKE_SOURCE_DIR}/test/references/1ptestcc2d3d-reference.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/1ptestcc2d3d-00002.vtu
+  ${CMAKE_CURRENT_BINARY_DIR}/test_cc1p2d3d)
+add_dune_alberta_flags(test_cc1p2d3d GRIDDIM 2 WORLDDIM 3)
+
diff --git a/test/implicit/1p/Makefile.am b/test/implicit/1p/Makefile.am
index 48b8129fce..530c604f65 100644
--- a/test/implicit/1p/Makefile.am
+++ b/test/implicit/1p/Makefile.am
@@ -1,22 +1,47 @@
 check_PROGRAMS = test_box1p \
+                 test_box1p1d3d \
+                 test_box1p2d3d \
                  test_box1pniconduction \
                  test_box1pniconvection \
                  test_box1pwithamg \
                  test_cc1p \
+                 test_cc1p1d3d \
+                 test_cc1p2d3d \
                  test_cc1pniconduction \
                  test_cc1pniconvection \
-                 test_cc1pwithamg 
+                 test_cc1pwithamg
 
 noinst_HEADERS := $(wildcard *.hh)
 EXTRA_DIST:=$(wildcard *.input) $(wildcard grids/*.dgf) CMakeLists.txt
 
 test_box1p_SOURCES = test_box1p.cc
+test_box1p1d3d_SOURCES = test_box1p1d3d.cc
+test_box1p2d3d_SOURCES = test_box1p2d3d.cc
 test_box1pniconduction_SOURCES = test_box1pniconduction.cc
 test_box1pniconvection_SOURCES = test_box1pniconvection.cc
 test_box1pwithamg_SOURCES = test_box1pwithamg.cc
 test_cc1p_SOURCES = test_cc1p.cc
+test_cc1p1d3d_SOURCES = test_cc1p1d3d.cc
+test_cc1p2d3d_SOURCES = test_cc1p2d3d.cc
 test_cc1pniconduction_SOURCES = test_cc1pniconduction.cc
 test_cc1pniconvection_SOURCES = test_cc1pniconvection.cc
 test_cc1pwithamg_SOURCES = test_cc1pwithamg.cc
 
+test_cc1p1d3d_LDADD = $(AM_LDFLAGS)  $(ALBERTA3D_LIBS)
+test_cc1p1d3d_LDFLAGS= $(AM_LDFLAGS) $(ALBERTA3D_LDFLAGS)
+test_cc1p1d3d_CPPFLAGS=$(AM_CPPFLAGS) $(ALBERTA3D_CPPFLAGS)
+
+test_box1p1d3d_LDADD = $(AM_LDFLAGS)  $(ALBERTA3D_LIBS)
+test_box1p1d3d_LDFLAGS= $(AM_LDFLAGS) $(ALBERTA3D_LDFLAGS)
+test_box1p1d3d_CPPFLAGS=$(AM_CPPFLAGS) $(ALBERTA3D_CPPFLAGS)
+
+test_cc1p2d3d_LDADD = $(AM_LDFLAGS)  $(ALBERTA3D_LIBS)
+test_cc1p2d3d_LDFLAGS= $(AM_LDFLAGS) $(ALBERTA3D_LDFLAGS)
+test_cc1p2d3d_CPPFLAGS=$(AM_CPPFLAGS) $(ALBERTA3D_CPPFLAGS)
+
+test_box1p2d3d_LDADD = $(AM_LDFLAGS)  $(ALBERTA3D_LIBS)
+test_box1p2d3d_LDFLAGS= $(AM_LDFLAGS) $(ALBERTA3D_LDFLAGS)
+test_box1p2d3d_CPPFLAGS=$(AM_CPPFLAGS) $(ALBERTA3D_CPPFLAGS)
+
+
 include $(top_srcdir)/am/global-rules
diff --git a/test/implicit/1p/grids/test_1p_1d3d.dgf b/test/implicit/1p/grids/test_1p_1d3d.dgf
new file mode 100644
index 0000000000..99cdba0909
--- /dev/null
+++ b/test/implicit/1p/grids/test_1p_1d3d.dgf
@@ -0,0 +1,18 @@
+DGF
+Vertex
+0 0 0
+0.25 0.25 0.25
+0.5 0.5 0.5
+0.75 0.75 0.75
+1 1 1
+#
+Simplex
+0 1
+1 2
+2 3
+3 4
+#
+Boundarydomain
+default 1    % all boundaries have id 1
+#
+# unitcube.dgf
diff --git a/test/implicit/1p/grids/test_1p_2d3d.dgf b/test/implicit/1p/grids/test_1p_2d3d.dgf
new file mode 100644
index 0000000000..1dfbbe4929
--- /dev/null
+++ b/test/implicit/1p/grids/test_1p_2d3d.dgf
@@ -0,0 +1,26 @@
+DGF
+Vertex
+0 0 0
+0.5 0 0
+1 0 0
+0 0.5 0.5
+0.5 0.5 0.5
+1 0.5 0.5
+0 1 1
+0.5 1 1
+1 1 1
+#
+Simplex
+0 1 4
+0 4 3
+1 2 4
+2 5 4
+3 4 6
+4 7 6
+4 5 8
+4 8 7
+#
+Boundarydomain
+default 1    % all boundaries have id 1
+#
+# unitcube.dgf
diff --git a/test/implicit/1p/test_box1p1d3d.cc b/test/implicit/1p/test_box1p1d3d.cc
new file mode 100644
index 0000000000..79f3611b1f
--- /dev/null
+++ b/test/implicit/1p/test_box1p1d3d.cc
@@ -0,0 +1,69 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \file
+ *
+ * \brief test for the one-phase CC model
+ */
+#include "config.h"
+#include "1ptestproblem.hh"
+#include <dumux/common/start.hh>
+
+/*!
+ * \brief Provides an interface for customizing error messages associated with
+ *        reading in parameters.
+ *
+ * \param progName  The name of the program, that was tried to be started.
+ * \param errorMsg  The error message that was issued by the start function.
+ *                  Comprises the thing that went wrong and a general help message.
+ */
+void usage(const char *progName, const std::string &errorMsg)
+{
+    if (errorMsg.size() > 0) {
+        std::string errorMessageOut = "\nUsage: ";
+                    errorMessageOut += progName;
+                    errorMessageOut += " [options]\n";
+                    errorMessageOut += errorMsg;
+                    errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n"
+                                        "\t-TimeManager.TEnd               End of the simulation [s] \n"
+                                        "\t-TimeManager.DtInitial          Initial timestep size [s] \n"
+                                        "\t-Grid.File                      Name of the file containing the grid \n"
+                                        "\t                                definition in DGF format\n"
+                                        "\t-SpatialParams.LensLowerLeftX   x-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensLowerLeftY   y-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightX  x-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightY  y-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.Permeability     Permeability of the domain [m^2] \n"
+                                        "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \n";
+
+        std::cout << errorMessageOut
+                  << "\n";
+    }
+}
+
+int main(int argc, char** argv)
+{
+#if HAVE_ALBERTA
+    typedef TTAG(OnePOneDThreeDTestBoxProblem) ProblemTypeTag;
+    return Dumux::start<ProblemTypeTag>(argc, argv, usage);
+#else
+    std::cout << "Test skipped, it needs Alberta!" << std::endl;
+    return 77;
+#endif
+}
diff --git a/test/implicit/1p/test_box1p1d3d.input b/test/implicit/1p/test_box1p1d3d.input
new file mode 100644
index 0000000000..7907d6434b
--- /dev/null
+++ b/test/implicit/1p/test_box1p1d3d.input
@@ -0,0 +1,21 @@
+[TimeManager]
+DtInitial = 1 # [s]
+TEnd = 1 # [s]
+
+[Grid]
+File = ./grids/test_1p_1d3d.dgf
+
+[Problem]
+Name = 1ptestbox1d3d # name passed to the output routines
+
+[SpatialParams]
+LensLowerLeftX = 0.2 # [m]
+LensLowerLeftY = 0.2 # [m]
+LensLowerLeftZ = 0.2 # [m]
+LensUpperRightX = 0.8 # [m]
+LensUpperRightY = 0.8 # [m]
+LensUpperRightZ = 0.8 # [m]
+
+Permeability = 1e-10 # [m^2]
+PermeabilityLens = 1e-12 # [m^2]
+
diff --git a/test/implicit/1p/test_box1p2d3d.cc b/test/implicit/1p/test_box1p2d3d.cc
new file mode 100644
index 0000000000..b66d95cfdf
--- /dev/null
+++ b/test/implicit/1p/test_box1p2d3d.cc
@@ -0,0 +1,69 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \file
+ *
+ * \brief test for the one-phase CC model
+ */
+#include "config.h"
+#include "1ptestproblem.hh"
+#include <dumux/common/start.hh>
+
+/*!
+ * \brief Provides an interface for customizing error messages associated with
+ *        reading in parameters.
+ *
+ * \param progName  The name of the program, that was tried to be started.
+ * \param errorMsg  The error message that was issued by the start function.
+ *                  Comprises the thing that went wrong and a general help message.
+ */
+void usage(const char *progName, const std::string &errorMsg)
+{
+    if (errorMsg.size() > 0) {
+        std::string errorMessageOut = "\nUsage: ";
+                    errorMessageOut += progName;
+                    errorMessageOut += " [options]\n";
+                    errorMessageOut += errorMsg;
+                    errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n"
+                                        "\t-TimeManager.TEnd               End of the simulation [s] \n"
+                                        "\t-TimeManager.DtInitial          Initial timestep size [s] \n"
+                                        "\t-Grid.File                      Name of the file containing the grid \n"
+                                        "\t                                definition in DGF format\n"
+                                        "\t-SpatialParams.LensLowerLeftX   x-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensLowerLeftY   y-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightX  x-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightY  y-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.Permeability     Permeability of the domain [m^2] \n"
+                                        "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \n";
+
+        std::cout << errorMessageOut
+                  << "\n";
+    }
+}
+
+int main(int argc, char** argv)
+{
+#if HAVE_ALBERTA
+    typedef TTAG(OnePTwoDThreeDTestBoxProblem) ProblemTypeTag;
+    return Dumux::start<ProblemTypeTag>(argc, argv, usage);
+#else
+    std::cout << "Test skipped, it needs Alberta!" << std::endl;
+    return 77;
+#endif
+}
diff --git a/test/implicit/1p/test_box1p2d3d.input b/test/implicit/1p/test_box1p2d3d.input
new file mode 100644
index 0000000000..b5081bd65e
--- /dev/null
+++ b/test/implicit/1p/test_box1p2d3d.input
@@ -0,0 +1,21 @@
+[TimeManager]
+DtInitial = 1 # [s]
+TEnd = 1 # [s]
+
+[Grid]
+File = ./grids/test_1p_2d3d.dgf
+
+[Problem]
+Name = 1ptestbox2d3d # name passed to the output routines
+
+[SpatialParams]
+LensLowerLeftX = 0.2 # [m]
+LensLowerLeftY = 0.2 # [m]
+LensLowerLeftZ = 0.2 # [m]
+LensUpperRightX = 0.8 # [m]
+LensUpperRightY = 0.8 # [m]
+LensUpperRightZ = 0.8 # [m]
+
+Permeability = 1e-10 # [m^2]
+PermeabilityLens = 1e-12 # [m^2]
+
diff --git a/test/implicit/1p/test_cc1p1d3d.cc b/test/implicit/1p/test_cc1p1d3d.cc
new file mode 100644
index 0000000000..6502e9f9d0
--- /dev/null
+++ b/test/implicit/1p/test_cc1p1d3d.cc
@@ -0,0 +1,69 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \file
+ *
+ * \brief test for the one-phase CC model
+ */
+#include "config.h"
+#include "1ptestproblem.hh"
+#include <dumux/common/start.hh>
+
+/*!
+ * \brief Provides an interface for customizing error messages associated with
+ *        reading in parameters.
+ *
+ * \param progName  The name of the program, that was tried to be started.
+ * \param errorMsg  The error message that was issued by the start function.
+ *                  Comprises the thing that went wrong and a general help message.
+ */
+void usage(const char *progName, const std::string &errorMsg)
+{
+    if (errorMsg.size() > 0) {
+        std::string errorMessageOut = "\nUsage: ";
+                    errorMessageOut += progName;
+                    errorMessageOut += " [options]\n";
+                    errorMessageOut += errorMsg;
+                    errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n"
+                                        "\t-TimeManager.TEnd               End of the simulation [s] \n"
+                                        "\t-TimeManager.DtInitial          Initial timestep size [s] \n"
+                                        "\t-Grid.File                      Name of the file containing the grid \n"
+                                        "\t                                definition in DGF format\n"
+                                        "\t-SpatialParams.LensLowerLeftX   x-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensLowerLeftY   y-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightX  x-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightY  y-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.Permeability     Permeability of the domain [m^2] \n"
+                                        "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \n";
+
+        std::cout << errorMessageOut
+                  << "\n";
+    }
+}
+
+int main(int argc, char** argv)
+{
+#if HAVE_ALBERTA
+    typedef TTAG(OnePOneDThreeDTestCCProblem) ProblemTypeTag;
+    return Dumux::start<ProblemTypeTag>(argc, argv, usage);
+#else
+    std::cout << "Test skipped, it needs Alberta!" << std::endl;
+    return 77;
+#endif
+}
diff --git a/test/implicit/1p/test_cc1p1d3d.input b/test/implicit/1p/test_cc1p1d3d.input
new file mode 100644
index 0000000000..c2929273ac
--- /dev/null
+++ b/test/implicit/1p/test_cc1p1d3d.input
@@ -0,0 +1,21 @@
+[TimeManager]
+DtInitial = 1 # [s]
+TEnd = 1 # [s]
+
+[Grid]
+File = ./grids/test_1p_1d3d.dgf
+
+[Problem]
+Name = 1ptestcc1d3d # name passed to the output routines
+
+[SpatialParams]
+LensLowerLeftX = 0.2 # [m]
+LensLowerLeftY = 0.2 # [m]
+LensLowerLeftZ = 0.2 # [m]
+LensUpperRightX = 0.8 # [m]
+LensUpperRightY = 0.8 # [m]
+LensUpperRightZ = 0.8 # [m]
+
+Permeability = 1e-10 # [m^2]
+PermeabilityLens = 1e-12 # [m^2]
+
diff --git a/test/implicit/1p/test_cc1p2d3d.cc b/test/implicit/1p/test_cc1p2d3d.cc
new file mode 100644
index 0000000000..9a3725b7e1
--- /dev/null
+++ b/test/implicit/1p/test_cc1p2d3d.cc
@@ -0,0 +1,69 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \file
+ *
+ * \brief test for the one-phase CC model
+ */
+#include "config.h"
+#include "1ptestproblem.hh"
+#include <dumux/common/start.hh>
+
+/*!
+ * \brief Provides an interface for customizing error messages associated with
+ *        reading in parameters.
+ *
+ * \param progName  The name of the program, that was tried to be started.
+ * \param errorMsg  The error message that was issued by the start function.
+ *                  Comprises the thing that went wrong and a general help message.
+ */
+void usage(const char *progName, const std::string &errorMsg)
+{
+    if (errorMsg.size() > 0) {
+        std::string errorMessageOut = "\nUsage: ";
+                    errorMessageOut += progName;
+                    errorMessageOut += " [options]\n";
+                    errorMessageOut += errorMsg;
+                    errorMessageOut += "\n\nThe list of mandatory arguments for this program is:\n"
+                                        "\t-TimeManager.TEnd               End of the simulation [s] \n"
+                                        "\t-TimeManager.DtInitial          Initial timestep size [s] \n"
+                                        "\t-Grid.File                      Name of the file containing the grid \n"
+                                        "\t                                definition in DGF format\n"
+                                        "\t-SpatialParams.LensLowerLeftX   x-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensLowerLeftY   y-coordinate of the lower left corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightX  x-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.LensUpperRightY  y-coordinate of the upper right corner of the lens [m] \n"
+                                        "\t-SpatialParams.Permeability     Permeability of the domain [m^2] \n"
+                                        "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \n";
+
+        std::cout << errorMessageOut
+                  << "\n";
+    }
+}
+
+int main(int argc, char** argv)
+{
+#if HAVE_ALBERTA
+    typedef TTAG(OnePTwoDThreeDTestCCProblem) ProblemTypeTag;
+    return Dumux::start<ProblemTypeTag>(argc, argv, usage);
+#else
+    std::cout << "Test skipped, it needs Alberta!" << std::endl;
+    return 77;
+#endif
+}
diff --git a/test/implicit/1p/test_cc1p2d3d.input b/test/implicit/1p/test_cc1p2d3d.input
new file mode 100644
index 0000000000..639070c93a
--- /dev/null
+++ b/test/implicit/1p/test_cc1p2d3d.input
@@ -0,0 +1,21 @@
+[TimeManager]
+DtInitial = 1 # [s]
+TEnd = 1 # [s]
+
+[Grid]
+File = ./grids/test_1p_2d3d.dgf
+
+[Problem]
+Name = 1ptestcc2d3d # name passed to the output routines
+
+[SpatialParams]
+LensLowerLeftX = 0.2 # [m]
+LensLowerLeftY = 0.2 # [m]
+LensLowerLeftZ = 0.2 # [m]
+LensUpperRightX = 0.8 # [m]
+LensUpperRightY = 0.8 # [m]
+LensUpperRightZ = 0.8 # [m]
+
+Permeability = 1e-10 # [m^2]
+PermeabilityLens = 1e-12 # [m^2]
+
diff --git a/test/implicit/2p/lensspatialparams.hh b/test/implicit/2p/lensspatialparams.hh
index c8dc33db3c..b57d99c867 100644
--- a/test/implicit/2p/lensspatialparams.hh
+++ b/test/implicit/2p/lensspatialparams.hh
@@ -183,7 +183,7 @@ public:
 private:
     bool isInLens_(const GlobalPosition &globalPos) const
     {
-        for (int i = 0; i < dim; ++i) {
+        for (int i = 0; i < dimWorld; ++i) {
             if (globalPos[i] < lensLowerLeft_[i] || globalPos[i] > lensUpperRight_[i])
                 return false;
         }
diff --git a/test/implicit/2p2c/injectionspatialparams.hh b/test/implicit/2p2c/injectionspatialparams.hh
index e8220bfe40..1a4c8da831 100644
--- a/test/implicit/2p2c/injectionspatialparams.hh
+++ b/test/implicit/2p2c/injectionspatialparams.hh
@@ -228,7 +228,7 @@ public:
 
 private:
     bool isFineMaterial_(const GlobalPosition &globalPos) const
-    { return globalPos[dim-1] > layerBottom_; }
+    { return globalPos[dimWorld-1] > layerBottom_; }
 
     Scalar fineK_;
     Scalar coarseK_;
diff --git a/test/implicit/2p2c/waterairspatialparams.hh b/test/implicit/2p2c/waterairspatialparams.hh
index e091f5da52..61d9c1b0d2 100644
--- a/test/implicit/2p2c/waterairspatialparams.hh
+++ b/test/implicit/2p2c/waterairspatialparams.hh
@@ -222,7 +222,7 @@ public:
 
 private:
     bool isFineMaterial_(const GlobalPosition &globalPos) const
-    { return globalPos[dim-1] > layerBottom_; }
+    { return globalPos[dimWorld-1] > layerBottom_; }
 
     Scalar fineK_;
     Scalar coarseK_;
diff --git a/test/implicit/co2/heterogeneousproblem.hh b/test/implicit/co2/heterogeneousproblem.hh
index 3711137b91..e816c7f38f 100644
--- a/test/implicit/co2/heterogeneousproblem.hh
+++ b/test/implicit/co2/heterogeneousproblem.hh
@@ -483,7 +483,7 @@ private:
         Scalar temp = temperature_(globalPos);
         Scalar densityW = FluidSystem::Brine::liquidDensity(temp, 1e7);
 
-        Scalar pl =  1e5 - densityW*this->gravity()[dim-1]*(depthBOR_ - globalPos[dim-1]);
+        Scalar pl =  1e5 - densityW*this->gravity()[dimWorld-1]*(depthBOR_ - globalPos[dimWorld-1]);
         Scalar moleFracLiquidCO2 = 0.00;
         Scalar moleFracLiquidBrine = 1.0 - moleFracLiquidCO2;
 
@@ -504,7 +504,7 @@ private:
 
     Scalar temperature_(const GlobalPosition globalPos) const
     {
-        Scalar T = 283.0 + (depthBOR_ - globalPos[dim-1])*0.03; 
+        Scalar T = 283.0 + (depthBOR_ - globalPos[dimWorld-1])*0.03; 
         return T;
     }
 
diff --git a/test/implicit/co2ni/heterogeneousproblemni.hh b/test/implicit/co2ni/heterogeneousproblemni.hh
index cc4c7af46d..548f2f647a 100644
--- a/test/implicit/co2ni/heterogeneousproblemni.hh
+++ b/test/implicit/co2ni/heterogeneousproblemni.hh
@@ -507,7 +507,7 @@ private:
         Scalar temp = temperature_(globalPos);
         Scalar densityW = FluidSystem::Brine::liquidDensity(temp, 1e7);
 
-        Scalar pl =  1e5 - densityW*this->gravity()[dim-1]*(depthBOR_ - globalPos[dim-1]);
+        Scalar pl =  1e5 - densityW*this->gravity()[dimWorld-1]*(depthBOR_ - globalPos[dimWorld-1]);
         Scalar moleFracLiquidCO2 = 0.00;
         Scalar moleFracLiquidBrine = 1.0 - moleFracLiquidCO2;
 
@@ -528,7 +528,7 @@ private:
 
     Scalar temperature_(const GlobalPosition globalPos) const
     {
-        Scalar T = 283.0 + (depthBOR_ - globalPos[dim-1])*0.03; 
+        Scalar T = 283.0 + (depthBOR_ - globalPos[dimWorld-1])*0.03; 
         return T;
     }
 
diff --git a/test/implicit/mpnc/combustionproblem1c.hh b/test/implicit/mpnc/combustionproblem1c.hh
index 396a371ba2..c738e9f47d 100644
--- a/test/implicit/mpnc/combustionproblem1c.hh
+++ b/test/implicit/mpnc/combustionproblem1c.hh
@@ -240,7 +240,7 @@ class CombustionProblemOneComponent: public ImplicitPorousMediaProblem<TypeTag>
 
 	typedef std::vector<Dune::FieldVector<Scalar, 1> > ScalarBuffer;
 	typedef std::array<ScalarBuffer, numPhases> PhaseBuffer;
-	typedef Dune::FieldVector<Scalar, dim> VelocityVector;
+	typedef Dune::FieldVector<Scalar, dimWorld> VelocityVector;
 	typedef Dune::BlockVector<VelocityVector> VelocityField;
 	typedef std::array<VelocityField, numPhases> PhaseVelocityField;
 
@@ -745,13 +745,13 @@ private:
 	 * \brief Give back whether the tested position (input) is a specific region (down, (gravityDir)) in the domain
 	 */
 	bool onLowerBoundary_(const GlobalPosition & globalPos) const
-	{	return globalPos[dim-1] < this->bBoxMin()[dim-1] + eps_;}
+	{	return globalPos[dimWorld-1] < this->bBoxMin()[dimWorld-1] + eps_;}
 
 	/*!
 	 * \brief Give back whether the tested position (input) is a specific region (up, (gravityDir)) in the domain
 	 */
 	bool onUpperBoundary_(const GlobalPosition & globalPos) const
-	{	return globalPos[dim-1] > this->bBoxMax()[dim-1] - eps_;}
+	{	return globalPos[dimWorld-1] > this->bBoxMax()[dimWorld-1] - eps_;}
 
 private:
 	Scalar eps_;
diff --git a/test/implicit/mpnc/evaporationatmosphereproblem.hh b/test/implicit/mpnc/evaporationatmosphereproblem.hh
index 57fbc24e32..cae13aa452 100644
--- a/test/implicit/mpnc/evaporationatmosphereproblem.hh
+++ b/test/implicit/mpnc/evaporationatmosphereproblem.hh
@@ -645,7 +645,7 @@ private:
         }
         else
             DUNE_THROW(Dune::InvalidStateException,
-                       "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+                       "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
 
         for (int i = 0; i < numPhases - 1; ++i)
             priVars[S0Idx + i] = S[i];
@@ -682,7 +682,7 @@ private:
             p[wPhaseIdx] = pnInitial_  ;
         }
         else
-            DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+            DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
         
         if(pressureFormulation == mostWettingFirst){
             // This means that the pressures are sorted from the most wetting to the least wetting-1 in the primary variables vector.
@@ -729,7 +729,7 @@ private:
                         priVars[conti00EqIdx + offset] = dryFluidState.moleFraction(phaseIdx,compIdx) ;
                     }
                     else
-                        DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+                        DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
                 }
             }
         }
@@ -772,13 +772,13 @@ private:
      * \brief Give back whether the tested position (input) is a specific region (down, (gravityDir)) in the domain
      */
     bool onLowerBoundary_(const GlobalPosition & globalPos) const
-    {        return globalPos[dim-1] < this->bBoxMin()[dim-1] + eps_;    }
+    {        return globalPos[dimWorld-1] < this->bBoxMin()[dimWorld-1] + eps_;    }
 
     /*!
      * \brief Give back whether the tested position (input) is a specific region (up, (gravityDir)) in the domain
      */
     bool onUpperBoundary_(const GlobalPosition & globalPos) const
-    {        return globalPos[dim-1] > this->bBoxMax()[dim-1] - eps_;    }
+    {        return globalPos[dimWorld-1] > this->bBoxMax()[dimWorld-1] - eps_;    }
 
 private:
     Scalar eps_;
diff --git a/test/implicit/mpnc/evaporationatmospherespatialparams.hh b/test/implicit/mpnc/evaporationatmospherespatialparams.hh
index 8b704fdeaf..66dd5b5021 100644
--- a/test/implicit/mpnc/evaporationatmospherespatialparams.hh
+++ b/test/implicit/mpnc/evaporationatmospherespatialparams.hh
@@ -335,7 +335,7 @@ public:
         else if (inPM_(globalPos))
             return intrinsicPermeabilityPM_ ;
         else
-            DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+            DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
     }
 
     /*! \brief Return the porosity \f$[-]\f$ of the soil
@@ -358,7 +358,7 @@ public:
         else if (inPM_(globalPos))
             return porosityPM_ ;
         else
-            DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+            DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
     }
 
     /*!
@@ -389,7 +389,7 @@ public:
             return materialParamsFF_ ;
         else if (inPM_(globalPos))
             return materialParamsPM_ ;
-        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
     }
 
     /*!\brief Return a reference to the container object for the
@@ -409,7 +409,7 @@ public:
             return aWettingNonWettingSurfaceParamsFreeFlow_  ;
         else if (inPM_(globalPos))
             return aWettingNonWettingSurfaceParams_ ;
-        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
      }
 
     /*!\brief Return a reference to the container object for the
@@ -429,7 +429,7 @@ public:
             return aNonWettingSolidSurfaceParamsFreeFlow_  ;
         else if (inPM_(globalPos))
             return aNonWettingSolidSurfaceParams_ ;
-        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
      }
 
     /*!\brief Return the maximum capillary pressure for the given pc-Sw curve
@@ -469,7 +469,7 @@ public:
             return characteristicLengthFF_ ;
         else if (inPM_(globalPos))
             return characteristicLengthPM_ ;
-        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
     }
 
     /*!\brief Return the pre factor the the energy transfer
@@ -492,7 +492,7 @@ public:
             return factorEnergyTransfer_ ;
         else if (inPM_(globalPos))
             return factorEnergyTransfer_ ;
-        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
     }
 
     /*!\brief Return the pre factor for the mass transfer
@@ -515,7 +515,7 @@ public:
             return factorMassTransfer_ ;
         else if (inPM_(globalPos))
             return factorMassTransfer_ ;
-        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dim-1]);
+        else             DUNE_THROW(Dune::InvalidStateException, "You should not be here: x=" << globalPos[0] << " y= "<< globalPos[dimWorld-1]);
     }
 
 
@@ -558,7 +558,7 @@ public:
      * -> be careful with neumannAtPos
      */
     const bool inPM_(const GlobalPosition & globalPos) const
-    {       return ( (globalPos[dim-1] > 0. - 1e-6) and (globalPos[dim-1] < (heightPM_ + 1e-6 ) ) );   }
+    {       return ( (globalPos[dimWorld-1] > 0. - 1e-6) and (globalPos[dimWorld-1] < (heightPM_ + 1e-6 ) ) );   }
 
     /*!
      * \brief Give back whether the tested position (input) is a specific region (above PM / "free flow") in the domain
@@ -572,7 +572,7 @@ public:
      * -> be careful with neumannAtPos
      */
     const bool inFF_(const GlobalPosition & globalPos) const
-    {       return ( (globalPos[dim-1] < heightDomain_ + 1e-6) and (globalPos[dim-1] > (heightPM_ + 1e-6) ) );   }
+    {       return ( (globalPos[dimWorld-1] < heightDomain_ + 1e-6) and (globalPos[dimWorld-1] > (heightPM_ + 1e-6) ) );   }
 
     /*!
      * \brief Give back whether the tested position (input) is a specific region (above PM / "free flow") in the domain
@@ -586,7 +586,7 @@ public:
      * -> be careful with neumannAtPos
      */
     const bool inInjection_(const GlobalPosition & globalPos) const
-    {       return ( (globalPos[dim-1] < heightDomain_ - 0.25*heightDomain_  + 1e-6) and (globalPos[dim-1] > (heightPM_ + 1e-6) ) );   }
+    {       return ( (globalPos[dimWorld-1] < heightDomain_ - 0.25*heightDomain_  + 1e-6) and (globalPos[dimWorld-1] > (heightPM_ + 1e-6) ) );   }
 
     /*! \brief access function for the depth / height of the porous medium */
     const Scalar heightPM() const
diff --git a/test/implicit/mpnc/forchheimer1pproblem.hh b/test/implicit/mpnc/forchheimer1pproblem.hh
index 138d297749..04ba9a5f3b 100644
--- a/test/implicit/mpnc/forchheimer1pproblem.hh
+++ b/test/implicit/mpnc/forchheimer1pproblem.hh
@@ -468,13 +468,13 @@ private:
      * \brief Give back whether the testes position (input) is a specific region (down, (gravityDir)) in the domain
      */
     bool onLowerBoundary_(const GlobalPosition &globalPos) const
-    {        return globalPos[dim-1] < this->bBoxMin()[dim-1] + eps_;    }
+    {        return globalPos[dimWorld-1] < this->bBoxMin()[dimWorld-1] + eps_;    }
 
     /*!
      * \brief Give back whether the testes position (input) is a specific region (up, (gravityDir)) in the domain
      */
     bool onUpperBoundary_(const GlobalPosition &globalPos) const
-    {        return globalPos[dim-1] > this->bBoxMax()[dim-1] - eps_;    }
+    {        return globalPos[dimWorld-1] > this->bBoxMax()[dimWorld-1] - eps_;    }
 
     Scalar temperature_;
     Scalar eps_;
diff --git a/test/implicit/richards/richardslensspatialparams.hh b/test/implicit/richards/richardslensspatialparams.hh
index 4fec0bcfe8..a62b9fb776 100644
--- a/test/implicit/richards/richardslensspatialparams.hh
+++ b/test/implicit/richards/richardslensspatialparams.hh
@@ -193,7 +193,7 @@ public:
 private:
     bool isInLens_(const GlobalPosition &globalPos) const
     {
-        for (int i = 0; i < dim; ++i) {
+        for (int i = 0; i < dimWorld; ++i) {
             if (globalPos[i] < lensLowerLeft_[i] || globalPos[i] > lensUpperRight_[i])
                 return false;
         }
diff --git a/test/references/1ptestbox1d3d-reference.vtp b/test/references/1ptestbox1d3d-reference.vtp
new file mode 100644
index 0000000000..7864527d13
--- /dev/null
+++ b/test/references/1ptestbox1d3d-reference.vtp
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<VTKFile type="PolyData" version="0.1" byte_order="LittleEndian">
+  <PolyData>
+    <Piece NumberOfLines="4" NumberOfPoints="5">
+      <PointData Scalars="p">
+        <DataArray type="Float32" Name="p" NumberOfComponents="1" format="ascii">
+          200000 182416 150000 117584 100000
+        </DataArray>
+        <DataArray type="Float32" Name="K" NumberOfComponents="1" format="ascii">
+          1e-10 1e-12 1e-12 1e-12 1e-10
+        </DataArray>
+      </PointData>
+      <CellData Scalars="process rank">
+        <DataArray type="Float32" Name="process rank" NumberOfComponents="1" format="ascii">
+          0 0 0 0
+        </DataArray>
+      </CellData>
+      <Points>
+        <DataArray type="Float32" Name="Coordinates" NumberOfComponents="3" format="ascii">
+          0 0 0 0.25 0.25 0.25 0.5 0.5 0.5 0.75 0.75 0.75
+          1 1 1
+        </DataArray>
+      </Points>
+      <Lines>
+        <DataArray type="Int32" Name="connectivity" NumberOfComponents="1" format="ascii">
+          0 1 1 2 2 3 3 4
+        </DataArray>
+        <DataArray type="Int32" Name="offsets" NumberOfComponents="1" format="ascii">
+          2 4 6 8
+        </DataArray>
+      </Lines>
+    </Piece>
+  </PolyData>
+</VTKFile>
diff --git a/test/references/1ptestbox2d3d-reference.vtu b/test/references/1ptestbox2d3d-reference.vtu
new file mode 100644
index 0000000000..bf40f01a93
--- /dev/null
+++ b/test/references/1ptestbox2d3d-reference.vtu
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
+  <UnstructuredGrid>
+    <Piece NumberOfCells="8" NumberOfPoints="9">
+      <PointData Scalars="p">
+        <DataArray type="Float32" Name="p" NumberOfComponents="1" format="ascii">
+          200000 200000 150000 150000 200000 150000 100000 100000 100000
+        </DataArray>
+        <DataArray type="Float32" Name="K" NumberOfComponents="1" format="ascii">
+          1e-10 1e-10 1e-12 1e-10 1e-10 1e-10 1e-10 1e-10 1e-10
+        </DataArray>
+      </PointData>
+      <CellData Scalars="process rank">
+        <DataArray type="Float32" Name="process rank" NumberOfComponents="1" format="ascii">
+          0 0 0 0 0 0 0 0
+        </DataArray>
+      </CellData>
+      <Points>
+        <DataArray type="Float32" Name="Coordinates" NumberOfComponents="3" format="ascii">
+          0 0 0 0.5 0 0 0.5 0.5 0.5 0 0.5 0.5
+          1 0 0 1 0.5 0.5 0 1 1 0.5 1 1
+          1 1 1
+        </DataArray>
+      </Points>
+      <Cells>
+        <DataArray type="Int32" Name="connectivity" NumberOfComponents="1" format="ascii">
+          0 1 2 0 2 3 1 4 2 4 5 2
+          3 2 6 2 7 6 2 5 8 2 8 7
+        </DataArray>
+        <DataArray type="Int32" Name="offsets" NumberOfComponents="1" format="ascii">
+          3 6 9 12 15 18 21 24
+        </DataArray>
+        <DataArray type="UInt8" Name="types" NumberOfComponents="1" format="ascii">
+          5 5 5 5 5 5 5 5
+        </DataArray>
+      </Cells>
+    </Piece>
+  </UnstructuredGrid>
+</VTKFile>
diff --git a/test/references/1ptestcc1d3d-reference.vtp b/test/references/1ptestcc1d3d-reference.vtp
new file mode 100644
index 0000000000..b4cfb0c08e
--- /dev/null
+++ b/test/references/1ptestcc1d3d-reference.vtp
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<VTKFile type="PolyData" version="0.1" byte_order="LittleEndian">
+  <PolyData>
+    <Piece NumberOfLines="4" NumberOfPoints="5">
+      <CellData Scalars="p">
+        <DataArray type="Float32" Name="p" NumberOfComponents="1" format="ascii">
+          198550 173550 126449 101449
+        </DataArray>
+        <DataArray type="Float32" Name="K" NumberOfComponents="1" format="ascii">
+          1e-10 1e-12 1e-12 1e-10
+        </DataArray>
+        <DataArray type="Float32" Name="process rank" NumberOfComponents="1" format="ascii">
+          0 0 0 0
+        </DataArray>
+      </CellData>
+      <Points>
+        <DataArray type="Float32" Name="Coordinates" NumberOfComponents="3" format="ascii">
+          0 0 0 0.25 0.25 0.25 0.5 0.5 0.5 0.75 0.75 0.75
+          1 1 1
+        </DataArray>
+      </Points>
+      <Lines>
+        <DataArray type="Int32" Name="connectivity" NumberOfComponents="1" format="ascii">
+          0 1 1 2 2 3 3 4
+        </DataArray>
+        <DataArray type="Int32" Name="offsets" NumberOfComponents="1" format="ascii">
+          2 4 6 8
+        </DataArray>
+      </Lines>
+    </Piece>
+  </PolyData>
+</VTKFile>
diff --git a/test/references/1ptestcc2d3d-reference.vtu b/test/references/1ptestcc2d3d-reference.vtu
new file mode 100644
index 0000000000..cd2f26c53c
--- /dev/null
+++ b/test/references/1ptestcc2d3d-reference.vtu
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
+  <UnstructuredGrid>
+    <Piece NumberOfCells="8" NumberOfPoints="9">
+      <CellData Scalars="p">
+        <DataArray type="Float32" Name="p" NumberOfComponents="1" format="ascii">
+          180435 167391 180435 167391 132609 119565 132609 119565
+        </DataArray>
+        <DataArray type="Float32" Name="K" NumberOfComponents="1" format="ascii">
+          1e-10 1e-10 1e-10 1e-10 1e-10 1e-10 1e-10 1e-10
+        </DataArray>
+        <DataArray type="Float32" Name="process rank" NumberOfComponents="1" format="ascii">
+          0 0 0 0 0 0 0 0
+        </DataArray>
+      </CellData>
+      <Points>
+        <DataArray type="Float32" Name="Coordinates" NumberOfComponents="3" format="ascii">
+          0 0 0 0.5 0 0 0.5 0.5 0.5 0 0.5 0.5
+          1 0 0 1 0.5 0.5 0 1 1 0.5 1 1
+          1 1 1
+        </DataArray>
+      </Points>
+      <Cells>
+        <DataArray type="Int32" Name="connectivity" NumberOfComponents="1" format="ascii">
+          0 1 2 0 2 3 1 4 2 4 5 2
+          3 2 6 2 7 6 2 5 8 2 8 7
+        </DataArray>
+        <DataArray type="Int32" Name="offsets" NumberOfComponents="1" format="ascii">
+          3 6 9 12 15 18 21 24
+        </DataArray>
+        <DataArray type="UInt8" Name="types" NumberOfComponents="1" format="ascii">
+          5 5 5 5 5 5 5 5
+        </DataArray>
+      </Cells>
+    </Piece>
+  </UnstructuredGrid>
+</VTKFile>
-- 
GitLab