boutproject / BOUT-dev

BOUT++: Plasma fluid finite-difference simulation code in curvilinear coordinate systems
http://boutproject.github.io/
GNU Lesser General Public License v3.0
186 stars 95 forks source link

More grid file provenance tracking #2591

Open johnomotani opened 2 years ago

johnomotani commented 2 years ago

We currently save a fair amount of information about hypnotoad, when running from a grid file https://github.com/boutproject/BOUT-dev/blob/ab69d52f362dcaaddb22f3bd3b16aa7bab924d84/src/mesh/impls/bout/boutmesh.cxx#L2685-L2713

It would be nice to add a bit more! Hypnotoad now saves the complete input as hypnotoad_inputs_yaml and the eqdsk file used as hypnotoad_input_geqdsk_file_contents. With those along with the hypnotoad version information already saved, we should be able to reproduce a grid file just from a BOUT.dmp.*.nc! I have done this when grabbing the inputs from an existing grid file (to save hunting down the input file and eqdsk), and it's easy! See https://github.com/boutproject/hypnotoad/blob/master/hypnotoad/scripts/hypnotoad_recreate_inputs.py - we could add a similar script to hypnotoad to extract inputs from a BOUT++ dump file.

I'm mostly opening this as a reminder to myself, but if anyone wants to beat me to it, I won't object!

johnomotani commented 2 years ago

It looks like this would be a pain to do in v4, because we cannot read str type variables with the old I/O classes (only str attributes). It should (I think?) be easier in v5 because the new OptionsNetCDF handles str variables (need to check what happens with attributes vs. variables though).