# How to make Von Mises Stress look better

**URL:** <https://fenicsproject.discourse.group/t/how-to-make-von-mises-stress-look-better/17013>\
**Category:** General\
**Tags:** post-processing\
**Created:** [February 17, 2025, 3:59pm UTC](https://fenicsproject.discourse.group/t/how-to-make-von-mises-stress-look-better/17013 "2025-02-17T15:59:55Z")\
**Posts on this page:** 1\
**Showing post:** 10

<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:** [February 18, 2025, 8:16pm UTC](https://fenicsproject.discourse.group/t/how-to-make-von-mises-stress-look-better/17013/10 "2025-02-18T20:16:45Z")

</div>

VTXWriter and VTKFile supports arbitrary order continuous and discontinuous Lagrange spaces, and should be used for outputting these variables.

If you want to show the von Mises stresses on the deformed geometry, I would interpolate the displacement into the same DG-1 space, i.e.

```python
V_DG = dolfinx.fem.functionspace(mesh, ("DG", degree, (mesh.geometry.dim,)))
stresses = dolfinx.fem.Function(V_DG, name="VonMises")
u_dg = dolfinx.fem.Function(V_DG, name="u")
bp_vonmises = dolfinx.io.VTXWriter(mesh.comm, output / "von_mises.bp", [stresses, u_dg])
s = sigma(u, mu, lmbda) - 1.0 / 3 * ufl.tr(sigma(u, mu, lmbda)) * ufl.Identity(len(u))
von_Mises = ufl.sqrt(3.0 / 2 * ufl.inner(s, s))
stress_expr = dolfinx.fem.Expression(von_Mises, V_DG.element.interpolation_points())
stresses.sub(0).interpolate(stress_expr)
u_dg.interpolate(u)
bp_vonmises.write(0.0)
bp_vonmises.close()

```

---

_[View the full topic](https://fenicsproject.discourse.group/t/how-to-make-von-mises-stress-look-better/17013)._
