Skip to content

Number of steps for given dt - rounding error? #47

@danielru

Description

@danielru

In runconvergence.py in acoustic_1d_imex:

  • run simulation until Tend=1.0 with Nsteps = 64, i.e. dt = 0.015625. In this case, the output from the last step reads 2015-12-02 13:42:04,252 - Process 0 on time 0.984375 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 1 -- Residual: 1.87173732e-03 2015-12-02 13:42:04,260 - Process 0 on time 0.984375 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 2 -- Residual: 3.94070291e-05 2015-12-02 13:42:04,270 - Process 0 on time 0.984375 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 3 -- Residual: 8.01802483e-07 2015-12-02 13:42:04,279 - Process 0 on time 0.984375 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 4 -- Residual: 1.57838695e-08. The time matches Tend-dt = 1.0 - 0.015625 = 0.984375
  • when chaning to Nsteps=65, the output from the last step becomes: 2015-12-02 13:47:50,509 - Process 0 on time 1.000000 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 1 -- Residual: 1.80955876e-03 2015-12-02 13:47:50,518 - Process 0 on time 1.000000 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 2 -- Residual: 3.72419523e-05 2015-12-02 13:47:50,527 - Process 0 on time 1.000000 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 3 -- Residual: 7.40115315e-07 2015-12-02 13:47:50,536 - Process 0 on time 1.000000 at stage IT_FINE_SWEEP: Level: L0 -- Iteration: 4 -- Residual: 1.42181506e-08 and the plotted solution suddenly deviates significantly (i.e. visibly in the generated plot) from the exact solution. For some reason, the final time is now exactly Tend instead of Tend-dt as in the case above!

The only difference in parameters in both simulations is the increase in time steps from 64 to 65.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions