Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SolidBody kirchhoff stress #221

Merged
merged 4 commits into from
May 17, 2022
Merged
Changes from 1 commit
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
Next Next commit
fix tovoigt math helper for 2d tensors
adtzlr committed May 17, 2022

Verified

This commit was signed with the committer’s verified signature.
truthbk Jaime Fullaondo
commit 7ba245c5b084f997c13454c31d21b7c4c4fb9ed7
8 changes: 6 additions & 2 deletions felupe/math/_tensor.py
Original file line number Diff line number Diff line change
@@ -279,8 +279,12 @@ def ddot(A, B, n=2, parallel=False):

def tovoigt(A):
"Convert (3, 3) tensor to (6, ) voigt notation."
B = np.zeros((6, *A.shape[2:]))
ij = [(0, 0), (1, 1), (2, 2), (0, 1), (1, 2), (0, 2)]
if A.shape[0] * A.shape[1] == 4:
B = np.zeros((3, *A.shape[2:]))
ij = [(0, 0), (1, 1), (0, 1)]
else:
B = np.zeros((6, *A.shape[2:]))
ij = [(0, 0), (1, 1), (2, 2), (0, 1), (1, 2), (0, 2)]
for i6, (i, j) in enumerate(ij):
B[i6] = A[i, j]
return B