Skip to content

Commit 8b9e5fc

Browse files
committed
Fix stability in LabIncompressible
add a (fake) volumetric strain energy function
1 parent c5570c8 commit 8b9e5fc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/matadi/_lab_incompressible.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55

66
from ._templates import MaterialHyperelastic
7-
from .math import det
7+
from .math import det, log
88

99

1010
class LabIncompressible:
@@ -50,18 +50,20 @@ def stability(stretch):
5050

5151
P = self.material.gradient([F])[0]
5252
A = self.material.hessian([F])[0]
53+
54+
# volumetric parts of strain energy function (required for stability)
55+
U = lambda F: 1e6 * log(det(F)) ** 2 / 2
56+
Ap = MaterialHyperelastic(U).hessian([F])[0]
5357
d2JdFdF = MaterialHyperelastic(lambda F: det(F)).hessian([F])[0]
5458

5559
# hydrostatic stress
5660
p = -P[-1, -1] * kinematics(stretch)[-1]
5761

5862
# convert hessian to (3, 3) matrix
5963
B = np.zeros((3, 3))
60-
c = [(0, 0), (1, 1), (2, 2)]
61-
62-
for i, a in enumerate(c):
63-
for j, b in enumerate(c):
64-
B[i, j] = (A + p * d2JdFdF)[(*a, *b)]
64+
for i in range(3):
65+
for j in range(3):
66+
B[i, j] = (A + Ap + p * d2JdFdF)[i, i, j, j]
6567

6668
# init unit force in direction 1
6769
# calculate linear solution of stretch 1 resulting from unit load

0 commit comments

Comments
 (0)