Thank you very much @dokken, it worked perfectly!
I have another question that follows from this. If now I want to find the cell size of my quadratic elements, can I reuse the following code (Evaluation of cell sizes)?
tdim = mesh.topology.dim
num_cells = mesh.topology.index_map(tdim).size_local
h = dolfinx.cpp.mesh.h(mesh, tdim, range(num_cells))
print(h)
Because when I run it, it gives the following error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Input In [14], in <cell line: 3>()
1 tdim = mesh.topology.dim
2 num_cells = mesh.topology.index_map(tdim).size_local
----> 3 h = dolfinx.cpp.mesh.h(mesh, tdim, range(2*num_cells))
4 h_av = np.mean(h)
RuntimeError: Incompatible dimension of arrays, compile in DEBUG for more info
Or is there a way to convert the quadratic mesh into a linear mesh directly from fenics, without having to re-generate a mesh on gmsh for example?
Thanks again for all your help!