Skip to content

Commit 86dbb32

Browse files
authored
Merge pull request #300 from boutproject/to_restart-int-as-intc
Fix int types when writing restart files
2 parents 4670160 + af8dc99 commit 86dbb32

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

xbout/utils.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -492,21 +492,23 @@ def _split_into_restarts(ds, variables, savepath, nxpe, nype, tind, prefix, over
492492
if isinstance(value, str):
493493
# Write strings as byte-strings so BOUT++ can read them
494494
value = value.encode()
495+
elif isinstance(value, int):
496+
value = np.intc(value)
495497

496498
restart_ds[v] = value
497499

498500
# These variables need to be altered, because they depend on the number of
499501
# files and/or the rank of this file.
500-
restart_ds["MXSUB"] = mxsub
501-
restart_ds["MYSUB"] = mysub
502-
restart_ds["NXPE"] = nxpe
503-
restart_ds["NYPE"] = nype
504-
restart_ds["PE_XIND"] = xproc
505-
restart_ds["PE_YIND"] = yproc
506-
restart_ds["hist_hi"] = hist_hi
507-
restart_ds["PE_XIND"] = xproc
508-
restart_ds["PE_YIND"] = yproc
509-
restart_ds["MYPE"] = yproc * nxpe + xproc
502+
restart_ds["MXSUB"] = np.intc(mxsub)
503+
restart_ds["MYSUB"] = np.intc(mysub)
504+
restart_ds["NXPE"] = np.intc(nxpe)
505+
restart_ds["NYPE"] = np.intc(nype)
506+
restart_ds["PE_XIND"] = np.intc(xproc)
507+
restart_ds["PE_YIND"] = np.intc(yproc)
508+
restart_ds["hist_hi"] = np.intc(hist_hi)
509+
restart_ds["PE_XIND"] = np.intc(xproc)
510+
restart_ds["PE_YIND"] = np.intc(yproc)
511+
restart_ds["MYPE"] = np.intc(yproc * nxpe + xproc)
510512

511513
# tt is the simulation time where the restart happens
512514
restart_ds["tt"] = tt

0 commit comments

Comments
 (0)