From 7fdab2b03b216fa88ac0d86d4d72129be6d38a59 Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Mon, 12 Nov 2018 07:31:28 +0100
Subject: [PATCH] [RANS] Add turbulence model to traits

---
 dumux/freeflow/nonisothermal/model.hh         |  2 +
 dumux/freeflow/rans/oneeq/model.hh            |  8 +++-
 dumux/freeflow/rans/twoeq/kepsilon/model.hh   |  8 +++-
 dumux/freeflow/rans/twoeq/komega/model.hh     |  6 +++
 .../rans/twoeq/lowrekepsilon/model.hh         |  8 +++-
 dumux/freeflow/rans/zeroeq/model.hh           | 42 ++++++++++++++++++-
 6 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/dumux/freeflow/nonisothermal/model.hh b/dumux/freeflow/nonisothermal/model.hh
index fadcf7b43d..aa8a956577 100644
--- a/dumux/freeflow/nonisothermal/model.hh
+++ b/dumux/freeflow/nonisothermal/model.hh
@@ -59,8 +59,10 @@ struct FreeflowNIModelTraits : public IsothermalTraits
 {
     //! We solve for one more equation, i.e. the energy balance
     static constexpr int numEq() { return IsothermalTraits::numEq()+1; }
+
     //! We additionally solve for the equation balance
     static constexpr bool enableEnergyBalance() { return true; }
+
     //! the indices
     using Indices = FreeflowNonIsothermalIndices<typename IsothermalTraits::Indices, numEq()>;
 };
diff --git a/dumux/freeflow/rans/oneeq/model.hh b/dumux/freeflow/rans/oneeq/model.hh
index 3cc40f2e0a..4b2844da7d 100644
--- a/dumux/freeflow/rans/oneeq/model.hh
+++ b/dumux/freeflow/rans/oneeq/model.hh
@@ -79,12 +79,14 @@
 
 #include <dumux/common/properties.hh>
 #include <dumux/freeflow/properties.hh>
+#include <dumux/freeflow/turbulencemodel.hh>
 #include <dumux/freeflow/rans/model.hh>
 #include <dumux/freeflow/nonisothermal/iofields.hh>
 
 #include "fluxvariables.hh"
 #include "indices.hh"
 #include "localresidual.hh"
+#include "problem.hh"
 #include "volumevariables.hh"
 #include "iofields.hh"
 
@@ -112,6 +114,10 @@ struct OneEqModelTraits : RANSModelTraits<dimension>
 
     //! the indices
     using Indices = OneEqIndices<dim(), numFluidComponents()>;
+
+    //! return the type of turbulence model used
+    static constexpr auto turbulenceModel()
+    { return TurbulenceModel::oneeq; }
 };
 
 ///////////////////////////////////////////////////////////////////////////
@@ -185,7 +191,7 @@ struct IOFields<TypeTag, TTag::OneEq> { using type = OneEqIOFields; };
 
 // Create new type tags
 namespace TTag {
-//! The type tag for the single-phase, isothermal Spalart-Allmaras model
+//! The type tag for the single-phase, non-isothermal Spalart-Allmaras model
 struct OneEqNI { using InheritsFrom = std::tuple<RANSNI>; };
 } // end namespace TTag
 
diff --git a/dumux/freeflow/rans/twoeq/kepsilon/model.hh b/dumux/freeflow/rans/twoeq/kepsilon/model.hh
index 1ebcffbaff..eaeefee2e0 100644
--- a/dumux/freeflow/rans/twoeq/kepsilon/model.hh
+++ b/dumux/freeflow/rans/twoeq/kepsilon/model.hh
@@ -69,7 +69,9 @@
 #include <dumux/freeflow/properties.hh>
 #include <dumux/freeflow/rans/model.hh>
 #include <dumux/freeflow/rans/twoeq/indices.hh>
+#include <dumux/freeflow/turbulencemodel.hh>
 
+#include "problem.hh"
 #include "fluxvariables.hh"
 #include "localresidual.hh"
 #include "volumevariables.hh"
@@ -99,6 +101,10 @@ struct KEpsilonModelTraits : RANSModelTraits<dimension>
 
     //! the indices
     using Indices = RANSTwoEqIndices<dim(), numFluidComponents()>;
+
+    //! return the type of turbulence model used
+    static constexpr auto turbulenceModel()
+    { return TurbulenceModel::kepsilon; }
 };
 
 ///////////////////////////////////////////////////////////////////////////
@@ -172,7 +178,7 @@ struct IOFields<TypeTag, TTag::KEpsilon> { using type = KEpsilonIOFields; };
 
 // Create new type tags
 namespace TTag {
-//! The type tag for the single-phase, isothermal k-epsilon model
+//! The type tag for the single-phase, non-isothermal k-epsilon model
 struct KEpsilonNI { using InheritsFrom = std::tuple<RANSNI>; };
 } // end namespace TTag
 
diff --git a/dumux/freeflow/rans/twoeq/komega/model.hh b/dumux/freeflow/rans/twoeq/komega/model.hh
index 905542f330..0bb59d8525 100644
--- a/dumux/freeflow/rans/twoeq/komega/model.hh
+++ b/dumux/freeflow/rans/twoeq/komega/model.hh
@@ -74,7 +74,9 @@
 #include <dumux/freeflow/properties.hh>
 #include <dumux/freeflow/rans/model.hh>
 #include <dumux/freeflow/rans/twoeq/indices.hh>
+#include <dumux/freeflow/turbulencemodel.hh>
 
+#include "problem.hh"
 #include "fluxvariables.hh"
 #include "localresidual.hh"
 #include "volumevariables.hh"
@@ -104,6 +106,10 @@ struct KOmegaModelTraits : RANSModelTraits<dimension>
 
     //! The indices
     using Indices = RANSTwoEqIndices<dim(), numFluidComponents()>;
+
+    //! return the type of turbulence model used
+    static constexpr auto turbulenceModel()
+    { return TurbulenceModel::komega; }
 };
 
 ///////////////////////////////////////////////////////////////////////////
diff --git a/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh b/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh
index d1592a5c25..945c34664c 100644
--- a/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh
+++ b/dumux/freeflow/rans/twoeq/lowrekepsilon/model.hh
@@ -82,7 +82,9 @@
 #include <dumux/freeflow/properties.hh>
 #include <dumux/freeflow/rans/model.hh>
 #include <dumux/freeflow/rans/twoeq/indices.hh>
+#include <dumux/freeflow/turbulencemodel.hh>
 
+#include "problem.hh"
 #include "fluxvariables.hh"
 #include "localresidual.hh"
 #include "volumevariables.hh"
@@ -112,6 +114,10 @@ struct LowReKEpsilonModelTraits : RANSModelTraits<dimension>
 
     //! the indices
     using Indices = RANSTwoEqIndices<dim(), numFluidComponents()>;
+
+    //! return the type of turbulence model used
+    static constexpr auto turbulenceModel()
+    { return TurbulenceModel::lowrekepsilon; }
 };
 
 ///////////////////////////////////////////////////////////////////////////
@@ -185,7 +191,7 @@ struct IOFields<TypeTag, TTag::LowReKEpsilon> { using type = LowReKEpsilonIOFiel
 
 // Create new type tags
 namespace TTag {
-//! The type tag for the single-phase, isothermal low-Reynolds k-epsilon model
+//! The type tag for the single-phase, non-isothermal low-Reynolds k-epsilon model
 struct LowReKEpsilonNI { using InheritsFrom = std::tuple<RANSNI>; };
 } // end namespace TTag
 
diff --git a/dumux/freeflow/rans/zeroeq/model.hh b/dumux/freeflow/rans/zeroeq/model.hh
index 789fa28b5d..7d7c6418df 100644
--- a/dumux/freeflow/rans/zeroeq/model.hh
+++ b/dumux/freeflow/rans/zeroeq/model.hh
@@ -40,6 +40,7 @@
 #include <dumux/freeflow/rans/model.hh>
 #include <dumux/freeflow/navierstokes/volumevariables.hh>
 
+#include "problem.hh"
 #include "volumevariables.hh"
 
 namespace Dumux {
@@ -55,6 +56,33 @@ namespace TTag {
 struct ZeroEq { using InheritsFrom = std::tuple<RANS>; };
 } // end namespace TTag
 
+/*!
+ * \ingroup ZeroEqModel
+ * \brief Traits for the ZeroEq model
+ *
+ * \tparam dimension The dimension of the problem
+ */
+template<int dimension>
+struct ZeroEqModelTraits : RANSModelTraits<dimension>
+{
+    //! The dimension of the model
+    static constexpr int dim() { return dimension; }
+
+    //! return the type of turbulence model used
+    static constexpr auto turbulenceModel()
+    { return TurbulenceModel::zeroeq; }
+};
+
+template<class TypeTag>
+struct ModelTraits<TypeTag, TTag::ZeroEq>
+{
+private:
+    using GridView = typename GetPropType<TypeTag, Properties::FVGridGeometry>::GridView;
+    static constexpr int dim = GridView::dimension;
+public:
+    using type = ZeroEqModelTraits<dim>;
+};
+
 //! Set the volume variables property
 template<class TypeTag>
 struct VolumeVariables<TypeTag, TTag::ZeroEq>
@@ -81,10 +109,22 @@ public:
 
 // Create new type tags
 namespace TTag {
-//! The type tag for the single-phase, isothermal Reynolds-Averaged Navier-Stokes model
+//! The type tag for the single-phase, non-isothermal Reynolds-Averaged Navier-Stokes model
 struct ZeroEqNI { using InheritsFrom = std::tuple<RANSNI>; };
 } // end namespace TTag
 
+//! The model traits of the non-isothermal model
+template<class TypeTag>
+struct ModelTraits<TypeTag, TTag::ZeroEqNI>
+{
+private:
+    using GridView = typename GetPropType<TypeTag, Properties::FVGridGeometry>::GridView;
+    static constexpr int dim = GridView::dimension;
+    using IsothermalTraits = ZeroEqModelTraits<dim>;
+public:
+    using type = FreeflowNIModelTraits<IsothermalTraits>;
+};
+
 //! Set the volume variables property
 template<class TypeTag>
 struct VolumeVariables<TypeTag, TTag::ZeroEqNI>
-- 
GitLab