From c14b2c458f23013877f9e7ba0d12fdc56f849e82 Mon Sep 17 00:00:00 2001
From: Philipp Nuske <philipp.nuske@mailbox.org>
Date: Thu, 18 Oct 2012 10:56:57 +0000
Subject: [PATCH] - include the property SpatialParamsForchCoeff in all
 boxmodels. This enables the user to apply a default value for the forchheimer
 coefficient and merely switch the BaseFluxvariables property. - remove
 include of the model in 2p2c spatialparameters. Otherwise the forchheimer
 property is multiply defined. headercheck still works. - include
 reference/hint in the forchheiemerspatialparams as how to include
 better-than-default forchheimer coefficients

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@9384 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/boxmodels/1p/1pproperties.hh            |  2 +-
 dumux/boxmodels/1p/1ppropertydefaults.hh      |  7 +++++
 dumux/boxmodels/1p2c/1p2cproperties.hh        |  1 +
 dumux/boxmodels/1p2c/1p2cpropertydefaults.hh  |  7 +++++
 dumux/boxmodels/2p/2pproperties.hh            |  1 +
 dumux/boxmodels/2p/2ppropertydefaults.hh      |  7 +++++
 dumux/boxmodels/2p2c/2p2cproperties.hh        |  1 +
 dumux/boxmodels/2p2c/2p2cpropertydefaults.hh  |  8 ++++--
 dumux/boxmodels/3p3c/3p3cproperties.hh        |  1 +
 dumux/boxmodels/3p3c/3p3cpropertydefaults.hh  |  8 ++++++
 .../boxmodels/richards/richardsproperties.hh  |  1 +
 .../richards/richardspropertydefaults.hh      |  7 +++++
 test/boxmodels/2p2c/injectionspatialparams.hh |  2 +-
 .../mpnc/forchheimerspatialparams.hh          | 28 +++++++++++--------
 14 files changed, 66 insertions(+), 15 deletions(-)

diff --git a/dumux/boxmodels/1p/1pproperties.hh b/dumux/boxmodels/1p/1pproperties.hh
index 7448c828fe..87112a4110 100644
--- a/dumux/boxmodels/1p/1pproperties.hh
+++ b/dumux/boxmodels/1p/1pproperties.hh
@@ -56,7 +56,7 @@ NEW_PROP_TAG(Fluid); //!< The fluid used for the default fluid system
 NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem
 NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< Returns weight of the upwind cell when calculating fluxes
 NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< Weight for the upwind mobility in the velocity calculation
-
+NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
 // \}
 }
 
diff --git a/dumux/boxmodels/1p/1ppropertydefaults.hh b/dumux/boxmodels/1p/1ppropertydefaults.hh
index 59b81f2cfe..27ef59c662 100644
--- a/dumux/boxmodels/1p/1ppropertydefaults.hh
+++ b/dumux/boxmodels/1p/1ppropertydefaults.hh
@@ -94,6 +94,13 @@ public:
 // enable gravity by default
 SET_BOOL_PROP(BoxOneP, ProblemEnableGravity, true);
 
+//! default value for the forchheimer coefficient
+// Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
+//        Actually the Forchheimer coefficient is also a function of the dimensions of the
+//        porous medium. Taking it as a constant is only a first approximation
+//        (Nield, Bejan, Convection in porous media, 2006, p. 10)
+SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);
+
 // \}
 } // end namepace Properties
 
diff --git a/dumux/boxmodels/1p2c/1p2cproperties.hh b/dumux/boxmodels/1p2c/1p2cproperties.hh
index 4f835f0547..38d03eba34 100644
--- a/dumux/boxmodels/1p2c/1p2cproperties.hh
+++ b/dumux/boxmodels/1p2c/1p2cproperties.hh
@@ -59,6 +59,7 @@ NEW_PROP_TAG(ImplicitMassUpwindWeight);   //!< The default value of the upwind w
 NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem
 NEW_PROP_TAG(UseMoles); //!Defines whether mole (true) or mass (false) fractions are used
 NEW_PROP_TAG(Scaling); //!Defines Scaling of the model
+NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
 }
 // \}
 }
diff --git a/dumux/boxmodels/1p2c/1p2cpropertydefaults.hh b/dumux/boxmodels/1p2c/1p2cpropertydefaults.hh
index 5511d6d304..79cd1e11f3 100644
--- a/dumux/boxmodels/1p2c/1p2cpropertydefaults.hh
+++ b/dumux/boxmodels/1p2c/1p2cpropertydefaults.hh
@@ -81,6 +81,13 @@ SET_INT_PROP(BoxOnePTwoC, PhaseIdx, 0);
 
 // enable gravity by default
 SET_BOOL_PROP(BoxOnePTwoC, ProblemEnableGravity, true);
+
+//! default value for the forchheimer coefficient
+// Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
+//        Actually the Forchheimer coefficient is also a function of the dimensions of the
+//        porous medium. Taking it as a constant is only a first approximation
+//        (Nield, Bejan, Convection in porous media, 2006, p. 10)
+SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);
 }
 // \}
 }
diff --git a/dumux/boxmodels/2p/2pproperties.hh b/dumux/boxmodels/2p/2pproperties.hh
index b3dce881be..c86ab53d93 100644
--- a/dumux/boxmodels/2p/2pproperties.hh
+++ b/dumux/boxmodels/2p/2pproperties.hh
@@ -68,6 +68,7 @@ NEW_PROP_TAG(NonwettingPhase); //!< The non-wetting phase for two-phase models
 NEW_PROP_TAG(FluidSystem); //!<The fluid systems including the information about the phases
 NEW_PROP_TAG(FluidState); //!<The phases state
 NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the vtk output
+NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
 }
 
 }
diff --git a/dumux/boxmodels/2p/2ppropertydefaults.hh b/dumux/boxmodels/2p/2ppropertydefaults.hh
index f6ea6fc25c..2cd202b430 100644
--- a/dumux/boxmodels/2p/2ppropertydefaults.hh
+++ b/dumux/boxmodels/2p/2ppropertydefaults.hh
@@ -133,6 +133,13 @@ SET_BOOL_PROP(BoxTwoP, VtkAddVelocity, false);
 
 // enable gravity by default
 SET_BOOL_PROP(BoxTwoP, ProblemEnableGravity, true);
+
+//! default value for the forchheimer coefficient
+// Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
+//        Actually the Forchheimer coefficient is also a function of the dimensions of the
+//        porous medium. Taking it as a constant is only a first approximation
+//        (Nield, Bejan, Convection in porous media, 2006, p. 10)
+SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);
 }
 //
 
diff --git a/dumux/boxmodels/2p2c/2p2cproperties.hh b/dumux/boxmodels/2p2c/2p2cproperties.hh
index 74bcf7ac14..0303514205 100644
--- a/dumux/boxmodels/2p2c/2p2cproperties.hh
+++ b/dumux/boxmodels/2p2c/2p2cproperties.hh
@@ -63,6 +63,7 @@ NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< Weight for the upwind mobility
 NEW_PROP_TAG(ReplaceCompEqIdx); //!< The index of the total mass balance equation, if one component balance is replaced (ReplaceCompEqIdx < NumComponents)
 NEW_PROP_TAG(VtkAddVelocity); //!< Returns whether velocity vectors are written into the vtk output
 NEW_PROP_TAG(BaseFluxVariables); //! The base flux variables
+NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
 }
 }
 
diff --git a/dumux/boxmodels/2p2c/2p2cpropertydefaults.hh b/dumux/boxmodels/2p2c/2p2cpropertydefaults.hh
index de6b948ecf..98c9a1f333 100644
--- a/dumux/boxmodels/2p2c/2p2cpropertydefaults.hh
+++ b/dumux/boxmodels/2p2c/2p2cpropertydefaults.hh
@@ -148,8 +148,12 @@ SET_BOOL_PROP(BoxTwoPTwoC, VtkAddVelocity, false);
 // enable gravity by default
 SET_BOOL_PROP(BoxTwoPTwoC, ProblemEnableGravity, true);
 
-//
-}
+//! default value for the forchheimer coefficient
+// Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
+//        Actually the Forchheimer coefficient is also a function of the dimensions of the
+//        porous medium. Taking it as a constant is only a first approximation
+//        (Nield, Bejan, Convection in porous media, 2006, p. 10)
+SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);}
 
 }
 
diff --git a/dumux/boxmodels/3p3c/3p3cproperties.hh b/dumux/boxmodels/3p3c/3p3cproperties.hh
index 9c0e3b0a3d..90ddfaa0d3 100644
--- a/dumux/boxmodels/3p3c/3p3cproperties.hh
+++ b/dumux/boxmodels/3p3c/3p3cproperties.hh
@@ -59,6 +59,7 @@ NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< The value of the upwind parameter f
 NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< Weight for the upwind mobility in the velocity calculation
 NEW_PROP_TAG(UseConstraintSolver); //!< Determines whether a constraint solver should be used explicitly
 NEW_PROP_TAG(BaseFluxVariables); //! The base flux variables
+NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
 }
 }
 
diff --git a/dumux/boxmodels/3p3c/3p3cpropertydefaults.hh b/dumux/boxmodels/3p3c/3p3cpropertydefaults.hh
index 833378df18..421ddab7bc 100644
--- a/dumux/boxmodels/3p3c/3p3cpropertydefaults.hh
+++ b/dumux/boxmodels/3p3c/3p3cpropertydefaults.hh
@@ -128,6 +128,14 @@ SET_TYPE_PROP(BoxThreePThreeC, SpatialParams, BoxSpatialParams<TypeTag>);
 
 // enable gravity by default
 SET_BOOL_PROP(BoxThreePThreeC, ProblemEnableGravity, true);
+
+//! default value for the forchheimer coefficient
+// Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
+//        Actually the Forchheimer coefficient is also a function of the dimensions of the
+//        porous medium. Taking it as a constant is only a first approximation
+//        (Nield, Bejan, Convection in porous media, 2006, p. 10)
+SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);
+
 }
 
 }
diff --git a/dumux/boxmodels/richards/richardsproperties.hh b/dumux/boxmodels/richards/richardsproperties.hh
index b03636dd63..fb1f3bd65b 100644
--- a/dumux/boxmodels/richards/richardsproperties.hh
+++ b/dumux/boxmodels/richards/richardsproperties.hh
@@ -60,6 +60,7 @@ NEW_PROP_TAG(NonwettingPhase); //!< Fluid which represents the non-wetting phase
 NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered in the problem
 NEW_PROP_TAG(ImplicitMassUpwindWeight); //!< The value of the weight of the upwind direction in the mass conservation equations
 NEW_PROP_TAG(ImplicitMobilityUpwindWeight); //!< The value of the weight for the upwind mobility in the velocity calculation
+NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient
 
 // \}
 }
diff --git a/dumux/boxmodels/richards/richardspropertydefaults.hh b/dumux/boxmodels/richards/richardspropertydefaults.hh
index 58b35bcf94..e7b6df30d4 100644
--- a/dumux/boxmodels/richards/richardspropertydefaults.hh
+++ b/dumux/boxmodels/richards/richardspropertydefaults.hh
@@ -153,6 +153,13 @@ public:
 // enable gravity by default
 SET_BOOL_PROP(BoxRichards, ProblemEnableGravity, true);
 
+//! default value for the forchheimer coefficient
+// Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90.
+//        Actually the Forchheimer coefficient is also a function of the dimensions of the
+//        porous medium. Taking it as a constant is only a first approximation
+//        (Nield, Bejan, Convection in porous media, 2006, p. 10)
+SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55);
+
 // \}
 }
 
diff --git a/test/boxmodels/2p2c/injectionspatialparams.hh b/test/boxmodels/2p2c/injectionspatialparams.hh
index 9ba2a7b0ae..dbab1803dd 100644
--- a/test/boxmodels/2p2c/injectionspatialparams.hh
+++ b/test/boxmodels/2p2c/injectionspatialparams.hh
@@ -31,7 +31,7 @@
 #include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh>
 #include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>
 
-#include <dumux/boxmodels/2p2c/2p2cmodel.hh>
+//#include <dumux/boxmodels/2p2c/2p2cmodel.hh>
 
 namespace Dumux
 {
diff --git a/test/boxmodels/mpnc/forchheimerspatialparams.hh b/test/boxmodels/mpnc/forchheimerspatialparams.hh
index 5b9c7e9635..79d1f2ad06 100644
--- a/test/boxmodels/mpnc/forchheimerspatialparams.hh
+++ b/test/boxmodels/mpnc/forchheimerspatialparams.hh
@@ -162,6 +162,17 @@ public:
         return porosity_;
     }
 
+    /*!
+     * \brief Function for defining the parameters needed by constitutive relationships (kr-Sw, pc-Sw, etc.).
+     *
+     * \param pos The global position of the sub-control volume.
+     * \return the material parameters object
+     */
+    const MaterialLawParams& materialLawParamsAtPos(const DimWorldVector &pos) const
+    {
+        return materialParams_;
+    }
+
 
     /*!
      * \brief Apply the Forchheimer coefficient for inertial forces
@@ -180,18 +191,13 @@ public:
      */
     Scalar forchCoeff(const Element &element,
                     const FVElementGeometry &fvElemGeom,
-                    int scvIdx) const
-    { return 0.55; }
-
-    /*!
-     * \brief Function for defining the parameters needed by constitutive relationships (kr-Sw, pc-Sw, etc.).
-     *
-     * \param pos The global position of the sub-control volume.
-     * \return the material parameters object
-     */
-    const MaterialLawParams& materialLawParamsAtPos(const DimWorldVector &pos) const
+                    const unsigned int scvIdx) const
     {
-        return materialParams_;
+        // If there are better measures / estimates / values available than this default number:
+        // here is the place to implement it
+        return ParentType::forchCoeff(element,
+                                      fvElemGeom,
+                                      scvIdx);
     }
 
     Scalar K_;
-- 
GitLab