Saving mesh with the new configuration

I have an elastic problem at hand and solved it for the displacements. I was wondering how the new configuration can be saved as a new mesh file, say as a gmsh file.
Thanks in advance

Saving it as a gmsh file is not something we support natively. I think you could save to xdmf and convert it to msh through meshio.

1 Like

Thank you for your response.
Based on the tutorials, saving the displacements is done through xdmf.write_function() and the mesh itself is saved with xdmf.write_mesh() as its initial configuration prior to the displacements. I don’t see how I can do xdmf.write_mesh() with the secondary configuration.

You would perturb the mesh prior to saving.
See for instance: Changing the shape in the surface normal directions - #6 by dokken

1 Like

I have another question. While trying to save the mesh in other formats (stl to be explicit), this is thrown:
Warning: STL can only write triangle cells. No triangle cells found.
I try to save the file with the lines below:

        with, "mesh.xdmf"), "w") as xdmf:
        meshio_mesh ="mesh.xdmf"))
        meshio.write("mesh.stl"), meshio_mesh)

My guess is what I need is something like:
mesh.topology.create_connectivity(gdim, gdim - 1)
But I cann’t figure out how I should use it.
Thank you again.

That is either an STL question, or a meshio question. We don’t develop either, so we can’t help much further: please ask the respective communities.

Adding mesh.topology.create_connectivity won’t make any difference.

1 Like