From 27a944b91d19a278c9ec91a23f6ff67a32893707 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Mon, 18 Jan 2021 12:52:49 +0100
Subject: [PATCH] [PL/T2PF] MPL data: Fwd to and store in T2PFData.

---
 Applications/ApplicationsLib/ProjectData.cpp  |  2 +-
 ...CreateThermalTwoPhaseFlowWithPPProcess.cpp | 22 +++++++++++--------
 .../CreateThermalTwoPhaseFlowWithPPProcess.h  |  4 +++-
 .../ThermalTwoPhaseFlowWithPPProcessData.h    |  3 +++
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp
index b59d477fec4..b48ceea6af7 100644
--- a/Applications/ApplicationsLib/ProjectData.cpp
+++ b/Applications/ApplicationsLib/ProjectData.cpp
@@ -1101,7 +1101,7 @@ void ProjectData::parseProcesses(
                 createThermalTwoPhaseFlowWithPPProcess(
                     name, *_mesh_vec[0], std::move(jacobian_assembler),
                     _process_variables, _parameters, integration_order,
-                    process_config, _curves);
+                    process_config, _curves, _media);
         }
         else
 #endif
diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp b/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp
index b8fda16a425..c0a1ad12644 100644
--- a/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp
+++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp
@@ -11,6 +11,8 @@
 
 #include <cassert>
 
+#include "MaterialLib/MPL/CheckMaterialSpatialDistributionMap.h"
+#include "MaterialLib/MPL/CreateMaterialSpatialDistributionMap.h"
 #include "ParameterLib/ConstantParameter.h"
 #include "ParameterLib/Utils.h"
 #include "ProcessLib/Output/CreateSecondaryVariables.h"
@@ -34,7 +36,8 @@ std::unique_ptr<Process> createThermalTwoPhaseFlowWithPPProcess(
     BaseLib::ConfigTree const& config,
     std::map<std::string,
              std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
-        curves)
+        curves,
+    std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media)
 {
     //! \ogs_file_param{prj__processes__process__type}
     config.checkConfigParameter("type", "THERMAL_TWOPHASE_WITH_PP");
@@ -108,14 +111,15 @@ std::unique_ptr<Process> createThermalTwoPhaseFlowWithPPProcess(
         createThermalTwoPhaseFlowWithPPMaterialProperties(
             mat_config, materialIDs(mesh), parameters);
 
-    ThermalTwoPhaseFlowWithPPProcessData process_data{specific_body_force,
-                                                      has_gravity,
-                                                      mass_lumping,
-                                                      diff_coeff_b,
-                                                      diff_coeff_a,
-                                                      density_solid,
-                                                      latent_heat_evaporation,
-                                                      std::move(material)};
+    auto media_map =
+        MaterialPropertyLib::createMaterialSpatialDistributionMap(media, mesh);
+
+    ThermalTwoPhaseFlowWithPPProcessData process_data{
+        std::move(media_map), specific_body_force,
+        has_gravity,          mass_lumping,
+        diff_coeff_b,         diff_coeff_a,
+        density_solid,        latent_heat_evaporation,
+        std::move(material)};
 
     return std::make_unique<ThermalTwoPhaseFlowWithPPProcess>(
         std::move(name), mesh, std::move(jacobian_assembler), parameters,
diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.h b/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.h
index b5e835030e9..d5adf1836c1 100644
--- a/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.h
+++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.h
@@ -12,6 +12,7 @@
 
 #include <memory>
 
+#include "MaterialLib/MPL/Medium.h"
 #include "ProcessLib/Process.h"
 
 namespace ProcessLib
@@ -28,6 +29,7 @@ std::unique_ptr<Process> createThermalTwoPhaseFlowWithPPProcess(
     BaseLib::ConfigTree const& config,
     std::map<std::string,
              std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
-        curves);
+        curves,
+    std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const& media);
 }  // namespace ThermalTwoPhaseFlowWithPP
 }  // namespace ProcessLib
diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcessData.h b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcessData.h
index a2227d529bb..448adf2ecb6 100644
--- a/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcessData.h
+++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/ThermalTwoPhaseFlowWithPPProcessData.h
@@ -10,6 +10,7 @@
 
 #pragma once
 
+#include "MaterialLib/MPL/MaterialSpatialDistributionMap.h"
 #include "ThermalTwoPhaseFlowWithPPMaterialProperties.h"
 
 namespace ProcessLib
@@ -21,6 +22,8 @@ namespace ThermalTwoPhaseFlowWithPP
 {
 struct ThermalTwoPhaseFlowWithPPProcessData
 {
+    std::unique_ptr<MaterialPropertyLib::MaterialSpatialDistributionMap>
+        media_map;
     Eigen::VectorXd const specific_body_force;
 
     bool const has_gravity;
-- 
GitLab