{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Riemann interactive\n", "\n", "In this notebook, we show interactive solutions of two Riemann problems for shallow water equations and acoustics. The user can interactively modify the phase planes and x-t planes and see its corresponding solutions. The code to produce these apps uses the mpld3 library, and it can be found on the clawpack folder riemann/riemann_interactive.py. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First we need to load the mpld3 and numpy libraries as well as the riemann_interactive code." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import mpld3\n", "import numpy as np\n", "from clawpack.riemann import riemann_interactive" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Shallow water equations\n", "In this section we show the interactive riemann solution of the exact solver for the shallow water equations. We first define the initial left and right state, the $g$ paramter and the plot range, then we call our riemann interactive plotting and display it. The commented line \"mpld3.save_html\" can be uncommented to save the output as html. On the app feel free to drag and drop the $q_l$ and $q_r$ states in the phase plane. The time can also be adjusted by dragging up and down the black dot in the horizontal time bar in the $x-t$ plane. " ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "
\n", "" ], "text/plain": [ "