From 43229ec3d031c83277eb0bfc7aa145b518c403bf Mon Sep 17 00:00:00 2001
From: Markus Wolff <markus.wolff@twt-gmbh.de>
Date: Mon, 8 Aug 2011 08:06:00 +0000
Subject: [PATCH] adapted tutorial problems to changes in models

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6407 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 tutorial/tutorialproblem_coupled.hh           |  7 +-
 tutorial/tutorialproblem_decoupled.hh         | 86 ++++++++++++++-----
 tutorial/tutorialspatialparameters_coupled.hh | 70 ++++++++++++---
 .../tutorialspatialparameters_decoupled.hh    | 80 ++++++++++++-----
 4 files changed, 180 insertions(+), 63 deletions(-)

diff --git a/tutorial/tutorialproblem_coupled.hh b/tutorial/tutorialproblem_coupled.hh
index 33863a0c1f..972493c935 100644
--- a/tutorial/tutorialproblem_coupled.hh
+++ b/tutorial/tutorialproblem_coupled.hh
@@ -49,7 +49,7 @@ class TutorialProblemCoupled;
 namespace Properties
 {
 // create a new type tag for the problem
-NEW_TYPE_TAG(TutorialProblemCoupled, INHERITS_FROM(BoxTwoP)); /*@\label{tutorial-coupled:create-type-tag}@*/
+NEW_TYPE_TAG(TutorialProblemCoupled, INHERITS_FROM(BoxTwoP, TutorialSpatialParametersCoupled)); /*@\label{tutorial-coupled:create-type-tag}@*/
 
 // Set the "Problem" property
 SET_PROP(TutorialProblemCoupled, Problem) /*@\label{tutorial-coupled:set-problem}@*/
@@ -89,11 +89,6 @@ private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
 public: typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type; /*@\label{tutorial-coupled:nonwettingPhase}@*/
 }; /*@\label{tutorial-coupled:2p-system-end}@*/
 
-
-// Set the spatial parameters
-SET_PROP(TutorialProblemCoupled, SpatialParameters) /*@\label{tutorial-coupled:set-spatialparameters}@*/
-{ typedef Dumux::TutorialSpatialParametersCoupled<TypeTag> type; };
-
 // Disable gravity
 SET_BOOL_PROP(TutorialProblemCoupled, EnableGravity, false); /*@\label{tutorial-coupled:gravity}@*/
 }
diff --git a/tutorial/tutorialproblem_decoupled.hh b/tutorial/tutorialproblem_decoupled.hh
index db9696d2f5..20a16e4851 100644
--- a/tutorial/tutorialproblem_decoupled.hh
+++ b/tutorial/tutorialproblem_decoupled.hh
@@ -55,7 +55,7 @@ class TutorialProblemDecoupled;
 namespace Properties
 {
 // create a new type tag for the problem
-NEW_TYPE_TAG(TutorialProblemDecoupled, INHERITS_FROM(DecoupledTwoP)); /*@\label{tutorial-decoupled:create-type-tag}@*/
+NEW_TYPE_TAG(TutorialProblemDecoupled, INHERITS_FROM(DecoupledTwoP, TutorialSpatialParametersDecoupled)); /*@\label{tutorial-decoupled:create-type-tag}@*/
 
 // Set the problem property
 SET_PROP(TutorialProblemDecoupled, Problem) /*@\label{tutorial-decoupled:set-problem}@*/
@@ -101,12 +101,6 @@ public:
     typedef Dumux::LiquidPhase<Scalar, Dumux::Oil<Scalar> > type; /*@\label{tutorial-decoupled:nonwettingPhase}@*/
 }; /*@\label{tutorial-decoupled:2p-system-end}@*/
 
-// Set the spatial parameters
-SET_PROP(TutorialProblemDecoupled, SpatialParameters) /*@\label{tutorial-decoupled:set-spatialparameters}@*/
-{
-    typedef Dumux::TutorialSpatialParametersDecoupled<TypeTag> type;
-};
-
 // Set the model properties
 SET_PROP(TutorialProblemDecoupled, TransportModel) /*@\label{tutorial-decoupled:TransportModel}@*/
 {
@@ -156,8 +150,12 @@ class TutorialProblemDecoupled: public IMPESProblem2P<TypeTag> /*@\label{tutoria
 
     enum
     {
-        wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx,
-        eqIdxPress = Indices::pressureEq, eqIdxSat = Indices::saturationEq
+        wPhaseIdx = Indices::wPhaseIdx,
+        nPhaseIdx = Indices::nPhaseIdx,
+        pWIdx = Indices::pwIdx,
+        SwIdx = Indices::SwIdx,
+        pressEqIdx = Indices::pressEqIdx,
+        satEqIdx = Indices::satEqIdx
     };
 
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
@@ -200,8 +198,13 @@ public:
 
     //! Returns the temperature within the domain at position globalPos.
     /*! This problem assumes a temperature of 10 degrees Celsius.
+     *
+     *  \param element The finite volume element
+     *
+     * Alternatively, the function temperatureAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     * is the vector including the global coordinates of the finite volume.
      */
-    Scalar temperatureAtPos(const GlobalPosition& globalPos) const /*@\label{tutorial-decoupled:temperature}@*/
+    Scalar temperature(const Element& element) const /*@\label{tutorial-decoupled:temperature}@*/
     {
         return 273.15 + 10; // -> 10°C
     }
@@ -210,18 +213,31 @@ public:
     /* For incrompressible simulations, a constant pressure is necessary
      * to enter the material laws to gain a constant density etc. In the compressible
      * case, the pressure is used for the initialization of material laws.
+     *
+     * \param element The finite volume element
+     *
+     * Alternatively, the function referencePressureAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     * is the vector including the global coordinates of the finite volume.
      */
-    Scalar referencePressureAtPos(const GlobalPosition& globalPos) const /*@\label{tutorial-decoupled:refPressure}@*/
+    Scalar referencePressure(const Element& element) const /*@\label{tutorial-decoupled:refPressure}@*/
     {
         return 2e5;
     }
 
-    //! Source of mass \f$ [\frac{kg}{m^3 \cdot s}] \f$ at position globalPos.
+    //! Source of mass \f$ [\frac{kg}{m^3 \cdot s}] \f$ of a finite volume.
     /*! Evaluate the source term for all phases within a given
-     *  volume. The method returns the mass generated (positive) or
+     *  volume.
+     *
+     *  \param values Includes sources for the two phases
+     *  \param element The finite volume element
+     *
+     *  The method returns the mass generated (positive) or
      *  annihilated (negative) per volume unit.
+     *
+     * Alternatively, the function sourceAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) could be defined, where globalPos
+     * is the vector including the global coordinates of the finite volume.
      */
-    void sourceAtPos(PrimaryVariables &values,const GlobalPosition& globalPos) const /*@\label{tutorial-decoupled:source}@*/
+    void source(PrimaryVariables &values, const Element& element) const /*@\label{tutorial-decoupled:source}@*/
     {
         values = 0;
     }
@@ -231,35 +247,53 @@ public:
      *  either pressure (dirichlet) or flux (neumann),
      *  and for the transport equation,
      *  either saturation (dirichlet) or flux (neumann).
+     *
+     *  \param bcTypes Includes the types of boundary conditions
+     *  \param globalPos The position of the center of the finite volume
+     *
+     *  Alternatively, the function boundaryTypes(PrimaryVariables &values, const Intersection& intersection) could be defined,
+     *  where intersection is the boundary intersection.
      */
     void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) const /*@\label{tutorial-decoupled:bctype}@*/
     {
             if (globalPos[0] < this->bboxMin()[0] + eps_)
             {
-                bcTypes.setDirichlet(eqIdxPress);
-                bcTypes.setDirichlet(eqIdxSat);
+                bcTypes.setDirichlet(pressEqIdx);
+                bcTypes.setDirichlet(satEqIdx);
 //                bcTypes.setAllDirichlet(); // alternative if the same BC is used for both types of equations
             }
             // all other boundaries
             else
             {
-                bcTypes.setNeumann(eqIdxPress);
-                bcTypes.setNeumann(eqIdxSat);
+                bcTypes.setNeumann(pressEqIdx);
+                bcTypes.setNeumann(satEqIdx);
 //                bcTypes.setAllNeumann(); // alternative if the same BC is used for both types of equations
             }
     }
     //! Value for dirichlet boundary condition at position globalPos.
     /*! In case of a dirichlet BC for the pressure equation the pressure \f$ [Pa] \f$, and for the transport equation the saturation [-]
      *  have to be defined on boundaries.
+     *
+     *  \param values Values of primary variables at the boundary
+     *  \param intersection The boundary intersection
+     *
+     *  Alternatively, the function dirichletAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
      */
-    void dirichletAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const /*@\label{tutorial-decoupled:dirichlet}@*/
+    void dirichlet(PrimaryVariables &values, const Intersection& intersection) const /*@\label{tutorial-decoupled:dirichlet}@*/
     {
-        values[eqIdxPress] = 2e5;
-        values[eqIdxSat] = 1.0;
+        values[pWIdx] = 2e5;
+        values[SwIdx] = 1.0;
     }
     //! Value for neumann boundary condition \f$ [\frac{kg}{m^3 \cdot s}] \f$ at position globalPos.
     /*! In case of a neumann boundary condition, the flux of matter
      *  is returned as a vector.
+     *
+     *  \param values Boundary flux values for the different phases
+     *  \param globalPos The position of the center of the finite volume
+     *
+     *  Alternatively, the function neumann(PrimaryVariables &values, const Intersection& intersection) could be defined,
+     *  where intersection is the boundary intersection.
      */
     void neumannAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const /*@\label{tutorial-decoupled:neumann}@*/
     {
@@ -271,9 +305,15 @@ public:
     }
     //! Initial condition at position globalPos.
     /*! Only initial values for saturation have to be given!
+     *
+     *  \param values Values of primary variables
+     *  \param element The finite volume element
+     *
+     *  Alternatively, the function initialAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
      */
-    void initialAtPos(PrimaryVariables &values,
-            const GlobalPosition &globalPos) const /*@\label{tutorial-decoupled:initial}@*/
+    void initial(PrimaryVariables &values,
+            const Element &element) const /*@\label{tutorial-decoupled:initial}@*/
     {
         values = 0;
     }
diff --git a/tutorial/tutorialspatialparameters_coupled.hh b/tutorial/tutorialspatialparameters_coupled.hh
index 6820093ded..70675f595b 100644
--- a/tutorial/tutorialspatialparameters_coupled.hh
+++ b/tutorial/tutorialspatialparameters_coupled.hh
@@ -35,6 +35,33 @@
 
 namespace Dumux
 {
+
+//forward declaration
+template<class TypeTag>
+class TutorialSpatialParametersCoupled;
+
+namespace Properties
+{
+// The spatial parameters TypeTag
+NEW_TYPE_TAG(TutorialSpatialParametersCoupled);/*@\label{tutorial-coupled:define-spatialparameters-typetag}@*/
+
+// Set the spatial parameters
+SET_TYPE_PROP(TutorialSpatialParametersCoupled, SpatialParameters, Dumux::TutorialSpatialParametersCoupled<TypeTag>); /*@\label{tutorial-coupled:set-spatialparameters}@*/
+
+// Set the material law
+SET_PROP(TutorialSpatialParametersCoupled, MaterialLaw)
+{
+private:
+    // material law typedefs
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
+    // select material law to be used
+    typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw;     /*@\label{tutorial-coupled:rawlaw}@*/
+public:
+    // adapter for absolute law
+    typedef EffToAbsLaw<RawMaterialLaw> type;   /*@\label{tutorial-coupled:eff2abs}@*/
+};
+}
+
 /*!
  * \ingroup TwoPBoxModel
  *
@@ -59,18 +86,23 @@ class TutorialSpatialParametersCoupled: public BoxSpatialParameters<TypeTag> /*@
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
     typedef typename Grid::Traits::template Codim<0>::Entity Element;
 
-    // select material law to be used
-    typedef RegularizedBrooksCorey<Scalar> EffectiveMaterialLaw;     /*@\label{tutorial-coupled:rawlaw}@*/
-
 public:
-    // adapter for absolute law
-    typedef EffToAbsLaw<EffectiveMaterialLaw> MaterialLaw;        /*@\label{tutorial-coupled:eff2abs}@*/
+    // get material law from property system
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(MaterialLaw)) MaterialLaw;
     // determine appropriate parameters depening on selected materialLaw
     typedef typename MaterialLaw::Params MaterialLawParams;    /*@\label{tutorial-coupled:matLawObjectType}@*/
 
 
-    // method returning the intrinsic permeability tensor K depending
-    // on the position within the domain
+    //! Intrinsic permeability tensor K \f$[m^2]\f$ depending
+    /*! on the position in the domain
+     *
+     *  \param element The finite volume element
+     *  \param fvElemGeom The finite-volume geometry in the box scheme
+     *  \param scvIdx The local vertex index
+     *
+     *  Alternatively, the function intrinsicPermeabilityAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
+     */
     const Dune::FieldMatrix<Scalar, dim, dim> &intrinsicPermeability(const Element &element, /*@\label{tutorial-coupled:permeability}@*/
                                                     const FVElementGeometry &fvElemGeom,
                                                     int scvIdx) const
@@ -78,8 +110,16 @@ public:
         return K_;
     }
 
-    // method returning the porosity of the porous matrix depending on
-    // the position within the domain
+    //! Define the porosity \f$[-]\f$ of the porous medium depending
+    /*! on the position in the domain
+     *
+     *  \param element The finite volume element
+     *  \param fvElemGeom The finite-volume geometry in the box scheme
+     *  \param scvIdx The local vertex index
+     *
+     *  Alternatively, the function porosityAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
+     */
     double porosity(const Element &element,                    /*@\label{tutorial-coupled:porosity}@*/
                     const FVElementGeometry &fvElemGeom,
                     int scvIdx) const
@@ -87,8 +127,16 @@ public:
         return 0.2;
     }
 
-    // return the parameter object for the material law (i.e. Brooks-Corey)
-    // which may vary with the spatial position
+    /*! Return the parameter object for the material law (i.e. Brooks-Corey)
+     *  depending on the position in the domain
+     *
+     *  \param element The finite volume element
+     *  \param fvElemGeom The finite-volume geometry in the box scheme
+     *  \param scvIdx The local vertex index
+     *
+     *  Alternatively, the function materialLawParamsAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
+     */
     const MaterialLawParams& materialLawParams(const Element &element,            /*@\label{tutorial-coupled:matLawParams}@*/
                                                const FVElementGeometry &fvElemGeom,
                                                int scvIdx) const
diff --git a/tutorial/tutorialspatialparameters_decoupled.hh b/tutorial/tutorialspatialparameters_decoupled.hh
index 7e16d5f096..685bd61bdd 100644
--- a/tutorial/tutorialspatialparameters_decoupled.hh
+++ b/tutorial/tutorialspatialparameters_decoupled.hh
@@ -26,17 +26,44 @@
 #define TUTORIALSPATIALPARAMETERS_DECOUPLED_HH
 
 
-//#include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh>
+#include <dumux/material/spatialparameters/fvspatialparameters.hh>
+#include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh>
 #include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh>
 #include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>
 
 namespace Dumux
 {
+
+//forward declaration
+template<class TypeTag>
+class TutorialSpatialParametersDecoupled;
+
+namespace Properties
+{
+// The spatial parameters TypeTag
+NEW_TYPE_TAG(TutorialSpatialParametersDecoupled);
+
+// Set the spatial parameters
+SET_TYPE_PROP(TutorialSpatialParametersDecoupled, SpatialParameters, Dumux::TutorialSpatialParametersDecoupled<TypeTag>); /*@\label{tutorial-decoupled:set-spatialparameters}@*/
+
+// Set the material law
+SET_PROP(TutorialSpatialParametersDecoupled, MaterialLaw)
+{
+private:
+    // material law typedefs
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
+    typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw;
+public:
+    typedef EffToAbsLaw<RawMaterialLaw> type;
+};
+}
+
 //! Definition of the spatial parameters for the decoupled tutorial
 
 template<class TypeTag>
-class TutorialSpatialParametersDecoupled
+class TutorialSpatialParametersDecoupled: public FVSpatialParameters<TypeTag>
 {
+    typedef FVSpatialParameters<TypeTag> ParentType;
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
     typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
@@ -50,45 +77,52 @@ class TutorialSpatialParametersDecoupled
     typedef Dune::FieldVector<CoordScalar, dim> LocalPosition;
     typedef Dune::FieldMatrix<Scalar,dim,dim> FieldMatrix;
 
-    // material law typedefs
-    typedef RegularizedBrooksCorey<Scalar> EffectiveMaterialLaw;
-//    typedef LinearMaterial<Scalar> EffectiveMaterialLaw;
 public:
-    typedef EffToAbsLaw<EffectiveMaterialLaw> MaterialLaw;
+    typedef typename GET_PROP_TYPE(TypeTag, PTAG(MaterialLaw)) MaterialLaw;
     typedef typename MaterialLaw::Params MaterialLawParams;
 
-    //! Update the spatial parameters with the flow solution after a timestep.
-    /*! Function left blank as there is nothing to do for the tutorial.
-     */
-    void update (Scalar saturationW, const Element& element)
-    {    }
-    //! Intrinsic permeability tensor
-    /*! Apply the intrinsic permeability tensor \f$[m^2]\f$ to a
-     *  pressure potential gradient.
+    //! Intrinsic permeability tensor K \f$[m^2]\f$ depending
+    /*! on the position in the domain
+     *
+     *  \param element The finite volume element
+     *
+     *  Alternatively, the function intrinsicPermeabilityAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
      */
-    const FieldMatrix& intrinsicPermeability (const GlobalPosition& globalPos,
-                                              const Element& element) const
+    const FieldMatrix& intrinsicPermeability (const Element& element) const
     {
             return K_;
     }
 
-    //! Define the porosity \f$[-]\f$ of the spatial parameters
-    double porosity(const GlobalPosition& globalPos, const Element& element) const
+    //! Define the porosity \f$[-]\f$ of the porous medium depending
+    /*! on the position in the domain
+     *
+     *  \param element The finite volume element
+     *
+     *  Alternatively, the function porosityAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
+     */
+    double porosity(const Element& element) const
     {
         return 0.2;
     }
 
-    //! return the parameter object for the material law (i.e. Brooks-Corey)
-    //! which may vary with the spatial position
-    const MaterialLawParams& materialLawParams(const GlobalPosition& globalPos,
-                                               const Element &element) const
+    /*! Return the parameter object for the material law (i.e. Brooks-Corey)
+     *  depending on the position in the domain
+     *
+     *  \param element The finite volume element
+     *
+     *  Alternatively, the function materialLawParamsAtPos(const GlobalPosition& globalPos) could be defined, where globalPos
+     *  is the vector including the global coordinates of the finite volume.
+     */
+    const MaterialLawParams& materialLawParams(const Element &element) const
     {
             return materialLawParams_;
     }
 
     //! Constructor
     TutorialSpatialParametersDecoupled(const GridView& gridView)
-    : K_(0)
+    : ParentType(gridView), K_(0)
     {
         for (int i = 0; i < dim; i++)
                 K_[i][i] = 1e-7;
-- 
GitLab