From 17ae2f2d480d313e7ca2f2f929ec00718da6a94b Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Mon, 2 Dec 2019 12:22:26 +0100
Subject: [PATCH] [PL] LIE; Fix aperture init from nodal property.

For the first timestep the initialization would fail
if the property is defined on nodes.
It was not caught before because the LIE/HM/single_fracture_3compartments_flow_linear_aperture0.prj
test didn't use the right material_id value for the
fracture.
---
 ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp  | 9 ++++++---
 .../LIE/SmallDeformation/SmallDeformationProcess.cpp     | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
index 0f5e0aa8d9c..0ab1bcebb44 100644
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
+++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
@@ -356,9 +356,12 @@ void HydroMechanicsProcess<GlobalDim>::initializeConcreteProcess(
             {
                 continue;
             }
-            ParameterLib::SpatialPosition x;
-            x.setElementID(e->getID());
-            (*mesh_prop_b)[e->getID()] = frac->aperture0(0, x)[0];
+            // Mean value for the element. This allows usage of node based
+            // properties for aperture.
+            (*mesh_prop_b)[e->getID()] =
+                frac->aperture0
+                    .getNodalValuesOnElement(*e, /*time independent*/ 0)
+                    .mean();
         }
         _process_data.mesh_prop_b = mesh_prop_b;
 
diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
index 89bfaa4ff0f..13f5530bdbd 100644
--- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
+++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
@@ -496,9 +496,12 @@ void SmallDeformationProcess<DisplacementDim>::initializeConcreteProcess(
             {
                 continue;
             }
-            ParameterLib::SpatialPosition x;
-            x.setElementID(e->getID());
-            (*mesh_prop_b)[e->getID()] = fracture_prop.aperture0(0, x)[0];
+            // Mean value for the element. This allows usage of node based
+            // properties for aperture.
+            (*mesh_prop_b)[e->getID()] =
+                fracture_prop.aperture0
+                    .getNodalValuesOnElement(*e, /*time independent*/ 0)
+                    .mean();
         }
     }
     _process_data._mesh_prop_b = mesh_prop_b;
-- 
GitLab