Skip to content

Commit

Permalink
Merge pull request #68 from adtzlr/fix-model-fiber-family
Browse files Browse the repository at this point in the history
Fix model fiber family
  • Loading branch information
adtzlr authored Dec 9, 2021
2 parents 744eb71 + 6f632f3 commit fbea718
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion matadi/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.24"
__version__ = "0.0.25"
11 changes: 8 additions & 3 deletions matadi/models/_hyperelasticity_anisotropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
det,
DM,
exp,
log,
cos,
sin,
pi,
Expand All @@ -27,7 +28,11 @@ def fiber(F, E, angle, k=1, axis=2, compression=False):
C = transpose(F) @ F

stretch = sqrt((transpose(N) @ C @ N))[0, 0]
strain = 1 / k * (stretch ** k - 1)

if k == 0:
strain = log(stretch)
else:
strain = 1 / k * (stretch ** k - 1)

if not compression:
strain = if_else(strain < 0, 0, strain)
Expand All @@ -39,8 +44,8 @@ def fiber(F, E, angle, k=1, axis=2, compression=False):
def fiber_family(F, E, angle, k=1, axis=2, compression=False):
"Fiber Family"

f1 = fiber(F, E, k, angle, axis, compression)
f2 = fiber(F, E, k, -angle, axis, compression)
f1 = fiber(F, E, angle=angle, k=k, axis=axis, compression=compression)
f2 = fiber(F, E, angle=-angle, k=k, axis=axis, compression=compression)

return f1 + f2

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "matadi"
version = "0.0.24"
version = "0.0.25"
description = "Material Definition with Automatic Differentiation"
readme = "README.md"
requires-python = ">=3.6"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = matadi
version = 0.0.24
version = 0.0.25
author = Andreas Dutzler
author_email = a.dutzler@gmail.com
description = Material Definition with Automatic Differentiation
Expand Down
5 changes: 4 additions & 1 deletion tests/test_fiber.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ def test_fiber():
for model in [fiber, fiber_family]:

# init Material without bulk
M = MaterialHyperelastic(model, E=1, angle=30, axis=2)
M = MaterialHyperelastic(model, E=1, angle=30, axis=2, k=0)

W0 = M.function([FF])
assert W0[0].shape == (2,)

# init Material
M = MaterialHyperelastic(model, E=1, angle=30, axis=2, bulk=5000)
Expand Down

0 comments on commit fbea718

Please sign in to comment.