Finite Element Analysis with Gridap.jl; how to define Von Mises stresses in Linear Elasticity problem?

58 Views Asked by At

From the Gridap.jl tutorial, I am struggling to compute the Von Mises stresses. I would love to get the feedback from the community on how to compute the Von Mises Stresses in the correct way. In this particular case I am not able to take the square root of j_2:

using LinearAlgebra: tr

hydrostatic_σ = tr(σ ∘ (ε(uh))) / 3
deviatoric_σ  = σ ∘ (ε(uh)) - hydrostatic_σ

j_2 = 1/2 * deviatoric_σ ⊙ deviatoric_σ        # deviatoric stress invariant = j_2 = 1/2 ∑σ_dev_ij^2

sigma_vm = sqrt.(3/2 * j_2) ## DOES NOT WORK

The error is:

ERROR: LoadError: MethodError: no method matching length(::Gridap.CellData.OperationCellField{ReferenceDomain})

Can I get a check from you?

1

There are 1 best solutions below

0
Mattia Samiolo On

uh is a CellField type, therefore the deviatoric stress invariant j_2 will be as well. Hence the calculations should be intsnciated using the function composition operator as follow.

sigma_vm =  sqrt ∘ (3 / 2 * j_2)

Credit due to JordiManyer (Jordi Manyer Fuertes) from the Gridap.jl gitter community