From 8dcda08722797380faad8b91a165cef3375fe94b Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Thu, 6 Sep 2018 21:13:33 +0200
Subject: [PATCH] [freeflow][io] Free IOFields of (almost all) template
 parameters

---
 dumux/freeflow/compositional/iofields.hh      |  9 ++----
 .../freeflow/compositional/kepsilonncmodel.hh | 17 ++---------
 dumux/freeflow/compositional/komegancmodel.hh | 17 ++---------
 .../compositional/lowrekepsilonncmodel.hh     | 17 ++---------
 .../compositional/navierstokesncmodel.hh      | 17 ++---------
 dumux/freeflow/compositional/oneeqncmodel.hh  | 17 ++---------
 dumux/freeflow/compositional/zeroeqncmodel.hh | 17 ++---------
 dumux/freeflow/navierstokes/iofields.hh       | 29 +++++++++++--------
 dumux/freeflow/navierstokes/model.hh          | 19 ++----------
 dumux/freeflow/nonisothermal/iofields.hh      |  9 ++----
 dumux/freeflow/rans/iofields.hh               | 11 +++----
 dumux/freeflow/rans/model.hh                  | 18 ++----------
 dumux/freeflow/rans/oneeq/iofields.hh         |  8 ++---
 dumux/freeflow/rans/oneeq/model.hh            | 18 ++----------
 .../freeflow/rans/twoeq/kepsilon/iofields.hh  |  9 ++----
 dumux/freeflow/rans/twoeq/kepsilon/model.hh   | 18 ++----------
 dumux/freeflow/rans/twoeq/komega/iofields.hh  |  9 ++----
 dumux/freeflow/rans/twoeq/komega/model.hh     | 18 ++----------
 .../rans/twoeq/lowrekepsilon/iofields.hh      |  9 ++----
 .../rans/twoeq/lowrekepsilon/model.hh         | 18 ++----------
 20 files changed, 66 insertions(+), 238 deletions(-)

diff --git a/dumux/freeflow/compositional/iofields.hh b/dumux/freeflow/compositional/iofields.hh
index ebed53abf2..895eefc9ff 100644
--- a/dumux/freeflow/compositional/iofields.hh
+++ b/dumux/freeflow/compositional/iofields.hh
@@ -36,12 +36,9 @@ namespace Dumux
  * \ingroup FreeflowNCModel
  * \brief Adds I/O fields specific to the FreeflowNC model
  */
-template<class BaseOutputFields, class ModelTraits>
-class FreeflowNCIOFields
+template<class BaseOutputFields, bool turbulenceModel = false>
+struct FreeflowNCIOFields
 {
-
-public:
-
     //! Initialize the FreeflowNC specific output fields.
     template <class OutputModule>
     DUNE_DEPRECATED_MSG("use initOutputModule instead")
@@ -67,7 +64,7 @@ public:
                 out.addVolumeVariable([j](const auto& v){ return v.diffusionCoefficient(0, j); }, "D^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(0));
 
                 // the eddy diffusivity is recalculated for an arbitrary component which is not the phase component
-                if (ModelTraits::usesTurbulenceModel())
+                if (turbulenceModel)
                     out.addVolumeVariable([j](const auto& v){ return v.effectiveDiffusivity(0, j) - v.diffusionCoefficient(0, j); }, "D_t");
             }
         }
diff --git a/dumux/freeflow/compositional/kepsilonncmodel.hh b/dumux/freeflow/compositional/kepsilonncmodel.hh
index 757ddc5966..5b2ad1784d 100644
--- a/dumux/freeflow/compositional/kepsilonncmodel.hh
+++ b/dumux/freeflow/compositional/kepsilonncmodel.hh
@@ -124,15 +124,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(KEpsilonNC, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using SinglePhaseIOFields = KEpsilonIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNCIOFields<SinglePhaseIOFields, ModelTraits>;
-};
+SET_TYPE_PROP(KEpsilonNC, IOFields, FreeflowNCIOFields<KEpsilonIOFields, true/*turbulenceModel*/>);
 
 //////////////////////////////////////////////////////////////////////////
 // Property values for non-isothermal multi-component k-epsilon model
@@ -198,12 +190,9 @@ public:
 SET_PROP(KEpsilonNCNI, IOFields)
 {
 private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = KEpsilonIOFields<FVGridGeometry>;
-    using NonIsothermalFields = FreeflowNonIsothermalIOFields<BaseIOFields, ModelTraits>;
+    using IsothermalIOFields = FreeflowNCIOFields<KEpsilonIOFields, true/*turbulenceModel*/>;
 public:
-    using type = FreeflowNCIOFields<NonIsothermalFields, ModelTraits>;
+    using type = FreeflowNonIsothermalIOFields<IsothermalIOFields, true/*turbulenceModel*/>;
 };
 
 // \}
diff --git a/dumux/freeflow/compositional/komegancmodel.hh b/dumux/freeflow/compositional/komegancmodel.hh
index 16c6b97e68..79843e06ef 100644
--- a/dumux/freeflow/compositional/komegancmodel.hh
+++ b/dumux/freeflow/compositional/komegancmodel.hh
@@ -142,15 +142,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(KOmegaNC, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using SinglePhaseIOFields = KOmegaIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNCIOFields<SinglePhaseIOFields, ModelTraits>;
-};
+SET_TYPE_PROP(KOmegaNC, IOFields, FreeflowNCIOFields<KOmegaIOFields, true/*turbulenceModel*/>);
 
 //////////////////////////////////////////////////////////////////////////
 // Property values for non-isothermal multi-component k-omega model
@@ -216,12 +208,9 @@ public:
 SET_PROP(KOmegaNCNI, IOFields)
 {
 private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = KOmegaIOFields<FVGridGeometry>;
-    using NonIsothermalFields = FreeflowNonIsothermalIOFields<BaseIOFields, ModelTraits>;
+    using IsothermalIOFields = FreeflowNCIOFields<KOmegaIOFields, true/*turbulenceModel*/>;
 public:
-    using type = FreeflowNCIOFields<NonIsothermalFields, ModelTraits>;
+    using type = FreeflowNonIsothermalIOFields<IsothermalIOFields, true/*turbulenceModel*/>;
 };
 
 // \}
diff --git a/dumux/freeflow/compositional/lowrekepsilonncmodel.hh b/dumux/freeflow/compositional/lowrekepsilonncmodel.hh
index d09a86edaa..5859f65338 100644
--- a/dumux/freeflow/compositional/lowrekepsilonncmodel.hh
+++ b/dumux/freeflow/compositional/lowrekepsilonncmodel.hh
@@ -129,15 +129,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(LowReKEpsilonNC, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using SinglePhaseIOFields = LowReKEpsilonIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNCIOFields<SinglePhaseIOFields, ModelTraits>;
-};
+SET_TYPE_PROP(LowReKEpsilonNC, IOFields, FreeflowNCIOFields<LowReKEpsilonIOFields, true/*turbulenceModel*/>);
 
 //////////////////////////////////////////////////////////////////////////
 // Property values for non-isothermal multi-component low-Re k-epsilon model
@@ -203,12 +195,9 @@ public:
 SET_PROP(LowReKEpsilonNCNI, IOFields)
 {
 private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = LowReKEpsilonIOFields<FVGridGeometry>;
-    using NonIsothermalFields = FreeflowNonIsothermalIOFields<BaseIOFields, ModelTraits>;
+    using IsothermalIOFields = FreeflowNCIOFields<LowReKEpsilonIOFields, true/*turbulenceModel*/>;
 public:
-    using type = FreeflowNCIOFields<NonIsothermalFields, ModelTraits>;
+    using type = FreeflowNonIsothermalIOFields<IsothermalIOFields, true/*turbulenceModel*/>;
 };
 
 // \}
diff --git a/dumux/freeflow/compositional/navierstokesncmodel.hh b/dumux/freeflow/compositional/navierstokesncmodel.hh
index b2fb022b16..27b91f3765 100644
--- a/dumux/freeflow/compositional/navierstokesncmodel.hh
+++ b/dumux/freeflow/compositional/navierstokesncmodel.hh
@@ -171,15 +171,7 @@ SET_TYPE_PROP(NavierStokesNC, FluxVariables, FreeflowNCFluxVariables<TypeTag>);
 SET_TYPE_PROP(NavierStokesNC, FluxVariablesCache, FreeFlowFluxVariablesCache<TypeTag>);
 
 //! The specific I/O fields
-SET_PROP(NavierStokesNC, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = NavierStokesIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNCIOFields<BaseIOFields, ModelTraits>;
-};
+SET_TYPE_PROP(NavierStokesNC, IOFields, FreeflowNCIOFields<NavierStokesIOFields>);
 
 /*!
  * \brief The fluid state which is used by the volume variables to
@@ -222,12 +214,9 @@ public:
 SET_PROP(NavierStokesNCNI, IOFields)
 {
 private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = NavierStokesIOFields<FVGridGeometry>;
-    using NonIsothermalFields = FreeflowNonIsothermalIOFields<BaseIOFields, ModelTraits>;
+    using IsothermalIOFields = FreeflowNCIOFields<NavierStokesIOFields>;
 public:
-    using type = FreeflowNCIOFields<NonIsothermalFields, ModelTraits>;
+    using type = FreeflowNonIsothermalIOFields<IsothermalIOFields>;
 };
 
 //! Use Fourier's Law as default heat conduction type
diff --git a/dumux/freeflow/compositional/oneeqncmodel.hh b/dumux/freeflow/compositional/oneeqncmodel.hh
index 4d75e899d0..5673309cfc 100644
--- a/dumux/freeflow/compositional/oneeqncmodel.hh
+++ b/dumux/freeflow/compositional/oneeqncmodel.hh
@@ -140,15 +140,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(OneEqNC, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using SinglePhaseIOFields = OneEqIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNCIOFields<SinglePhaseIOFields, ModelTraits>;
-};
+SET_TYPE_PROP(OneEqNC, IOFields, FreeflowNCIOFields<OneEqIOFields, true/*turbulenceModel*/>);
 
 //////////////////////////////////////////////////////////////////////////
 // Property values for non-isothermal multi-component one-equation model
@@ -214,12 +206,9 @@ public:
 SET_PROP(OneEqNCNI, IOFields)
 {
 private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = OneEqIOFields<FVGridGeometry>;
-    using NonIsothermalFields = FreeflowNonIsothermalIOFields<BaseIOFields, ModelTraits>;
+    using IsothermalIOFields = FreeflowNCIOFields<OneEqIOFields, true/*turbulenceModel*/>;
 public:
-    using type = FreeflowNCIOFields<NonIsothermalFields, ModelTraits>;
+    using type = FreeflowNonIsothermalIOFields<IsothermalIOFields, true/*turbulenceModel*/>;
 };
 
 // \}
diff --git a/dumux/freeflow/compositional/zeroeqncmodel.hh b/dumux/freeflow/compositional/zeroeqncmodel.hh
index 45168b0716..8974cf29ae 100644
--- a/dumux/freeflow/compositional/zeroeqncmodel.hh
+++ b/dumux/freeflow/compositional/zeroeqncmodel.hh
@@ -99,15 +99,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(ZeroEqNC, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = RANSIOFields<FVGridGeometry>;
-public:
-     using type = FreeflowNCIOFields<BaseIOFields, ModelTraits>;
-};
+SET_TYPE_PROP(ZeroEqNC, IOFields, FreeflowNCIOFields<RANSIOFields, true/*turbulenceModel*/>);
 
 //////////////////////////////////////////////////////////////////////////
 // Property values for non-isothermal multi-component ZeroEq model
@@ -155,12 +147,9 @@ public:
 SET_PROP(ZeroEqNCNI, IOFields)
 {
 private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using BaseIOFields = RANSIOFields<FVGridGeometry>;
-    using NonIsothermalFields = FreeflowNonIsothermalIOFields<BaseIOFields, ModelTraits>;
+    using IsothermalIOFields = FreeflowNCIOFields<RANSIOFields, true/*turbulenceModel*/>;
 public:
-    using type = FreeflowNCIOFields<NonIsothermalFields, ModelTraits>;
+    using type = FreeflowNonIsothermalIOFields<IsothermalIOFields, true/*turbulenceModel*/>;
 };
 
 // \}
diff --git a/dumux/freeflow/navierstokes/iofields.hh b/dumux/freeflow/navierstokes/iofields.hh
index 704541c2ae..e23bc18ff9 100644
--- a/dumux/freeflow/navierstokes/iofields.hh
+++ b/dumux/freeflow/navierstokes/iofields.hh
@@ -74,29 +74,35 @@ std::function<std::string(int,int)> createStaggeredPVNameFunction(const Dune::Mu
     }
 }
 
+// forward declare
+template<class T, class U>
+class StaggeredVtkOutputModule;
+
 /*!
  * \ingroup NavierStokesModel
  * \brief Adds I/O fields for the Navier-Stokes model
  */
-template<class FVGridGeometry>
 class NavierStokesIOFields
 {
-    // Helper type used for tag dispatching (to add discretization-specific fields).
-    template<DiscretizationMethod discMethod>
-    using discMethodTag = std::integral_constant<DiscretizationMethod, discMethod>;
+    //! Helper strcuts to determine whether a staggered grid discretization is used
+    template<class T>
+    struct isStaggered : public std::false_type {};
+
+    template<class... Args>
+    struct isStaggered<StaggeredVtkOutputModule<Args...>>
+    : public std::true_type {};
 
 public:
     //! Initialize the Navier-Stokes specific output fields.
     template <class OutputModule>
     static void initOutputModule(OutputModule& out)
     {
-        using FluidSystem = typename OutputModule::VolumeVariables::FluidSystem;
         out.addVolumeVariable([](const auto& v){ return v.pressure(); }, IOName::pressure());
         out.addVolumeVariable([](const auto& v){ return v.molarDensity(); }, IOName::molarDensity());
         out.addVolumeVariable([](const auto& v){ return v.density(); }, IOName::density());
 
         // add discretization-specific fields
-        additionalOutput_(out, discMethodTag<FVGridGeometry::discMethod>{});
+        additionalOutput_(out, isStaggered<OutputModule>());
     }
 
     template <class OutputModule>
@@ -119,21 +125,20 @@ public:
 private:
 
     //! Adds discretization-specific fields (nothing by default).
-    template <class OutputModule, class AnyMethod>
-    static void additionalOutput_(OutputModule& out, AnyMethod)
+    template <class OutputModule>
+    static void additionalOutput_(OutputModule& out)
     { }
 
     //! Adds discretization-specific fields (velocity vectors on the faces for the staggered discretization).
     template <class OutputModule>
-    static void additionalOutput_(OutputModule& out, discMethodTag<DiscretizationMethod::staggered>)
+    static void additionalOutput_(OutputModule& out, std::true_type)
     {
         const bool writeFaceVars = getParamFromGroup<bool>(out.paramGroup(), "Vtk.WriteFaceData", false);
         if(writeFaceVars)
         {
-            auto faceVelocityVector = [](const typename FVGridGeometry::SubControlVolumeFace& scvf, const auto& faceVars)
+            auto faceVelocityVector = [](const auto& scvf, const auto& faceVars)
                                       {
-                                          using Scalar = typename OutputModule::VolumeVariables::PrimaryVariables::value_type;
-                                          using VelocityVector = Dune::FieldVector<Scalar, FVGridGeometry::GridView::dimensionworld>;
+                                          using VelocityVector = std::decay_t<decltype(scvf.unitOuterNormal())>;
 
                                           VelocityVector velocity(0.0);
                                           velocity[scvf.directionIndex()] = faceVars.velocitySelf();
diff --git a/dumux/freeflow/navierstokes/model.hh b/dumux/freeflow/navierstokes/model.hh
index c3940e3628..6b0275aaa5 100644
--- a/dumux/freeflow/navierstokes/model.hh
+++ b/dumux/freeflow/navierstokes/model.hh
@@ -199,13 +199,8 @@ SET_TYPE_PROP(NavierStokes, FluxVariables, NavierStokesFluxVariables<TypeTag>);
 SET_TYPE_PROP(NavierStokes, FluxVariablesCache, FreeFlowFluxVariablesCache<TypeTag>);
 
 //! The specific I/O fields
-SET_PROP(NavierStokes, IOFields)
-{
-private:
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-public:
-     using type = NavierStokesIOFields<FVGridGeometry>;
-};
+SET_TYPE_PROP(NavierStokes, IOFields, NavierStokesIOFields);
+
 //////////////////////////////////////////////////////////////////
 // Property values for non-isothermal Navier-Stokes model
 //////////////////////////////////////////////////////////////////
@@ -222,15 +217,7 @@ public:
 };
 
 //! The specific non-isothermal I/O fields
-SET_PROP(NavierStokesNI, IOFields)
-{
-private:
-     using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-     using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-     using IsothermalFields = NavierStokesIOFields<FVGridGeometry>;
-public:
-     using type = FreeflowNonIsothermalIOFields<IsothermalFields, ModelTraits>;
-};
+SET_TYPE_PROP(NavierStokesNI, IOFields, FreeflowNonIsothermalIOFields<NavierStokesIOFields>);
 
  // \}
 }
diff --git a/dumux/freeflow/nonisothermal/iofields.hh b/dumux/freeflow/nonisothermal/iofields.hh
index c8044fdb1d..06c4d268c8 100644
--- a/dumux/freeflow/nonisothermal/iofields.hh
+++ b/dumux/freeflow/nonisothermal/iofields.hh
@@ -35,12 +35,9 @@ namespace Dumux
  * \ingroup FreeflowNIModel
  * \brief Adds I/O fields specific to non-isothermal free-flow models
  */
-template<class IsothermalIOFields, class ModelTraits>
-class FreeflowNonIsothermalIOFields
+template<class IsothermalIOFields, bool turbulenceModel = false>
+struct FreeflowNonIsothermalIOFields
 {
-
-public:
-
     //! Initialize the non-isothermal specific output fields.
     template <class OutputModule>
     DUNE_DEPRECATED_MSG("use initOutputModule instead")
@@ -57,7 +54,7 @@ public:
 
         out.addVolumeVariable([](const auto& v){ return v.temperature(); }, IOName::temperature());
         out.addVolumeVariable([](const auto& v){ return v.thermalConductivity(); }, "lambda");
-        if (ModelTraits::usesTurbulenceModel())
+        if (turbulenceModel)
             out.addVolumeVariable([](const auto& v){ return v.effectiveThermalConductivity() - v.thermalConductivity(); }, "lambda_t");
     }
 
diff --git a/dumux/freeflow/rans/iofields.hh b/dumux/freeflow/rans/iofields.hh
index d14609bc55..cbe45478ed 100644
--- a/dumux/freeflow/rans/iofields.hh
+++ b/dumux/freeflow/rans/iofields.hh
@@ -34,13 +34,8 @@ namespace Dumux
  * \ingroup RANSModel
  * \brief Adds I/O fields for the Reynolds-Averaged Navier-Stokes model
  */
-template<class FVGridGeometry>
-class RANSIOFields
+struct RANSIOFields
 {
-    enum { dim = FVGridGeometry::GridView::dimension };
-
-public:
-
     template <class OutputModule>
     DUNE_DEPRECATED_MSG("use initOutputModule instead")
     static void init(OutputModule& out)
@@ -52,7 +47,9 @@ public:
     template <class OutputModule>
     static void initOutputModule(OutputModule& out)
     {
-        NavierStokesIOFields<FVGridGeometry>::initOutputModule(out);
+        NavierStokesIOFields::initOutputModule(out);
+
+        static constexpr auto dim = decltype(std::declval<typename OutputModule::VolumeVariables>().velocity())::dimension;
 
         out.addVolumeVariable([](const auto& v){ return v.velocity()[0] / v.velocityMaximum()[0]; }, "v_x/v_x,max");
         out.addVolumeVariable([](const auto& v){ return v.velocityGradients()[0]; }, "dv_x/dx_");
diff --git a/dumux/freeflow/rans/model.hh b/dumux/freeflow/rans/model.hh
index 4a1f4e4635..d03900ccd0 100644
--- a/dumux/freeflow/rans/model.hh
+++ b/dumux/freeflow/rans/model.hh
@@ -84,13 +84,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(RANS, IOFields)
-{
-private:
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-public:
-    using type = RANSIOFields<FVGridGeometry>;
-};
+SET_TYPE_PROP(RANS, IOFields, RANSIOFields);
 
 //////////////////////////////////////////////////////////////////
 // Property values for non-isothermal Reynolds-averaged Navier-Stokes model
@@ -112,15 +106,7 @@ public:
 };
 
 //! The specific non-isothermal I/O fields
-SET_PROP(RANSNI, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using IsothermalFields = RANSIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNonIsothermalIOFields<IsothermalFields, ModelTraits>;
-};
+SET_TYPE_PROP(RANSNI, IOFields, FreeflowNonIsothermalIOFields<RANSIOFields, true/*turbulenceModel*/>);
 
 //! Use Fourier's Law as default heat conduction type
 SET_TYPE_PROP(RANSNI, HeatConductionType, FouriersLaw<TypeTag>);
diff --git a/dumux/freeflow/rans/oneeq/iofields.hh b/dumux/freeflow/rans/oneeq/iofields.hh
index 090195661b..82e1bb64d1 100644
--- a/dumux/freeflow/rans/oneeq/iofields.hh
+++ b/dumux/freeflow/rans/oneeq/iofields.hh
@@ -33,12 +33,8 @@ namespace Dumux
  * \ingroup OneEqModel
  * \brief Adds I/O fields for the one-equation turbulence model by Spalart-Allmaras
  */
-template<class FVGridGeometry>
-class OneEqIOFields
+struct OneEqIOFields
 {
-    enum { dim = FVGridGeometry::GridView::dimension };
-
-public:
     template <class OutputModule>
     DUNE_DEPRECATED_MSG("use initOutputModule instead")
     static void init(OutputModule& out)
@@ -50,7 +46,7 @@ public:
     template <class OutputModule>
     static void initOutputModule(OutputModule& out)
     {
-        RANSIOFields<FVGridGeometry>::initOutputModule(out);
+        RANSIOFields::initOutputModule(out);
         out.addVolumeVariable([](const auto& v){ return v.viscosityTilde(); }, "nu_tilde");
     }
 
diff --git a/dumux/freeflow/rans/oneeq/model.hh b/dumux/freeflow/rans/oneeq/model.hh
index ac34e6be3b..18e8e56c8d 100644
--- a/dumux/freeflow/rans/oneeq/model.hh
+++ b/dumux/freeflow/rans/oneeq/model.hh
@@ -170,13 +170,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(OneEq, IOFields)
-{
-private:
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-public:
-    using type = OneEqIOFields<FVGridGeometry>;
-};
+SET_TYPE_PROP(OneEq, IOFields, OneEqIOFields);
 
 //////////////////////////////////////////////////////////////////
 // default property values for the non-isothermal Spalart-Allmaras model
@@ -216,15 +210,7 @@ public:
 };
 
 //! The specific non-isothermal I/O fields
-SET_PROP(OneEqNI, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using IsothermalFields = OneEqIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNonIsothermalIOFields<IsothermalFields, ModelTraits>;
-};
+SET_TYPE_PROP(OneEqNI, IOFields, FreeflowNonIsothermalIOFields<OneEqIOFields, true/*turbulenceModel*/>);
 
 // \}
 }
diff --git a/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh b/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh
index 4fd4cab951..59b31fc03b 100644
--- a/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh
+++ b/dumux/freeflow/rans/twoeq/kepsilon/iofields.hh
@@ -34,13 +34,8 @@ namespace Dumux
  * \ingroup KEpsilonModel
  * \brief Adds I/O fields for the k-epsilon turbulence model
  */
-template<class FVGridGeometry>
-class KEpsilonIOFields
+struct KEpsilonIOFields
 {
-    enum { dim = FVGridGeometry::GridView::dimension };
-
-public:
-
     template <class OutputModule>
     DUNE_DEPRECATED_MSG("use initOutputModule instead")
     static void init(OutputModule& out)
@@ -52,7 +47,7 @@ public:
     template <class OutputModule>
     static void initOutputModule(OutputModule& out)
     {
-        RANSIOFields<FVGridGeometry>::initOutputModule(out);
+        RANSIOFields::initOutputModule(out);
 
         out.addVolumeVariable([](const auto& v){ return v.turbulentKineticEnergy(); }, "k");
         out.addVolumeVariable([](const auto& v){ return v.dissipation(); }, "epsilon");
diff --git a/dumux/freeflow/rans/twoeq/kepsilon/model.hh b/dumux/freeflow/rans/twoeq/kepsilon/model.hh
index 9a70db5584..e0ea1338b0 100644
--- a/dumux/freeflow/rans/twoeq/kepsilon/model.hh
+++ b/dumux/freeflow/rans/twoeq/kepsilon/model.hh
@@ -156,13 +156,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(KEpsilon, IOFields)
-{
-private:
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-public:
-    using type = KEpsilonIOFields<FVGridGeometry>;
-};
+SET_TYPE_PROP(KEpsilon, IOFields, KEpsilonIOFields);
 
 //////////////////////////////////////////////////////////////////
 // default property values for the non-isothermal k-epsilon model
@@ -202,15 +196,7 @@ public:
 };
 
 //! The specific non-isothermal I/O fields
-SET_PROP(KEpsilonNI, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using IsothermalFields = KEpsilonIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNonIsothermalIOFields<IsothermalFields, ModelTraits>;
-};
+SET_TYPE_PROP(KEpsilonNI, IOFields, FreeflowNonIsothermalIOFields<KEpsilonIOFields, true/*turbulenceModel*/>);
 
 // \}
 }
diff --git a/dumux/freeflow/rans/twoeq/komega/iofields.hh b/dumux/freeflow/rans/twoeq/komega/iofields.hh
index 689745676f..8f0a7fff43 100644
--- a/dumux/freeflow/rans/twoeq/komega/iofields.hh
+++ b/dumux/freeflow/rans/twoeq/komega/iofields.hh
@@ -34,13 +34,8 @@ namespace Dumux
  * \ingroup KOmegaModel
  * \brief Adds I/O fields for the Reynolds-Averaged Navier-Stokes model
  */
-template<class FVGridGeometry>
-class KOmegaIOFields
+struct KOmegaIOFields
 {
-    enum { dim = FVGridGeometry::GridView::dimension };
-
-public:
-
     template <class OutputModule>
     DUNE_DEPRECATED_MSG("use initOutputModule instead")
     static void init(OutputModule& out)
@@ -52,7 +47,7 @@ public:
     template <class OutputModule>
     static void initOutputModule(OutputModule& out)
     {
-        RANSIOFields<FVGridGeometry>::initOutputModule(out);
+        RANSIOFields::initOutputModule(out);
 
         out.addVolumeVariable([](const auto& v){ return v.turbulentKineticEnergy(); }, "k");
         out.addVolumeVariable([](const auto& v){ return v.dissipation(); }, "omega");
diff --git a/dumux/freeflow/rans/twoeq/komega/model.hh b/dumux/freeflow/rans/twoeq/komega/model.hh
index 7bf6db6d8c..7cfebf2463 100644
--- a/dumux/freeflow/rans/twoeq/komega/model.hh
+++ b/dumux/freeflow/rans/twoeq/komega/model.hh
@@ -163,13 +163,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(KOmega, IOFields)
-{
-private:
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-public:
-    using type = KOmegaIOFields<FVGridGeometry>;
-};
+SET_TYPE_PROP(KOmega, IOFields, KOmegaIOFields);
 
 ///////////////////////////////////////////////////////////////////////////
 // default property values for the non-isothermal k-omega single phase model
@@ -210,15 +204,7 @@ public:
 };
 
 //! The specific non-isothermal I/O fields
-SET_PROP(KOmegaNI, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using IsothermalFields = KOmegaIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNonIsothermalIOFields<IsothermalFields, ModelTraits>;
-};
+SET_TYPE_PROP(KOmegaNI, IOFields, FreeflowNonIsothermalIOFields<KOmegaIOFields, true/*turbulenceModel*/>);
 
 // \}
 }
diff --git a/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh b/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh
index de2ffd8ad8..3c66ddb0b9 100644
--- a/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh
+++ b/dumux/freeflow/rans/twoeq/lowrekepsilon/iofields.hh
@@ -34,13 +34,8 @@ namespace Dumux
  * \ingroup LowReKEpsilonModel
  * \brief Adds I/O fields for the low-Re k-epsilon turbulence model
  */
-template<class FVGridGeometry>
-class LowReKEpsilonIOFields
+struct LowReKEpsilonIOFields
 {
-    enum { dim = FVGridGeometry::GridView::dimension };
-
-public:
-
     template <class OutputModule>
     DUNE_DEPRECATED_MSG("use initOutputModule instead")
     static void init(OutputModule& out)
@@ -52,7 +47,7 @@ public:
     template <class OutputModule>
     static void initOutputModule(OutputModule& out)
     {
-        RANSIOFields<FVGridGeometry>::initOutputModule(out);
+        RANSIOFields::initOutputModule(out);
         out.addVolumeVariable([](const auto& v){ return v.turbulentKineticEnergy(); }, "k");
         out.addVolumeVariable([](const auto& v){ return v.dissipationTilde(); }, "epsilon");
     }
diff --git a/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh b/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh
index b1a840544b..6b178aa20f 100644
--- a/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh
+++ b/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh
@@ -172,13 +172,7 @@ public:
 };
 
 //! The specific I/O fields
-SET_PROP(LowReKEpsilon, IOFields)
-{
-private:
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-public:
-    using type = LowReKEpsilonIOFields<FVGridGeometry>;
-};
+SET_TYPE_PROP(LowReKEpsilon, IOFields, LowReKEpsilonIOFields);
 
 //////////////////////////////////////////////////////////////////
 // default property values for the non-isothermal low-Reynolds k-epsilon model
@@ -218,15 +212,7 @@ public:
 };
 
 //! The specific non-isothermal I/O fields
-SET_PROP(LowReKEpsilonNI, IOFields)
-{
-private:
-    using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
-    using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using IsothermalFields = LowReKEpsilonIOFields<FVGridGeometry>;
-public:
-    using type = FreeflowNonIsothermalIOFields<IsothermalFields, ModelTraits>;
-};
+SET_TYPE_PROP(LowReKEpsilonNI, IOFields, FreeflowNonIsothermalIOFields<LowReKEpsilonIOFields, true/*turbulenceModel*/>);
 
 // \}
 }
-- 
GitLab