From d7898ef909a1c7277d7a1d5f028f4937f6a666ad Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 11 Feb 2020 18:17:25 +0100
Subject: [PATCH] [PL/LiquidFlow] Impl. checkMPLProperties.

---
 ProcessLib/LiquidFlow/LiquidFlowProcess.cpp | 36 +++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
index 6fcf80c7c93..b45fe8779e0 100644
--- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
+++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
@@ -26,6 +26,40 @@ namespace ProcessLib
 {
 namespace LiquidFlow
 {
+void checkMPLProperties(
+    MeshLib::Mesh const& mesh,
+    MaterialPropertyLib::MaterialSpatialDistributionMap const& media_map)
+{
+    DBUG("Check the media properties of LiquidFlow process ...");
+
+    std::array const requiredPropertyMedium = {
+        MaterialPropertyLib::PropertyType::porosity,
+        MaterialPropertyLib::PropertyType::permeability};
+
+    std::array const requiredPropertyLiquidPhase = {
+        MaterialPropertyLib::PropertyType::viscosity,
+        MaterialPropertyLib::PropertyType::density};
+
+    std::array const requiredPropertySolidPhase = {
+        MaterialPropertyLib::PropertyType::storage};
+
+    for (auto const& element : mesh.getElements())
+    {
+        auto const element_id = element->getID();
+
+        auto const& medium = *media_map.getMedium(element_id);
+        MaterialPropertyLib::checkRequiredProperties(
+            medium, requiredPropertyMedium);
+
+        MaterialPropertyLib::checkRequiredProperties(
+            medium.phase("AqueousLiquid"), requiredPropertyLiquidPhase);
+
+        MaterialPropertyLib::checkRequiredProperties(
+            medium.phase("Solid"), requiredPropertySolidPhase);
+    }
+    DBUG("Media properties verified.");
+}
+
 LiquidFlowProcess::LiquidFlowProcess(
     std::string name,
     MeshLib::Mesh& mesh,
@@ -61,6 +95,8 @@ void LiquidFlowProcess::initializeConcreteProcess(
     MeshLib::Mesh const& mesh,
     unsigned const integration_order)
 {
+    checkMPLProperties(mesh, *_process_data.media_map.get());
+
     const int process_id = 0;
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     ProcessLib::createLocalAssemblers<LiquidFlowLocalAssembler>(
-- 
GitLab