Restart breaking as current time not a multiple of dt

I am running a workflow with PyFR. I run a simulation to blow away an initial transient and then I want to run an ensemble of simulations with slightly different settings on that developed solution.

Unfortunately, my restart fails with

ValueError: Plugin start times must be multiples of dt

Upon closer inspection, this is probably because my current time, tcurr, is indeed not a multiple of dt. When manually looking through the pyfrs file I see:

[solver-time-integrator]
tcurr = 200.00000000001123

Is there a clean way to set it to an arbitrary value? I tried just editing this to be 200 or 0, but then I end up with a hdf5 error. For my purposes, I would be happy to change this to 0 and pretend it’s a new run - do I need to write my own h5py processor for this?

This error should not usually occur. Specifically,

Attempts to account for this by comparing with a tolerance that is defined in terms of the minimum time step:

which should be sufficient to avoid this eventuality.

Regards, Freddie.

Right, so my problem was clearly caused by the default value of self.dtmin. I built my use case from the 2D cylinder tutorial and dt-min was not defined in INI file. After adding dt-min to INI it now seems to restart properly.

But it would actually be more practical for me to reset the time back to 0 on restart? Is there an easy way to do it in PyFR/pyfrs files? I suspect I need to create aa batch HDF5 editor, which overwrites this value.

You would want to use h5py to modify the stats record. Only thing you need to be careful about is ensuring that it is written back as the correct type of string (h5py has several different ways of handling strings).

Regards, Freddie.

1 Like