From 42f9afde70cd73d1332c6daaa69a34eaed2e225c Mon Sep 17 00:00:00 2001
From: Wenqing Wang <wenqing.wang@ufz.de>
Date: Fri, 13 Sep 2024 10:41:45 +0200
Subject: [PATCH] [B-bar] Restrict B-bar in 2x2 strain tensor for plain stain
 problem

---
 ProcessLib/Deformation/LinearBMatrix.h | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/ProcessLib/Deformation/LinearBMatrix.h b/ProcessLib/Deformation/LinearBMatrix.h
index eaee91bc30b..b0d75350be0 100644
--- a/ProcessLib/Deformation/LinearBMatrix.h
+++ b/ProcessLib/Deformation/LinearBMatrix.h
@@ -172,15 +172,22 @@ void applyBbar(BBarMatrixType const& B_bar, BMatrixType& B,
 
         auto const B_bar_i = B_bar.col(i);
 
-        double const b0_dil_pertubation =
-            is_axially_symmetric
-                ? (B_i_0[0] - B_bar_i[0] + B_i_0[2] - B_bar_i[2])
-                : (B_i_0[0] - B_bar_i[0]);
-
-        B_i_0.template segment<3>(0) -=
-            Eigen::Vector3d::Constant((b0_dil_pertubation) / 3.);
-        B_i_1.template segment<3>(0) -=
-            Eigen::Vector3d::Constant((B_i_1[1] - B_bar_i[1]) / 3.);
+        if (is_axially_symmetric)
+        {
+            double const b0_dil_pertubation =
+                (B_i_0[0] - B_bar_i[0] + B_i_0[2] - B_bar_i[2]);
+            B_i_0.template segment<3>(0) -=
+                Eigen::Vector3d::Constant((b0_dil_pertubation) / 3.);
+            B_i_1.template segment<3>(0) -=
+                Eigen::Vector3d::Constant((B_i_1[1] - B_bar_i[1]) / 3.);
+            continue;
+        }
+
+        // Plane strain
+        B_i_0.template segment<2>(0) -=
+            Eigen::Vector2d::Constant((B_i_0[0] - B_bar_i[0]) / 2.);
+        B_i_1.template segment<2>(0) -=
+            Eigen::Vector2d::Constant((B_i_1[1] - B_bar_i[1]) / 2.);
     }
 }
 }  // namespace detail
-- 
GitLab