From 02943424773980c44bced0096f69eef8ab7db198 Mon Sep 17 00:00:00 2001
From: Thomas Fetzer <thomas.fetzer@iws.uni-stuttgart.de>
Date: Tue, 17 Apr 2018 13:18:26 +0200
Subject: [PATCH] [navierstokes] Implement an unsymmetrized version of the
 velocity gradient

---
 .../navierstokes/staggered/fluxvariables.hh   | 56 +++++++++++--------
 1 file changed, 33 insertions(+), 23 deletions(-)

diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh
index 996bf049b2..84168c3e03 100644
--- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh
+++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh
@@ -234,7 +234,11 @@ public:
         // The velocity gradient already accounts for the orientation
         // of the staggered face's outer normal vector.
         const Scalar gradV = (velocityOpposite - velocitySelf) / scvf.selfToOppositeDistance();
-        normalFlux -= insideVolVars.effectiveViscosity() * 2.0 * gradV;
+
+        static const bool enableUnsymmetrizedVelocityGradient
+            = getParamFromGroup<bool>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "FreeFlow.EnableUnsymmetrizedVelocityGradient", false);
+        Scalar factor = enableUnsymmetrizedVelocityGradient ? 1.0 : 2.0;
+        normalFlux -= factor * insideVolVars.effectiveViscosity() * gradV;
 
         // The pressure term.
         // If specified, the pressure can be normalized using the initial value on the scfv of interest.
@@ -426,6 +430,9 @@ private:
     {
         FacePrimaryVariables normalDiffusiveFlux(0.0);
 
+        static const bool enableUnsymmetrizedVelocityGradient
+            = getParamFromGroup<bool>(GET_PROP_VALUE(TypeTag, ModelParameterGroup), "FreeFlow.EnableUnsymmetrizedVelocityGradient", false);
+
         // Get the volume variables of the own and the neighboring element. The neighboring
         // element is adjacent to the staggered face normal to the current scvf
         // where the dof of interest is located.
@@ -437,33 +444,36 @@ private:
                              ? insideVolVars.effectiveViscosity()
                              : (insideVolVars.effectiveViscosity() + outsideVolVars.effectiveViscosity()) * 0.5;
 
-        // For the normal gradient, get the velocities perpendicular to the velocity at the current scvf.
-        // The inner one is located at staggered face within the own element,
-        // the outer one at the respective staggered face of the element on the other side of the
-        // current scvf.
-        const Scalar innerNormalVelocity = faceVars.velocityNormalInside(localSubFaceIdx);
-
-        // Lambda to conveniently get the outer normal velocity for faces that are on the boundary
-        // and therefore have no neighbor. Calls the problem to retrieve a fixed value set on the boundary.
-        auto getNormalVelocityFromBoundary = [&]()
+        if (!enableUnsymmetrizedVelocityGradient)
         {
-            const auto ghostFace = makeNormalGhostFace_(scvf, localSubFaceIdx);
-            return problem.dirichlet(element, ghostFace)[Indices::velocity(normalFace.directionIndex())];
-        };
+            // For the normal gradient, get the velocities perpendicular to the velocity at the current scvf.
+            // The inner one is located at staggered face within the own element,
+            // the outer one at the respective staggered face of the element on the other side of the
+            // current scvf.
+            const Scalar innerNormalVelocity = faceVars.velocityNormalInside(localSubFaceIdx);
+
+            // Lambda to conveniently get the outer normal velocity for faces that are on the boundary
+            // and therefore have no neighbor. Calls the problem to retrieve a fixed value set on the boundary.
+            auto getNormalVelocityFromBoundary = [&]()
+            {
+                const auto ghostFace = makeNormalGhostFace_(scvf, localSubFaceIdx);
+                return problem.dirichlet(element, ghostFace)[Indices::velocity(normalFace.directionIndex())];
+            };
 
-        const Scalar outerNormalVelocity = scvf.hasFrontalNeighbor(localSubFaceIdx)
-                                           ? faceVars.velocityNormalOutside(localSubFaceIdx)
-                                           : getNormalVelocityFromBoundary();
+            const Scalar outerNormalVelocity = scvf.hasFrontalNeighbor(localSubFaceIdx)
+                                              ? faceVars.velocityNormalOutside(localSubFaceIdx)
+                                              : getNormalVelocityFromBoundary();
 
-        // Calculate the velocity gradient in positive coordinate direction.
-        const Scalar normalDeltaV = scvf.normalInPosCoordDir()
-                                    ? (outerNormalVelocity - innerNormalVelocity)
-                                    : (innerNormalVelocity - outerNormalVelocity);
+            // Calculate the velocity gradient in positive coordinate direction.
+            const Scalar normalDeltaV = scvf.normalInPosCoordDir()
+                                        ? (outerNormalVelocity - innerNormalVelocity)
+                                        : (innerNormalVelocity - outerNormalVelocity);
 
-        const Scalar normalGradient = normalDeltaV / scvf.pairData(localSubFaceIdx).normalDistance;
+            const Scalar normalGradient = normalDeltaV / scvf.pairData(localSubFaceIdx).normalDistance;
 
-        // Account for the orientation of the staggered normal face's outer normal vector.
-        normalDiffusiveFlux -= muAvg * normalGradient * normalFace.directionSign();
+            // Account for the orientation of the staggered normal face's outer normal vector.
+            normalDiffusiveFlux -= muAvg * normalGradient * normalFace.directionSign();
+        }
 
         // For the parallel derivative, get the velocities at the current (own) scvf
         // and at the parallel one at the neighboring scvf.
-- 
GitLab