[FEM] Compute and draw von Mises stress - #6216
Open
alxbilger wants to merge 28 commits into
Open
Conversation
… and can be linked to VonMisesStress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces the computation and visualization of von Mises stress, based on the FEM. It consists in the local least-squares projection of stress values from quadrature points to nodes. The projection is local: the value at the node depends on the considered element, i.e. a global node has multiple values depending on its neighbour element. The result is a discontinuous stress field. It's on purpose! A discontinuity would indicate a problem of discretization. Without any problem, the field should appear continuous.
The theory
In FEM, the Cauchy stress is approximated in any point of an element by:
where$\sigma_i$ are the values at nodes, $N_i$ are the shape functions.
We want this error to be minimal. Its minimum is when its derivative is zero:
We rearrange:
that we can write as$M \sigma_j = b$ . It's a linear system to solve. The solution gives the stress values at the nodes.
The$M$ matrix is the Gram matrix (mentioned in the code). It's constant over time, so it's pre-computed. In order to solve the linear system, we store the inverse of this matrix. The algorithm simply consists in assembling $b$ and multiply it by $M^{-1}$ .
Note: for the future, one can think about smoothing the field to make it continuous. There are two ways:
sofa_video_r60_0005_compressed.mp4
For future PRs:
DrawElementColoredMeshis not implemented for all types of elements.LinearSmallStrainFEMForceFieldderives fromCauchyStressEvaluator. The next candidate to support stress evaluation is naturallyCorotationalFEMForceField. AndHyperelasticMaterialonce [FEM.HyperElastic] Integration of hyperelasticity from Elasticity plugin to SOFA #6206 is merged.sofa_video_r60_0007.mp4
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if