From d61efb9e3928376df0d4803c305a0a7f051505a3 Mon Sep 17 00:00:00 2001
From: Katharina Heck <katharina.heck@iws.uni-stuttgart.de>
Date: Thu, 8 Mar 2018 16:07:33 +0100
Subject: [PATCH] [freeflow] remove typtag from vtkoutputfields

---
 .../staggered/freeflow/facevariables.hh       |  4 +---
 dumux/freeflow/navierstokes/model.hh          | 17 +++++++++++---
 .../freeflow/navierstokes/vtkoutputfields.hh  | 23 +++++++------------
 dumux/freeflow/navierstokesnc/model.hh        | 23 ++++++++++++++++---
 .../navierstokesnc/vtkoutputfields.hh         | 23 +++++++------------
 dumux/freeflow/nonisothermal/model.hh         |  8 ++++++-
 .../freeflow/nonisothermal/vtkoutputfields.hh |  7 +++---
 dumux/io/staggeredvtkoutputmodule.hh          |  3 ++-
 8 files changed, 63 insertions(+), 45 deletions(-)

diff --git a/dumux/discretization/staggered/freeflow/facevariables.hh b/dumux/discretization/staggered/freeflow/facevariables.hh
index ad29caaeed..5cadb11af6 100644
--- a/dumux/discretization/staggered/freeflow/facevariables.hh
+++ b/dumux/discretization/staggered/freeflow/facevariables.hh
@@ -38,7 +38,6 @@ namespace Dumux
 template<class TypeTag>
 class StaggeredFaceVariables
 {
-    using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
     using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
     using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables);
@@ -49,7 +48,6 @@ class StaggeredFaceVariables
     static constexpr int dimWorld = GridView::dimensionworld;
     static constexpr int numPairs = (dimWorld == 2) ? 2 : 4;
 
-    using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
     using Element = typename GridView::template Codim<0>::Entity;
 
     using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices);
@@ -57,7 +55,7 @@ class StaggeredFaceVariables
     typename DofTypeIndices::FaceIdx faceIdx;
 
 public:
-
+    using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
     /*!
     * \brief Partial update of the face variables. Only the face itself is considered.
     *
diff --git a/dumux/freeflow/navierstokes/model.hh b/dumux/freeflow/navierstokes/model.hh
index ccaf1d7902..7fc7b2029c 100644
--- a/dumux/freeflow/navierstokes/model.hh
+++ b/dumux/freeflow/navierstokes/model.hh
@@ -145,8 +145,13 @@ public:
 };
 
 //! The specific vtk output fields
-SET_TYPE_PROP(NavierStokes, VtkOutputFields, NavierStokesVtkOutputFields<TypeTag>);
-
+SET_PROP(NavierStokes, VtkOutputFields)
+{
+private:
+    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
+public:
+     using type = NavierStokesVtkOutputFields<FVGridGeometry>;
+};
 //////////////////////////////////////////////////////////////////
 // Property values for isothermal model required for the general non-isothermal model
 //////////////////////////////////////////////////////////////////
@@ -161,7 +166,13 @@ public:
 };
 
 //! The specific isothermal vtk output fields
-SET_TYPE_PROP(NavierStokesNI, IsothermalVtkOutputFields, NavierStokesVtkOutputFields<TypeTag>);
+SET_PROP(NavierStokesNI, IsothermalVtkOutputFields)
+{
+private:
+    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
+public:
+     using type = NavierStokesVtkOutputFields<FVGridGeometry>;
+};
 
 //! The number of equations for the isothermal model
 SET_PROP(NavierStokesNI, IsothermalNumEq)
diff --git a/dumux/freeflow/navierstokes/vtkoutputfields.hh b/dumux/freeflow/navierstokes/vtkoutputfields.hh
index 49de187929..c13234c310 100644
--- a/dumux/freeflow/navierstokes/vtkoutputfields.hh
+++ b/dumux/freeflow/navierstokes/vtkoutputfields.hh
@@ -36,18 +36,11 @@ namespace Dumux
  * \ingroup NavierStokesModel
  * \brief Adds vtk output fields for the Navier-Stokes model
  */
-template<class TypeTag>
+template<class FVGridGeometry>
 class NavierStokesVtkOutputFields
 {
-    using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
-    using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
-    using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
-    using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
-    using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
-    using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
-    using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables);
-
-    using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>;
+    using ctype = typename FVGridGeometry::GridView::ctype;
+    using GlobalPosition = Dune::FieldVector<ctype, FVGridGeometry::GridView::dimensionworld>;
 
     // Helper type used for tag dispatching (to add discretization-specific fields).
     template<DiscretizationMethod discMethod>
@@ -58,10 +51,10 @@ public:
     template <class VtkOutputModule>
     static void init(VtkOutputModule& vtk)
     {
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.pressure(); }, "p");
+        vtk.addVolumeVariable([](const auto& v){ return v.pressure(); }, "p");
 
         // add discretization-specific fields
-        additionalOutput_(vtk, discMethodTag<GET_PROP_TYPE(TypeTag, FVGridGeometry)::discMethod>{});
+        additionalOutput_(vtk, discMethodTag<FVGridGeometry::discMethod>{});
     }
 
 private:
@@ -75,13 +68,13 @@ private:
     template <class VtkOutputModule>
     static void additionalOutput_(VtkOutputModule& vtk, discMethodTag<DiscretizationMethod::staggered>)
     {
-        const bool writeFaceVars = getParamFromGroup<bool>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "Vtk.WriteFaceData", false);
+        const bool writeFaceVars = getParamFromGroup<bool>(vtk.paramGroup(), "Vtk.WriteFaceData", false);
         if(writeFaceVars)
         {
-            auto faceVelocityVector = [](const SubControlVolumeFace& scvf, const FaceVariables& f)
+            auto faceVelocityVector = [](const typename FVGridGeometry::SubControlVolumeFace& scvf, const auto& faceVars)
                                       {
                                           GlobalPosition velocity(0.0);
-                                          velocity[scvf.directionIndex()] = f.velocitySelf();
+                                          velocity[scvf.directionIndex()] = faceVars.velocitySelf();
                                           return velocity;
                                       };
 
diff --git a/dumux/freeflow/navierstokesnc/model.hh b/dumux/freeflow/navierstokesnc/model.hh
index 83b4384f04..d3468ef03c 100644
--- a/dumux/freeflow/navierstokesnc/model.hh
+++ b/dumux/freeflow/navierstokesnc/model.hh
@@ -155,8 +155,16 @@ public:
     using type = NavierStokesNCIndices<dim, numEq, phaseIdx, replaceCompEqIdx>;
 };
 
-//! The vtk output fields
-SET_TYPE_PROP(NavierStokesNC, VtkOutputFields, NavierStokesNCVtkOutputFields<TypeTag>);
+//! The specific vtk output fields
+SET_PROP(NavierStokesNC, VtkOutputFields)
+{
+private:
+    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
+    using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
+    static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
+public:
+     using type = NavierStokesNCVtkOutputFields<FVGridGeometry, FluidSystem, phaseIdx>;
+};
 
 /*!
  * \brief The fluid state which is used by the volume variables to
@@ -192,7 +200,16 @@ public:
 };
 
 //! The isothermal vtk output fields
-SET_TYPE_PROP(NavierStokesNCNI, IsothermalVtkOutputFields, NavierStokesNCVtkOutputFields<TypeTag>);
+//! The specific vtk output fields
+SET_PROP(NavierStokesNCNI, IsothermalVtkOutputFields)
+{
+private:
+    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
+    using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
+    static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
+public:
+     using type = NavierStokesNCVtkOutputFields<FVGridGeometry, FluidSystem, phaseIdx>;
+};
 
 //! The number of equations for the isothermal model
 SET_PROP(NavierStokesNCNI, IsothermalNumEq)
diff --git a/dumux/freeflow/navierstokesnc/vtkoutputfields.hh b/dumux/freeflow/navierstokesnc/vtkoutputfields.hh
index fbe2d923dc..2ffa7778ef 100644
--- a/dumux/freeflow/navierstokesnc/vtkoutputfields.hh
+++ b/dumux/freeflow/navierstokesnc/vtkoutputfields.hh
@@ -34,31 +34,24 @@ namespace Dumux
  * \ingroup NavierStokesNCModel
  * \brief Adds vtk output fields specific to the NavierStokesNC model
  */
-template<class TypeTag>
-class NavierStokesNCVtkOutputFields : NavierStokesVtkOutputFields<TypeTag>
+template<class FVGridGeometry, class FluidSystem, int phaseIdx>
+class NavierStokesNCVtkOutputFields
 {
-    using ParentType = NavierStokesVtkOutputFields<TypeTag>;
-    using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
-    using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
-    using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
-
-    static constexpr int numComponents = GET_PROP_VALUE(TypeTag, NumComponents);
-    static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
 
 public:
     //! Initialize the Navier-StokesNC specific vtk output fields.
     template <class VtkOutputModule>
     static void init(VtkOutputModule& vtk)
     {
-        ParentType::init(vtk);
+        NavierStokesVtkOutputFields<FVGridGeometry>::init(vtk);
 
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.molarDensity(); }, "rhoMolar");
-        vtk.addVolumeVariable([](const VolumeVariables& v){ return v.density(); }, "rho");
+        vtk.addVolumeVariable([](const auto& v){ return v.molarDensity(); }, "rhoMolar");
+        vtk.addVolumeVariable([](const auto& v){ return v.density(); }, "rho");
 
-        for (int j = 0; j < numComponents; ++j)
+        for (int j = 0; j < FluidSystem::numComponents; ++j)
         {
-            vtk.addVolumeVariable([j](const VolumeVariables& v){ return v.massFraction(phaseIdx,j); }, "X^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx));
-            vtk.addVolumeVariable([j](const VolumeVariables& v){ return v.moleFraction(phaseIdx,j); }, "x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx));
+            vtk.addVolumeVariable([j](const auto& v){ return v.massFraction(phaseIdx,j); }, "X^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx));
+            vtk.addVolumeVariable([j](const auto& v){ return v.moleFraction(phaseIdx,j); }, "x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx));
         }
     }
 };
diff --git a/dumux/freeflow/nonisothermal/model.hh b/dumux/freeflow/nonisothermal/model.hh
index 1fba624a3b..69751208c8 100644
--- a/dumux/freeflow/nonisothermal/model.hh
+++ b/dumux/freeflow/nonisothermal/model.hh
@@ -76,7 +76,13 @@ public:
 };
 
 //! The non-isothermal vtk output fields
-SET_TYPE_PROP(NavierStokesNonIsothermal, VtkOutputFields, NavierStokesNonIsothermalVtkOutputFields<TypeTag>);
+SET_PROP(NavierStokesNonIsothermal, VtkOutputFields)
+{
+private:
+    using IsothermalVtkOutputFields = typename GET_PROP_TYPE(TypeTag, IsothermalVtkOutputFields);
+public:
+    using type = NavierStokesNonIsothermalVtkOutputFields<IsothermalVtkOutputFields>;
+};
 
 //! Use Fourier's Law as default heat conduction type
 SET_TYPE_PROP(NavierStokesNonIsothermal, HeatConductionType, FouriersLaw<TypeTag>);
diff --git a/dumux/freeflow/nonisothermal/vtkoutputfields.hh b/dumux/freeflow/nonisothermal/vtkoutputfields.hh
index a498db9d68..8cdf0c8f0c 100644
--- a/dumux/freeflow/nonisothermal/vtkoutputfields.hh
+++ b/dumux/freeflow/nonisothermal/vtkoutputfields.hh
@@ -33,11 +33,10 @@ namespace Dumux
  * \ingroup NavierStokesNIModel
  * \brief Adds vtk output fields specific to non-isothermal free-flow models
  */
-template<class TypeTag>
+template<class IsothermalVtkOutputFields>
 class NavierStokesNonIsothermalVtkOutputFields
 {
-    using IsothermalVtkOutputFields = typename GET_PROP_TYPE(TypeTag, IsothermalVtkOutputFields);
-    using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
+
 public:
 
     //! Initialize the non-isothermal specific vtk output fields.
@@ -45,7 +44,7 @@ public:
     static void init(VtkOutputModule& vtk)
     {
         IsothermalVtkOutputFields::init(vtk);
-        vtk.addVolumeVariable( [](const VolumeVariables& v){ return v.temperature(); }, "temperature");
+        vtk.addVolumeVariable( [](const auto& v){ return v.temperature(); }, "temperature");
     }
 };
 
diff --git a/dumux/io/staggeredvtkoutputmodule.hh b/dumux/io/staggeredvtkoutputmodule.hh
index ea04999234..fd21d18ef2 100644
--- a/dumux/io/staggeredvtkoutputmodule.hh
+++ b/dumux/io/staggeredvtkoutputmodule.hh
@@ -89,9 +89,10 @@ public:
                     const GridVariables& gridVariables,
                     const SolutionVector& sol,
                     const std::string& name,
+                    const std::string& paramGroup = "",
                     bool verbose = true,
                     Dune::VTK::DataMode dm = Dune::VTK::conforming)
-    : ParentType(problem, fvGridGeometry, gridVariables, sol, name, verbose, dm)
+    : ParentType(problem, fvGridGeometry, gridVariables, sol, name, paramGroup, verbose, dm)
     , problem_(problem)
     , gridGeom_(fvGridGeometry)
     , gridVariables_(gridVariables)
-- 
GitLab