boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
21 stars 8 forks source link

Restart created from dmp* files not working #256

Closed jonycastagna closed 1 year ago

jonycastagna commented 1 year ago

Hi, I tried to use the restart routine on the branch next-periodicx and Hasegawa Wakatani test case but it is not working. Here my procedure: 1) run hasegawa wakatani with 1 CPU only: 4 ./hasegawa-wakatani Works, with file generated in data folder 2) restart as follows: ./hasegawa-wakatani restart Works 3) create a restart file from dmp* files as follows: *import xbout df = xbout.open_boutdataset("./data/BOUT.dmp..nc") df.bout.to_restart(tind=1)**

Works, a restart files is generated in the hasegawa-wakatani folder and copied into data/ (this overwrite current restart file). 4) restart as follows: ./hasegawa-wakatani restart fails with message: Loading restart file: data/BOUT.restart.nc Using NetCDF4 format for file 'data/BOUT.restart.nc' terminate called after throwing an instance of 'netCDF::exceptions::NcChar' what(): NetCDF: Attempt to convert between text & numbers file: ncVar.cpp line:1594 [DLHRT0110:19468] Process received signal [DLHRT0110:19468] Signal: Aborted (6) [DLHRT0110:19468] Signal code: (-6) [DLHRT0110:19468] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x43090)[0x7fd6547fb090] [DLHRT0110:19468] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7fd6547fb00b] [DLHRT0110:19468] [ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7fd6547da859] [DLHRT0110:19468] [ 3] /lib/x86_64-linux-gnu/libstdc++.so.6(+0x9e911)[0x7fd654a65911] [DLHRT0110:19468] [ 4] /lib/x86_64-linux-gnu/libstdc++.so.6(+0xaa38c)[0x7fd654a7138c] [DLHRT0110:19468] [ 5] /lib/x86_64-linux-gnu/libstdc++.so.6(+0xaa3f7)[0x7fd654a713f7] [DLHRT0110:19468] [ 6] /lib/x86_64-linux-gnu/libstdc++.so.6(+0xaa6a9)[0x7fd654a716a9] [DLHRT0110:19468] [ 7] /lib/x86_64-linux-gnu/libnetcdf_c++4.so.1(+0x22a6b)[0x7fd65476ea6b] [DLHRT0110:19468] [ 8] /lib/x86_64-linux-gnu/libnetcdf_c++4.so.1(_ZNK6netCDF5NcVar6getVarERKSt6vectorImSaImEES5_Pc+0xa8)[0x7fd6547866e8] [DLHRT0110:19468] [ 9] /home/jcastagna/projects/Turbulence_with_Style/PhaseII_FARSCAPE2/codes/BOUT-dev/build_debug/lib/libbout++.so.5.0.0(_ZN5Ncxx44readEPcPKci+0x236)[0x7fd655715576] [DLHRT0110:19468] [10] /home/jcastagna/projects/Turbulence_with_Style/PhaseII_FARSCAPE2/codes/BOUT-dev/build_debug/lib/libbout++.so.5.0.0(_ZN8Datafile4readEv+0xa3d)[0x7fd6556f2927] [DLHRT0110:19468] [11] /home/jcastagna/projects/Turbulence_with_Style/PhaseII_FARSCAPE2/codes/BOUT-dev/build_debug/lib/libbout++.so.5.0.0(_ZN12PhysicsModel8postInitEb+0x2fb)[0x7fd655a84755] [DLHRT0110:19468] [12] /home/jcastagna/projects/Turbulence_with_Style/PhaseII_FARSCAPE2/codes/BOUT-dev/build_debug/lib/libbout++.so.5.0.0(_ZN12PhysicsModel10initialiseEP6Solver+0x132)[0x7fd655abaf00] [DLHRT0110:19468] [13] /home/jcastagna/projects/Turbulence_with_Style/PhaseII_FARSCAPE2/codes/BOUT-dev/build_debug/lib/libbout++.so.5.0.0(_ZN6Solver8setModelEP12PhysicsModel+0xb9)[0x7fd655aafdad] [DLHRT0110:19468] [14] ./hasegawa-wakatani(+0x5ae0c)[0x55f8d6a23e0c] [DLHRT0110:19468] [15] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fd6547dc083] [DLHRT0110:19468] [16] ./hasegawa-wakatani(+0x5ac8e)[0x55f8d6a23c8e] [DLHRT0110:19468] End of error message Aborted

Any hint?

johnomotani commented 1 year ago

What version of xbout are you using? I've just tested using output files from the hasegawa-wakatani example on next-periodicx and to_restart() works fine for me using either either the 0.3.3 release or the master branch.

Edited to add: I was using xarray-2022.6.0 and netCDF4-1.6.0 - those might also be relevant.

jonycastagna commented 1 year ago

Hi @johnomotani, I got:

import xbout as xb
print(xb.__version__)

0.3.4.dev26+gc5a8eda The version of xarray is 2022.6.0 and netCDF4 1.5.3

johnomotani commented 1 year ago

I get the same error with netCD4-1.5.3 - can you try upgrading?

jonycastagna commented 1 year ago

I updated to netCDF4 1.6.2 but I get same issue

johnomotani commented 1 year ago

I think I've found the real issue now. @jonycastagna could you try the branch from #259 and see if that fixes the issue for you? Thanks!

jonycastagna commented 1 year ago

Yep, it works! Thanks a lot @johnomotani