Hi,
I have been working with fenicsx 0.6.0. I am trying to save state variables every 100 timesteps, which helps me restarting the simulation from last saved timestep when my simulation crashes - checkpointing in other terms I guess. I am able to do that in serial code using these functions:
def save_state(step, u, un, filename="./stateBackup/simulation_state.npz"):
# Convert to numpy arrays
u_array = u.vector[:]
un_array = un.vector[:]
# Save using np.savez
np.savez(filename, step=step, u=u_array, un=un_array)
def load_state(u, un, filename="./stateBackup/simulation_state.npz"):
# Load the data
with np.load(filename, allow_pickle=False) as data:
step = data['step']
u.vector.setArray(data['u'])
un.vector.setArray(data['un'])
return step
But while working in parallel, I am facing issues of dof mismatch after restarting with the saved state file. Any leads on how to work with this in parallel environment would be super helpful. Thanks in advance.