diff --git a/dumux/boxmodels/2p/2pfluxvariables.hh b/dumux/boxmodels/2p/2pfluxvariables.hh index bbf97881b50f0a636ad9e1d663a14193e3e60256..4949221d5bac758a1b2e2bf780a82ceb911f4809 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 989edd6a738460905e74e15298b420e3e2c899ef..66076a8b60eda4e2831316b4d6d5666ddd1d8fb7 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 063b38d21a49401393c0045a32e612d4336b3855..bf2cc56c51395ece30cc25056c322000eca3bef0 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