Skip to content

calculate Von-Mises Stress element by element in a 3D Case #1129

Answered by kinnala
Preetzl asked this question in Q&A
Discussion options

You must be logged in to vote

Here are some thoughts:

  • What do you mean by a knot?
  • It is possible to loop over elements but it is against the philosophy of scikit-fem...
  • We try to avoid looping over elements, since it is computationally inefficient to do loops in Python, this is why numpy was invented
  • It is perhaps a better idea to calculate von Mises stress in all elements in one numpy call and then find which of them will yield

So you can then just slightly modify example 4:

s = {}
dgb = ib.with_element(ElementTetP0())
up = ib.interpolate(u)

for i in [0, 1]:
    for j in [0, 1]:
        s[i, j] = dgb.project(C(sym_grad(up))[i, j])

s[2, 2] = poisson_ratio * (s[0, 0] + s[1, 1])

vonmises = np.sqrt(.5 * ((s[0, 0] - s[1

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Preetzl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants