Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/matadi/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.0"
__version__ = "0.3.1"
18 changes: 9 additions & 9 deletions src/matadi/_lab_compressible.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def stability(stretch, stretches_23):
for j, b in enumerate(c):
B[i, j] = A[(*a, *b)]

# unit force in direction 1
# unit forces in all directions
# calculate linear solution of stretch 1 resulting from unit load
dl = np.linalg.inv(B)[0, 0]
dl = np.diag(np.linalg.inv(B))

return dl > 0
return np.all(dl > 0)

def stress_free(stretches_23, stretch):
s = stress(stretch, *stretches_23)
Expand Down Expand Up @@ -77,11 +77,11 @@ def stability(stretch, stretch_3):
for j, b in enumerate(c):
B[i, j] = A[(*a, *b)]

# unit force in direction 1
# unit forces in all directions
# calculate linear solution of stretch 1 resulting from unit load
dl = np.linalg.inv(B)[0, 0]
dl = np.diag(np.linalg.inv(B))

return dl > 0
return np.all(dl > 0)

def stress_free(stretch_3, stretch):
return [stress(stretch, *stretch_3)[2, 2]]
Expand Down Expand Up @@ -116,11 +116,11 @@ def stability(stretch, stretch_3):
for j, b in enumerate(c):
B[i, j] = A[(*a, *b)]

# init unit force in direction 1
# init unit forces in all directions
# calculate linear solution of stretch 1 resulting from unit load
dl = np.linalg.inv(B)[0, 0]
dl = np.diag(np.linalg.inv(B))

return dl > 0
return np.all(dl > 0)

def stress_free(stretch_3, stretch):
return [stress(stretch, *stretch_3)[2, 2]]
Expand Down
35 changes: 16 additions & 19 deletions src/matadi/_lab_incompressible.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import matplotlib.pyplot as plt
import numpy as np

from ._templates import MaterialHyperelastic
from .math import det


class LabIncompressible:
def __init__(self, material, title=None):
Expand Down Expand Up @@ -47,30 +50,24 @@ def stability(stretch):

P = self.material.gradient([F])[0]
A = self.material.hessian([F])[0]
d2JdFdF = MaterialHyperelastic(lambda F: det(F)).hessian([F])[0]

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

# convert hessian to (3, 3) matrix
B = np.zeros((3, 3))
c = [(0, 0), (1, 1), (2, 2)]

# convert hessian to (3, 3) matrix and take (2, 2) submatrix
B = np.zeros((2, 2))
delta = np.eye(2)

for i in range(2):
for j in range(2):
B[i, j] = (
A[i, i, j, j]
- delta[-1, j] / kinematics(stretch)[i] * P[-1, -1]
- kinematics(stretch)[-1]
/ kinematics(stretch)[i]
* A[-1, -1, j, j]
+ kinematics(stretch)[-1]
/ kinematics(stretch)[i] ** 2
* P[-1, -1]
* delta[i, j]
)
for i, a in enumerate(c):
for j, b in enumerate(c):
B[i, j] = (A + p * d2JdFdF)[(*a, *b)]

# init unit force in direction 1
# calculate linear solution of stretch 1 resulting from unit load
dl = np.linalg.inv(B)[0, 0]
dl = np.diag(np.linalg.inv(B))

return dl > 0
return np.all(dl > 0)

return (
stress_free(stretch),
Expand Down