# Comparative Analysis: Ansys vs. FEniCSx \[von Mises in Linear Elasticity\]

**URL:** <https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-von-mises-in-linear-elasticity/13399>\
**Category:** General\
**Tags:** interpolation\
**Created:** [January 24, 2024, 2:55pm UTC](https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-von-mises-in-linear-elasticity/13399 "2024-01-24T14:55:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaribeiro](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/jaribeiro/32/4314_2.png) [@jaribeiro](https://fenicsproject.discourse.group/u/jaribeiro)\
**Post date:** [January 24, 2024, 2:55pm UTC](https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-von-mises-in-linear-elasticity/13399/1 "2024-01-24T14:55:03Z")

</div>

Hi,

I’m working on validating my code with Ansys. As you can see in this [topic](https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-displacement-in-linear-elasticity/13398), the displacements are quite close with only minor differences. However, for the von Mises stress, the discrepancy is larger:

 ![von_mises_fenicsx_vs_ansys](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/4/40f1aabf46f37a523393e1d2292b72069d470831.jpeg)

I’ve been following this [tutorial](https://jsdokken.com/dolfinx-tutorial/chapter2/linearelasticity_code.html) by @dokken. However, since I need the von Mises stress at the nodes and I’m using a serendipity family, I’ve interpolated it as follows:

```auto
V_von_mises = fem.FunctionSpace(domain, ("S", 1))
stress_expr = fem.Expression(von_Mises, V_von_mises.element.interpolation_points())
stresses = fem.Function(V_von_mises)
stresses.interpolate(stress_expr)

```

I suspect that the error might be in this interpolation.

Does this method calculate the von Mises stress at the Gauss points? I’m asking because Ansys calculates it at the Gauss points and then interpolates to the nodes.

Any suggestions or insights would be greatly appreciated.

Thanks,  
João

---

<div class="post-metadata">

**Author:** ![bleyerj](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bleyerj/32/6020_2.png) [@bleyerj](https://fenicsproject.discourse.group/u/bleyerj)\
**Post date:** [January 24, 2024, 3:09pm UTC](https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-von-mises-in-linear-elasticity/13399/2 "2024-01-24T15:09:22Z")

</div>

From your previous post, if you already have differences in displacement, the issue does not come from the stress interpolation which is only a post-processing step.

---

<div class="post-metadata">

**Author:** ![jaribeiro](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/jaribeiro/32/4314_2.png) [@jaribeiro](https://fenicsproject.discourse.group/u/jaribeiro)\
**Post date:** [January 24, 2024, 3:30pm UTC](https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-von-mises-in-linear-elasticity/13399/3 "2024-01-24T15:30:10Z")

</div>

I get your point, but even with minor errors in displacements, it appears that the von Mises stress is significantly larger. Could this discrepancy be related to the way the stress is calculated and interpolate?

---

<div class="post-metadata">

**Author:** ![French\_fries](https://avatars.discourse-cdn.com/v4/letter/f/71c47a/32.png) [@French\_fries](https://fenicsproject.discourse.group/u/French_fries)\
**Post date:** [November 20, 2024, 6:26am UTC](https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-von-mises-in-linear-elasticity/13399/4 "2024-11-20T06:26:14Z")

</div>

Hi, may I ask if you have solved this problem? I am encountering the same issue：[The verification of thermoelastic von Mises stress](https://fenicsproject.discourse.group/t/the-verification-of-thermoelastic-von-mises-stress/16337)

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [November 20, 2024, 6:57am UTC](https://fenicsproject.discourse.group/t/comparative-analysis-ansys-vs-fenicsx-von-mises-in-linear-elasticity/13399/5 "2024-11-20T06:57:45Z")

</div>

If the move data from Gauss points to the vertices of the mesh, there will definitely be discrepancies, even with the same deformation field.

A discussion of potential issues have been touched upon in  
[http://jsdokken.com/FEniCS-workshop/src/approximations.html](http://jsdokken.com/FEniCS-workshop/src/approximations.html)

and the additional information provided in  
[https://bleyerj.github.io/comet-fenicsx/tips/computing\_reactions/computing\_reactions.html](https://bleyerj.github.io/comet-fenicsx/tips/computing_reactions/computing_reactions.html)
