boutproject / boutdata

GNU Lesser General Public License v3.0
0 stars 2 forks source link

Copying old metadata to new resized file #77

Open mredenti opened 2 years ago

mredenti commented 2 years ago

Copying the metadata from a BOUT.restart.*.nc file to the resized BOUT.restart.*.nc file is a bad idea. I mean, you are resizing the grid and therefore parameters like "nx" (and others) should be obviously updated to match the size of the new grid. https://github.com/boutproject/boutdata/blob/1cb6d08f8515c1541b937fadb65ffeccc5a4edc1/boutdata/restart.py#L219

johnomotani commented 2 years ago

Yes, true. I believe it's not an issue in practice as only the evolving variables (which are probably Field3Ds) are actually read from the restart files by BOUT++. PR to improve this would be welcome though!

mredenti commented 2 years ago

Yes, true. I believe it's not an issue in practice as only the evolving variables (which are probably Field3Ds) are actually read from the restart files by BOUT++. PR to improve this would be welcome though!

I will have a go at it

mredenti commented 2 years ago

Yes, true. I believe it's not an issue in practice as only the evolving variables (which are probably Field3Ds) are actually read from the restart files by BOUT++. PR to improve this would be welcome though!

I don't think that is actually the case. If you look into in the reference code below you will see that BOUT++ reads other parameters from the BOUT.restart.*.nc files.
https://github.com/boutproject/BOUT-dev/blob/ab69d52f362dcaaddb22f3bd3b16aa7bab924d84/src/fileio/datafile.cxx#L1093-L1118

I know this for a fact: when creating restart files with the boutdata.restart.create much of the metadata is missing (for example "MXG" - # guard cells in the x-direction). Older version of BOUT++ (version v4.3.0 for example) did not read these parameters but the current version of BOUT++ does and won't restart the simulation if restarting from a file created with boutdata.restart.create

johnomotani commented 2 years ago

Ah, in that case you're right and the metadata definitely needs updating!