When I try to dump and restore a simulation in Basilisk, I encounter two problems:
First, I start a new simulation and dump the simulation with function dump() provided by basilisk in output.h . Then, I use the dumped file at step i=100 to restart the simulation with function restore(). The source code is attached in this post.
By default, these information are dumped (Figure 1). the names of the dumped scalars are ‘flag’ ‘size’ ‘f’ ‘u.x’ ‘u.y’
‘g.x’ ‘g.y’ ‘rhov’.
I restart the simulation with dumped file at i=100 and dump the smulation at i=101 (Figure 2). Then, I compare these two files. I can see the advance of i and t. But when I compare the scalars, ‘size’ ‘f’ ‘u.x’ ‘u.y’ ‘g.x’ ‘g.y’ and ‘flag’ are exactly the same. Scalar ‘rhov’ is different, but if I only compared ‘rhov’ at leaf cells, they are the same.
Then, I check the order of the event:
For a new simulation (Figure 3), after event init(), there will be a calculation and then simulation enters next time step i=1. However, for a restored simulation (Figure 4), after event init(), no calculation will be executed and it directly enters the next step i=101. I dump file in event snapshot. That may explain why the two dump files are the same except scalar ‘rhov’.
Although
these two dump files are the same, after restoring, their step i and
time t are different. This gives me incorrect time information when I
run a simulation piecewisely. The shift of i can be solved by modifying
the restore() function. For t, I can specify tnext explicitly in the
code to correct it. But I still have a question, why 'rhov' is
different?
Another problem is the large dt after restoring. I output the information of t, dt, dtmax in the event adapt, which is executed at the end of a time step.
When I start a new simulation and run to i=100, we can see dtmax at this time step is 0.0012 (Figure 5).
When I restore the simulation, note that now i=101 because of the offset, dtmax seems not correctly calculated and is unreasonably large (Figure 6). This causes dt exceeding dtmax = 0.0012. The simulation may be unstable.
Although I can walk around by setting small DT when restoring, I still cannot understand why dt is so large even set_dtmax and stability events have been executed (Figure 4).
Best regards,
Canwei Jin