Convergence of Linear Advection

Convergence of Linear Advection#

Assessing the convergence of the linear advection solver is straightforward, since linear advection should not alter the initial profile’s shape, just simply shift it by a velocity \(u\).

Therefore if we use periodic boundary conditions and advect for a full period, then the solution should be the same as the initial conditions–any deviation is numerical error.

Important

When measuring convergence, it is important to use smooth initial conditions, to ensure that the initial conditions themselves are resolved and the limiters do not kick in severely.

For that reason, here we use the sine initial conditions.

from ppmpy.advection import advection, sine
u = 1.0
C = 0.5

We’ll run for several resolutions and compute the norm of the error–the different between the solution and the initial conditions.

for nx in [32, 64, 128, 256, 512]:
    g, a = advection(nx, u, C, init_cond=sine)
    err = g.norm(a - sine(g))
    print(f"nx = {nx:3d}; error = {err:9.5g}")
nx =  32; error = 0.0049829
nx =  64; error = 0.0012803
nx = 128; error = 0.0003151
nx = 256; error = 7.6614e-05
nx = 512; error = 1.8475e-05

Here we see that as we double the resolution, the error goes down by approximately a factor of four, demonstrating second-order convergence.