From 13f68da485a3953721ffb59b30707d3c3c44668e Mon Sep 17 00:00:00 2001
From: "Dennis.Glaeser" <dennis.glaeser@iws.uni-stuttgart.de>
Date: Thu, 25 Jul 2019 14:50:38 +0200
Subject: [PATCH] =?UTF-8?q?[=C5=A7est][poromech]=20avoid=20deprecation=20w?=
 =?UTF-8?q?arnings=20from=20cm?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../poromechanics/el1p/problem_poroelastic.hh | 17 ++++-----
 .../poromechanics/el2p/problem_poroelastic.hh | 35 ++++++++-----------
 2 files changed, 20 insertions(+), 32 deletions(-)

diff --git a/test/multidomain/poromechanics/el1p/problem_poroelastic.hh b/test/multidomain/poromechanics/el1p/problem_poroelastic.hh
index 1a3859fc11..2194719b9e 100644
--- a/test/multidomain/poromechanics/el1p/problem_poroelastic.hh
+++ b/test/multidomain/poromechanics/el1p/problem_poroelastic.hh
@@ -138,11 +138,9 @@ public:
     Scalar effectiveFluidDensity(const Element& element,
                                  const SubControlVolume& scv) const
     {
-        // get context from coupling manager
-        // here, we know that the flow problem uses cell-centered finite volumes,
-        // thus, we simply take the volume variables of the element and return the density
-        const auto& context = couplingManager().poroMechanicsCouplingContext();
-        return (*context.pmFlowElemVolVars)[scv.elementIndex()].density();
+        // get porous medium flow volume variables from coupling manager
+        const auto pmFlowVolVars = couplingManager().getPMFlowVolVars(element);
+        return pmFlowVolVars.density();
     }
 
     /*!
@@ -154,12 +152,9 @@ public:
                                  const ElementVolumeVariables& elemVolVars,
                                  const FluxVarsCache& fluxVarsCache) const
     {
-        // get context from coupling manager
-        // here, we know that the flow problem uses cell-centered finite volumes,
-        // thus, we simply take the volume variables of the element and return the pressure
-        const auto& context = couplingManager().poroMechanicsCouplingContext();
-        const auto eIdx = this->fvGridGeometry().elementMapper().index(element);
-        return (*context.pmFlowElemVolVars)[eIdx].pressure();
+        // get porous medium flow volume variables from coupling manager
+        const auto pmFlowVolVars = couplingManager().getPMFlowVolVars(element);
+        return pmFlowVolVars.pressure();
     }
 
     /*!
diff --git a/test/multidomain/poromechanics/el2p/problem_poroelastic.hh b/test/multidomain/poromechanics/el2p/problem_poroelastic.hh
index d4027b1500..4034d3ea08 100644
--- a/test/multidomain/poromechanics/el2p/problem_poroelastic.hh
+++ b/test/multidomain/poromechanics/el2p/problem_poroelastic.hh
@@ -139,16 +139,13 @@ public:
      */
     Scalar effectiveFluidDensity(const Element& element, const SubControlVolume& scv) const
     {
-        // get context from coupling manager
-        const auto& context = couplingManager().poroMechanicsCouplingContext();
-
-        // here, we know that the flow problem uses cell-centered finite volumes, thus,
-        // we simply take the volume variables of the scv (i.e. element) to obtain fluid properties
-        const auto& facetVolVars = (*context.pmFlowElemVolVars)[scv.elementIndex()];
-        Scalar wPhaseDensity = facetVolVars.density(FluidSystem::phase0Idx);
-        Scalar nPhaseDensity = facetVolVars.density(FluidSystem::phase1Idx);
-        Scalar Sw = facetVolVars.saturation(FluidSystem::phase0Idx);
-        Scalar Sn = facetVolVars.saturation(FluidSystem::phase1Idx);
+        // get porous medium flow volume variables from coupling manager
+        const auto pmFlowVolVars = couplingManager().getPMFlowVolVars(element);
+
+        Scalar wPhaseDensity = pmFlowVolVars.density(FluidSystem::phase0Idx);
+        Scalar nPhaseDensity = pmFlowVolVars.density(FluidSystem::phase1Idx);
+        Scalar Sw = pmFlowVolVars.saturation(FluidSystem::phase0Idx);
+        Scalar Sn = pmFlowVolVars.saturation(FluidSystem::phase1Idx);
         return (wPhaseDensity * Sw + nPhaseDensity * Sn);
     }
 
@@ -161,17 +158,13 @@ public:
                                  const ElementVolumeVariables& elemVolVars,
                                  const FluxVarsCache& fluxVarsCache) const
     {
-        // get context from coupling manager
-        const auto& context = couplingManager().poroMechanicsCouplingContext();
-
-        // here, we know that the flow problem uses cell-centered finite volumes, thus,
-        // we simply take the volume variables of the element to obtain fluid properties
-        const auto eIdx = this->fvGridGeometry().elementMapper().index(element);
-        const auto& facetVolVars = (*context.pmFlowElemVolVars)[eIdx];
-        Scalar pw = facetVolVars.pressure(FluidSystem::phase0Idx);
-        Scalar pn = facetVolVars.pressure(FluidSystem::phase1Idx);
-        Scalar Sw = facetVolVars.saturation(FluidSystem::phase0Idx);
-        Scalar Sn = facetVolVars.saturation(FluidSystem::phase1Idx);
+        // get porous medium flow volume variables from coupling manager
+        const auto pmFlowVolVars = couplingManager().getPMFlowVolVars(element);
+
+        Scalar pw = pmFlowVolVars.pressure(FluidSystem::phase0Idx);
+        Scalar pn = pmFlowVolVars.pressure(FluidSystem::phase1Idx);
+        Scalar Sw = pmFlowVolVars.saturation(FluidSystem::phase0Idx);
+        Scalar Sn = pmFlowVolVars.saturation(FluidSystem::phase1Idx);
         return (pw * Sw + pn * Sn);
     }
 
-- 
GitLab