meshio icon indicating copy to clipboard operation
meshio copied to clipboard

Time series with Gmsh .msh format

Open mrkwjc opened this issue 3 years ago • 5 comments

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

mrkwjc avatar Apr 14 '21 18:04 mrkwjc

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.

nschloe avatar Apr 14 '21 18:04 nschloe

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?

mrkwjc avatar Apr 14 '21 19:04 mrkwjc

Only a few mesh formats support time right now. See the main readme for an example with XDMF.

nschloe avatar Apr 14 '21 20:04 nschloe

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.

gdmcbain avatar Apr 14 '21 23:04 gdmcbain

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.

mrkwjc avatar Apr 15 '21 10:04 mrkwjc