From ff26deceee02c15fcef2f4749d7b84d18c770b25 Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Tue, 21 May 2013 10:35:13 +0000
Subject: [PATCH] CCElementVolumeVariables: copy the volume variables from the
 cell to the Neumann/outflow boundary faces to allow for a uniform treatment
 in, for example, the velocity calculation.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10713 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 .../cellcentered/ccelementvolumevariables.hh    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/dumux/implicit/cellcentered/ccelementvolumevariables.hh b/dumux/implicit/cellcentered/ccelementvolumevariables.hh
index c4ef734582..b2a5b09e1a 100644
--- a/dumux/implicit/cellcentered/ccelementvolumevariables.hh
+++ b/dumux/implicit/cellcentered/ccelementvolumevariables.hh
@@ -104,14 +104,16 @@ public:
         // only treat boundary if current solution is evaluated
         if (!oldSol)
         {
-            // check if element intersects with a Dirichlet boundary 
+            // check if element intersects with the boundary 
             ElementBoundaryTypes elemBCTypes;
             elemBCTypes.update(problem, element);
-            if (elemBCTypes.hasDirichlet())
+            if (elemBCTypes.hasDirichlet() 
+                || elemBCTypes.hasNeumann() 
+                || elemBCTypes.hasOutflow())
             {
                 this->resize(numNeighbors + element.template count<1>());
 
-                // add volume variables for the Dirichlet faces
+                // add volume variables for the boundary faces
                 IntersectionIterator isIt = problem.gridView().ibegin(element);
                 IntersectionIterator isEndIt = problem.gridView().iend(element);
                 for (; isIt != isEndIt; ++isIt) {
@@ -121,13 +123,14 @@ public:
                     BoundaryTypes bcTypes;
                     problem.boundaryTypes(bcTypes, *isIt);
 
+                    int faceIdx = isIt->indexInInside();
+                    int indexInVariables = numNeighbors + faceIdx;
+
                     if (bcTypes.hasDirichlet())
                     {
                         PrimaryVariables dirichletValues;
                         problem.dirichlet(dirichletValues, *isIt);
 
-                        int faceIdx = isIt->indexInInside();
-                        int indexInVariables = numNeighbors + faceIdx;
                         (*this)[indexInVariables].update(dirichletValues,
                                                          problem,
                                                          element,
@@ -135,6 +138,10 @@ public:
                                                          /*scvIdx=*/0,
                                                          oldSol);
                     }
+                    else 
+                    {
+                        (*this)[indexInVariables] = (*this)[0];
+                    }
                 }
             }
         }
-- 
GitLab