Issues with resuming simulations

14 views
Skip to first unread message

Lautaro Alvear

unread,
Jun 10, 2026, 12:08:10 PMJun 10
to Dedalus Users
Hi Dedalus experts, I was trying to resume a simulation using a similar logic to that of the Internally heated convection example and i was having trouble with the append
file_handler_mode. What I do is

file_read = f"{filesnapshots}/{filesnapshots}_s{resume_index}.h5"
write, initial_timestep = solver.load_state(file_read,allow_missing=True)
if initial_timestep > max_timestep:
    initial_timestep = max_timestep
file_handler_mode = 'append'
snapshots = solver.evaluator.add_file_handler(filesnapshots, sim_dt=dt_writes*tA, max_writes=int(max_time_writes/dt_writes), mode=file_handler_mode)

the line that reads the last snapshot works fine, but in the line that I define the file handler, I get the following error

Traceback (most recent call last):
 File "/home/lalvear/CompressibleNS/Star_stability_v2.py", line 825, in <module>
   slices = solver.evaluator.add_file_handler(filesnapshots, sim_dt=dt_writes*tA, max_writes=int(max_time_writes/dt_writes), mode=file_handler_mode)
 File "/home/lalvear/miniforge3/envs/dedalus3/lib/python3.13/site-packages/dedalus/core/evaluator.py", line 74, in add_file_handler
   return self.add_handler(FileHandler(filename, self.dist, self.vars, **kw))
                           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/lalvear/miniforge3/envs/dedalus3/lib/python3.13/site-packages/dedalus/core/evaluator.py", line 422, in __init__
   max_set = max(set_nums)
ValueError: max() iterable argument is empty


as I understand, Dedalus is trying to to find the last index of the data in filesnapshots, but it is not finding anything in the file. This shouldn't be the case, since when I read the file to load the state of the solver it works just fine. I would be very grateful if someone could help me with this, as this forces me to restart the whole simulation if it gets canceled for any reason.

Best regards,
Lautaro.
Reply all
Reply to author
Forward
0 new messages