From e0e2533e704c64344c19834801d597ba1a2dab23 Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Fri, 1 Dec 2017 16:28:17 +0100
Subject: [PATCH] [cpgrid] fix grid creator, cleanup fvelementgeometry

The static Opm::Deck variable was handled incorrectly in the
grid creator. Fix the behavior by initializing the variable
directly.

Also perform a cleanup of the FVElementGeometry by removing the
lines associated with local coordinates and removing an unused
local variable.
---
 dumux/implicit/cornerpoint/fvelementgeometry.hh | 8 --------
 dumux/io/cpgridcreator.hh                       | 6 ++----
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/dumux/implicit/cornerpoint/fvelementgeometry.hh b/dumux/implicit/cornerpoint/fvelementgeometry.hh
index 27ad099485..d313c4eac6 100644
--- a/dumux/implicit/cornerpoint/fvelementgeometry.hh
+++ b/dumux/implicit/cornerpoint/fvelementgeometry.hh
@@ -64,7 +64,6 @@ class CpFVElementGeometry
 public:
     struct SubControlVolume //! FV intersected with element
     {
-        LocalPosition local; //!< local position
         GlobalPosition global; //!< global position
         Scalar volume; //!< volume of scv
         bool inner;
@@ -86,7 +85,6 @@ public:
 
     typedef SubControlVolumeFace BoundaryFace; //!< compatibility typedef
 
-    LocalPosition elementLocal; //!< local coordinate of element center
     GlobalPosition elementGlobal; //!< global coordinate of element center
     Scalar elementVolume; //!< element volume
     SubControlVolume subContVol[1]; //!< data of the sub control volumes
@@ -104,12 +102,10 @@ public:
 
         elementVolume = geometry.volume();
         elementGlobal = geometry.center();
-        //elementLocal = geometry.local(elementGlobal);
 
         numScv = 1;
         numScvf = 0;
 
-        subContVol[0].local = elementLocal;
         subContVol[0].global = elementGlobal;
         subContVol[0].inner = true;
         subContVol[0].volume = elementVolume;
@@ -125,8 +121,6 @@ public:
     {
         updateInner(element);
 
-        const Geometry geometry = element.geometry();
-
         bool onBoundary = false;
 
         // fill neighbor information and control volume face data:
@@ -147,7 +141,6 @@ public:
                 scvFace.j = scvfIdx + 1;
 
                 scvFace.ipGlobal = isGeometry.center();
-                //scvFace.ipLocal =  geometry.local(scvFace.ipGlobal);
                 scvFace.normal = intersection.centerUnitOuterNormal();
                 auto di = scvFace.ipGlobal;
                 di -= elementGlobal;
@@ -184,7 +177,6 @@ public:
                 SubControlVolumeFace& bFace = boundaryFace[bfIdx];
 
                 bFace.ipGlobal = isGeometry.center();
-                //bFace.ipLocal =  geometry.local(bFace.ipGlobal);
                 bFace.normal = intersection.centerUnitOuterNormal();
                 auto di = bFace.ipGlobal;
                 di -= elementGlobal;
diff --git a/dumux/io/cpgridcreator.hh b/dumux/io/cpgridcreator.hh
index b14f47845b..837e35be2f 100644
--- a/dumux/io/cpgridcreator.hh
+++ b/dumux/io/cpgridcreator.hh
@@ -58,9 +58,6 @@ public:
      */
     static void makeGrid()
     {
-        std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Grid, File);
-
-        deck() = Opm::Parser().parseFile(fileName);
         Opm::EclipseGrid ecl_grid(deck());
 
         gridPtr() = std::make_shared<Grid>(*(new Grid()));
@@ -91,7 +88,8 @@ public:
      */
     static Deck &deck()
     {
-        static Deck deck_;
+        static auto fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Grid, File);
+        static auto deck_ = Opm::Parser().parseFile(fileName);
         return deck_;
     }
 
-- 
GitLab