From 91f8f0b0820a08d6f157c9350a84e8fe21cbac7a Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Sat, 18 May 2013 08:59:28 +0000
Subject: [PATCH] implicit cell-centered: mixed Dirichlet/Neumann conditions
 need a special treatment. Until something better is found, the Dirichlet part
 of the mixed conditions is set in a strong way.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10709 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 .../implicit/cellcentered/cclocalresidual.hh  | 34 ++++++++++++++-----
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/dumux/implicit/cellcentered/cclocalresidual.hh b/dumux/implicit/cellcentered/cclocalresidual.hh
index 43d4f4e05d..15afb7023e 100644
--- a/dumux/implicit/cellcentered/cclocalresidual.hh
+++ b/dumux/implicit/cellcentered/cclocalresidual.hh
@@ -204,15 +204,33 @@ protected:
         Valgrind::SetUndefined(values);
 
         unsigned bfIdx = isIt->indexInInside();
-        this->asImp_().computeFlux(values, bfIdx, true);
-        values *= this->curVolVars_(0).extrusionFactor();
-
-        // add fluxes to the residual
-        Valgrind::CheckDefined(values);
-        for (int eqIdx = 0; eqIdx < numEq; ++eqIdx)
+        
+        // check for mixed Dirichlet/Neumann conditions
+        if (bcTypes.hasNeumann())
         {
-            if (bcTypes.isDirichlet(eqIdx))
-                this->residual_[0][eqIdx] += values[eqIdx];
+            this->problem_().dirichlet(values, *isIt);
+            Valgrind::CheckDefined(values);
+            
+            // set Dirichlet conditions in a strong sense
+            for (int eqIdx = 0; eqIdx < numEq; ++eqIdx)
+            {
+                if (bcTypes.isDirichlet(eqIdx))
+                    this->residual_[0][eqIdx] 
+                      = this->curPriVar_(0, eqIdx) - values[eqIdx];
+            }
+        }
+        else // pure Dirichlet conditions
+        {
+            this->asImp_().computeFlux(values, bfIdx, true);
+            values *= this->curVolVars_(0).extrusionFactor();
+
+            // add fluxes to the residual
+            Valgrind::CheckDefined(values);
+            for (int eqIdx = 0; eqIdx < numEq; ++eqIdx)
+            {
+                if (bcTypes.isDirichlet(eqIdx))
+                    this->residual_[0][eqIdx] += values[eqIdx];
+            }
         }
     }
 
-- 
GitLab