Skip to content

Commit

Permalink
Merge pull request #22 from EdCaunt/notebook_tidyup
Browse files Browse the repository at this point in the history
examples: tidied up notebooks and examples for paper submission
  • Loading branch information
EdCaunt authored Jun 29, 2023
2 parents 53929f3 + 48180eb commit c26109c
Show file tree
Hide file tree
Showing 24 changed files with 1,317 additions and 1,139 deletions.
87 changes: 64 additions & 23 deletions examples/10_1st_order_acoustic_sinusoid_hill.ipynb

Large diffs are not rendered by default.

133 changes: 45 additions & 88 deletions examples/11_3D_2nd_order_acoustic_parabola.ipynb

Large diffs are not rendered by default.

472 changes: 122 additions & 350 deletions examples/12_elastic_flat_surface.ipynb

Large diffs are not rendered by default.

53 changes: 38 additions & 15 deletions examples/13_vti.ipynb

Large diffs are not rendered by default.

104 changes: 77 additions & 27 deletions examples/14_1st-order_exact_solution_comparison.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
"source": [
"# 1st-order exact solution comparison\n",
"\n",
"In this notebook, we will compare a solution of the 1st-order acoustic wave equation using an immersed boundary to the previously-used exact solution."
"In this notebook, a solution of the 1st-order acoustic wave equation using an immersed boundary is compared to the previously-used exact solution."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "5fb0a3a7",
"metadata": {
"scrolled": false
"scrolled": false,
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
Expand Down Expand Up @@ -205,7 +208,11 @@
"cell_type": "code",
"execution_count": 4,
"id": "6ea21c04",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"name": "stderr",
Expand Down Expand Up @@ -257,7 +264,11 @@
"cell_type": "code",
"execution_count": 6,
"id": "db7e40b9",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"data": {
Expand All @@ -279,7 +290,9 @@
"cel_data_full = np.concatenate((cel_data[-5:-1], cel_data, cel_data[1:5]))\n",
"cel.data[:, :-4] = cel_data_full[:]\n",
"\n",
"plt.imshow(cel.data.T, extent=(-4*grid.spacing[0], 2*np.pi+4*grid.spacing[0], 0, -3*np.pi/4), aspect='auto')\n",
"plt.imshow(cel.data.T,\n",
" extent=(-4*grid.spacing[0], 2*np.pi+4*grid.spacing[0],0, -3*np.pi/4),\n",
" aspect='auto')\n",
"plt.title(\"Celerity field\")\n",
"plt.colorbar()\n",
"plt.show()"
Expand All @@ -300,7 +313,11 @@
"cell_type": "code",
"execution_count": 8,
"id": "53bb70bd",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -365,7 +382,11 @@
"cell_type": "code",
"execution_count": 9,
"id": "e8559026",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -484,11 +505,7 @@
"Generating stencils for Derivative(p(t, x, y), x)\n",
"Generating stencils for Derivative(p(t, x, y), y)\n",
"Generating stencils for Derivative(v_x(t + dt, x + h_x/2, y), x)\n",
"Support expanded. Remaining = 123\n",
"Support expanded. Remaining = 12\n",
"Generating stencils for Derivative(v_y(t + dt, x, y + h_y/2), y)\n",
"Support expanded. Remaining = 300\n",
"Support expanded. Remaining = 24\n"
"Generating stencils for Derivative(v_y(t + dt, x, y + h_y/2), y)\n"
]
}
],
Expand Down Expand Up @@ -610,28 +627,34 @@
"cell_type": "code",
"execution_count": 18,
"id": "924f66fc",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Operator `Kernel` ran in 86.33 s\n"
"Operator `Kernel` ran in 93.14 s\n"
]
},
{
"data": {
"text/plain": [
"PerformanceSummary([(PerfKey(name='section0', rank=None),\n",
" PerfEntry(time=10.052069999999967, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" PerfEntry(time=10.634757999999968, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" (PerfKey(name='section1', rank=None),\n",
" PerfEntry(time=0.021199999999998883, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" PerfEntry(time=0.02746699999999824, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" (PerfKey(name='section2', rank=None),\n",
" PerfEntry(time=76.1822969999998, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" PerfEntry(time=0.059053999999997234, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" (PerfKey(name='section3', rank=None),\n",
" PerfEntry(time=0.013786999999999834, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" PerfEntry(time=82.33782100000003, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" (PerfKey(name='section4', rank=None),\n",
" PerfEntry(time=0.04537799999999799, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[]))])"
" PerfEntry(time=0.015068999999999659, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
" (PerfKey(name='section5', rank=None),\n",
" PerfEntry(time=0.05057899999999759, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[]))])"
]
},
"execution_count": 18,
Expand All @@ -647,7 +670,11 @@
"cell_type": "code",
"execution_count": 19,
"id": "174a4bdf",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -676,7 +703,10 @@
"execution_count": 20,
"id": "7d898c47",
"metadata": {
"scrolled": false
"scrolled": false,
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
Expand All @@ -702,7 +732,10 @@
"execution_count": 21,
"id": "3e37500a",
"metadata": {
"scrolled": false
"scrolled": false,
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
Expand All @@ -727,7 +760,11 @@
"cell_type": "code",
"execution_count": 22,
"id": "3891c06c",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -780,7 +817,11 @@
"cell_type": "code",
"execution_count": 23,
"id": "9d14ed6a",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"data": {
Expand All @@ -805,7 +846,11 @@
"cell_type": "code",
"execution_count": 24,
"id": "2a2011a7",
"metadata": {},
"metadata": {
"tags": [
"nbval-ignore-output"
]
},
"outputs": [
{
"data": {
Expand All @@ -828,14 +873,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"id": "80dab0a8",
"metadata": {},
"outputs": [],
"source": []
"source": [
"assert np.isclose(np.linalg.norm(p.data), 77.93062)\n",
"assert np.isclose(np.linalg.norm(v[0].data), 74.66077)\n",
"assert np.isclose(np.linalg.norm(v[1].data), 13.953425)"
]
}
],
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
Expand Down
Loading

0 comments on commit c26109c

Please sign in to comment.