How to check mesh quality?

Hi everyone

How do I check my mesh is good or not? I found some videos on youtube but they are a little bit advance. If you know some tutorials, please let me know.

Best regards

You could try visualising your mesh using eg Gmsh or Paraview.

In what way(s) do you think your mesh might not be good?

There are several functions in dolfin to check meshquality, see the API:
https://fenicsproject.org/docs/dolfin/2019.1.0/python/_autogenerated/dolfin.cpp.mesh.html?highlight=meshquality#dolfin.cpp.mesh.MeshQuality,
Which can be import by from dolfin.cpp.mesh import MeshQuality

However, I agree with @mscroggs that Paraview is a very suitable tool for visualizing the quality of the mesh, as it has several filters for this purpose

Thank you dokken and mscroggs

I will use Paraview for checking mesh quality.

Do you know where I can find an example or a tutorial for this purpose? And how to fix the mesh after checking it too.

Thank you very much

Depending on how you have generated your mesh, that tool might have ways of improving mesh quality (changing meshing algorithms etc).

Which tool Did you use?

vtkplotter has methods to measure mesh quality, see here.

import dolfin
from vtkplotter.dolfin import MeshActor, plot, datadir
from vtkplotter import meshQuality

mesh = dolfin.Mesh(datadir + "dolfin_fine.xml")

vtkmesh = meshQuality(MeshActor(mesh)) # wrap mesh
vtkmesh.lineWidth(0.1)

plot(vtkmesh, bg='white')

Hi Dokken

I am using gmsh, but I usually take the mesh from others.

Gmsh has several meshing algorithms implemented that can change the mesh quality.

It is possible to perturb meshes in dolfin using ALE.move(mesh, pert), Where pert is a CG1 vector function over the mesh. So, if you can Express the change you would like to do as a CG1 function in dolfin, you can modify the mesh there.