From cfc3de91a26175e4446f383be1acc3c536dd2862 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Wed, 6 Apr 2022 17:53:29 +0200 Subject: [PATCH] [MPL] Add early exit in if saturation change is 0 This change is twofold; one one side the complicated matrix multiplication is avoided, but on the other side it is also preventing in initialization of the processes, when dt = 0 the division by zero. Naturally, this is a hack due to lag of separation of constitutive variables update in the time step from initialization (where dt, S_L_prev relevant for this property, are not yet initialized). --- MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp b/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp index 33a3ad57e18..6e90fea693e 100644 --- a/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp +++ b/MaterialLib/MPL/Properties/SaturationDependentSwelling.cpp @@ -83,6 +83,11 @@ PropertyDataType SaturationDependentSwelling::value( double const delta_S_eff = S_eff - S_eff_prev; + if (delta_S_eff == 0.) + { + return delta_sigma_sw; // still being zero. + } + // \Delta\sigma_{sw} = - \sum_i k_i (\lambda p S_{eff}^{(\lambda_i - 1)} // e_i \otimes e_i \Delta S_L / (S_{max} - S_{min}), where // e_i \otimes e_i is a square matrix with e_i,0^2 e_i,0*e_i,1 etc. -- GitLab