From 0ad15b51508e01c5d6e058eac5f53f58693e386c Mon Sep 17 00:00:00 2001
From: Markus Wolff <markus.wolff@twt-gmbh.de>
Date: Wed, 22 Aug 2012 11:53:05 +0000
Subject: [PATCH] fixed bug at dirichlet boundaries of decoupled 2p mpfa models

   - corrected calculation of phase potentials at boundaries



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8951 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh              | 1 -
 .../diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2p.hh   | 3 +--
 .../fvmpfa/lmethod/fvmpfal2pfaboundpressure2padaptive.hh     | 3 +--
 .../diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2p.hh   | 2 +-
 .../fvmpfa/lmethod/fvmpfal2pfaboundvelocity2padaptive.hh     | 2 +-
 .../diffusion/fvmpfa/omethod/fvmpfao2pfaboundpressure2p.hh   | 3 +--
 .../diffusion/fvmpfa/omethod/fvmpfao2pfaboundvelocity2p.hh   | 5 ++++-
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh
index b615aa5a63..2cb79eede1 100644
--- a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh
+++ b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh
@@ -352,7 +352,6 @@ public:
         for (int i = 0; i < size; i++)
         {
             CellData& cellData = problem_.variables().cellData(i);
-            storePressureSolution(i, cellData);
 
             if (pressureType_ == pw)
             {
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2p.hh
index 8ef79f66f4..9a0c5ecc6b 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2p.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2p.hh
@@ -348,7 +348,6 @@ public:
                 int idx = problem_.variables().index(*eIt);
                 CellData& cellData = problem_.variables().cellData(idx);
 
-                storePressureSolution(*eIt);
                 (*pC)[idx] = cellData.capillaryPressure();
 
                 if (pressureType_ == pw)
@@ -1864,7 +1863,7 @@ void FVMPFAL2PFABoundPressure2P<TypeTag>::assemble()
                             lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
 
                             Scalar potentialBound = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx];
-                            Scalar gdeltaZ = (problem_.bboxMax()-globalPos) * gravity_;
+                            Scalar gdeltaZ = (problem_.bboxMax()-globalPosFace) * gravity_;
 
                             //calculate potential gradients
                             Scalar potentialW = 0;
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2padaptive.hh
index 37c5b3856b..a612522ef6 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundpressure2padaptive.hh
@@ -369,7 +369,6 @@ public:
                 int idx = problem_.variables().index(*eIt);
                 CellData& cellData = problem_.variables().cellData(idx);
 
-                storePressureSolution(*eIt);
                 (*pC)[idx] = cellData.capillaryPressure();
 
                 if (pressureType_ == pw)
@@ -2659,7 +2658,7 @@ void FVMPFAL2PFABoundPressure2PAdaptive<TypeTag>::assemble()
                             lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
 
                             Scalar potentialBound = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx];
-                            Scalar gdeltaZ = (problem_.bboxMax()-globalPos) * gravity_;
+                            Scalar gdeltaZ = (problem_.bboxMax()-globalPosFace) * gravity_;
 
                             //calculate potential gradients
                             Scalar potentialW = 0;
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2p.hh
index 76e5627f81..82afaa96ea 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2p.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2p.hh
@@ -813,7 +813,7 @@ void FVMPFAL2PFABoundVelocity2P<TypeTag>::calculateVelocity()
                             lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
                             lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
 
-                            Scalar gdeltaZ = (problem_.bboxMax()-globalPos) * gravity_;
+                            Scalar gdeltaZ = (problem_.bboxMax()-globalPosFace) * gravity_;
                             Scalar potentialBoundW = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx] + density_[wPhaseIdx]*gdeltaZ;
                             Scalar potentialBoundNW = potentialBoundW;
 
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2padaptive.hh
index 7ce8226574..c936c913f7 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2padaptive.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal2pfaboundvelocity2padaptive.hh
@@ -1156,7 +1156,7 @@ void FVMPFAL2PFABoundVelocity2PAdaptive<TypeTag>::calculateVelocity()
                             lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
                             lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
 
-                            Scalar gdeltaZ = (problem_.bboxMax()-globalPos) * gravity_;
+                            Scalar gdeltaZ = (problem_.bboxMax()-globalPosFace) * gravity_;
                             Scalar potentialBoundW = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx] + density_[wPhaseIdx]*gdeltaZ;
                             Scalar potentialBoundNW = potentialBoundW;
 
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundpressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundpressure2p.hh
index 2ac546010c..2b778d8d3f 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundpressure2p.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundpressure2p.hh
@@ -337,7 +337,6 @@ public:
                 int idx = problem_.variables().index(*eIt);
                 CellData& cellData = problem_.variables().cellData(idx);
 
-                storePressureSolution(*eIt);
                 (*pC)[idx] = cellData.capillaryPressure();
 
                 if (pressureType_ == pw)
@@ -1938,7 +1937,7 @@ void FVMPFAO2PFABoundPressure2P<TypeTag>::assemble()
                             lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
 
                             Scalar potentialBound = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx];
-                            Scalar gdeltaZ = (problem_.bboxMax()-globalPos) * gravity_;
+                            Scalar gdeltaZ = (problem_.bboxMax()-globalPosFace) * gravity_;
 
                             //calculate potential gradients
                             Scalar potentialW = 0;
diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundvelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundvelocity2p.hh
index af0c7a4f24..aa48cf4a3f 100644
--- a/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundvelocity2p.hh
+++ b/dumux/decoupled/2p/diffusion/fvmpfa/omethod/fvmpfao2pfaboundvelocity2p.hh
@@ -205,8 +205,11 @@ public:
     {
         ParentType::addOutputVtkFields(writer);
 
+        std::cout<<"muh\n";
         if (vtkOutputLevel_ > 0)
         {
+            std::cout<<"muhin\n";
+
             Dune::BlockVector < DimVector > &velocityWetting = *(writer.template allocateManagedBuffer<
                     Scalar, dim>(problem_.gridView().size(0)));
             Dune::BlockVector < DimVector > &velocityNonwetting =
@@ -695,7 +698,7 @@ void FVMPFAO2PFABoundVelocity2P<TypeTag>::calculateVelocity()
                             lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
                             lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
 
-                            Scalar gdeltaZ = (problem_.bboxMax()-globalPos) * gravity_;
+                            Scalar gdeltaZ = (problem_.bboxMax()-globalPosFace) * gravity_;
                             Scalar potentialBoundW = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx] + density_[wPhaseIdx]*gdeltaZ;
                             Scalar potentialBoundNW = potentialBoundW;
 
-- 
GitLab