From 080a80e98d29a6b3349d2afdb1cf1922405336f1 Mon Sep 17 00:00:00 2001
From: Wenqing Wang <wenqing.wang@ufz.de>
Date: Mon, 18 May 2020 16:02:25 +0200
Subject: [PATCH] [MPL/vanGenuchten] added checkVanGenuchtenExponentRange

---
 .../Utils/CheckVanGenuchtenExponentRange.cpp  | 28 +++++++++++++++++++
 .../Utils/CheckVanGenuchtenExponentRange.h    | 17 +++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.cpp
 create mode 100644 MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.h

diff --git a/MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.cpp b/MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.cpp
new file mode 100644
index 00000000000..bdd0fa4ec06
--- /dev/null
+++ b/MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.cpp
@@ -0,0 +1,28 @@
+/**
+ * \file
+ * \copyright
+ * Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ * Created on April 20, 2020, 10:47 AM
+ */
+
+#include "CheckVanGenuchtenExponentRange.h"
+
+#include "BaseLib/Error.h"
+
+namespace MaterialPropertyLib
+{
+void checkVanGenuchtenExponentRange(const double m)
+{
+    if (m <= 0 || m >= 1)
+    {
+        OGS_FATAL(
+            "The exponent value m = {:e} of van Genuchten saturation "
+            "model, is out of its range of(0, 1) ",
+            m);
+    }
+}
+}  // namespace MaterialPropertyLib
diff --git a/MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.h b/MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.h
new file mode 100644
index 00000000000..e93f7691b43
--- /dev/null
+++ b/MaterialLib/MPL/Utils/CheckVanGenuchtenExponentRange.h
@@ -0,0 +1,17 @@
+/**
+ * \file
+ * \copyright
+ * Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ * Created on April 20, 2020, 10:47 AM
+ */
+
+#pragma once
+
+namespace MaterialPropertyLib
+{
+void checkVanGenuchtenExponentRange(const double m);
+}  // namespace MaterialPropertyLib
-- 
GitLab