From 79a7d227fc34f5627fb19554ee0ad6c79224bea0 Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Mon, 5 Dec 2016 09:54:36 +0100
Subject: [PATCH] [staggeredGrid] Treat initial facet values the same way as
 dirichlet values

---
 dumux/freeflow/staggered/problem.hh           | 18 ++++++++++---
 dumux/implicit/staggered/model.hh             |  2 +-
 dumux/implicit/staggered/problem.hh           |  2 +-
 .../staggered/staggeredtestproblem.hh         | 25 ++++++++++++-------
 4 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/dumux/freeflow/staggered/problem.hh b/dumux/freeflow/staggered/problem.hh
index 6ee5c27bfe..128067bcbf 100644
--- a/dumux/freeflow/staggered/problem.hh
+++ b/dumux/freeflow/staggered/problem.hh
@@ -121,19 +121,31 @@ public:
 
      /*!
      * \brief Evaluate the boundary conditions for a dirichlet
-     *        control volume.
+     *        facet.
      *
      * \param globalPos The position of the center of the finite volume
      *            for which the dirichlet condition ought to be
      *            set in global coordinates
-     *
-     * For this method, the \a values parameter stores primary variables.
+     * \param direction The direction index of the facets unit outer normal
      */
     FacePrimaryVariables faceDirichletAtPos(const GlobalPosition &globalPos, const int direction) const
     {
         return asImp_().dirichletVelocityAtPos(globalPos)[direction];
     }
 
+    /*!
+     * \brief Evaluate the initial value for a facet.
+     *
+     * \param globalPos The position of the center of the finite volume
+     *            for which the initial values ought to be
+     *            set (in global coordinates)
+     * \param direction The direction index of the facets unit outer normal
+     */
+    FacePrimaryVariables initialFaceValueAtPos(const GlobalPosition &globalPos, const int direction) const
+    {
+        return asImp_().initialVelocityAtPos(globalPos)[direction];
+    }
+
     // \}
 
 private:
diff --git a/dumux/implicit/staggered/model.hh b/dumux/implicit/staggered/model.hh
index 603fbc4912..7529c3f0c1 100644
--- a/dumux/implicit/staggered/model.hh
+++ b/dumux/implicit/staggered/model.hh
@@ -265,7 +265,7 @@ public:
             // loop over faces
             for(auto&& scvf : scvfs(fvGeometry))
             {
-                auto initPriVars = this->problem_().initialFaceValueAtPos(scvf.center());
+                auto initPriVars = this->problem_().initialFaceValueAtPos(scvf.center(), scvf.directionIndex());
                 this->uCur_[faceIdx][scvf.dofIndexSelf()] = initPriVars;
             }
         }
diff --git a/dumux/implicit/staggered/problem.hh b/dumux/implicit/staggered/problem.hh
index ea9c1afec2..bcf6cf3422 100644
--- a/dumux/implicit/staggered/problem.hh
+++ b/dumux/implicit/staggered/problem.hh
@@ -299,7 +299,7 @@ public:
      *
      * For this method, the \a values parameter stores primary variables.
      */
-    FacePrimaryVariables initialFaceValueAtPos(const GlobalPosition &globalPos) const
+    FacePrimaryVariables initialFaceValueAtPos(const GlobalPosition &globalPos, const int direction) const
     {
         // Throw an exception (there is no reasonable default value
         // for initial values)
diff --git a/test/freeflow/staggered/staggeredtestproblem.hh b/test/freeflow/staggered/staggeredtestproblem.hh
index b42496d501..f607210c28 100644
--- a/test/freeflow/staggered/staggeredtestproblem.hh
+++ b/test/freeflow/staggered/staggeredtestproblem.hh
@@ -254,25 +254,32 @@ public:
     }
 
 
-        /*!
+    /*!
      * \brief Evaluate the initial value for a facet.
      *
-     * \param values The initial values for the primary variables
      * \param globalPos The position of the center of the finite volume
      *            for which the initial values ought to be
      *            set (in global coordinates)
-     *
-     * For this method, the \a values parameter stores primary variables.
+     * \param direction The direction index of the facets unit outer normal
      */
-    FacePrimaryVariables initialFaceValueAtPos(const GlobalPosition &globalPos) const
+    GlobalPosition initialVelocityAtPos(const GlobalPosition &globalPos) const
     {
-        FacePrimaryVariables value(0.0);
-        if(globalPos[0] < 1e-6)
-            value[0] = 1.0;
-        return value;
+        GlobalPosition velocity;
+        velocity[0] = 1.0;
+        velocity[1] = 0.0;
+        return velocity;
 
     }
 
+     /*!
+     * \brief Evaluate the boundary conditions for a dirichlet
+     *        facet.
+     *
+     * \param globalPos The position of the center of the finite volume
+     *            for which the dirichlet condition ought to be
+     *            set in global coordinates
+     * \param direction The direction index of the facets unit outer normal
+     */
     GlobalPosition dirichletVelocityAtPos(const GlobalPosition &pos) const
     {
         GlobalPosition velocity;
-- 
GitLab