Skip to content

Commit

Permalink
A few minor improvements to pyclaw notebooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
ketch committed Nov 19, 2023
1 parent b7bc4b2 commit 219daee
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
22 changes: 18 additions & 4 deletions notebooks/pyclaw/Stegotons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Stegotons: solitary waves arising in non-dispersive periodic media\n",
"# Stegotons: solitary waves arising in non-dispersive periodic media"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Author: [David I. Ketcheson](http:https://www.davidketcheson.info/) \n",
"License: CC-BY"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A fascinating new class of solitary waves was discovered in [a 2003 paper by R.J. LeVeque and D. Yong](http:https://faculty.washington.edu/rjl/pubs/solitary/40815.pdf). Solitary waves usually appear as solutions of nonlinear dispersive wave equations, like the KdV or NLS equations. But the waves discovered by LeVeque and Yong arise in a system of nonlinear wave equations **with no dispersion!** The nonlinear elasticity equations they investigated are:\n",
"\n",
"\\begin{align}\n",
Expand All @@ -14,7 +28,7 @@
"\n",
"They took the density $\\rho(x)$ and bulk modulus $K(x)$ to be periodic functions and the stress strain relation $\\sigma(\\epsilon,x)$ nonlinear (they used an exponential function, but any nonlinear function will work).\n",
"\n",
"If $\\rho$ and $K$ are chosen so that the impedance $Z = \\sqrt{\\rho K}$ varies in space, then waves undergo reflection on the fine scale. Remarkably, the effect of these reflections is an effective behavior that mimics dispersion -- as [predicted already by Santosa & Symes in 1993](http:https://epubs.siam.org/doi/abs/10.1137/0151049).\n",
"If $\\rho$ and $K$ are chosen so that the impedance $Z = \\sqrt{\\rho K}$ varies in space, then waves undergo reflection on the fine scale. Remarkably, the effect of these reflections is an effective behavior that mimics dispersion -- as [predicted already by Santosa & Symes in 1991](http:https://epubs.siam.org/doi/abs/10.1137/0151049).\n",
"\n",
"Here we reproduce some of their original experiments in PyClaw. If you're interested in the simulations, all of the code is provided here and you can run it yourself. If you're only interested in the results, feel free to just skip over the code.\n",
"\n",
Expand Down Expand Up @@ -92,7 +106,7 @@
"plt.figure(figsize=(10,6))\n",
"plt.plot(xc,state.q[0,:])\n",
"plt.xlim(460,540)\n",
"plt.title('Strain at t=0')"
"plt.title('Strain at t=0');"
]
},
{
Expand Down Expand Up @@ -441,5 +455,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
18 changes: 12 additions & 6 deletions notebooks/pyclaw/beach.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@
" surface = np.maximum(b,h+b)\n",
"\n",
" x, y = frame.state.grid.p_centers \n",
" save_plots = True\n",
" slice = 1\n",
" #line, = ax1.plot(x[:,0],surface[:,slice],'-k',linewidth=3)\n",
" fill = ax1.fill_between(x[:,0],b[:,slice],surface[:,slice],facecolor='blue')\n",
Expand Down Expand Up @@ -214,8 +213,15 @@
"\n",
" anim = animation.FuncAnimation(fig, fplot, frames=len(claw.frames), interval=100, repeat=False)\n",
" plt.close()\n",
" return HTML(anim.to_jshtml())\n",
"\n",
" return HTML(anim.to_jshtml())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plot_waves(claw)"
]
},
Expand Down Expand Up @@ -250,7 +256,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -264,7 +270,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.11.4"
},
"toc": {
"nav_menu": {},
Expand All @@ -278,5 +284,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}
10 changes: 6 additions & 4 deletions notebooks/pyclaw/pyclaw_geometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
"metadata": {},
"outputs": [],
"source": [
"grid.plot(num_ghost=2);"
"grid.plot(num_ghost=4);"
]
},
{
Expand Down Expand Up @@ -355,6 +355,8 @@
"outputs": [],
"source": [
"x.upper = 1.\n",
"x.num_cells = 30\n",
"y.num_cells = 30\n",
"\n",
"grid.mapc2p = square2circle\n",
"grid.plot(num_ghost=1);"
Expand All @@ -363,7 +365,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -377,7 +379,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.11.4"
},
"toc": {
"nav_menu": {},
Expand All @@ -391,5 +393,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}

0 comments on commit 219daee

Please sign in to comment.