meshio
meshio copied to clipboard
Time series with Gmsh .msh format
Hi!
I'd like to ask if there are any plans to support reading/writing time data with Gmsh .msh file. This format certainly supports this.
Best regards, Marek
Does it? I personally don't take much interest in this, or the gmsh format in general. If someone comes up with a PR, I can review it of course.
Yes, it does. :) It seems this is as simple as writing data to the file many times, but with a different time tag (this tag is even mentioned in the code of the .msh data reader). How do you store time data internally in meshio?
Only a few mesh formats support time right now. See the main readme for an example with XDMF.
Writing the current MSH 4.1 is really hard #332 (et seq.), but I do have some old FreeFEM code for writing unsteady data in the legacy Gmsh MSH 2.2 format which might reasonably be translated to Python.
https://gitlab.com/gdmcbain/freefem-tricks/-/blob/master/writemsh/writemsh.edp#L105
The idea there was that the (non-adaptive) mesh was written with the zeroth time-step in one file and then subsequent snapshots were written to separate files. These can all be read together at once by Gmsh for visualization and postprocessing (something like gmsh unsteady-*.msh
, if care is taken that the file-names order lexicographically and chronologically the same).
Formerly I used this a lot but after discovering meshio.xdmf.TimeSeriesWriter
, I haven't looked back.
Hi! You can keep everything in one file - look here for an example (MSH 2.2).
A time ago, I wrote in python a writer for this. It was based on meshio actually, so it should be relatively easy to incorporate. I'll try to dig for it.