From bad2feb0320c280325afbe9c438f114a19f7f756 Mon Sep 17 00:00:00 2001 From: Andreas Dutzler Date: Sat, 30 Mar 2024 22:52:01 +0100 Subject: [PATCH 1/2] Fix `FieldContainer.evaluate.strain()` for custom strain-stretch --- docs/tutorial/examples/extut03_building_blocks.py | 9 ++++++++- src/felupe/field/_evaluate.py | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/examples/extut03_building_blocks.py b/docs/tutorial/examples/extut03_building_blocks.py index 50c84084..14673308 100644 --- a/docs/tutorial/examples/extut03_building_blocks.py +++ b/docs/tutorial/examples/extut03_building_blocks.py @@ -25,8 +25,9 @@ """ # sphinx_gallery_thumbnail_number = -1 import felupe as fem +import numpy as np -mesh = fem.Cube(n=9) +mesh = fem.Cube(n=6) element = fem.Hexahedron() quadrature = fem.GaussLegendre(order=1, dim=3) @@ -104,6 +105,12 @@ # identity matrix is added to the gradient of the field. F = field.extract(grad=True, sym=False, add_identity=True) +# %% +# Methods to evaluate the deformation gradient as well as strain measures are +# provided in :class:`FieldContainer.evaluate `. +log_strain = field.evaluate.strain(fun=lambda stretch: np.log(stretch), tensor=True) +principal_stretches = field.evaluate.strain(fun=lambda stretch: stretch, tensor=False) + # %% # Constitution # ~~~~~~~~~~~~ diff --git a/src/felupe/field/_evaluate.py b/src/felupe/field/_evaluate.py index 31071d94..984af36d 100644 --- a/src/felupe/field/_evaluate.py +++ b/src/felupe/field/_evaluate.py @@ -91,7 +91,9 @@ def strain(self, fun=strain_stretch_1d, tensor=True, asvoigt=False, n=0, **kwarg math.strain : Compute a Lagrangian strain tensor. math.strain_stretch_1d : Compute the Seth-Hill strains. """ - return strain(self.field, tensor=tensor, asvoigt=asvoigt, n=0, **kwargs) + return strain( + self.field, fun=fun, tensor=tensor, asvoigt=asvoigt, n=0, **kwargs + ) def log_strain(self, tensor=True, asvoigt=False, n=0): r"""Return the logarithmic Lagrangian strain tensor or its principal values. From 69edfc93934c17f88c168aa0e3ddeb65cdd8a4d8 Mon Sep 17 00:00:00 2001 From: Andreas Dutzler Date: Sat, 30 Mar 2024 22:53:32 +0100 Subject: [PATCH 2/2] Set version tag to 8.2.1 --- CHANGELOG.md | 5 +++++ src/felupe/__about__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63388dfa..5b48a602 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format ## [Unreleased] +## [8.2.1] - 2024-03-30 + +### Fixed +- Fix `FieldContainer.evaluate.strain(fun=lambda stretch: stretch)` for custom strain-stretch callables. The `fun`-argument was previously ignored. + ## [8.2.0] - 2024-03-25 ### Added diff --git a/src/felupe/__about__.py b/src/felupe/__about__.py index c0968f8f..1f1024b1 100644 --- a/src/felupe/__about__.py +++ b/src/felupe/__about__.py @@ -1 +1 @@ -__version__ = "8.3.0-dev" +__version__ = "8.2.1"