From 390ecef4439f5478459b7c5c8d2f15b8422b5abe Mon Sep 17 00:00:00 2001
From: Andreas Lauser <and@poware.org>
Date: Thu, 24 Mar 2011 11:13:53 +0000
Subject: [PATCH] make it possible to specify solution dependend source terms
 and neumann conditions

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@5455 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/boxmodels/common/boxlocalresidual.hh    |   3 +-
 dumux/boxmodels/common/boxproblem.hh          | 361 +++++++++++++-----
 .../richards/richardslocalresidual.hh         |   3 +-
 test/boxmodels/1p/1ptestproblem.hh            |  18 +-
 test/boxmodels/1p2c/tissue_tumor_problem.hh   |   9 +-
 test/boxmodels/2p/lensproblem.hh              |  52 +--
 test/boxmodels/2p2c/injectionproblem.hh       |  22 +-
 test/boxmodels/2p2cni/waterairproblem.hh      |  22 +-
 test/boxmodels/2pni/injectionproblem2pni.hh   |  22 +-
 .../boxmodels/richards/richardslensproblem.hh |  59 +--
 10 files changed, 288 insertions(+), 283 deletions(-)

diff --git a/dumux/boxmodels/common/boxlocalresidual.hh b/dumux/boxmodels/common/boxlocalresidual.hh
index ffa9008bf2..295e4a797b 100644
--- a/dumux/boxmodels/common/boxlocalresidual.hh
+++ b/dumux/boxmodels/common/boxlocalresidual.hh
@@ -462,7 +462,8 @@ protected:
                                fvElemGeom_(),
                                *isIt,
                                scvIdx,
-                               boundaryFaceIdx);
+                               boundaryFaceIdx,
+                               curVolVars_());
             values *= fvElemGeom_().boundaryFace[boundaryFaceIdx].area;
             Valgrind::CheckDefined(values);
             residual_[scvIdx] += values;
diff --git a/dumux/boxmodels/common/boxproblem.hh b/dumux/boxmodels/common/boxproblem.hh
index 070a30f518..cba0ac970f 100644
--- a/dumux/boxmodels/common/boxproblem.hh
+++ b/dumux/boxmodels/common/boxproblem.hh
@@ -60,16 +60,22 @@ private:
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(VertexMapper)) VertexMapper;
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(ElementMapper)) ElementMapper;
 
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables)) PrimaryVariables;
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(ElementVolumeVariables)) ElementVolumeVariables;
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(BoundaryTypes)) BoundaryTypes;
+
     enum {
         dim = GridView::dimension,
         dimWorld = GridView::dimensionworld
     };
 
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables)) PrimaryVariables;
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(BoundaryTypes)) BoundaryTypes;
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
+    typedef typename GridView::template Codim<dim>::Entity Vertex;
+    typedef typename GridView::template Codim<dim>::Iterator VertexIterator;
+
 
     typedef typename GridView::template Codim<0>::Entity Element;
+    typedef typename GridView::Intersection Intersection;
 
     typedef typename GridView::template Codim<dim>::Entity Vertex;
     typedef typename GridView::template Codim<dim>::Iterator VertexIterator;
@@ -122,6 +128,7 @@ public:
         delete resultWriter_;
     };
 
+
     /*!
      * \brief Called by the Dumux::TimeManager in order to
      *        initialize the problem.
@@ -135,6 +142,252 @@ public:
         model().init(asImp_());
     }
 
+    /*!
+     * \brief Specifies which kind of boundary condition should be
+     *        used for which equation on a given boundary segment.
+     *
+     * \param values The boundary types for the conservation equations
+     * \param vertex The vertex for which the boundary type is set
+     */
+    void boundaryTypes(BoundaryTypes &values,
+                       const Vertex &vertex) const
+    {
+        // forward it to the method which only takes the global coordinate
+        asImp_().boundaryTypes(values, vertex.geometry().center());
+    }
+
+    /*!
+     * \brief Specifies which kind of boundary condition should be
+     *        used for which equation on a given boundary segment.
+     *
+     * \param values The boundary types for the conservation equations
+     * \param pos The position of the finite volume in global coordinates
+     */
+    void boundaryTypes(PrimaryVariables &values,
+                       const GlobalPosition &pos) const
+    {
+        // Throw an exception (there is no reasonable default value
+        // for Dirichlet conditions)
+        DUNE_THROW(Dune::InvalidStateException,
+                   "The problem does not provide "
+                   "a boundaryTypes() method.");
+    }
+
+
+    /*!
+     * \brief Evaluate the boundary conditions for a dirichlet
+     *        control volume.
+     *
+     * \param values The dirichlet values for the primary variables
+     * \param vertex The vertex representing the "half volume on the boundary"
+     *
+     * For this method, the \a values parameter stores primary variables.
+     */
+    void dirichlet(PrimaryVariables &values,
+                   const Vertex &vertex) const
+    {
+        // forward it to the method which only takes the global coordinate
+        asImp_().dirichlet(values, vertex.geometry().center());
+    }
+
+    /*!
+     * \brief Evaluate the boundary conditions for a dirichlet
+     *        control volume.
+     *
+     * \param values The dirichlet values for the primary variables
+     * \param pos The position of the center of the finite volume
+     *            for which the dirichlet condition ought to be
+     *            set in global coordinates
+     *
+     * For this method, the \a values parameter stores primary variables.
+     */
+    void dirichlet(PrimaryVariables &values,
+                   const GlobalPosition &pos) const
+    {
+        // Throw an exception (there is no reasonable default value
+        // for Dirichlet conditions)
+        DUNE_THROW(Dune::InvalidStateException,
+                   "The problem specifies that some boundary "
+                   "segments are dirichlet, but does not provide "
+                   "a dirichlet() method.");
+    }
+
+    /*!
+     * \brief Evaluate the boundary conditions for a neumann
+     *        boundary segment.
+     *
+     * \param values The neumann values for the conservation equations [kg / (m^2 *s )]
+     * \param element The finite element
+     * \param fvElemGeom The finite-volume geometry in the box scheme
+     * \param is The intersection between element and boundary
+     * \param scvIdx The local vertex index
+     * \param boundaryFaceIdx The index of the boundary face
+     *
+     * For this method, the \a values parameter stores the mass flux
+     * in normal direction of each phase. Negative values mean influx.
+     */
+    void neumann(PrimaryVariables &values,
+                 const Element &element,
+                 const FVElementGeometry &fvElemGeom,
+                 const Intersection &is,
+                 int scvIdx,
+                 int boundaryFaceIdx,
+                 const ElementVolumeVariables &elemVolVars) const
+    {
+        // forward it to the interface without the volume variables
+        asImp_().neumann(values,
+                         element,
+                         fvElemGeom,
+                         is,
+                         scvIdx,
+                         boundaryFaceIdx);
+    }
+
+    /*!
+     * \brief Evaluate the boundary conditions for a neumann
+     *        boundary segment.
+     *
+     * \param values The neumann values for the conservation equations [kg / (m^2 *s )]
+     * \param element The finite element
+     * \param fvElemGeom The finite-volume geometry in the box scheme
+     * \param is The intersection between element and boundary
+     * \param scvIdx The local vertex index
+     * \param boundaryFaceIdx The index of the boundary face
+     *
+     * For this method, the \a values parameter stores the mass flux
+     * in normal direction of each phase. Negative values mean influx.
+     */
+    void neumann(PrimaryVariables &values,
+                 const Element &element,
+                 const FVElementGeometry &fvElemGeom,
+                 const Intersection &is,
+                 int scvIdx,
+                 int boundaryFaceIdx) const
+    {
+        // forward it to the interface with only the global position
+        asImp_().neumann(values, fvElemGeom.boundaryFace[boundaryFaceIdx].ipGlobal);
+    }
+
+    /*!
+     * \brief Evaluate the boundary conditions for a neumann
+     *        boundary segment.
+     *
+     * \param values The neumann values for the conservation equations [kg / (m^2 *s )]
+     * \param pos The position of the boundary face's integration point in global coordinates
+     *
+     * For this method, the \a values parameter stores the mass flux
+     * in normal direction of each phase. Negative values mean influx.
+     */
+    void neumann(PrimaryVariables &values,
+                 const GlobalPosition &pos) const
+    {
+        // do nothing
+        values = 0.0;
+    }
+
+    /*!
+     * \brief Evaluate the source term for all phases within a given
+     *        sub-control-volume.
+     *
+     * \param values The source and sink values for the conservation equations
+     * \param element The finite element
+     * \param fvElemGeom The finite-volume geometry in the box scheme
+     * \param scvIdx The local vertex index
+     *
+     * For this method, the \a values parameter stores the rate mass
+     * generated or annihilate per volume unit. Positive values mean
+     * that mass is created, negative ones mean that it vanishes.
+     */
+    void source(PrimaryVariables &values,
+                const Element &element,
+                const FVElementGeometry &fvElemGeom,
+                int scvIdx,
+                const ElementVolumeVariables &elemVolVars) const
+    {
+        // forward to solution independent, box specific interface
+        asImp_().source(values, element, fvElemGeom, scvIdx);
+    }
+
+    /*!
+     * \brief Evaluate the source term for all phases within a given
+     *        sub-control-volume.
+     *
+     * \param values The source and sink values for the conservation equations
+     * \param element The finite element
+     * \param fvElemGeom The finite-volume geometry in the box scheme
+     * \param scvIdx The local vertex index
+     *
+     * For this method, the \a values parameter stores the rate mass
+     * generated or annihilate per volume unit. Positive values mean
+     * that mass is created, negative ones mean that it vanishes.
+     */
+    void source(PrimaryVariables &values,
+                const Element &element,
+                const FVElementGeometry &fvElemGeom,
+                int scvIdx) const
+    {
+        // forward to generic interface
+        asImp_().source(values, fvElemGeom.subContVol[scvIdx].global);
+    }
+
+    /*!
+     * \brief Evaluate the source term for all phases within a given
+     *        sub-control-volume.
+     *
+     * \param values The source and sink values for the conservation equations
+     * \param pos The position of the center of the finite volume
+     *            for which the source term ought to be
+     *            specified in global coordinates
+     *
+     * For this method, the \a values parameter stores the rate mass
+     * generated or annihilate per volume unit. Positive values mean
+     * that mass is created, negative ones mean that it vanishes.
+     */
+    void source(PrimaryVariables &values,
+                const GlobalPosition &pos) const
+    { values = Scalar(0.0);  }
+
+    /*!
+     * \brief Evaluate the initial value for a control volume.
+     *
+     * \param values The initial values for the primary variables
+     * \param element The finite element
+     * \param fvElemGeom The finite-volume geometry in the box scheme
+     * \param scvIdx The local vertex index
+     *
+     * For this method, the \a values parameter stores primary
+     * variables.
+     */
+    void initial(PrimaryVariables &values,
+                 const Element &element,
+                 const FVElementGeometry &fvElemGeom,
+                 int scvIdx) const
+    {
+        // forward to generic interface
+        asImp_().source(values, fvElemGeom.subContVol[scvIdx].global);
+    }
+
+    /*!
+     * \brief Evaluate the initial value for a control volume.
+     *
+     * \param values The dirichlet values for the primary variables
+     * \param pos The position of the center of the finite volume
+     *            for which the initial values ought to be
+     *            set (in global coordinates)
+     *
+     * For this method, the \a values parameter stores primary variables.
+     */
+    void initial(PrimaryVariables &values,
+                 const GlobalPosition &pos) const
+    {
+        // Throw an exception (there is no reasonable default value
+        // for Dirichlet conditions)
+        DUNE_THROW(Dune::InvalidStateException,
+                   "The problem does not provide "
+                   "a initial() method.");
+    }
+
+
     /*!
      * \brief Returns the maximum allowed time step size [s]
      *
@@ -367,108 +620,6 @@ public:
     { return model_; }
     // \}
 
-    /*!
-     * \brief Specifies which kind of boundary condition should be
-     *        used for which equation on a given boundary segment.
-     *
-     * \param values The boundary types for the conservation equations
-     * \param vertex The vertex for which the boundary type is set
-     */
-    void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const
-    {
-        // Throw an exception
-        DUNE_THROW(Dune::NotImplemented,
-                   "The problem specifies does not provide "
-                   "a boundaryTypes() method.");
-    }
-
-    /*!
-     * \brief Evaluate the boundary conditions for a dirichlet
-     *        control volume.
-     *
-     * \param values The dirichlet values for the primary variables
-     * \param pos The position of the center of the finite volume
-     *            for which the dirichlet condition ought to be
-     *            set in global coordinates
-     *
-     * For this method, the \a values parameter stores primary variables.
-     */
-    void dirichlet(PrimaryVariables &values,
-                   const GlobalPosition &pos) const
-    {
-        // Throw an exception (there is no reasonable default value
-        // for Dirichlet conditions)
-        DUNE_THROW(Dune::NotImplemented,
-                   "The problem specifies that some boundary "
-                   "segments are dirichlet, but does not provide "
-                   "a dirichlet() method.");
-    }
-
-    /*!
-     * \brief Evaluate the boundary conditions for a neumann
-     *        boundary segment.
-     *
-     * \param values The neumann values for the conservation equations [kg / (m^2 *s )]
-     * \param element The finite element
-     * \param fvElemGeom The finite-volume geometry in the box scheme
-     * \param is The intersection between element and boundary
-     * \param scvIdx The local vertex index
-     * \param boundaryFaceIdx The index of the boundary face
-     *
-     * For this method, the \a values parameter stores the mass flux
-     * in normal direction of each phase. Negative values mean influx.
-     */
-    void neumann(PrimaryVariables &values,
-                 const Element &element,
-                 const FVElementGeometry &fvElemGeom,
-                 const Intersection &is,
-                 int scvIdx,
-                 int boundaryFaceIdx) const
-    {
-        // Throw an exception
-        DUNE_THROW(Dune::NotImplemented,
-                   "The problem specifies that some boundary "
-                   "segments are dirichlet, but does not provide "
-                   "a neumann() method.");
-    };
-
-    /*!
-     * \brief Evaluate the initial value for a control volume.
-     *
-     * For this method, the \a values parameter stores primary
-     * variables.
-     */
-    void initial(PrimaryVariables &values,
-                 const Element &element,
-                 const FVElementGeometry &fvElemGeom,
-                 int scvIdx) const
-    {
-        // Throw an exception
-        DUNE_THROW(Dune::NotImplemented,
-                   "The problem specifies does not provide "
-                   "a initial() method.");
-    }
-
-    /*!
-     * \brief Evaluate the source term for all phases within a given
-     *        sub-control-volume.
-     *
-     * For this method, the \a values parameter stores the rate mass
-     * of a component is generated or annihilate per volume
-     * unit. Positive values mean that mass is created, negative ones
-     * mean that it vanishes.
-     */
-    void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
-    {
-        // Throw an exception
-        DUNE_THROW(Dune::NotImplemented,
-                   "The problem specifies does not provide "
-                   "a source() method.");
-    }
-
     /*!
      * \name Restart mechanism
      */
diff --git a/dumux/boxmodels/richards/richardslocalresidual.hh b/dumux/boxmodels/richards/richardslocalresidual.hh
index 0ceaedda89..3d738fc236 100644
--- a/dumux/boxmodels/richards/richardslocalresidual.hh
+++ b/dumux/boxmodels/richards/richardslocalresidual.hh
@@ -151,7 +151,8 @@ public:
         this->problem_().source(q,
                                 this->elem_(),
                                 this->fvElemGeom_(),
-                                scvIdx);
+                                scvIdx,
+                                this->curVolVars_());
     }
 };
 
diff --git a/test/boxmodels/1p/1ptestproblem.hh b/test/boxmodels/1p/1ptestproblem.hh
index 5afe5cc9eb..63b1101d2f 100644
--- a/test/boxmodels/1p/1ptestproblem.hh
+++ b/test/boxmodels/1p/1ptestproblem.hh
@@ -222,6 +222,7 @@ public:
      * in normal direction of each component. Negative values mean
      * influx.
      */
+    using ParentType::neumann;
     void neumann(PrimaryVariables &values,
                  const Element &element,
                  const FVElementGeometry &fvElemGeom,
@@ -241,23 +242,6 @@ public:
      */
     // \{
 
-    /*!
-     * \brief Evaluate the source term for all phases within a given
-     *        sub-control-volume.
-     *
-     * For this method, the \a values parameter stores the rate mass
-     * of a component is generated or annihilate per volume
-     * unit. Positive values mean that mass is created, negative ones
-     * mean that it vanishes.
-     */
-    void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
-    {
-        values = Scalar(0.0);
-    }
-
     /*!
      * \brief Evaluate the initial value for a control volume.
      *
diff --git a/test/boxmodels/1p2c/tissue_tumor_problem.hh b/test/boxmodels/1p2c/tissue_tumor_problem.hh
index a2c7141c38..d507d51697 100644
--- a/test/boxmodels/1p2c/tissue_tumor_problem.hh
+++ b/test/boxmodels/1p2c/tissue_tumor_problem.hh
@@ -246,6 +246,7 @@ public:
      * in normal direction of each component. Negative values mean
      * influx.
      */
+    using ParentType::neumann;
     void neumann(PrimaryVariables &values,
                  const Element &element,
                  const FVElementGeometry &fvElemGeom,
@@ -285,14 +286,10 @@ public:
      * unit. Positive values mean that mass is created, negative ones
      * mean that it vanishes.
      */
+    using ParentType::source;
     void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
+                const GlobalPosition &globalPos) const
     {
-        const GlobalPosition &globalPos
-            = element.geometry().corner(scvIdx);
-
         values = Scalar(0.0);
         if (inInjectionVolume_(globalPos)) {
             // total volumetric injection rate in ml/h
diff --git a/test/boxmodels/2p/lensproblem.hh b/test/boxmodels/2p/lensproblem.hh
index e994a0d530..f2033432f6 100644
--- a/test/boxmodels/2p/lensproblem.hh
+++ b/test/boxmodels/2p/lensproblem.hh
@@ -313,15 +313,14 @@ public:
      *        control volume.
      *
      * \param values The dirichlet values for the primary variables
-     * \param vertex The vertex representing the "half volume on the boundary"
+     * \param globalPos The center of the finite volume which ought to be set.
      *
      * For this method, the \a values parameter stores primary variables.
      */
+    using ParentType::dirichlet;
     void dirichlet(PrimaryVariables &values,
-                   const Vertex &vertex) const
+                   const GlobalPosition &globalPos) const
     {
-        const GlobalPosition globalPos = vertex.geometry().center();
-
         Scalar densityW = FluidSystem::componentDensity(wPhaseIdx,
                                                         wPhaseIdx,
                                                         temperature_,
@@ -354,25 +353,15 @@ public:
      *        boundary segment.
      *
      * \param values The neumann values for the conservation equations [kg / (m^2 *s )]
-     * \param element The finite element
-     * \param fvElemGeom The finite-volume geometry in the box scheme
-     * \param is The intersection between element and boundary
-     * \param scvIdx The local vertex index
-     * \param boundaryFaceIdx The index of the boundary face
+     * \param globalPos The position of the integration point of the boundary segment.
      *
      * For this method, the \a values parameter stores the mass flux
      * in normal direction of each phase. Negative values mean influx.
      */
+    using ParentType::neumann;
     void neumann(PrimaryVariables &values,
-                 const Element &element,
-                 const FVElementGeometry &fvElemGeom,
-                 const Intersection &is,
-                 int scvIdx,
-                 int boundaryFaceIdx) const
+                 const GlobalPosition &globalPos) const
     {
-        const GlobalPosition &globalPos
-            = element.geometry().corner(scvIdx);
-
         values = 0.0;
         if (onInlet_(globalPos)) {
             values[contiNEqIdx] = -0.04; // kg / (m * s)
@@ -385,42 +374,19 @@ public:
      */
     // \{
 
-    /*!
-     * \brief Evaluate the source term for all phases within a given
-     *        sub-control-volume.
-     *
-     * \param values The source and sink values for the conservation equations
-     * \param element The finite element
-     * \param fvElemGeom The finite-volume geometry in the box scheme
-     * \param scvIdx The local vertex index
-     *
-     * For this method, the \a values parameter stores the rate mass
-     * generated or annihilate per volume unit. Positive values mean
-     * that mass is created, negative ones mean that it vanishes.
-     */
-    void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
-    {
-        values = Scalar(0.0);
-    }
 
     /*!
      * \brief Evaluate the initial value for a control volume.
      *
      * \param values The initial values for the primary variables
-     * \param element The finite element
-     * \param fvElemGeom The finite-volume geometry in the box scheme
-     * \param scvIdx The local vertex index
+     * \param globalPos The center of the finite volume which ought to be set.
      *
      * For this method, the \a values parameter stores primary
      * variables.
      */
+    using ParentType::initial;
     void initial(PrimaryVariables &values,
-                 const Element &element,
-                 const FVElementGeometry &fvElemGeom,
-                 int scvIdx) const
+                 const GlobalPosition &globalPos) const
     {
         // no DNAPL, some random pressure
         values[pwIdx] = 1e5;
diff --git a/test/boxmodels/2p2c/injectionproblem.hh b/test/boxmodels/2p2c/injectionproblem.hh
index d60170999f..3052afc36b 100644
--- a/test/boxmodels/2p2c/injectionproblem.hh
+++ b/test/boxmodels/2p2c/injectionproblem.hh
@@ -276,6 +276,7 @@ public:
      * For this method, the \a values parameter stores the mass flux
      * in normal direction of each phase. Negative values mean influx.
      */
+    using ParentType::neumann;
     void neumann(PrimaryVariables &values,
                  const Element &element,
                  const FVElementGeometry &fvElemGeom,
@@ -298,27 +299,6 @@ public:
      */
     // \{
 
-    /*!
-     * \brief Evaluate the source term for all phases within a given
-     *        sub-control-volume.
-     *
-     * \param values The source and sink values for the conservation equations
-     * \param element The finite element
-     * \param fvElemGeom The finite-volume geometry in the box scheme
-     * \param scvIdx The local vertex index
-     *
-     * For this method, the \a values parameter stores the rate mass
-     * generated or annihilate per volume unit. Positive values mean
-     * that mass is created, negative ones mean that it vanishes.
-     */
-    void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
-    {
-        values = Scalar(0.0);
-    }
-
     /*!
      * \brief Evaluate the initial value for a control volume.
      *
diff --git a/test/boxmodels/2p2cni/waterairproblem.hh b/test/boxmodels/2p2cni/waterairproblem.hh
index 8ccc478661..60caafff02 100644
--- a/test/boxmodels/2p2cni/waterairproblem.hh
+++ b/test/boxmodels/2p2cni/waterairproblem.hh
@@ -276,6 +276,7 @@ public:
      * For this method, the \a values parameter stores the mass flux
      * in normal direction of each phase. Negative values mean influx.
      */
+    using ParentType::neumann;
     void neumann(PrimaryVariables &values,
                  const Element &element,
                  const FVElementGeometry &fvElemGeom,
@@ -301,27 +302,6 @@ public:
      */
     // \{
 
-    /*!
-     * \brief Evaluate the source term for all phases within a given
-     *        sub-control-volume.
-     *
-     * \param values The source and sink values for the conservation equations
-     * \param element The finite element
-     * \param fvElemGeom The finite-volume geometry in the box scheme
-     * \param scvIdx The local vertex index
-     *
-     * For this method, the \a values parameter stores the rate mass
-     * generated or annihilate per volume unit. Positive values mean
-     * that mass is created, negative ones mean that it vanishes.
-     */
-    void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
-    {
-           values = Scalar(0.0);
-    }
-
     /*!
      * \brief Evaluate the initial value for a control volume.
      *
diff --git a/test/boxmodels/2pni/injectionproblem2pni.hh b/test/boxmodels/2pni/injectionproblem2pni.hh
index 82078c8131..be25ec595f 100644
--- a/test/boxmodels/2pni/injectionproblem2pni.hh
+++ b/test/boxmodels/2pni/injectionproblem2pni.hh
@@ -316,6 +316,7 @@ public:
      * For this method, the \a values parameter stores the mass flux
      * in normal direction of each phase. Negative values mean influx.
      */
+    using ParentType::neumann;
     void neumann(PrimaryVariables &values,
                  const Element &element,
                  const FVElementGeometry &fvElemGeom,
@@ -340,27 +341,6 @@ public:
      */
     // \{
 
-    /*!
-     * \brief Evaluate the source term for all phases within a given
-     *        sub-control-volume.
-     *
-     * \param values The source and sink values for the conservation equations
-     * \param element The finite element
-     * \param fvElemGeom The finite-volume geometry in the box scheme
-     * \param scvIdx The local vertex index
-     *
-     * For this method, the \a values parameter stores the rate mass
-     * generated or annihilate per volume unit. Positive values mean
-     * that mass is created, negative ones mean that it vanishes.
-     */
-    void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
-    {
-           values = Scalar(0.0);
-    }
-
     /*!
      * \brief Evaluate the initial value for a control volume.
      *
diff --git a/test/boxmodels/richards/richardslensproblem.hh b/test/boxmodels/richards/richardslensproblem.hh
index 1148c269c1..3db022abc5 100644
--- a/test/boxmodels/richards/richardslensproblem.hh
+++ b/test/boxmodels/richards/richardslensproblem.hh
@@ -127,7 +127,7 @@ SET_BOOL_PROP(RichardsLensProblem, NewtonWriteConvergence, false);
  * where the initial time step is 100 seconds, and the end of the
  * simulation time is 10,000,000 seconds (115.7 days)
  */
-template <class TypeTag = TTAG(RichardsLensProblem) >
+template <class TypeTag>
 class RichardsLensProblem : public RichardsBoxProblem<TypeTag>
 {
     typedef RichardsLensProblem<TypeTag> ThisType;
@@ -239,10 +239,10 @@ public:
      * \param values The boundary types for the conservation equations
      * \param vertex The vertex for which the boundary type is set
      */
-    void boundaryTypes(BoundaryTypes &values, const Vertex &vertex) const
+    using ParentType::boundaryTypes;
+    void boundaryTypes(BoundaryTypes &values,
+                       const GlobalPosition &globalPos) const
     {
-        const GlobalPosition globalPos = vertex.geometry().center();
-
         if (onLeftBoundary_(globalPos) ||
             onRightBoundary_(globalPos))
         {
@@ -261,9 +261,10 @@ public:
      *
      * For this method, the \a values parameter stores primary variables.
      */
-    void dirichlet(PrimaryVariables &values, const Vertex &vertex) const
+    using ParentType::dirichlet;
+    void dirichlet(PrimaryVariables &values, 
+                   const GlobalPosition &globalPos) const
     {
-        const GlobalPosition globalPos = vertex.geometry().center();
         // use initial values as boundary conditions
         initial_(values, globalPos);
     }
@@ -285,17 +286,10 @@ public:
      * \param boundaryFaceIdx The index of the boundary face of the
      *                        finite volume geometry
      */
+    using ParentType::neumann;
     void neumann(PrimaryVariables &values,
-                 const Element &element,
-                 const FVElementGeometry &fvElemGeom,
-                 const Intersection &is,
-                 int scvIdx,
-                 int boundaryFaceIdx) const
+                 const GlobalPosition &globalPos) const
     {
-
-        const GlobalPosition &globalPos
-            = element.geometry().corner(scvIdx);
-
         values = 0.0;
         if (onInlet_(globalPos)) {
             // inflow of water
@@ -308,30 +302,6 @@ public:
      */
     // \{
 
-    /*!
-     * \brief Specify the source term [kg/m^3] for the wetting phase
-     *        within a given sub-control-volume.
-     *
-     * For this method, the \a values parameter stores the rate
-     * wetting phase mass is generated or annihilate per volume
-     * unit. Positive values mean that mass is created, negative ones
-     * mean that it vanishes.
-     *
-     * \param values Storage for all values for the source terms
-     * \param element The DUNE Codim<0> entity which intersects with
-     *                the finite volume in question
-     * \param fvElemGeom The finite volume geometry of the element
-     * \param scvIdx The sub control volume index of the finite
-     *               volume geometry
-     */
-    void source(PrimaryVariables &values,
-                const Element &element,
-                const FVElementGeometry &fvElemGeom,
-                int scvIdx) const
-    {
-        values = Scalar(0.0);
-    }
-
     /*!
      * \brief Evaluate the initial values for a control volume.
      *
@@ -345,15 +315,10 @@ public:
      * \param scvIdx The sub control volume index of the finite
      *               volume geometry
      */
+    using ParentType::initial;
     void initial(PrimaryVariables &values,
-                 const Element &element,
-                 const FVElementGeometry &fvElemGeom,
-                 int scvIdx) const
-    {
-        const GlobalPosition pos = element.geometry().corner(scvIdx);
-
-        initial_(values, pos);
-    };
+                 const GlobalPosition &pos)
+    { initial_(values, pos); };
 
     // \}
 
-- 
GitLab