Comparison of fixed-step Euler and variable-step Euler:
fixed Euler:
dE=.096 with 1540 steps (dt=0.013) dE=.00941 with 10002 steps (dt=.002)
variable Euler:
dE=.089 with 440 steps dE=.0098 with 2202 steps
Computation Time without and with time-step control
Euler Scheme with time-step control: without and with extrapolation
Convergence Tests of Variable-Step Extrapolated Runge-Kutta Scheme
In the homework a fourth-order Runge-Kutta scheme was applied to the Duffing oscillator. The initial conditions were chosen such that the particle barely made it across the barrier in the center, which makes the dynamics very sensitive to the accurace of the code.
Here the time-step control was not via determining the optimal time step, but rather just increasing/decreasing the time step by a fixed factor whenever the difference between solutions with different resolutions became to small/large.
Solution u for tol=0.025
Solution u for tol=1e-11
Time dependence of the total energy.
Time dependence of the time steps.
Difference between approximations to u for delta t and delta t/2.
Dependence of change in total energy in the oscillator on the tolerance applied in the choice of time step. The energy change and the tolerance are linearly related.
The difference in the value of the dependent variable u between two approximations using timesteps delta t and delta t/2 as a function of the tolerance. The accuracy of the solution and the tolerance are linearly related.
The dependence of the energy change on the time step shows the 5th-order accuracy.
The computational effort grows with the fifth-power of the accurace (change in energy).