From a2935f1c2aa2ebf520e9aaff5b7872ea0b448962 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Sat, 27 Feb 2021 01:31:45 +0100
Subject: [PATCH] [swe] Fix missing includes. Cleanup. Pass param group.

---
 dumux/flux/shallowwaterviscousflux.hh         | 19 ++++++++++++-------
 dumux/freeflow/shallowwater/localresidual.hh  |  3 ++-
 .../shallowwater/poiseuilleflow/properties.hh |  8 +++++---
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/dumux/flux/shallowwaterviscousflux.hh b/dumux/flux/shallowwaterviscousflux.hh
index 3e8d84ac5a..ce0ce087f8 100644
--- a/dumux/flux/shallowwaterviscousflux.hh
+++ b/dumux/flux/shallowwaterviscousflux.hh
@@ -27,7 +27,11 @@
 #include <cmath>
 #include <algorithm>
 #include <utility>
+#include <type_traits>
+
+#include <dumux/common/parameters.hh>
 #include <dumux/flux/fluxvariablescaching.hh>
+#include <dumux/flux/shallowwater/fluxlimiterlet.hh>
 
 namespace Dumux {
 
@@ -37,7 +41,8 @@ namespace Dumux {
  *        by adding all surrounding shear stresses.
  *        For now implemented strictly for 2D depth-averaged models (i.e. 3 equations)
  */
-template<class PrimaryVariables, class NumEqVector, typename std::enable_if_t<NumEqVector::size() == 3, int> = 0>
+template<class PrimaryVariables, class NumEqVector,
+         typename std::enable_if_t<NumEqVector::size() == 3, int> = 0>
 class ShallowWaterViscousFlux
 {
 
@@ -112,10 +117,10 @@ public:
         const Scalar turbViscosity = [&,gradU=gradU,gradV=gradV]()
         {
             // The (constant) background turbulent viscosity
-            static const auto turbBGViscosity = getParam<Scalar>("ShallowWater.TurbulentViscosity", 1.0e-6);
+            static const auto turbBGViscosity = getParamFromGroup<Scalar>(problem.paramGroup(), "ShallowWater.TurbulentViscosity", 1.0e-6);
 
             // Check whether the mixing-length turbulence model is used
-            static const auto useMixingLengthTurbulenceModel = getParam<bool>("ShallowWater.UseMixingLengthTurbulenceModel", false);
+            static const auto useMixingLengthTurbulenceModel = getParamFromGroup<bool>(problem.paramGroup(), "ShallowWater.UseMixingLengthTurbulenceModel", false);
 
             // constant eddy viscosity equal to the prescribed background eddy viscosity
             if (!useMixingLengthTurbulenceModel)
@@ -124,8 +129,8 @@ public:
             // turbulence model based on mixing length
             // Compute the turbulent viscosity using a combined horizonal/vertical mixing length approach
             // Turbulence coefficients: vertical (Elder like) and horizontal (Smagorinsky like)
-            static const auto turbConstV = getParam<Scalar>("ShallowWater.VerticalCoefficientOfMixingLengthModel", 1.0);
-            static const auto turbConstH = getParam<Scalar>("ShallowWater.HorizontalCoefficientOfMixingLengthModel", 0.1);
+            static const auto turbConstV = getParamFromGroup<Scalar>(problem.paramGroup(), "ShallowWater.VerticalCoefficientOfMixingLengthModel", 1.0);
+            static const auto turbConstH = getParamFromGroup<Scalar>(problem.paramGroup(), "ShallowWater.HorizontalCoefficientOfMixingLengthModel", 0.1);
 
             /** The vertical (Elder-like) contribution to the turbulent viscosity scales with water depth \f[ h \f] and shear velocity \f[ u_{*} \f] :
             *
@@ -193,8 +198,8 @@ public:
         const auto vViscousFlux = turbViscosity * averageDepth * gradV;
 
         // compute the mobility of the flux with the fluxlimiter
-        static const auto upperWaterDepthFluxLimiting = getParam<double>("FluxLimiterLET.UpperWaterDepth", 1e-3);
-        static const auto lowerWaterDepthFluxLimiting = getParam<double>("FluxLimiterLET.LowerWaterDepth", 1e-5);
+        static const auto upperWaterDepthFluxLimiting = getParamFromGroup<double>(problem.paramGroup(), "FluxLimiterLET.UpperWaterDepth", 1e-3);
+        static const auto lowerWaterDepthFluxLimiting = getParamFromGroup<double>(problem.paramGroup(), "FluxLimiterLET.LowerWaterDepth", 1e-5);
 
         const auto limitingDepth = (waterDepthLeft + waterDepthRight) * 0.5;
         const auto mobility = ShallowWater::fluxLimiterLET(limitingDepth,
diff --git a/dumux/freeflow/shallowwater/localresidual.hh b/dumux/freeflow/shallowwater/localresidual.hh
index bfcc6d193e..1c00928c84 100644
--- a/dumux/freeflow/shallowwater/localresidual.hh
+++ b/dumux/freeflow/shallowwater/localresidual.hh
@@ -24,6 +24,7 @@
 #ifndef DUMUX_FREEFLOW_SHALLOW_WATER_LOCAL_RESIDUAL_HH
 #define DUMUX_FREEFLOW_SHALLOW_WATER_LOCAL_RESIDUAL_HH
 
+#include <dumux/common/parameters.hh>
 #include <dumux/common/properties.hh>
 
 namespace Dumux{
@@ -99,7 +100,7 @@ public:
         flux += fluxVars.advectiveFlux(problem, element, fvGeometry, elemVolVars, scvf);
 
         // Compute viscous momentum flux contribution if required
-        static const bool enableViscousFlux = getParam<bool>("ShallowWater.EnableViscousFlux", false);
+        static const bool enableViscousFlux = getParamFromGroup<bool>(problem.paramGroup(), "ShallowWater.EnableViscousFlux", false);
         if (enableViscousFlux)
             flux += fluxVars.viscousFlux(problem, element, fvGeometry, elemVolVars, scvf);
         return flux;
diff --git a/test/freeflow/shallowwater/poiseuilleflow/properties.hh b/test/freeflow/shallowwater/poiseuilleflow/properties.hh
index 7a1312806d..75ac8c8e18 100644
--- a/test/freeflow/shallowwater/poiseuilleflow/properties.hh
+++ b/test/freeflow/shallowwater/poiseuilleflow/properties.hh
@@ -23,11 +23,13 @@
 #include <dumux/common/properties.hh>
 #include <dumux/freeflow/shallowwater/model.hh>
 #include <dumux/discretization/cctpfa.hh>
-
+#include <dune/grid/yaspgrid.hh>
 #if HAVE_UG
 #include <dune/grid/uggrid.hh>
-#else
-#include <dune/grid/yaspgrid.hh>
+#endif
+
+#ifndef GRIDTYPE
+#define GRIDTYPE Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<double, 2>>
 #endif
 
 #include "problem.hh"
-- 
GitLab