From 9e7b291f8fe12528817ba9b6e5f800b5acb5d051 Mon Sep 17 00:00:00 2001 From: Andreas Dutzler Date: Fri, 19 Aug 2022 11:50:01 +0200 Subject: [PATCH] field integration: fix field-trimming for plane strain fixes #259 --- felupe/_assembly/_base.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/felupe/_assembly/_base.py b/felupe/_assembly/_base.py index 9ec97e87..13f96115 100644 --- a/felupe/_assembly/_base.py +++ b/felupe/_assembly/_base.py @@ -163,8 +163,15 @@ def integrate(self, parallel=False, jit=False): dV = self.dV fun = self.fun - if len(fun) > v.dim: - fun = fun[tuple([slice(v.dim)] * (len(fun.shape) - 2))] + # plane strain + # trim 3d vector-valued functions to the dimension of the field + function_dimension = len(fun.shape) - 2 + function_is_vector = function_dimension >= 1 + function_is_3d = len(fun) == 3 + field_is_2d = v.dim == 2 + + if function_is_vector and function_is_3d and field_is_2d: + fun = fun[tuple([slice(2)] * function_dimension)] if parallel: einsum = einsumt