From 6ee7a240976a39b74b65dbd36618cbc6fc50aff4 Mon Sep 17 00:00:00 2001
From: Thomas Fetzer <thomas.fetzer@iws.uni-stuttgart.de>
Date: Tue, 3 Jul 2018 16:53:43 +0200
Subject: [PATCH] [rans][oneeq] Implement different sTilde methods

---
 dumux/freeflow/rans/oneeq/volumevariables.hh | 36 +++++++++++++++++---
 test/freeflow/rans/test_pipe_laufer.input    |  3 ++
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/dumux/freeflow/rans/oneeq/volumevariables.hh b/dumux/freeflow/rans/oneeq/volumevariables.hh
index c37b1f502c..207233d82d 100644
--- a/dumux/freeflow/rans/oneeq/volumevariables.hh
+++ b/dumux/freeflow/rans/oneeq/volumevariables.hh
@@ -234,11 +234,29 @@ public:
     //! \brief Returns a modified version of the stress tensor scalar product
     Scalar stressTensorScalarProductTilde() const
     {
-//         return std::max(0.3 * vorticityMagnitude(),
-//                vorticityMagnitude()
-//                + viscosityTilde() * fv2()
-//                  / RANSParentType::karmanConstant() / RANSParentType::karmanConstant()
-//                  / RANSParentType::wallDistance() / RANSParentType::wallDistance());
+
+        static const int sTildeTerm = getParamFromGroup<int>("",
+                                                             "OneEq.STildeType", 0);
+        if (sTildeTerm == 1)
+        {
+            return std::max(0.3 * vorticityMagnitude(),
+                   vorticityMagnitude()
+                   + viscosityTilde() * fv2()
+                     / RANSParentType::karmanConstant() / RANSParentType::karmanConstant()
+                     / RANSParentType::wallDistance() / RANSParentType::wallDistance());
+        }
+        else if (sTildeTerm == 2)
+        {
+            Scalar sBar = viscosityTilde() * fv2()
+                          / RANSParentType::karmanConstant() / RANSParentType::karmanConstant()
+                          / RANSParentType::wallDistance() / RANSParentType::wallDistance();
+            return sBar < -c2() * vorticityMagnitude()
+                  ? vorticityMagnitude()
+                    + (vorticityMagnitude() * (c2() * c2() * vorticityMagnitude() + c3() * sBar))
+                      / ((c3() - 2.0 * c2()) * vorticityMagnitude() - sBar)
+                  : vorticityMagnitude() + sBar;
+        }
+
         return vorticityMagnitude()
                + viscosityTilde() * fv2()
                  / RANSParentType::karmanConstant() / RANSParentType::karmanConstant()
@@ -252,6 +270,14 @@ public:
         return sqrt(2.0 * vorticityTensorScalarProduct_);
     }
 
+    //! \brief Returns a model constant
+    Scalar c2() const
+    { return 0.7; }
+
+    //! \brief Returns a model constant
+    Scalar c3() const
+    { return 0.9; }
+
     //! \brief Returns a model constant
     Scalar sigma() const
     { return 2.0/3.0; }
diff --git a/test/freeflow/rans/test_pipe_laufer.input b/test/freeflow/rans/test_pipe_laufer.input
index 6f15f68d03..aeb798c570 100644
--- a/test/freeflow/rans/test_pipe_laufer.input
+++ b/test/freeflow/rans/test_pipe_laufer.input
@@ -20,6 +20,9 @@ InletVelocity = 2.5 # [m/s]
 EnableGravity = false
 SandGrainRoughness = 0.0 # [m] # not implemented for EddyViscosityModel = 3
 
+[OneEq]
+STildeType = 2
+
 [RANS]
 EddyViscosityModel = "baldwinLomax"
 UseStoredEddyViscosity = false
-- 
GitLab