From 9f43de642309938fc355250d7fe1977ca006396b Mon Sep 17 00:00:00 2001
From: Wenqing Wang <wenqing.wang@ufz.de>
Date: Mon, 26 Aug 2024 14:01:22 +0200
Subject: [PATCH] [LIE/HM] Enable to read the MPL properties

---
 Applications/ApplicationsLib/ProjectData.cpp  |  4 ++--
 .../CreateHydroMechanicsProcess.cpp           | 19 +++++++++++++++----
 .../CreateHydroMechanicsProcess.h             | 11 +++++++++--
 .../HydroMechanicsProcessData.h               |  4 ++++
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp
index 95eece38395..9aae20a6fa9 100644
--- a/Applications/ApplicationsLib/ProjectData.cpp
+++ b/Applications/ApplicationsLib/ProjectData.cpp
@@ -922,7 +922,7 @@ void ProjectData::parseProcesses(
                             name, *_mesh_vec[0], std::move(jacobian_assembler),
                             _process_variables, _parameters,
                             _local_coordinate_system, integration_order,
-                            process_config);
+                            process_config, _media);
                     break;
                 case 3:
                     process = ProcessLib::LIE::HydroMechanics::
@@ -930,7 +930,7 @@ void ProjectData::parseProcesses(
                             name, *_mesh_vec[0], std::move(jacobian_assembler),
                             _process_variables, _parameters,
                             _local_coordinate_system, integration_order,
-                            process_config);
+                            process_config, _media);
                     break;
                 default:
                     OGS_FATAL(
diff --git a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp
index ba887104e63..95f10727c57 100644
--- a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp
+++ b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.cpp
@@ -18,6 +18,8 @@
 #include "MaterialLib/FractureModels/CreateCoulomb.h"
 #include "MaterialLib/FractureModels/CreateLinearElasticIsotropic.h"
 #include "MaterialLib/FractureModels/Permeability/CreatePermeabilityModel.h"
+#include "MaterialLib/MPL/CreateMaterialSpatialDistributionMap.h"
+#include "MaterialLib/MPL/MaterialSpatialDistributionMap.h"
 #include "MaterialLib/SolidModels/CreateConstitutiveRelation.h"
 #include "ParameterLib/Utils.h"
 #include "ProcessLib/Output/CreateSecondaryVariables.h"
@@ -38,7 +40,8 @@ std::unique_ptr<Process> createHydroMechanicsProcess(
     std::optional<ParameterLib::CoordinateSystem> const&
         local_coordinate_system,
     unsigned const integration_order,
-    BaseLib::ConfigTree const& config)
+    BaseLib::ConfigTree const& config,
+    std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
 {
     //! \ogs_file_param{prj__processes__process__type}
     config.checkConfigParameter("type", "HYDRO_MECHANICS_WITH_LIE");
@@ -326,9 +329,13 @@ std::unique_ptr<Process> createHydroMechanicsProcess(
     //! \ogs_file_param{prj__processes__process__HYDRO_MECHANICS_WITH_LIE__use_b_bar}
     auto const use_b_bar = config.getConfigParameter<bool>("use_b_bar", false);
 
+    auto media_map =
+        MaterialPropertyLib::createMaterialSpatialDistributionMap(media, mesh);
+
     HydroMechanicsProcessData<GlobalDim> process_data{
         materialIDs(mesh),
         std::move(solid_constitutive_relations),
+        std::move(media_map),
         intrinsic_permeability,
         specific_storage,
         fluid_viscosity,
@@ -343,7 +350,8 @@ std::unique_ptr<Process> createHydroMechanicsProcess(
         initial_fracture_effective_stress,
         deactivate_matrix_in_flow,
         reference_temperature,
-        use_b_bar};
+        use_b_bar,
+    };
 
     SecondaryVariableCollection secondary_variables;
 
@@ -365,7 +373,9 @@ template std::unique_ptr<Process> createHydroMechanicsProcess<2>(
     std::optional<ParameterLib::CoordinateSystem> const&
         local_coordinate_system,
     unsigned const integration_order,
-    BaseLib::ConfigTree const& config);
+    BaseLib::ConfigTree const& config,
+    std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media);
+
 template std::unique_ptr<Process> createHydroMechanicsProcess<3>(
     std::string const& name,
     MeshLib::Mesh& mesh,
@@ -375,7 +385,8 @@ template std::unique_ptr<Process> createHydroMechanicsProcess<3>(
     std::optional<ParameterLib::CoordinateSystem> const&
         local_coordinate_system,
     unsigned const integration_order,
-    BaseLib::ConfigTree const& config);
+    BaseLib::ConfigTree const& config,
+    std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media);
 
 }  // namespace HydroMechanics
 }  // namespace LIE
diff --git a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h
index c3795c43471..02ce3c87434 100644
--- a/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h
+++ b/ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h
@@ -10,6 +10,7 @@
 
 #pragma once
 
+#include <map>
 #include <memory>
 #include <optional>
 #include <string>
@@ -19,6 +20,12 @@ namespace BaseLib
 {
 class ConfigTree;
 }
+
+namespace MaterialPropertyLib
+{
+class Medium;
+}
+
 namespace MeshLib
 {
 class Mesh;
@@ -51,8 +58,8 @@ std::unique_ptr<Process> createHydroMechanicsProcess(
     std::optional<ParameterLib::CoordinateSystem> const&
         local_coordinate_system,
     unsigned const integration_order,
-    BaseLib::ConfigTree const& config);
-
+    BaseLib::ConfigTree const& config,
+    std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media);
 }  // namespace HydroMechanics
 }  // namespace LIE
 }  // namespace ProcessLib
diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h
index 09d0e506b27..994223ab27d 100644
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h
+++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h
@@ -15,6 +15,7 @@
 #include <utility>
 
 #include "MaterialLib/FractureModels/FractureModelBase.h"
+#include "MaterialLib/MPL/MaterialSpatialDistributionMap.h"
 #include "MaterialLib/SolidModels/MechanicsBase.h"
 #include "MeshLib/ElementStatus.h"
 #include "MeshLib/PropertyVector.h"
@@ -38,6 +39,9 @@ struct HydroMechanicsProcessData
     std::map<int,
              std::shared_ptr<MaterialLib::Solids::MechanicsBase<GlobalDim>>>
         solid_materials;
+
+    MaterialPropertyLib::MaterialSpatialDistributionMap media_map;
+
     ParameterLib::Parameter<double> const& intrinsic_permeability;
     ParameterLib::Parameter<double> const& specific_storage;
     ParameterLib::Parameter<double> const& fluid_viscosity;
-- 
GitLab