Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Del Razo Sarmina Mauricio committed Apr 24, 2017
2 parents 5269171 + c0aef8f commit f6aefca
Show file tree
Hide file tree
Showing 11 changed files with 753 additions and 695 deletions.
227 changes: 64 additions & 163 deletions Euler_equations.ipynb

Large diffs are not rendered by default.

149 changes: 100 additions & 49 deletions Pressureless_flow.ipynb
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from exact_solvers import shallow_water\n",
"from collections import namedtuple\n",
"from utils import riemann_tools\n",
"from ipywidgets import interact, widgets\n",
"State = namedtuple('State', shallow_water.conserved_variables)\n",
"Primitive_State = namedtuple('PrimState', shallow_water.primitive_variables)\n",
"plt.style.use('seaborn-talk')"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -53,6 +33,34 @@
"collapsed": false
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from exact_solvers import shallow_water\n",
"from collections import namedtuple\n",
"from utils import riemann_tools\n",
"from ipywidgets import interact, widgets\n",
"State = namedtuple('State', shallow_water.conserved_variables)\n",
"Primitive_State = namedtuple('PrimState', shallow_water.primitive_variables)\n",
"plt.style.use('seaborn-talk')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from ipywidgets import interact # for interactive widgets\n",
"#from utils.snapshot_widgets import interact # for static figure that can be viewed online"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def connect_states(h_l=1.,u_l=-1.,h_r=1.,u_r=1.,logg=0.,plot_unphysical=True):\n",
" g = 10.**logg\n",
Expand Down Expand Up @@ -186,9 +194,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"q_l = State(Depth = 3.,\n",
Expand All @@ -212,9 +218,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"q_l = State(Depth = 3.,\n",
Expand All @@ -235,9 +239,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"q_l = State(Depth = 3.,\n",
Expand All @@ -252,7 +254,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Keep a close eye on the scale of the x-axis in the phase plane plot, and notice again that s $g \\to 0$ the hugoniot loci become nearly parallel (horizontal in the $h-u$ plane). This means that their intersection occurs at a very large value of $h$, so the middle state depth goes to $\\infty$ as $g\\to 0$. Meanwhile, the speed of both shocks approaches a single value, so the region occupied by the middle state gets ever narrower. In the limit, the solution for the depth involves a delta function."
"Keep a close eye on the scale of the x-axis in the phase plane plot, and notice again that as $g \\to 0$ the hugoniot loci become nearly parallel (horizontal in the $h-u$ plane). This means that their intersection occurs at a very large value of $h$, so the middle state depth goes to $\\infty$ as $g\\to 0$. Meanwhile, the speed of both shocks approaches a single value, so the region occupied by the middle state gets ever narrower. In the limit, the solution for the depth involves a delta function."
]
},
{
Expand All @@ -265,9 +267,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"q_l = State(Depth = 1.,\n",
Expand All @@ -282,31 +282,31 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"What's going on here, physically, when $g$ is very small? At the interface, water is colliding. With the gravitational pressure term present, this leads to the formation of outgoing shock waves that redistribute water away from the interface. But without that term, there is no force to equilibrate the depth and each parcel of water just flows with its initial velocity, until eventually it collides with water of a different velocity. Water from both sides accumulates at the interface, leading to a delta function.\n",
"What's going on here, physically, when $g$ is very small? At the interface, water is colliding. With the gravitational pressure term present, this leads to the formation of outgoing shock waves that redistribute water away from the interface. But without that term, there is no force to equilibrate the depth and each parcel of water just flows with its initial velocity, until eventually it collides with water of a different velocity. Water from both sides accumulates at the interface, leading to what is known as a *delta shock*.\n",
"\n",
"If you drag the time slider for different fixed values of $g$ in the last example, you'll see that since $g$ is still nonzero there are two shock waves and the near-delta-function region expands with time, but the rate of this expansion is smaller for smaller values of $g$. For very small values, the expansion cannot be resolved on the scale of the plots above. Indeed, the width of the line plotted there significantly exaggerates the width of this region when $g$ is very small.\n",
"If you drag the time slider for different fixed values of $g$ in the last example, you'll see that since $g$ is still nonzero there are two shock waves and the near-delta-function region expands with time, but the rate of this expansion is smaller for smaller values of $g$. For very small values, the region between the shocks cannot be resolved on the scale of the plots above. Indeed, the width of the line plotted there significantly exaggerates the width of this region when $g$ is very small.\n",
"\n",
"There are two import details we haven't yet explained: first, the interface is moving; second the delta function is growing in time. Movement of the interface is necessary in order to conserve momentum; since the water from the left is arriving with a different speed than that from the right, if the interface were stationary then momentum would not be conserved. Growth of the delta function is of course necessary in order to conserve mass.\n",
"There are two import details we haven't yet explained: first, the delta shock is moving; second, it is growing in time. Movement of the delta shock is necessary in order to conserve momentum; since the water from the left is arriving with a different speed than that from the right, if the delta shock were stationary then momentum would not be conserved. Growth of the delta shock is necessary in order to conserve mass.\n",
"\n",
"Let $h_\\delta$ denote the mass of the delta function for depth. How must $h_\\delta$ grow in order to conserve mass? Let $\\hat{u}$ denote the velocity of the interface, with $u_l \\ge \\hat{u} \\ge u_r$. Then over a unit time interval, a quantity $h_l(u_l-\\hat{u})$ of water arrives from the left, while $h_r(\\hat{u}-u_r)$ arrives from the right. Thus we must have\n",
"Let $h_\\delta$ denote the mass of the delta shock. How must $h_\\delta$ grow in order to conserve mass? Let $\\hat{u}$ denote the velocity of the delta shock, with $u_l \\ge \\hat{u} \\ge u_r$. Then over a unit time interval, a quantity $h_l(u_l-\\hat{u})$ of water arrives from the left, while $h_r(\\hat{u}-u_r)$ arrives from the right. Thus we must have\n",
"\n",
"$$\n",
" h_\\delta(t) = t \\left( h_l u_l - h_r u_r + \\hat{u}(h_r-h_l) \\right).\n",
"$$\n",
"\n",
"At what speed must the water in the delta function move in order to conserve momentum? The rate of momentum flowing into the delta function from the left is $h_l u_l (u_l-\\hat{u})$ and the rate of momentum flowing into the delta function from the right is $h_r u_r (\\hat{u}-u_r)$, so we must have\n",
"At what speed must the water in the delta shock move in order to conserve momentum? The rate of momentum flowing into the delta shock from the left is $h_l u_l (u_l-\\hat{u})$ and the rate of momentum flowing into the delta shock from the right is $h_r u_r (\\hat{u}-u_r)$, so we must have\n",
"\n",
"$$\n",
" h_\\delta(t) \\hat{u} = t \\left( h_l u_l^2 - h_r u_r^2 + \\hat{u}(h_r u_r - h_l u_l \\right).\n",
"$$\n",
"\n",
"Combining these two conservation conditions, we find the speed of the interface:\n",
"Combining these two conservation conditions, we find the speed of the delta shock:\n",
"\n",
"$$\n",
" \\hat{u} = \\frac{\\sqrt{h_l}u_l + \\sqrt{h_r}{u_r}}{\\sqrt{h_l}+\\sqrt{h_r}}\n",
"$$\n",
"\n",
"and the rate of growth of the delta function:\n",
"and its rate of growth:\n",
"\n",
"$$\n",
" h_\\delta(t) = t \\sqrt{h_l h_r}(u_l - u_r).\n",
Expand All @@ -319,34 +319,85 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exercise\n",
"In the example below, the initial velocity is zero for both states. Observe that multiplying the value of $g$ by a factor $\\alpha$ is equivalent to rescaling all the velocities by $\\sqrt{\\alpha}$. Prove that this scaling must hold for any Riemann solution of this system when $u_l = u_r = 0$."
"## High-speed flows\n",
"Above we have considered the limit as gravity tends to zero in the shallow water equations (or equivalently as the sound speed goes to zero in the isothermal flow equations). As with any mathematical analysis involving a \"small\" parameter, one should ask \"small relative to what\"?\n",
"\n",
"By non-dimensionalizing the shallow water equations, one obtains the system\n",
"\n",
"\\begin{align}\n",
" h_t + (hu)_x & = 0 \\\\\n",
" (hu)_t + \\left(hu^2 + \\frac{1}{2F^2}h^2\\right)_x & = 0.\n",
"\\end{align}\n",
"\n",
"where\n",
"\n",
"$$\n",
" F = \\frac{U}{\\sqrt{gH}}\n",
"$$\n",
"\n",
"is the ratio of a typical velocity $U$ to the speed of gravity waves with typical depth $H$. From this form we can see that in fact we have studied the *large Froude number limit* of the shallow water equations, and we should expect to see something similar to a delta shock form whenever the Froude number is large. We can approach this limit in ways other than taking $g \\to 0$. For instance, if the velocity is very large and $\\sqrt{gh}=O(1)$, then we obtain (approximately) delta-shock solutions like those seen above. Here is an example."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"q_l = State(Depth = 3.,\n",
" Momentum = 0.)\n",
"q_l = State(Depth = 1.,\n",
" Momentum = 100.)\n",
"q_r = State(Depth = 1.,\n",
" Momentum = 0.)\n",
"\n",
"plot_riemann_SW(q_l,q_r)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Similarly, a non-dimensionalization of the isothermal equations shows that the pressureless flow equations correspond to the large Mach number limit (i.e. when the typical flow velocity is much greater than the sound speed)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## References\n",
"Delta shocks arising in pressureless flows have been studied by many authors; see Section 16.3 of <cite data-cite=\"fvmhp\"><a href=\"riemann.html#fvmhp\">(LeVeque, 2002)<a></cite> and references therein, as well as <cite data-cite=\"leveque2004dynamics\"><a href=\"riemann.html#leveque2004dynamics\">(LeVeque, 2004)<a></cite>. For an examination of the large Froude number limit in shallow water flow, see <cite data-cite=\"edwards2008non\"><a href=\"riemann.html#fvmhp\">(Edwards et. al., 2008)<a></cite>."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exercises\n",
"\n",
"(1) In the example below, the initial velocity is zero for both states. Observe that multiplying the value of $g$ by a factor $\\alpha$ is equivalent to rescaling all the velocities by $\\sqrt{\\alpha}$. Prove that this scaling must hold for any Riemann solution of this system when $u_l = u_r = 0$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
"source": [
"q_l = State(Depth = 3.,\n",
" Momentum = 0.)\n",
"q_r = State(Depth = 1.,\n",
" Momentum = 0.)\n",
"\n",
"plot_riemann_SW(q_l,q_r)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"(2) Here we have considered the large Froude number limit. What happens in the low Froude number limit? What form do the integral curves and Hugoniot loci take? What happens to the hyperbolic structure of the system? To the solution of the Riemann problem? You may wish to modify the examples above to allow for much larger values of $g$ in order to check your answers."
]
}
],
"metadata": {
Expand All @@ -365,7 +416,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.13"
"version": "2.7.12"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion Shallow_water.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@
"editable": true
},
"source": [
"Near the point of intersection, the curves are very close; indeed, they must be tangent at this point since their direction is parallel to the corresponding eigenvector there. Far from this point they diverge; for small depths they must diverge greatly, since the Hugoniot locus never reaches $h=0$ at any finite depth."
"Near the point of intersection, the curves are very close; indeed, they must be tangent at this point since their direction is parallel to the corresponding eigenvector there. Far from this point they diverge; for small depths they must diverge greatly, since the Hugoniot locus never reaches $h=0$ at any finite velocity."
]
},
{
Expand Down
Loading

0 comments on commit f6aefca

Please sign in to comment.