From 7e8ad8d0cd79b892916d599affb1607d11d2895d Mon Sep 17 00:00:00 2001
From: Philipp Nuske <philipp.nuske@mailbox.org>
Date: Thu, 18 Oct 2012 09:15:17 +0000
Subject: [PATCH] put a forchCoeff() function into the 1pboxspatialparams. The
 default value will be set in the individual boxproperties. This way only the
 BaseFluxVariables needs to be set to BoxForchheimerFluxVariables<TypeTag>  in
 order to test the forchheimer velocity approximation in stead of darcy.
 Reviewed by Bernd

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@9377 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 .../spatialparams/boxspatialparams.hh         |  3 +-
 .../spatialparams/boxspatialparams1p.hh       | 34 +++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/dumux/material/spatialparams/boxspatialparams.hh b/dumux/material/spatialparams/boxspatialparams.hh
index 87b547fdbf..3e226ce990 100644
--- a/dumux/material/spatialparams/boxspatialparams.hh
+++ b/dumux/material/spatialparams/boxspatialparams.hh
@@ -29,7 +29,7 @@
 #include "boxspatialparams1p.hh"
 
 namespace Dumux {
-// forward declation of property tags
+// forward declaration of property tags
 namespace Properties {
 NEW_PROP_TAG(MaterialLaw);
 NEW_PROP_TAG(MaterialLawParams);
@@ -48,6 +48,7 @@ template<class TypeTag>
 class BoxSpatialParams: public BoxSpatialParamsOneP<TypeTag>
 {
     typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
+    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
     typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) Implementation;
 
     typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
diff --git a/dumux/material/spatialparams/boxspatialparams1p.hh b/dumux/material/spatialparams/boxspatialparams1p.hh
index efc22294b2..a5c001780e 100644
--- a/dumux/material/spatialparams/boxspatialparams1p.hh
+++ b/dumux/material/spatialparams/boxspatialparams1p.hh
@@ -162,6 +162,40 @@ public:
                    "a porosityAtPos() method.");
     }
 
+    /*!
+     * \brief Apply the Forchheimer coefficient for inertial forces
+     *        calculation.
+     *
+     *        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)
+     *
+     * \param element The current finite element
+     * \param fvElemGeom The current finite volume geometry of the element
+     * \param scvIdx The index sub-control volume face where the
+     *                      intrinsic velocity ought to be calculated.
+     *
+     */
+    Scalar forchCoeff(const Element &element,
+                    const FVElementGeometry &fvElemGeom,
+                    const unsigned int scvIdx) const
+    {
+        try
+        {
+            const Scalar forchCoeff = GET_PARAM_FROM_GROUP(TypeTag, Scalar, SpatialParams, ForchCoeff);
+            return forchCoeff ;
+        }
+        catch (Dumux::ParameterException &e) {
+            std::cerr << e << ". Aborted in file "<< __FILE__ << "!\n";
+            exit(1) ;
+        }
+        catch (...) {
+            std::cerr << "Unknown exception thrown!\n";
+            exit(1) ;
+        }
+    }
+
 private:
     Implementation &asImp_()
     { return *static_cast<Implementation*>(this); }
-- 
GitLab