Scalar advection problem in conservative form with variable velocity field. There are four Riemann solvers that can be tried out here, all described in LeVeque (Cambridge Press, 2002)
Two examples are avaible. In Example 1, the velocity field $u(x)$ is positive. In Example 2, the velocity field changes sign. Both velocity fields have non-zero divergence.
Run code in serial mode (will work, even if code is compiled with MPI)
In [ ]:
!swirlcons --user:example=2 --user:rp-solver=4
Or, run code in parallel mode (command may need to be customized, depending your on MPI installation.)
In [ ]:
#!mpirun -n 4 swirlcons
Create PNG files for web-browser viewing, or animation.
In [ ]:
%run make_plots.py
View PNG files in browser, using URL above, or create an animation of all PNG files, using code below.
In [ ]:
%pylab inline
In [ ]:
import glob
from matplotlib import image
from clawpack.visclaw.JSAnimation import IPython_display
from matplotlib import animation
figno = 0
fname = '_plots/*fig' + str(figno) + '.png'
filenames=sorted(glob.glob(fname))
fig = plt.figure()
im = plt.imshow(image.imread(filenames[0]))
def init():
im.set_data(image.imread(filenames[0]))
return im,
def animate(i):
image_i=image.imread(filenames[i])
im.set_data(image_i)
return im,
animation.FuncAnimation(fig, animate, init_func=init,
frames=len(filenames), interval=500, blit=True)