Saving mesh with the new configuration

Hello,
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

Hello,
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 fe.io.XDMFFile(mesh.comm, "mesh.xdmf"), "w") as xdmf:
            xdmf.write_mesh(mesh)
        
        meshio_mesh = meshio.read("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