From cbc9f7128024119a57f6ddfb0f6ac45a4cee7b76 Mon Sep 17 00:00:00 2001
From: Steffen Beese <steffen.beese@bgr.de>
Date: Wed, 21 Jul 2021 09:13:15 +0200
Subject: [PATCH] [RM/DSM] bugfix for transport porosity computation in case of
 DSM

---
 .../RichardsMechanicsFEM-impl.h               | 42 +++++++++++--------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h
index 82cf97988ff..db458015520 100644
--- a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h
+++ b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM-impl.h
@@ -941,16 +941,19 @@ void RichardsMechanicsLocalAssembler<ShapeFunctionDisplacement,
 
         if (medium->hasProperty(MPL::PropertyType::transport_porosity))
         {
-            variables_prev[static_cast<int>(
-                MPL::Variable::transport_porosity)] =
-                _ip_data[ip].transport_porosity_prev;
+            if (!medium->hasProperty(MPL::PropertyType::saturation_micro))
+            {
+                variables_prev[static_cast<int>(
+                    MPL::Variable::transport_porosity)] =
+                    _ip_data[ip].transport_porosity_prev;
 
-            _ip_data[ip].transport_porosity =
-                medium->property(MPL::PropertyType::transport_porosity)
-                    .template value<double>(variables, variables_prev,
-                                            x_position, t, dt);
-            variables[static_cast<int>(MPL::Variable::transport_porosity)] =
-                _ip_data[ip].transport_porosity;
+                _ip_data[ip].transport_porosity =
+                    medium->property(MPL::PropertyType::transport_porosity)
+                        .template value<double>(variables, variables_prev,
+                                                x_position, t, dt);
+                variables[static_cast<int>(MPL::Variable::transport_porosity)] =
+                    _ip_data[ip].transport_porosity;
+            }
         }
         else
         {
@@ -1722,16 +1725,19 @@ void RichardsMechanicsLocalAssembler<ShapeFunctionDisplacement,
 
         if (medium->hasProperty(MPL::PropertyType::transport_porosity))
         {
-            variables_prev[static_cast<int>(
-                MPL::Variable::transport_porosity)] =
-                _ip_data[ip].transport_porosity_prev;
+            if (!medium->hasProperty(MPL::PropertyType::saturation_micro))
+            {
+                variables_prev[static_cast<int>(
+                    MPL::Variable::transport_porosity)] =
+                    _ip_data[ip].transport_porosity_prev;
 
-            _ip_data[ip].transport_porosity =
-                medium->property(MPL::PropertyType::transport_porosity)
-                    .template value<double>(variables, variables_prev,
-                                            x_position, t, dt);
-            variables[static_cast<int>(MPL::Variable::transport_porosity)] =
-                _ip_data[ip].transport_porosity;
+                _ip_data[ip].transport_porosity =
+                    medium->property(MPL::PropertyType::transport_porosity)
+                        .template value<double>(variables, variables_prev,
+                                                x_position, t, dt);
+                variables[static_cast<int>(MPL::Variable::transport_porosity)] =
+                    _ip_data[ip].transport_porosity;
+            }
         }
         else
         {
-- 
GitLab