From 558537b592238ee077ec8add72688bdc74486d52 Mon Sep 17 00:00:00 2001
From: Benjamin Faigle <benjamin.faigle@posteo.de>
Date: Thu, 26 Jan 2012 17:31:57 +0000
Subject: [PATCH] change arguments in spatial parameters correct minor bug in
 fluidstate reduce calls to pressure vector

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7527 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/decoupled/2p2c/2p2cproperties.hh        |   4 +
 dumux/decoupled/2p2c/cellData2p2c.hh          |   8 +-
 dumux/decoupled/2p2c/dec2p2cfluidstate.hh     |   2 +-
 dumux/decoupled/2p2c/fluxData2p2c.hh          | 145 ++++++++++++++++++
 dumux/decoupled/2p2c/fvpressure2p2c.hh        |  57 +++----
 .../2p2c/fvpressure2p2cmultiphysics.hh        |  29 ++--
 .../decoupled/2p2c/fvpressurecompositional.hh |  32 ++--
 dumux/decoupled/2p2c/fvtransport2p2c.hh       |  35 ++---
 .../2p2c/fvtransport2p2cmultiphysics.hh       |   2 +-
 dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh  |   4 +-
 .../2p2c/test_dec2p2c_spatialparams.hh        |  45 ++++--
 test/decoupled/2p2c/test_dec2p2cproblem.hh    |  27 ++--
 .../2p2c/test_multiphysics2p2cproblem.hh      |  14 +-
 13 files changed, 273 insertions(+), 131 deletions(-)
 create mode 100644 dumux/decoupled/2p2c/fluxData2p2c.hh

diff --git a/dumux/decoupled/2p2c/2p2cproperties.hh b/dumux/decoupled/2p2c/2p2cproperties.hh
index bebaadaa69..8e68eb2174 100644
--- a/dumux/decoupled/2p2c/2p2cproperties.hh
+++ b/dumux/decoupled/2p2c/2p2cproperties.hh
@@ -192,6 +192,10 @@ public:
     static const int wCompIdx = wPhaseIdx; //!< Component index equals phase index
     static const int nCompIdx = nPhaseIdx; //!< Component index equals phase index
 
+    // Ensure pressure fomrulation index coincides with FluidSystem
+    static const int pressureW = wPhaseIdx;
+    static const int pressureNW = nPhaseIdx;
+
     // Equation indices
     static const int pressureEqIdx = 0;
     static const int transportEqOffset = pressureEqIdx + 1; //!< Offset to access transport (mass conservation -) equations
diff --git a/dumux/decoupled/2p2c/cellData2p2c.hh b/dumux/decoupled/2p2c/cellData2p2c.hh
index 3487967527..87c4b8502b 100644
--- a/dumux/decoupled/2p2c/cellData2p2c.hh
+++ b/dumux/decoupled/2p2c/cellData2p2c.hh
@@ -152,9 +152,9 @@ public:
         return fluidState_->pressure(phaseIdx);
     }
 
-    void setPressure(int phaseIdx, Scalar press)
+    void setPressure(int phaseIdx, Scalar value)
     {
-        DUNE_THROW(Dune::NotImplemented,"setPressure function defined for compressible models!");
+        fluidState_->setPressure(phaseIdx, value);
     }
 
     //! Return saturation vector
@@ -162,6 +162,10 @@ public:
     {
         fluidState_->setMassConcentration(compIdx, value);
     }
+    void setMassConcentration(int compIdx, Scalar value)
+    {
+        fluidState_->setMassConcentration(compIdx, value);
+    }
 
     const Scalar totalConcentration(int compIdx) const
     {
diff --git a/dumux/decoupled/2p2c/dec2p2cfluidstate.hh b/dumux/decoupled/2p2c/dec2p2cfluidstate.hh
index 477c477d47..2a68270917 100644
--- a/dumux/decoupled/2p2c/dec2p2cfluidstate.hh
+++ b/dumux/decoupled/2p2c/dec2p2cfluidstate.hh
@@ -125,7 +125,7 @@ public:
         {
             nu_[nPhaseIdx] = 1; // only nPhase
             massFraction_[nPhaseIdx][wCompIdx] = Z1; // hence, assign complete mass soluted into nPhase
-            massFraction_[wPhaseIdx][nCompIdx] = 1. - massFraction_[wPhaseIdx][wCompIdx];
+            massFraction_[nPhaseIdx][nCompIdx] = 1. - massFraction_[nPhaseIdx][wCompIdx];
             // store as moleFractions
             moleFraction_[nPhaseIdx][wCompIdx] = ( massFraction_[nPhaseIdx][wCompIdx] / FluidSystem::molarMass(wCompIdx) );  // = moles of compIdx
             moleFraction_[nPhaseIdx][wCompIdx] /= ( massFraction_[nPhaseIdx][wCompIdx] / FluidSystem::molarMass(wCompIdx)
diff --git a/dumux/decoupled/2p2c/fluxData2p2c.hh b/dumux/decoupled/2p2c/fluxData2p2c.hh
new file mode 100644
index 0000000000..b28d8debcc
--- /dev/null
+++ b/dumux/decoupled/2p2c/fluxData2p2c.hh
@@ -0,0 +1,145 @@
+/*****************************************************************************
+ *   Copyright (C) 2011 by Markus Wolff                                      *
+ *   Institute of Hydraulic Engineering                                      *
+ *   University of Stuttgart, Germany                                        *
+ *   email: <givenname>.<name>@iws.uni-stuttgart.de                          *
+ *                                                                           *
+ *   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/>.   *
+ *****************************************************************************/
+#ifndef DUMUX_FLUXDATA2P2C_HH
+#define DUMUX_FLUXDATA2P2C_HH
+
+#include "2p2cproperties.hh"
+
+/**
+ * @file
+ * @brief  Class including the variables and data of discretized data of the constitutive relations
+ * @author Markus Wolff
+ */
+
+namespace Dumux
+{
+/*!
+ * \ingroup IMPES
+ */
+//! Class including the variables and data of discretized data of the constitutive relations.
+/*! The variables of two-phase flow, which are one pressure and one saturation are stored in this class.
+ * Additionally, a velocity needed in the transport part of the decoupled two-phase flow is stored, as well as discretized data of constitutive relationships like
+ * mobilities, fractional flow functions and capillary pressure. Thus, they have to be callculated just once in every time step or every iteration step.
+ *
+ * @tparam TypeTag The Type Tag
+ 1*/
+template<class TypeTag>
+class FluxData2P2C
+{
+private:
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
+    typedef typename GridView::IntersectionIterator IntersectionIterator;
+    typedef typename GridView::Traits::template Codim<0>::Entity Element;
+
+    enum
+    {
+        dim = GridView::dimension, dimWorld = GridView::dimensionworld
+    };
+
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(Indices)) Indices;
+
+    enum
+    {
+        wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx
+    };
+
+    enum
+    {
+        numEquations = GET_PROP_VALUE(TypeTag, PTAG(NumEq))
+    };
+
+    typename Dune::FieldVector<typename Dune::FieldVector<bool, numEquations>, (2 * dim)> isUpwindCell_;
+
+public:
+
+    //! Constructs a VariableClass object
+    /**
+     *  @param gridView a DUNE gridview object corresponding to diffusion and transport equation
+     */
+
+    FluxData2P2C()
+    {
+        for (int i = 0; i<2*dim; i++)
+        {
+            isUpwindCell_[i] = false;
+        }
+    }
+
+    /** functions returning upwind information **/
+    bool& isUpwindCell(int indexInInside, int equationIdx) const
+    {
+        return isUpwindCell_[indexInInside][equationIdx];
+    }
+
+    void setUpwindCell(int indexInInside, int equationIdx, bool value)
+    {
+        isUpwindCell_[indexInInside][equationIdx] = value;
+    }
+
+};
+}
+#endif
+
+
+/*** in transport module:
+ *     // upwind mobility
+    double lambdaW, lambdaNW;
+    if (potentialW >= 0.)
+    {
+        lambdaW = cellDataI.mobility(wPhaseIdx);
+        cellDataI.setUpwindCell(intersection.indexInInside(), contiWEqIdx, true);
+        cellDataJ.setUpwindCell(intersection.indexInOutside(), contiWEqIdx, false);
+    }
+    else
+    {
+        lambdaW = cellDataJ.mobility(wPhaseIdx);
+        cellDataJ.setUpwindCell(intersection.indexInOutside(), contiWEqIdx, true);
+        cellDataI.setUpwindCell(intersection.indexInInside(), contiWEqIdx, false);
+    }
+
+    if (potentialNW >= 0.)
+    {
+        lambdaNW = cellDataI.mobility(nPhaseIdx);
+        cellDataI.setUpwindCell(intersection.indexInInside(), contiNEqIdx, true);
+        cellDataJ.setUpwindCell(intersection.indexInOutside(), contiNEqIdx, false);
+    }
+    else
+    {
+        lambdaW = cellDataJ.mobility(nPhaseIdx);
+        cellDataJ.setUpwindCell(intersection.indexInOutside(), contiNEqIdx, true);
+        cellDataI.setUpwindCell(intersection.indexInInside(), contiNEqIdx, false);
+    }
+
+
+    in cellData:
+
+    //! Acess to flux data
+    bool& isUpwindCell(int indexInInside, int equationIdx) const
+    {
+        return fluxData_.isUpwindCell(indexInInside, equationIdx);
+    }
+
+    void setUpwindCell(int indexInInside, int equationIdx, bool value)
+    {
+        fluxData_.setUpwindCell(indexInInside, equationIdx, value);
+    }
+ */
+
diff --git a/dumux/decoupled/2p2c/fvpressure2p2c.hh b/dumux/decoupled/2p2c/fvpressure2p2c.hh
index 5b37c27579..381466ca41 100644
--- a/dumux/decoupled/2p2c/fvpressure2p2c.hh
+++ b/dumux/decoupled/2p2c/fvpressure2p2c.hh
@@ -252,7 +252,9 @@ void FVPressure2P2C<TypeTag>::getStorage(Dune::FieldVector<Scalar, 2>& storageEn
         Scalar compress_term = cellDataI.dv_dp() / timestep_;
 
         storageEntry[matrix] -= compress_term*volume;
-        storageEntry[rhs] -= this->pressure(globalIdxI) * compress_term * volume;
+        // cellData has data from last TS, and pressurType points to
+        // the pressure Index used as a Primary Variable
+        storageEntry[rhs] -= cellDataI.pressure(pressureType) * compress_term * volume;
 
         if (isnan(compress_term) || isinf(compress_term))
             DUNE_THROW(Dune::MathError, "Compressibility term leads to NAN matrix entry at index " << globalIdxI);
@@ -329,7 +331,7 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries,
     const GlobalPosition& gravity_ = problem().gravity();
 
     // get absolute permeability
-    FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(globalPos, *elementPointerI));
+    FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(*elementPointerI));
 
     // get mobilities and fractional flow factors
     Scalar fractionalWI=0, fractionalNWI=0;
@@ -365,8 +367,7 @@ void FVPressure2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries,
     unitDistVec /= dist;
 
     FieldMatrix permeabilityJ
-        = problem().spatialParameters().intrinsicPermeability(globalPosNeighbor,
-                                                                    *neighborPointer);
+        = problem().spatialParameters().intrinsicPermeability(*neighborPointer);
 
     // compute vectorized permeabilities
     FieldMatrix meanPermeability(0);
@@ -543,7 +544,6 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en
     // get global coordinate of cell center
     ElementPointer elementPointerI = intersection.inside();
     const GlobalPosition& globalPos = elementPointerI->geometry().center();
-    int globalIdxI = problem().variables().index(*elementPointerI);
 
     // get normal vector
     const GlobalPosition& unitOuterNormal = intersection.centerUnitOuterNormal();
@@ -575,7 +575,7 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en
     if (bcType.isDirichlet(Indices::pressureEqIdx))
     {
         // get absolute permeability
-        FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(globalPos, *elementPointerI));
+        FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(*elementPointerI));
         const GlobalPosition& gravity_ = problem().gravity();
 
         //permeability vector at boundary
@@ -640,10 +640,10 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en
             else if(GET_PROP_VALUE(TypeTag, BoundaryMobility) == Indices::permDependent)
             {
                 lambdaWBound
-                    = MaterialLaw::krw(problem().spatialParameters().materialLawParams(globalPos, *elementPointerI),
+                    = MaterialLaw::krw(problem().spatialParameters().materialLawParams(*elementPointerI),
                             BCfluidState.saturation(wPhaseIdx)) / viscosityWBound;
                 lambdaNWBound
-                    = MaterialLaw::krn(problem().spatialParameters().materialLawParams(globalPos, *elementPointerI),
+                    = MaterialLaw::krn(problem().spatialParameters().materialLawParams(*elementPointerI),
                             BCfluidState.saturation(wPhaseIdx)) / viscosityNWBound;
             }
             // get average density
@@ -667,18 +667,9 @@ void FVPressure2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& en
                 Scalar densityNW=rhoMeanNW;
 
                 //calculate potential gradient
-                if (pressureType == pw)
-                {
-                    potentialW = (this->pressure(globalIdxI) - pressBC[wPhaseIdx])/dist;
-                    potentialNW = (this->pressure(globalIdxI) + cellDataI.capillaryPressure()
-                                    - pressBC[wPhaseIdx] - pcBound)/dist;
-                }
-                else if (pressureType == pn)
-                {
-                    potentialW = (this->pressure(globalIdxI) - cellDataI.capillaryPressure()
-                            - pressBC[nPhaseIdx] + pcBound)/dist;
-                    potentialNW = (this->pressure(globalIdxI) - pressBC[nPhaseIdx])/dist;
-                }
+                potentialW = (cellDataI.pressure(wPhaseIdx) - pressBC[wPhaseIdx])/dist;
+                potentialNW = (cellDataI.pressure(nPhaseIdx) - pressBC[nPhaseIdx])/dist;
+
                 potentialW += densityW * (unitDistVec * gravity_);
                 potentialNW += densityNW * (unitDistVec * gravity_);
            }   //end !first
@@ -838,11 +829,11 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element
     // reset
     cellData.reset();
 
-    // make shure total concentrations from solution vector are exact in fluidstate
-    fluidState.setMassConcentration(wCompIdx,
-            problem().transportModel().totalConcentration(wCompIdx,globalIdx));
-    fluidState.setMassConcentration(nCompIdx,
-            problem().transportModel().totalConcentration(nCompIdx,globalIdx));
+//    // make shure total concentrations from solution vector are exact in fluidstate
+//    fluidState.setMassConcentration(wCompIdx,
+//            problem().transportModel().totalConcentration(wCompIdx,globalIdx));
+//    fluidState.setMassConcentration(nCompIdx,
+//            problem().transportModel().totalConcentration(nCompIdx,globalIdx));
     // get the overall mass of component 1 Z1 = C^k / (C^1+C^2) [-]
     Scalar Z1 = fluidState.massConcentration(wCompIdx)
             / (fluidState.massConcentration(wCompIdx)
@@ -898,13 +889,13 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element
     }
 
     //complete fluid state
-    fluidState.update(Z1, pressure, problem().spatialParameters().porosity(globalPos, elementI), temperature_);
+    fluidState.update(Z1, pressure, problem().spatialParameters().porosity(elementI), temperature_);
 
     // iterations part in case of enabled capillary pressure
     Scalar pc(0.), oldPc(0.);
     if(GET_PROP_VALUE(TypeTag, EnableCapillarity))
     {
-        pc = MaterialLaw::pC(problem().spatialParameters().materialLawParams(globalPos, elementI),
+        pc = MaterialLaw::pC(problem().spatialParameters().materialLawParams(elementI),
                 fluidState.saturation(wPhaseIdx));
         int maxiter = 5; int iterout = -1;
         //start iteration loop
@@ -930,9 +921,9 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element
             //store old pc
             oldPc = pc;
             //update with better pressures
-            fluidState.update(Z1, pressure, problem().spatialParameters().porosity(globalPos, elementI),
+            fluidState.update(Z1, pressure, problem().spatialParameters().porosity(elementI),
                                 problem().temperatureAtPos(globalPos));
-            pc = MaterialLaw::pC(problem().spatialParameters().materialLawParams(globalPos, elementI),
+            pc = MaterialLaw::pC(problem().spatialParameters().materialLawParams(elementI),
                                 fluidState.saturation(wPhaseIdx));
             // TODO: get right criterion, do output for evaluation
             //converge criterion
@@ -948,9 +939,9 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element
     cellData.setViscosity(nPhaseIdx, FluidSystem::viscosity(fluidState, nPhaseIdx));
 
     // initialize mobilities
-    cellData.setMobility(wPhaseIdx, MaterialLaw::krw(problem().spatialParameters().materialLawParams(globalPos, elementI), fluidState.saturation(wPhaseIdx))
+    cellData.setMobility(wPhaseIdx, MaterialLaw::krw(problem().spatialParameters().materialLawParams(elementI), fluidState.saturation(wPhaseIdx))
                 / cellData.viscosity(wPhaseIdx));
-    cellData.setMobility(nPhaseIdx, MaterialLaw::krn(problem().spatialParameters().materialLawParams(globalPos, elementI), fluidState.saturation(wPhaseIdx))
+    cellData.setMobility(nPhaseIdx, MaterialLaw::krn(problem().spatialParameters().materialLawParams(elementI), fluidState.saturation(wPhaseIdx))
                 / cellData.viscosity(nPhaseIdx));
 
     // determine volume mismatch between actual fluid volume and pore volume
@@ -964,7 +955,7 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element
     Scalar vol = massw / cellData.density(wPhaseIdx) + massn / cellData.density(nPhaseIdx);
     if (problem().timeManager().timeStepSize() != 0)
     {
-        cellData.volumeError()=(vol - problem().spatialParameters().porosity(globalPos, elementI));
+        cellData.volumeError()=(vol - problem().spatialParameters().porosity(elementI));
 
         if (std::isnan(cellData.volumeError()))
         {
@@ -972,7 +963,7 @@ void FVPressure2P2C<TypeTag>::updateMaterialLawsInElement(const Element& element
                     << "volErr[" << globalIdx << "] isnan: vol = " << vol
                     << ", massw = " << massw << ", rho_l = " << cellData.density(wPhaseIdx)
                     << ", massn = " << massn << ", rho_g = " << cellData.density(nPhaseIdx)
-                    << ", poro = " << problem().spatialParameters().porosity(globalPos, elementI)
+                    << ", poro = " << problem().spatialParameters().porosity(elementI)
                     << ", dt = " << problem().timeManager().timeStepSize());
         }
     }
diff --git a/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh b/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh
index 32ba56ed0c..d8d7144bee 100644
--- a/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh
+++ b/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh
@@ -319,7 +319,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pStorage(Dune::FieldVector<Scalar,
         Scalar incp = 1e-2;
 
         // numerical derivative of fluid volume with respect to pressure
-        Scalar p_ = this->pressure(globalIdxI) + incp;
+        Scalar p_ = cellDataI.pressure(pressureType) + incp;
         Scalar sumC = (cellDataI.massConcentration(wCompIdx) + cellDataI.massConcentration(nCompIdx));
         Scalar Z1 = cellDataI.massConcentration(wCompIdx) / sumC;
         // initialize simple fluidstate object
@@ -351,7 +351,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pStorage(Dune::FieldVector<Scalar,
         Scalar compress_term = cellDataI.dv_dp() / timestep_;
 
         storageEntry[0] -= compress_term*volume;
-        storageEntry[1] -= this->pressure(globalIdxI) * compress_term * volume;
+        storageEntry[1] -= cellDataI.pressure(pressureType) * compress_term * volume;
 
         if (isnan(compress_term) || isinf(compress_term))
             DUNE_THROW(Dune::MathError, "Compressibility term leads to NAN matrix entry at index " << globalIdxI);
@@ -404,10 +404,10 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFlux(Dune::FieldVector<Scalar, 2>
     const GlobalPosition& globalPos = elementPointerI->geometry().center();
 
     // cell index
-    int globalIdxI = problem().variables().index(*elementPointerI);
+//    int globalIdxI = problem().variables().index(*elementPointerI);
 
     // get absolute permeability
-    FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(globalPos, *elementPointerI));
+    FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(*elementPointerI));
 
     // get normal vector
     const GlobalPosition& unitOuterNormal = intersection.centerUnitOuterNormal();
@@ -433,8 +433,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFlux(Dune::FieldVector<Scalar, 2>
         unitDistVec /= dist;
 
         FieldMatrix permeabilityJ
-            = problem().spatialParameters().intrinsicPermeability(globalPosNeighbor,
-                                                                    *neighborPointer);
+            = problem().spatialParameters().intrinsicPermeability(*neighborPointer);
 
         // compute vectorized permeabilities
         FieldMatrix meanPermeability(0);
@@ -453,7 +452,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFlux(Dune::FieldVector<Scalar, 2>
         Scalar density = 0;
 
         // 1p => no pC => only 1 pressure, potential
-        Scalar potential = (this->pressure(globalIdxI) - this->pressure(globalIdxJ)) / dist;
+        Scalar potential = (cellDataI.pressure(phaseIdx) - cellDataJ.pressure(phaseIdx)) / dist;
 
         potential += rhoMean * (unitDistVec * gravity_);
 
@@ -484,7 +483,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFluxOnBoundary(Dune::FieldVector<
     // get global coordinate of cell center
     ElementPointer elementPointerI = intersection.inside();
     const GlobalPosition& globalPos = elementPointerI->geometry().center();
-    int globalIdxI = problem().variables().index(*elementPointerI);
+//    int globalIdxI = problem().variables().index(*elementPointerI);
     int phaseIdx = cellDataI.subdomain();
 
     // get normal vector
@@ -512,7 +511,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFluxOnBoundary(Dune::FieldVector<
                 if (bcType.isDirichlet(Indices::pressureEqIdx))
                 {
                     // get absolute permeability
-                    FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(globalPos, *elementPointerI));
+                    FieldMatrix permeabilityI(problem().spatialParameters().intrinsicPermeability(*elementPointerI));
                     // get mobilities and fractional flow factors
                     Scalar lambdaI = cellDataI.mobility(phaseIdx);
 
@@ -554,11 +553,11 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFluxOnBoundary(Dune::FieldVector<
                             {
                             if (phaseIdx == wPhaseIdx)
                                 lambdaBound = MaterialLaw::krw(
-                                    problem().spatialParameters().materialLawParams(globalPos, *elementPointerI), BCfluidState.saturation(wPhaseIdx))
+                                    problem().spatialParameters().materialLawParams(*elementPointerI), BCfluidState.saturation(wPhaseIdx))
                                     / viscosityBound;
                             else
                                 lambdaBound = MaterialLaw::krn(
-                                    problem().spatialParameters().materialLawParams(globalPos, *elementPointerI), BCfluidState.saturation(wPhaseIdx))
+                                    problem().spatialParameters().materialLawParams(*elementPointerI), BCfluidState.saturation(wPhaseIdx))
                                     / viscosityBound;
                             break;
                             }
@@ -568,7 +567,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::get1pFluxOnBoundary(Dune::FieldVector<
                         Scalar potential = 0;
 
                         //calculate potential gradient: pc = 0;
-                        potential = (this->pressure(globalIdxI) - pressBC[phaseIdx]) / dist;
+                        potential = (cellDataI.pressure(phaseIdx) - pressBC[phaseIdx]) / dist;
 
                         potential += rhoMean * (unitDistVec * gravity_);
 
@@ -725,11 +724,11 @@ void FVPressure2P2CMultiPhysics<TypeTag>::updateMaterialLaws()
             // initialize mobilities
             if(presentPhaseIdx == wPhaseIdx)
                 cellData.setMobility(wPhaseIdx,
-                    MaterialLaw::krw(problem().spatialParameters().materialLawParams(globalPos, *eIt), pseudoFluidState.saturation(wPhaseIdx))
+                    MaterialLaw::krw(problem().spatialParameters().materialLawParams(*eIt), pseudoFluidState.saturation(wPhaseIdx))
                         / cellData.viscosity(wPhaseIdx));
             else
                 cellData.setMobility(nPhaseIdx,
-                    MaterialLaw::krn(problem().spatialParameters().materialLawParams(globalPos, *eIt), pseudoFluidState.saturation(wPhaseIdx))
+                    MaterialLaw::krn(problem().spatialParameters().materialLawParams(*eIt), pseudoFluidState.saturation(wPhaseIdx))
                         / cellData.viscosity(nPhaseIdx));
 
             // error term handling
@@ -737,7 +736,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::updateMaterialLaws()
             vol = sumConc / pseudoFluidState.density(presentPhaseIdx);
 
             if (dt != 0)
-                cellData.volumeError() = (vol - problem().spatialParameters().porosity(globalPos, *eIt));
+                cellData.volumeError() = (vol - problem().spatialParameters().porosity(*eIt));
 
 
         }
diff --git a/dumux/decoupled/2p2c/fvpressurecompositional.hh b/dumux/decoupled/2p2c/fvpressurecompositional.hh
index d1e4f1cc61..8afa485484 100644
--- a/dumux/decoupled/2p2c/fvpressurecompositional.hh
+++ b/dumux/decoupled/2p2c/fvpressurecompositional.hh
@@ -270,8 +270,8 @@ public:
             // get position, index
             GlobalPosition globalPos = eIt->geometry().center();
             int globalIdx = problem_.variables().index(*eIt);
-            poro_[globalIdx] = problem_.spatialParameters().porosity(globalPos, *eIt);
-            perm_[globalIdx] = problem_.spatialParameters().intrinsicPermeability(globalPos, *eIt)[0][0];
+            poro_[globalIdx] = problem_.spatialParameters().porosity(*eIt);
+            perm_[globalIdx] = problem_.spatialParameters().intrinsicPermeability(*eIt)[0][0];
         }
         *poroPtr = poro_;
         *permPtr = perm_;
@@ -456,12 +456,12 @@ void FVPressureCompositional<TypeTag>::initialMaterialLaws(bool compositional)
             if (icFormulation == Indices::saturation)  // saturation initial condition
             {
                 sat_0 = problem_.initSat(*eIt);
-                fluidState.satFlash(sat_0, pressure, problem_.spatialParameters().porosity(globalPos, *eIt), temperature_);
+                fluidState.satFlash(sat_0, pressure, problem_.spatialParameters().porosity(*eIt), temperature_);
             }
             else if (icFormulation == Indices::concentration) // concentration initial condition
             {
                 Scalar Z1_0 = problem_.initConcentration(*eIt);
-                fluidState.update(Z1_0, pressure, problem_.spatialParameters().porosity(globalPos, *eIt), temperature_);
+                fluidState.update(Z1_0, pressure, problem_.spatialParameters().porosity(*eIt), temperature_);
             }
         }
         else if(compositional)    //means we regard compositional effects since we know an estimate pressure field
@@ -473,7 +473,7 @@ void FVPressureCompositional<TypeTag>::initialMaterialLaws(bool compositional)
                 Scalar pc=0.;
                 if(GET_PROP_VALUE(TypeTag, PTAG(EnableCapillarity)))
                 {
-                    pc = MaterialLaw::pC(problem_.spatialParameters().materialLawParams(globalPos, *eIt),
+                    pc = MaterialLaw::pC(problem_.spatialParameters().materialLawParams(*eIt),
                                     sat_0);
                 }
                 else
@@ -496,7 +496,7 @@ void FVPressureCompositional<TypeTag>::initialMaterialLaws(bool compositional)
                     }
                 }
 
-                fluidState.satFlash(sat_0, pressure, problem_.spatialParameters().porosity(globalPos, *eIt), temperature_);
+                fluidState.satFlash(sat_0, pressure, problem_.spatialParameters().porosity(*eIt), temperature_);
             }
             else if (icFormulation == Indices::concentration) // concentration initial condition
             {
@@ -534,16 +534,16 @@ void FVPressureCompositional<TypeTag>::initialMaterialLaws(bool compositional)
                         //store old pc
                         Scalar oldPc = pc;
                         //update with better pressures
-                        fluidState.update(Z1_0, pressure, problem_.spatialParameters().porosity(globalPos, *eIt),
+                        fluidState.update(Z1_0, pressure, problem_.spatialParameters().porosity(*eIt),
                                             problem_.temperatureAtPos(globalPos));
-                        pc = MaterialLaw::pC(problem_.spatialParameters().materialLawParams(globalPos, *eIt),
+                        pc = MaterialLaw::pC(problem_.spatialParameters().materialLawParams(*eIt),
                                             fluidState.saturation(wPhaseIdx));
                         // TODO: get right criterion, do output for evaluation
                         //converge criterion
                         if (abs(oldPc-pc)<10)
                             iter = maxiter;
 
-                        pc = MaterialLaw::pC(problem_.spatialParameters().materialLawParams(globalPos, *eIt),
+                        pc = MaterialLaw::pC(problem_.spatialParameters().materialLawParams(*eIt),
                                 fluidState.saturation(wPhaseIdx));
                     }
                 }
@@ -551,10 +551,10 @@ void FVPressureCompositional<TypeTag>::initialMaterialLaws(bool compositional)
                 {
                     pressure[wPhaseIdx] = pressure[nPhaseIdx]
                         = this->pressure()[globalIdx];
-                    fluidState.update(Z1_0, pressure, problem_.spatialParameters().porosity(globalPos, *eIt), temperature_);
+                    fluidState.update(Z1_0, pressure, problem_.spatialParameters().porosity(*eIt), temperature_);
                 }
 
-                fluidState.calculateMassConcentration(problem_.spatialParameters().porosity(globalPos, *eIt));
+                fluidState.calculateMassConcentration(problem_.spatialParameters().porosity(*eIt));
 
             } //end conc initial condition
         } //end compositional
@@ -566,9 +566,9 @@ void FVPressureCompositional<TypeTag>::initialMaterialLaws(bool compositional)
         cellData.setViscosity(nPhaseIdx, FluidSystem::viscosity(fluidState, nPhaseIdx));
 
         // initialize mobilities
-        cellData.setMobility(wPhaseIdx, MaterialLaw::krw(problem_.spatialParameters().materialLawParams(globalPos, *eIt), fluidState.saturation(wPhaseIdx))
+        cellData.setMobility(wPhaseIdx, MaterialLaw::krw(problem_.spatialParameters().materialLawParams(*eIt), fluidState.saturation(wPhaseIdx))
                     / cellData.viscosity(wPhaseIdx));
-        cellData.setMobility(nPhaseIdx, MaterialLaw::krn(problem_.spatialParameters().materialLawParams(globalPos, *eIt), fluidState.saturation(wPhaseIdx))
+        cellData.setMobility(nPhaseIdx, MaterialLaw::krn(problem_.spatialParameters().materialLawParams(*eIt), fluidState.saturation(wPhaseIdx))
                     / cellData.viscosity(nPhaseIdx));
 
         // calculate perimeter used as weighting factor
@@ -663,7 +663,7 @@ void FVPressureCompositional<TypeTag>::volumeDerivatives(const GlobalPosition& g
     p_ += pressure;
     Scalar Z1 = mass[0] / mass.one_norm();
     updFluidState.update(Z1,
-            p_, problem_.spatialParameters().porosity(globalPos, element), temperature_);
+            p_, problem_.spatialParameters().porosity(element), temperature_);
 
     specificVolume=0.; // = \sum_{\alpha} \nu_{\alpha} / \rho_{\alpha}
     for(int phaseIdx = 0; phaseIdx< numPhases; phaseIdx++)
@@ -678,7 +678,7 @@ void FVPressureCompositional<TypeTag>::volumeDerivatives(const GlobalPosition& g
 
         p_ -= 2*incp;
         updFluidState.update(Z1,
-                    p_, problem_.spatialParameters().porosity(globalPos, element), temperature_);
+                    p_, problem_.spatialParameters().porosity(element), temperature_);
 
         specificVolume=0.; // = \sum_{\alpha} \nu_{\alpha} / \rho_{\alpha}
         for(int phaseIdx = 0; phaseIdx< numPhases; phaseIdx++)
@@ -697,7 +697,7 @@ void FVPressureCompositional<TypeTag>::volumeDerivatives(const GlobalPosition& g
     {
         mass[comp] +=  massIncrement[comp];
         Z1 = mass[0] / mass.one_norm();
-        updFluidState.update(Z1, pressure, problem_.spatialParameters().porosity(globalPos, element), temperature_);
+        updFluidState.update(Z1, pressure, problem_.spatialParameters().porosity(element), temperature_);
 
         specificVolume=0.; // = \sum_{\alpha} \nu_{\alpha} / \rho_{\alpha}
         for(int phaseIdx = 0; phaseIdx< numPhases; phaseIdx++)
diff --git a/dumux/decoupled/2p2c/fvtransport2p2c.hh b/dumux/decoupled/2p2c/fvtransport2p2c.hh
index 261349dac8..29e8c528a8 100644
--- a/dumux/decoupled/2p2c/fvtransport2p2c.hh
+++ b/dumux/decoupled/2p2c/fvtransport2p2c.hh
@@ -288,7 +288,7 @@ void FVTransport2P2C<TypeTag>::update(const Scalar t, Scalar& dt, TransportSolut
 
         // account for porosity
         sumfactorin = std::max(sumfactorin,sumfactorout)
-                        / problem().spatialParameters().porosity(globalPos, *eIt);
+                        / problem().spatialParameters().porosity(*eIt);
 
         if ( 1./sumfactorin < dt)
         {
@@ -312,7 +312,7 @@ void FVTransport2P2C<TypeTag>::updateTransportedQuantity(TransportSolutionType&
         for(int compIdx = 0; compIdx < GET_PROP_VALUE(TypeTag, NumComponents); compIdx++)
         {
             totalConcentration_[compIdx][i] += (updateVector[compIdx][i]*=dt);
-            cellDataI.setTotalConcentration(wCompIdx, totalConcentration_[compIdx][i]);
+            cellDataI.setTotalConcentration(compIdx, totalConcentration_[compIdx][i]);
         }
     }
 }
@@ -336,13 +336,13 @@ void FVTransport2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& fluxEntries
     // get values of cell I
     Scalar pressI = problem().pressureModel().pressure(globalIdxI);
     Scalar pcI = cellDataI.capillaryPressure();
-    Dune::FieldMatrix<Scalar,dim,dim> K_I(problem().spatialParameters().intrinsicPermeability(globalPos, *elementI));
+    Dune::FieldMatrix<Scalar,dim,dim> K_I(problem().spatialParameters().intrinsicPermeability(*elementI));
 
     Scalar SwmobI = std::max((cellDataI.saturation(wPhaseIdx)
-                            - problem().spatialParameters().materialLawParams(globalPos, *elementI).Swr())
+                            - problem().spatialParameters().materialLawParams(*elementI).Swr())
                             , 1e-2);
     Scalar SnmobI = std::max((cellDataI.saturation(nPhaseIdx)
-                                - problem().spatialParameters().materialLawParams(globalPos, *elementI).Snr())
+                                - problem().spatialParameters().materialLawParams(*elementI).Snr())
                             , 1e-2);
 
     Scalar densityWI (0.), densityNWI(0.);
@@ -409,8 +409,7 @@ void FVTransport2P2C<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& fluxEntries
     Dune::FieldMatrix<Scalar,dim,dim> meanK_(0.);
     Dumux::harmonicMeanMatrix(meanK_,
             K_I,
-            problem().spatialParameters().intrinsicPermeability(globalPosNeighbor,
-                                                                *neighborPointer));
+            problem().spatialParameters().intrinsicPermeability(*neighborPointer));
     Dune::FieldVector<Scalar,dim> K(0);
     meanK_.umv(unitDistVec,K);
 
@@ -492,13 +491,13 @@ void FVTransport2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& f
     // get values of cell I
     Scalar pressI = problem().pressureModel().pressure(globalIdxI);
     Scalar pcI = cellDataI.capillaryPressure();
-    Dune::FieldMatrix<Scalar,dim,dim> K_I(problem().spatialParameters().intrinsicPermeability(globalPos, *elementI));
+    Dune::FieldMatrix<Scalar,dim,dim> K_I(problem().spatialParameters().intrinsicPermeability(*elementI));
 
     Scalar SwmobI = std::max((cellDataI.saturation(wPhaseIdx)
-                            - problem().spatialParameters().materialLawParams(globalPos, *elementI).Swr())
+                            - problem().spatialParameters().materialLawParams(*elementI).Swr())
                             , 1e-2);
     Scalar SnmobI = std::max((cellDataI.saturation(nPhaseIdx)
-                                - problem().spatialParameters().materialLawParams(globalPos, *elementI).Snr())
+                                - problem().spatialParameters().materialLawParams(*elementI).Snr())
                             , 1e-2);
 
     Scalar densityWI (0.), densityNWI(0.);
@@ -606,7 +605,7 @@ void FVTransport2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& f
                 lambdaW = BCfluidState.saturation(wPhaseIdx) / viscosityWBound;
             else
                 lambdaW = MaterialLaw::krw(
-                        problem().spatialParameters().materialLawParams(globalPos, *elementI), BCfluidState.saturation(wPhaseIdx))
+                        problem().spatialParameters().materialLawParams(*elementI), BCfluidState.saturation(wPhaseIdx))
                         / viscosityWBound;
             }
         if (potentialNW >= 0.)
@@ -617,7 +616,7 @@ void FVTransport2P2C<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& f
                 lambdaNW = BCfluidState.saturation(nPhaseIdx) / viscosityNWBound;
             else
                 lambdaNW = MaterialLaw::krn(
-                        problem().spatialParameters().materialLawParams(globalPos, *elementI), BCfluidState.saturation(wPhaseIdx))
+                        problem().spatialParameters().materialLawParams(*elementI), BCfluidState.saturation(wPhaseIdx))
                         / viscosityNWBound;
             }
         // calculate and standardized velocity
@@ -712,7 +711,7 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace,
         Scalar satBound = primaryVariablesOnBoundary[contiWEqIdx];
         if(GET_PROP_VALUE(TypeTag, EnableCapillarity))
         {
-            Scalar pcBound = MaterialLaw::pC(problem().spatialParameters().materialLawParams(globalPosFace, *eIt),
+            Scalar pcBound = MaterialLaw::pC(problem().spatialParameters().materialLawParams(*eIt),
                     satBound);
             switch (pressureType)
             {
@@ -734,7 +733,7 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace,
             pressBound[wPhaseIdx] = pressBound[nPhaseIdx] = primaryVariablesOnBoundary[Indices::pressureEqIdx];
 
 
-        BCfluidState.satFlash(satBound, pressBound, problem().spatialParameters().porosity(globalPosFace, *eIt),
+        BCfluidState.satFlash(satBound, pressBound, problem().spatialParameters().porosity(*eIt),
                             problem().temperatureAtPos(globalPosFace));
 
     }
@@ -743,12 +742,12 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace,
         // saturation and hence pc and hence corresponding pressure unknown
         pressBound[wPhaseIdx] = pressBound[nPhaseIdx] = primaryVariablesOnBoundary[Indices::pressureEqIdx];
         Scalar Z1Bound = primaryVariablesOnBoundary[contiWEqIdx];
-        BCfluidState.update(Z1Bound, pressBound, problem().spatialParameters().porosity(globalPosFace, *eIt),
+        BCfluidState.update(Z1Bound, pressBound, problem().spatialParameters().porosity(*eIt),
                             problem().temperatureAtPos(globalPosFace));
 
         if(GET_PROP_VALUE(TypeTag, EnableCapillarity))
         {
-            Scalar pcBound = MaterialLaw::pC(problem().spatialParameters().materialLawParams(globalPosFace, *eIt),
+            Scalar pcBound = MaterialLaw::pC(problem().spatialParameters().materialLawParams(*eIt),
                     BCfluidState.saturation(wPhaseIdx));
             int maxiter = 3;
             //start iteration loop
@@ -776,9 +775,9 @@ void FVTransport2P2C<TypeTag>::evalBoundary(GlobalPosition globalPosFace,
                 //store old pc
                 Scalar oldPc = pcBound;
                 //update with better pressures
-                BCfluidState.update(Z1Bound, pressBound, problem().spatialParameters().porosity(globalPosFace, *eIt),
+                BCfluidState.update(Z1Bound, pressBound, problem().spatialParameters().porosity(*eIt),
                                     problem().temperatureAtPos(globalPosFace));
-                pcBound = MaterialLaw::pC(problem().spatialParameters().materialLawParams(globalPosFace, *eIt),
+                pcBound = MaterialLaw::pC(problem().spatialParameters().materialLawParams(*eIt),
                         BCfluidState.saturation(wPhaseIdx));
                 // TODO: get right criterion, do output for evaluation
                 //converge criterion
diff --git a/dumux/decoupled/2p2c/fvtransport2p2cmultiphysics.hh b/dumux/decoupled/2p2c/fvtransport2p2cmultiphysics.hh
index 4e8a6107ff..8242422ac7 100644
--- a/dumux/decoupled/2p2c/fvtransport2p2cmultiphysics.hh
+++ b/dumux/decoupled/2p2c/fvtransport2p2cmultiphysics.hh
@@ -204,7 +204,7 @@ void FVTransport2P2CMultiPhysics<TypeTag>::update(const Scalar t, Scalar& dt, Tr
 
             // account for porosity
             sumfactorin = std::max(sumfactorin,sumfactorout)
-                            / problem().spatialParameters().porosity(globalPos, *eIt);
+                            / problem().spatialParameters().porosity(*eIt);
 
             if ( 1./sumfactorin < dt)
             {
diff --git a/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh b/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh
index 0a74c39bd2..3fd9ab6b08 100644
--- a/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh
+++ b/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh
@@ -27,7 +27,6 @@
 #ifndef DUMUX_PSEUDO1P2C_FLUID_STATE_HH
 #define DUMUX_PSEUDO1P2C_FLUID_STATE_HH
 
-#include <dumux/material/old_fluidsystems/fluidstate.hh>
 #include <dumux/decoupled/2p2c/2p2cproperties.hh>
 
 namespace Dumux
@@ -41,8 +40,7 @@ namespace Dumux
  *  \tparam TypeTag The property Type Tag
  */
 template <class TypeTag>
-class PseudoOnePTwoCFluidState : public FluidState<typename GET_PROP_TYPE(TypeTag, Scalar),
-                                           PseudoOnePTwoCFluidState<TypeTag> >
+class PseudoOnePTwoCFluidState
 {
     typedef typename GET_PROP_TYPE(TypeTag, Scalar)      Scalar;
     typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
diff --git a/test/decoupled/2p2c/test_dec2p2c_spatialparams.hh b/test/decoupled/2p2c/test_dec2p2c_spatialparams.hh
index 0fecc25a9d..bf64e0dca2 100644
--- a/test/decoupled/2p2c/test_dec2p2c_spatialparams.hh
+++ b/test/decoupled/2p2c/test_dec2p2c_spatialparams.hh
@@ -28,19 +28,43 @@
 #define TEST_2P2C_SPATIALPARAMETERS_HH
 
 #include <dumux/decoupled/2p2c/2p2cproperties.hh>
+#include <dumux/material/spatialparameters/fvspatialparameters.hh>
 #include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh>
 //#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh>
 #include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>
 
 namespace Dumux
 {
+//forward declaration
+template<class TypeTag>
+class Test2P2CSpatialParams;
+
+namespace Properties
+{
+// The spatial parameters TypeTag
+NEW_TYPE_TAG(Test2P2CSpatialParams);
+
+// Set the spatial parameters
+SET_TYPE_PROP(Test2P2CSpatialParams, SpatialParameters, Dumux::Test2P2CSpatialParams<TypeTag>);
+
+// Set the material law
+SET_PROP(Test2P2CSpatialParams, MaterialLaw)
+{
+private:
+    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
+    //    typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw;
+    typedef LinearMaterial<Scalar>         RawMaterialLaw;
+public:
+    typedef EffToAbsLaw<RawMaterialLaw> type;
+};
+}
 
 /*!
  * \ingroup IMPETtests
  * \brief spatial parameters for the sequential 2p2c test
  */
 template<class TypeTag>
-class Test2P2CSpatialParams
+class Test2P2CSpatialParams : public FVSpatialParameters<TypeTag>
 {
     typedef typename GET_PROP_TYPE(TypeTag, Grid)     Grid;
     typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
@@ -55,37 +79,30 @@ class Test2P2CSpatialParams
     typedef Dune::FieldVector<CoordScalar, dim> LocalPosition;
     typedef Dune::FieldMatrix<Scalar,dim,dim> FieldMatrix;
 
-//    typedef RegularizedBrooksCorey<Scalar>                RawMaterialLaw;
-    typedef LinearMaterial<Scalar>                        RawMaterialLaw;
 public:
-    typedef EffToAbsLaw<RawMaterialLaw>               MaterialLaw;
+    typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
     typedef typename MaterialLaw::Params MaterialLawParams;
 
-    void update (Scalar saturationW, const Element& element)
-    {
-
-    }
-
-    const FieldMatrix& intrinsicPermeability  (const GlobalPosition& globalPos, const Element& element) const
+    const FieldMatrix& intrinsicPermeability (const Element& element) const
     {
         return constPermeability_;
     }
 
-    double porosity(const GlobalPosition& globalPos, const Element& element) const
+    double porosity(const Element& element) const
     {
         return 0.2;
     }
 
 
     // return the parameter object for the Brooks-Corey material law which depends on the position
-    const MaterialLawParams& materialLawParams(const GlobalPosition& globalPos, const Element &element) const
+    const MaterialLawParams& materialLawParams(const Element &element) const
     {
             return materialLawParams_;
     }
 
 
-    Test2P2CSpatialParams(const GridView& gridView)
-    : constPermeability_(0)
+    Test2P2CSpatialParams(const GridView& gridView) : FVSpatialParameters<TypeTag>(gridView),
+            constPermeability_(0)
     {
         // residual saturations
         materialLawParams_.setSwr(0);
diff --git a/test/decoupled/2p2c/test_dec2p2cproblem.hh b/test/decoupled/2p2c/test_dec2p2cproblem.hh
index 196ebf7521..875d77ca45 100644
--- a/test/decoupled/2p2c/test_dec2p2cproblem.hh
+++ b/test/decoupled/2p2c/test_dec2p2cproblem.hh
@@ -55,7 +55,7 @@ class TestDecTwoPTwoCProblem;
 // Specify the properties
 namespace Properties
 {
-NEW_TYPE_TAG(TestDecTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC));
+NEW_TYPE_TAG(TestDecTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC, Test2P2CSpatialParams));
 
 // Set the grid type
 SET_PROP(TestDecTwoPTwoCProblem, Grid)
@@ -67,18 +67,18 @@ SET_PROP(TestDecTwoPTwoCProblem, Grid)
 // Set the problem property
 SET_PROP(TestDecTwoPTwoCProblem, Problem)
 {
-    typedef Dumux::TestDecTwoPTwoCProblem<TTAG(TestDecTwoPTwoCProblem)> type;
+    typedef Dumux::TestDecTwoPTwoCProblem<TypeTag> type;
 };
 
 // Set the model properties
 SET_PROP(TestDecTwoPTwoCProblem, TransportModel)
 {
-    typedef Dumux::FVTransport2P2C<TTAG(TestDecTwoPTwoCProblem)> type;
+    typedef Dumux::FVTransport2P2C<TypeTag> type;
 };
 
 SET_PROP(TestDecTwoPTwoCProblem, PressureModel)
 {
-    typedef Dumux::FVPressure2P2C<TTAG(TestDecTwoPTwoCProblem)> type;
+    typedef Dumux::FVPressure2P2C<TypeTag> type;
 };
 
 SET_INT_PROP(TestDecTwoPTwoCProblem, PressureFormulation,
@@ -101,17 +101,6 @@ SET_PROP(TestDecTwoPTwoCProblem, Components) : public GET_PROP(TypeTag, DefaultC
         typedef Dumux::H2O<Scalar> H2O;
 };
 
-// Set the soil properties
-SET_PROP(TestDecTwoPTwoCProblem, SpatialParameters)
-{
-private:
-    typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
-    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
-
-public:
-    typedef Dumux::Test2P2CSpatialParams<TypeTag> type;
-};
-
 //SET_TYPE_PROP(TestDecTwoPTwoCProblem, LinearSolver, IMPETBiCGStabILU0Solver<TypeTag> );
 
 // Enable gravity
@@ -171,8 +160,14 @@ public:
 TestDecTwoPTwoCProblem(TimeManager &timeManager, const GridView &gridView, const GlobalPosition lowerLeft = 0, const GlobalPosition upperRight = 0) :
 ParentType(timeManager, gridView), lowerLeft_(lowerLeft), upperRight_(upperRight)
 {
+//    this->setOutputInterval(20);
     // initialize the tables of the fluid system
-//    FluidSystem::init();
+    FluidSystem::init(/*tempMin=*/280,
+            /*tempMax=*/290,
+            /*numTemp=*/10,
+            /*pMin=*/190000,
+            /*pMax=*/280000,
+            /*numP=*/400);
 }
 
 /*!
diff --git a/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh b/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh
index d86b8846ae..b5d8382bd8 100644
--- a/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh
+++ b/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh
@@ -43,6 +43,7 @@
 // fluid properties
 //#include <dumux/material/fluidsystems/brine_co2_system.hh>
 #include <dumux/material/fluidsystems/h2on2fluidsystem.hh>
+#include <dumux/material/fluidsystems/h2oairfluidsystem.hh>
 
 #include "test_dec2p2c_spatialparams.hh"
 
@@ -55,7 +56,7 @@ class TestMultTwoPTwoCProblem;
 // Specify the properties
 namespace Properties
 {
-NEW_TYPE_TAG(TestMultTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC));
+NEW_TYPE_TAG(TestMultTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC, Test2P2CSpatialParams));
 
 SET_TYPE_PROP(TestMultTwoPTwoCProblem, CellData, Dumux::CellData2P2Cmultiphysics<TypeTag>);
 
@@ -108,17 +109,6 @@ SET_BOOL_PROP(TestMultTwoPTwoCProblem, EnableComplicatedFluidSystem, true);
 //        typedef Dumux::H2O<Scalar> H2O;
 //};
 
-// Set the soil properties
-SET_PROP(TestMultTwoPTwoCProblem, SpatialParameters)
-{
-private:
-    typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
-    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
-
-public:
-    typedef Dumux::Test2P2CSpatialParams<TypeTag> type;
-};
-
 // Enable gravity
 SET_BOOL_PROP(TestMultTwoPTwoCProblem, EnableGravity, true);
 SET_BOOL_PROP(TestMultTwoPTwoCProblem, EnableCapillarity, true);
-- 
GitLab