Skip to content

Commit

Permalink
Merge pull request #731 from adtzlr/fix-field-evaluate-strain
Browse files Browse the repository at this point in the history
Fix `FieldContainer.evaluate.strain(fun=lambda stretch: stretch)` for custom `fun`-callables
  • Loading branch information
adtzlr authored Mar 30, 2024
2 parents d0455ca + 69edfc9 commit 03ca271
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion docs/tutorial/examples/extut03_building_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 <felupe.field.EvaluateFieldContainer>`.
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
# ~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion src/felupe/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "8.3.0-dev"
__version__ = "8.2.1"
4 changes: 3 additions & 1 deletion src/felupe/field/_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 03ca271

Please sign in to comment.