Dumping & restoring: time shift and large dt when restoring

138 views
Skip to first unread message

Canwei Jin

unread,
Mar 3, 2023, 7:19:06 AM3/3/23
to basilisk-fr
Hi everyone,

When I try to dump and restore a simulation in Basilisk, I encounter two problems:

  1. there will be a shift in the step i and simulation time t;
  2. dt in first step is very large at restoring
I think what I have posted here is something similar to the problem raised by Anthony in 2019 (https://groups.google.com/g/basilisk-fr/c/Urqu2uiAnq8/m/0EEg5vY7BAAJ). However, this problem has not been fixed yet.

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’.


Shift in step i and time t

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?

Large dt for first time step when restoring

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

figure6.png
figure5.png
monoDemo.c
figure3.png
figure4.png
figure2.png
figure1.png
Reply all
Reply to author
Forward
0 new messages