From d4b24cc6f4c5ef5ad4c2bb83176aee781de70afe Mon Sep 17 00:00:00 2001
From: Norbert Grunwald <Norbert.Grunwald@ufz.de>
Date: Tue, 1 Dec 2020 14:26:00 +0100
Subject: [PATCH] <MPL> Documentation for Udell property added

---
 .../property/RelPermUdell/c_RelPermUdell.md   |  1 +
 .../t_min_relative_permeability_gas.md        |  1 +
 .../t_min_relative_permeability_liquid.md     |  1 +
 .../RelPermUdell/t_residual_gas_saturation.md |  1 +
 .../t_residual_liquid_saturation.md           |  1 +
 MaterialLib/MPL/CreateProperty.h              |  2 +-
 MaterialLib/MPL/Properties/CreateProperties.h |  2 +-
 .../CreateRelPermUdell.cpp                    |  2 +-
 .../RelativePermeability/RelPermUdell.cpp     | 20 +++++++------
 .../RelativePermeability/RelPermUdell.h       | 30 ++++++++++---------
 Tests/MaterialLib/TestMPLRelPermUdell.cpp     |  8 +----
 11 files changed, 36 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/ProjectFile/properties/property/RelPermUdell/c_RelPermUdell.md
 create mode 100644 Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_gas.md
 create mode 100644 Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_liquid.md
 create mode 100644 Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_gas_saturation.md
 create mode 100644 Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_liquid_saturation.md

diff --git a/Documentation/ProjectFile/properties/property/RelPermUdell/c_RelPermUdell.md b/Documentation/ProjectFile/properties/property/RelPermUdell/c_RelPermUdell.md
new file mode 100644
index 00000000000..1d797d57af5
--- /dev/null
+++ b/Documentation/ProjectFile/properties/property/RelPermUdell/c_RelPermUdell.md
@@ -0,0 +1 @@
+\copydoc MaterialPropertyLib::RelPermUdell
diff --git a/Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_gas.md b/Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_gas.md
new file mode 100644
index 00000000000..74b9360c430
--- /dev/null
+++ b/Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_gas.md
@@ -0,0 +1 @@
+The minimal relative permeability of the gas phase.
diff --git a/Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_liquid.md b/Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_liquid.md
new file mode 100644
index 00000000000..63d661fd8dd
--- /dev/null
+++ b/Documentation/ProjectFile/properties/property/RelPermUdell/t_min_relative_permeability_liquid.md
@@ -0,0 +1 @@
+The minimal relative permeability of the liquid phase.
diff --git a/Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_gas_saturation.md b/Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_gas_saturation.md
new file mode 100644
index 00000000000..323809a94a3
--- /dev/null
+++ b/Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_gas_saturation.md
@@ -0,0 +1 @@
+The smallest degree of saturation of the gas phase.
diff --git a/Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_liquid_saturation.md b/Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_liquid_saturation.md
new file mode 100644
index 00000000000..348adff2f69
--- /dev/null
+++ b/Documentation/ProjectFile/properties/property/RelPermUdell/t_residual_liquid_saturation.md
@@ -0,0 +1 @@
+The smallest degree of satutation of the liquid phase.
diff --git a/MaterialLib/MPL/CreateProperty.h b/MaterialLib/MPL/CreateProperty.h
index 26246fa4511..4917462d056 100644
--- a/MaterialLib/MPL/CreateProperty.h
+++ b/MaterialLib/MPL/CreateProperty.h
@@ -24,7 +24,7 @@ namespace ParameterLib
 {
 struct ParameterBase;
 struct CoordinateSystem;
-}
+}  // namespace ParameterLib
 namespace MathLib
 {
 class PiecewiseLinearInterpolation;
diff --git a/MaterialLib/MPL/Properties/CreateProperties.h b/MaterialLib/MPL/Properties/CreateProperties.h
index 1af9674f10c..cf18d75bff5 100644
--- a/MaterialLib/MPL/Properties/CreateProperties.h
+++ b/MaterialLib/MPL/Properties/CreateProperties.h
@@ -34,6 +34,6 @@
 #include "CreateTransportPorosityFromMassBalance.h"
 #include "RelativePermeability/CreateRelPermBrooksCorey.h"
 #include "RelativePermeability/CreateRelPermLiakopoulos.h"
-#include "RelativePermeability/CreateRelPermVanGenuchten.h"
 #include "RelativePermeability/CreateRelPermUdell.h"
+#include "RelativePermeability/CreateRelPermVanGenuchten.h"
 #include "SwellingStress/CreateLinearSaturationSwellingStress.h"
diff --git a/MaterialLib/MPL/Properties/RelativePermeability/CreateRelPermUdell.cpp b/MaterialLib/MPL/Properties/RelativePermeability/CreateRelPermUdell.cpp
index 373087e372a..c0de0858f08 100644
--- a/MaterialLib/MPL/Properties/RelativePermeability/CreateRelPermUdell.cpp
+++ b/MaterialLib/MPL/Properties/RelativePermeability/CreateRelPermUdell.cpp
@@ -43,7 +43,7 @@ std::unique_ptr<RelPermUdell> createRelPermUdell(
     if ((min_relative_permeability_liquid < 0) ||
         (min_relative_permeability_gas < 0))
     {
-        OGS_FATAL("Minimal relative permeabilities must be positive.");
+        OGS_FATAL("Minimal relative permeabilities must be non-negative.");
     }
 
     return std::make_unique<RelPermUdell>(
diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp
index 4c9cf2cec49..3bbda249441 100644
--- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp
+++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.cpp
@@ -2,7 +2,6 @@
  * \file
  * \author Norbert Grunwald
  * \date   01.12.2020
- * \brief
  *
  * \copyright
  * Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
@@ -32,11 +31,12 @@ RelPermUdell::RelPermUdell(std::string name,
       min_relative_permeability_gas_(min_relative_permeability_gas)
 {
     name_ = std::move(name);
-};
+}
 
-PropertyDataType RelPermUdell::value(VariableArray const& variable_array,
-                                     ParameterLib::SpatialPosition const& pos,
-                                     double const t, double const dt) const
+PropertyDataType RelPermUdell::value(
+    VariableArray const& variable_array,
+    ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
+    double const /*dt*/) const
 {
     const double s_L = std::get<double>(
         variable_array[static_cast<int>(Variable::liquid_saturation)]);
@@ -70,10 +70,10 @@ PropertyDataType RelPermUdell::value(VariableArray const& variable_array,
     return Eigen::Vector2d{std::max(k_rel_LR, k_rel_min_LR),
                            std::max(k_rel_GR, k_rel_min_GR)};
 }
-PropertyDataType RelPermUdell::dValue(VariableArray const& variable_array,
-                                      Variable const primary_variable,
-                                      ParameterLib::SpatialPosition const& pos,
-                                      double const t, double const dt) const
+PropertyDataType RelPermUdell::dValue(
+    VariableArray const& variable_array, Variable const primary_variable,
+    ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/,
+    double const /*dt*/) const
 {
     (void)primary_variable;
     assert((primary_variable == Variable::liquid_saturation) &&
@@ -88,7 +88,9 @@ PropertyDataType RelPermUdell::dValue(VariableArray const& variable_array,
     auto const s = (s_L - s_L_res) / (s_L_max - s_L_res);
 
     if ((s < 0.) || (s > 1.))
+    {
         return Eigen::Vector2d{0., 0.};
+    }
 
     auto const d_se_d_sL = 1. / (s_L_max - s_L_res);
 
diff --git a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.h b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.h
index 1c93ca28538..af372e5c4f8 100644
--- a/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.h
+++ b/MaterialLib/MPL/Properties/RelativePermeability/RelPermUdell.h
@@ -2,7 +2,6 @@
  * \file
  * \author Norbert Grunwald
  * \date   01.12.2020
- * \brief
  *
  * \copyright
  * Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
@@ -13,7 +12,6 @@
  */
 #pragma once
 
-#include "BaseLib/ConfigTree.h"
 #include "MaterialLib/MPL/Property.h"
 
 namespace MaterialPropertyLib
@@ -22,14 +20,20 @@ class Medium;
 class Phase;
 class Component;
 /**
- * \class RelPermUdell
- * \brief Relative permeability used in:
+ * A simple relative permeability function as used in
+ *
  *        Kent S Udell. "Heat transfer in porous media considering phase change
  *        and capillarity-the heat pipe effect".In:International Journal of Heat
  *        and Mass Transfer 28.2 (1985), pp. 485-495
- * \details This property must be a medium
- * property, it computes the permeability reduction due to saturation as
- * function of capillary pressure.
+ *         Definition:
+ *          \f$k_{\textrm{rel}}^{\alpha} =
+ * \left(s^{\textrm{eff}}_{\alpha}\right)^{3}\f$ where
+ *          - \f$k_{\textrm{rel}}^{\alpha}\f$ is relative permeability of phase
+ * \f$\alpha\f$
+ *          - \f$s^{\textrm{eff}}_{\alpha}\f$ is the effective saturation of
+ * phase \f$\alpha\f$ \details This property must be a medium property, it
+ * computes the permeability reduction due to saturation as function of
+ * capillary pressure.
  */
 class RelPermUdell final : public Property
 {
@@ -40,10 +44,10 @@ private:
     const double min_relative_permeability_gas_;
 
 public:
-    RelPermUdell(std::string name, const double /*residual_liquid_saturation*/,
-                 const double /*residual_gas_saturation*/,
-                 const double /*min_relative_permeability_liquid_*/,
-                 const double /*min_relative_permeability_gas_*/);
+    RelPermUdell(std::string name, const double residual_liquid_saturation,
+                 const double residual_gas_saturation,
+                 const double min_relative_permeability_liquid_,
+                 const double min_relative_permeability_gas_);
 
     void checkScale() const override
     {
@@ -55,13 +59,11 @@ public:
         }
     }
 
-    /// Those methods override the base class implementations and
-    /// actually compute and set the property values_ and dValues_.
     PropertyDataType value(VariableArray const& variable_array,
                            ParameterLib::SpatialPosition const& pos,
                            double const t, double const dt) const override;
     PropertyDataType dValue(VariableArray const& variable_array,
-                            Variable const variable,
+                            Variable const primary_variable,
                             ParameterLib::SpatialPosition const& pos,
                             double const t, double const dt) const override;
 };
diff --git a/Tests/MaterialLib/TestMPLRelPermUdell.cpp b/Tests/MaterialLib/TestMPLRelPermUdell.cpp
index 3be9a10af61..75d5042a150 100644
--- a/Tests/MaterialLib/TestMPLRelPermUdell.cpp
+++ b/Tests/MaterialLib/TestMPLRelPermUdell.cpp
@@ -27,7 +27,6 @@ TEST(MaterialPropertyLib, RelPermUdell)
     std::stringstream m;
 
     m << "<medium>\n";
-    //    m_beg << "<phases></phases>\n";
     m << "<properties>\n";
     m << "  <property>\n";
     m << "    <name>relative_permeability</name>\n";
@@ -80,13 +79,8 @@ TEST(MaterialPropertyLib, RelPermUdell)
         3.18744740712E-04, 0.00000000000E+00, 0.00000000000E+00,
         0.00000000000E+00};
 
-    for (size_t idx = 0; idx < ref_saturation.size(); idx++)
+    for (std::size_t idx = 0; idx < ref_saturation.size(); idx++)
     {
-        // std::stringstream m_sat;
-        // m_sat << "    <value>" << ref_saturation[idx] << "</value>\n";
-        // std::stringstream m;
-        // m << m_beg.str() << m_sat.str() << m_end.str();
-
         auto const& medium = Tests::createTestMaterial(m.str());
         MaterialPropertyLib::VariableArray variable_array;
         ParameterLib::SpatialPosition const pos;
-- 
GitLab