From cd916a7292b24d3075cbe19b1068aa701d72c130 Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Fri, 6 Apr 2012 07:25:37 +0000
Subject: [PATCH] 2pfluxvariables, boxfvelementgeometry: add possibility for
 generalizing the flux approximation. 2plocalresidual: derive from the already
 existing property BaseLocalResidual instead of explicitly deriving from
 BoxLocalResidual.

Reviewed by Christoph.


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8062 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/boxmodels/2p/2pfluxvariables.hh          | 7 +++++--
 dumux/boxmodels/2p/2plocalresidual.hh          | 2 +-
 dumux/boxmodels/common/boxfvelementgeometry.hh | 5 +++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dumux/boxmodels/2p/2pfluxvariables.hh b/dumux/boxmodels/2p/2pfluxvariables.hh
index bbf97881b5..4949221d5b 100644
--- a/dumux/boxmodels/2p/2pfluxvariables.hh
+++ b/dumux/boxmodels/2p/2pfluxvariables.hh
@@ -157,18 +157,21 @@ private:
     {
         // calculate gradients
         for (int idx = 0;
-             idx < fvElemGeom_.numVertices;
+             idx < fvElemGeom_.numFAP;
              idx++) // loop over adjacent vertices
         {
             // FE gradient at vertex idx
             const Vector &feGrad = face().grad[idx];
 
+	    // index for the element volume variables 
+	    int volVarsIdx = face().fapIndices[idx];
+	    
             // compute sum of pressure gradients for each phase
             for (int phase = 0; phase < numPhases; phase++)
             {
                 // the pressure gradient
                 Vector tmp(feGrad);
-                tmp *= elemVolVars[idx].pressure(phase);
+                tmp *= elemVolVars[volVarsIdx].pressure(phase);
                 potentialGrad_[phase] += tmp;
             }
         }
diff --git a/dumux/boxmodels/2p/2plocalresidual.hh b/dumux/boxmodels/2p/2plocalresidual.hh
index 989edd6a73..66076a8b60 100644
--- a/dumux/boxmodels/2p/2plocalresidual.hh
+++ b/dumux/boxmodels/2p/2plocalresidual.hh
@@ -44,7 +44,7 @@ namespace Dumux
  * that it uses static polymorphism.
  */
 template<class TypeTag>
-class TwoPLocalResidual : public BoxLocalResidual<TypeTag>
+class TwoPLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
 {
 protected:
     typedef typename GET_PROP_TYPE(TypeTag, LocalResidual) Implementation;
diff --git a/dumux/boxmodels/common/boxfvelementgeometry.hh b/dumux/boxmodels/common/boxfvelementgeometry.hh
index 063b38d21a..bf2cc56c51 100644
--- a/dumux/boxmodels/common/boxfvelementgeometry.hh
+++ b/dumux/boxmodels/common/boxfvelementgeometry.hh
@@ -325,6 +325,7 @@ class BoxFVElementGeometry
     enum{maxNF = (dim < 3 ? 1 : 6)};
     enum{maxCOS = (dim < 3 ? 2 : 4)};
     enum{maxBF = (dim < 3 ? 8 : 24)};
+    enum{maxNFAP = (dim < 3 ? 4 : 8)};
     typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
     typedef typename GridView::ctype CoordScalar;
     typedef typename GridView::Traits::template Codim<0>::Entity Element;
@@ -571,6 +572,7 @@ public:
         Scalar area; //!< area of face
         Dune::FieldVector<Vector, maxNC> grad; //!< derivatives of shape functions at ip
         Dune::FieldVector<Scalar, maxNC> shapeValue; //!< value of shape functions at ip
+        Dune::FieldVector<int, maxNFAP> fapIndices; //!< indices w.r.t.neighbors of the flux approximation points
     };
 
     typedef SubControlVolumeFace BoundaryFace; //!< compatibility typedef
@@ -586,6 +588,7 @@ public:
     int numVertices; //!< number of verts
     int numEdges; //!< number of edges
     int numFaces; //!< number of faces (0 in < 3D)
+    int numFAP; //!< number of flux approximation points
 
     const LocalFiniteElementCache feCache_;
     bool computeGradientAtScvCenters;
@@ -618,6 +621,7 @@ public:
         numVertices = referenceElement.size(dim);
         numEdges = referenceElement.size(dim-1);
         numFaces = (dim<3)?0:referenceElement.size(1);
+        numFAP = numVertices;
 
         // corners:
         for (int vert = 0; vert < numVertices; vert++) {
@@ -713,6 +717,7 @@ public:
             for (int vert = 0; vert < numVertices; vert++) {
                 jacInvT.mv(localJac[vert][0], subContVolFace[k].grad[vert]);
                 subContVolFace[k].shapeValue[vert] = Scalar(shapeVal[vert]);
+                subContVolFace[k].fapIndices[vert] = vert;
             }
         } // end loop over edges / sub control volume faces
 
-- 
GitLab