Skip to content

Commit

Permalink
Fix creating restart files for BOUT++ 5
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Feb 16, 2024
1 parent a043a2b commit ae2b2d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions boutdata/restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@ def create(
# This attribute results in the correct (x,y,z) dimension labels
data_slice.attributes["bout_type"] = "Field3D"

# The presence of `time_dimension` triggers BOUT++ to
# save field with a time dimension, which breaks
# subsequent restart files. `current_time_index` just
# doesn't make sense for restart files
for bad_attr in ["current_time_index", "time_dimension"]:
if bad_attr in data.attributes:
data_slice.attributes.pop(bad_attr)

outfile.write(var, data_slice)

infile.close()
Expand Down

0 comments on commit ae2b2d7

Please sign in to comment.