!swirl   

"""
Explanation: Swirl

Scalar advection problem with swirling velocity field.

Run code in serial mode (will work, even if code is compiled with MPI)
End of explanation
"""


!mpirun -n 4 swirl

"""
Explanation: Or, run code in parallel mode (command may need to be customized, depending your on MPI installation.)
End of explanation
"""


%run make_plots.py

"""
Explanation: Create PNG files for web-browser viewing, or animation.
End of explanation
"""


%pylab inline

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)

"""
Explanation: View PNG files in browser, using URL above, or create an animation of all PNG files, using code below.
End of explanation
"""


