From a83f78dd1d72f420b38408ed54257fe420a081f2 Mon Sep 17 00:00:00 2001
From: tkurz <theresa.kurz@iws.uni-stuttgart.de>
Date: Mon, 30 Mar 2020 20:16:30 +0200
Subject: [PATCH] [brookscorey] add regularization for rel. permeability
 derivatives

---
 .../2p/regularizedbrookscorey.hh              | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh b/dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh
index 973f850a49..742bd0ebb9 100644
--- a/dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh
+++ b/dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh
@@ -263,6 +263,25 @@ public:
         return BrooksCorey::krw(params, swe);
     }
 
+    /*!
+     * \brief A regularized version of the derivative of the relative
+     *        permeability for the wetting phase in regard to the wetting
+     *        saturation of the medium implied by the Brooks-Corey parameterization.
+     *
+     * \copydetails BrooksCorey::dkrw_dswe()
+     */
+    static Scalar dkrw_dswe(const Params &params, Scalar swe)
+    {
+        // derivative of the regularization
+        // the slope is zero below sw=0.0 and above sw=1.0
+        if (swe <= 0.0)
+            return 0.0;
+        else if (swe >= 1.0)
+            return 0.0;
+
+        return BrooksCorey::dkrw_dswe(params, swe);
+    }
+
     /*!
      * \brief   Regularized version of the  relative permeability
      *          for the non-wetting phase of
@@ -286,6 +305,25 @@ public:
 
         return BrooksCorey::krn(params, swe);
     }
+
+    /*!
+     * \brief A regularized version of the derivative of the relative permeability
+     *        for the non-wetting phase in regard to the wetting saturation of
+     *        the medium as implied by the Brooks-Corey parameterization.
+     *
+     * \copydetails BrooksCorey::dkrn_dswe()
+     */
+    static Scalar dkrn_dswe(const Params &params, Scalar swe)
+    {
+        // derivative of the regularization
+        // the slope is zero below sw=0.0 and above sw=1.0
+        if (swe <= 0)
+            return 0.0;
+        else if (swe >= 1)
+            return 0.0;
+
+        return BrooksCorey::dkrn_dswe(params, swe);
+    }
 };
 } // end namespace Dumux
 
-- 
GitLab