Skip to content

Commit c26109c

Browse files
authored
Merge pull request #22 from EdCaunt/notebook_tidyup
examples: tidied up notebooks and examples for paper submission
2 parents 53929f3 + 48180eb commit c26109c

24 files changed

Lines changed: 1317 additions & 1139 deletions

examples/10_1st_order_acoustic_sinusoid_hill.ipynb

Lines changed: 64 additions & 23 deletions
Large diffs are not rendered by default.

examples/11_3D_2nd_order_acoustic_parabola.ipynb

Lines changed: 45 additions & 88 deletions
Large diffs are not rendered by default.

examples/12_elastic_flat_surface.ipynb

Lines changed: 122 additions & 350 deletions
Large diffs are not rendered by default.

examples/13_vti.ipynb

Lines changed: 38 additions & 15 deletions
Large diffs are not rendered by default.

examples/14_1st-order_exact_solution_comparison.ipynb

Lines changed: 77 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77
"source": [
88
"# 1st-order exact solution comparison\n",
99
"\n",
10-
"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."
10+
"In this notebook, a solution of the 1st-order acoustic wave equation using an immersed boundary is compared to the previously-used exact solution."
1111
]
1212
},
1313
{
1414
"cell_type": "code",
1515
"execution_count": 1,
1616
"id": "5fb0a3a7",
1717
"metadata": {
18-
"scrolled": false
18+
"scrolled": false,
19+
"tags": [
20+
"nbval-ignore-output"
21+
]
1922
},
2023
"outputs": [
2124
{
@@ -205,7 +208,11 @@
205208
"cell_type": "code",
206209
"execution_count": 4,
207210
"id": "6ea21c04",
208-
"metadata": {},
211+
"metadata": {
212+
"tags": [
213+
"nbval-ignore-output"
214+
]
215+
},
209216
"outputs": [
210217
{
211218
"name": "stderr",
@@ -257,7 +264,11 @@
257264
"cell_type": "code",
258265
"execution_count": 6,
259266
"id": "db7e40b9",
260-
"metadata": {},
267+
"metadata": {
268+
"tags": [
269+
"nbval-ignore-output"
270+
]
271+
},
261272
"outputs": [
262273
{
263274
"data": {
@@ -279,7 +290,9 @@
279290
"cel_data_full = np.concatenate((cel_data[-5:-1], cel_data, cel_data[1:5]))\n",
280291
"cel.data[:, :-4] = cel_data_full[:]\n",
281292
"\n",
282-
"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",
293+
"plt.imshow(cel.data.T,\n",
294+
" extent=(-4*grid.spacing[0], 2*np.pi+4*grid.spacing[0],0, -3*np.pi/4),\n",
295+
" aspect='auto')\n",
283296
"plt.title(\"Celerity field\")\n",
284297
"plt.colorbar()\n",
285298
"plt.show()"
@@ -300,7 +313,11 @@
300313
"cell_type": "code",
301314
"execution_count": 8,
302315
"id": "53bb70bd",
303-
"metadata": {},
316+
"metadata": {
317+
"tags": [
318+
"nbval-ignore-output"
319+
]
320+
},
304321
"outputs": [
305322
{
306323
"data": {
@@ -365,7 +382,11 @@
365382
"cell_type": "code",
366383
"execution_count": 9,
367384
"id": "e8559026",
368-
"metadata": {},
385+
"metadata": {
386+
"tags": [
387+
"nbval-ignore-output"
388+
]
389+
},
369390
"outputs": [
370391
{
371392
"data": {
@@ -484,11 +505,7 @@
484505
"Generating stencils for Derivative(p(t, x, y), x)\n",
485506
"Generating stencils for Derivative(p(t, x, y), y)\n",
486507
"Generating stencils for Derivative(v_x(t + dt, x + h_x/2, y), x)\n",
487-
"Support expanded. Remaining = 123\n",
488-
"Support expanded. Remaining = 12\n",
489-
"Generating stencils for Derivative(v_y(t + dt, x, y + h_y/2), y)\n",
490-
"Support expanded. Remaining = 300\n",
491-
"Support expanded. Remaining = 24\n"
508+
"Generating stencils for Derivative(v_y(t + dt, x, y + h_y/2), y)\n"
492509
]
493510
}
494511
],
@@ -610,28 +627,34 @@
610627
"cell_type": "code",
611628
"execution_count": 18,
612629
"id": "924f66fc",
613-
"metadata": {},
630+
"metadata": {
631+
"tags": [
632+
"nbval-ignore-output"
633+
]
634+
},
614635
"outputs": [
615636
{
616637
"name": "stderr",
617638
"output_type": "stream",
618639
"text": [
619-
"Operator `Kernel` ran in 86.33 s\n"
640+
"Operator `Kernel` ran in 93.14 s\n"
620641
]
621642
},
622643
{
623644
"data": {
624645
"text/plain": [
625646
"PerformanceSummary([(PerfKey(name='section0', rank=None),\n",
626-
" PerfEntry(time=10.052069999999967, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
647+
" PerfEntry(time=10.634757999999968, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
627648
" (PerfKey(name='section1', rank=None),\n",
628-
" PerfEntry(time=0.021199999999998883, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
649+
" PerfEntry(time=0.02746699999999824, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
629650
" (PerfKey(name='section2', rank=None),\n",
630-
" PerfEntry(time=76.1822969999998, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
651+
" PerfEntry(time=0.059053999999997234, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
631652
" (PerfKey(name='section3', rank=None),\n",
632-
" PerfEntry(time=0.013786999999999834, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
653+
" PerfEntry(time=82.33782100000003, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
633654
" (PerfKey(name='section4', rank=None),\n",
634-
" PerfEntry(time=0.04537799999999799, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[]))])"
655+
" PerfEntry(time=0.015068999999999659, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[])),\n",
656+
" (PerfKey(name='section5', rank=None),\n",
657+
" PerfEntry(time=0.05057899999999759, gflopss=0.0, gpointss=0.0, oi=0.0, ops=0, itershapes=[]))])"
635658
]
636659
},
637660
"execution_count": 18,
@@ -647,7 +670,11 @@
647670
"cell_type": "code",
648671
"execution_count": 19,
649672
"id": "174a4bdf",
650-
"metadata": {},
673+
"metadata": {
674+
"tags": [
675+
"nbval-ignore-output"
676+
]
677+
},
651678
"outputs": [
652679
{
653680
"data": {
@@ -676,7 +703,10 @@
676703
"execution_count": 20,
677704
"id": "7d898c47",
678705
"metadata": {
679-
"scrolled": false
706+
"scrolled": false,
707+
"tags": [
708+
"nbval-ignore-output"
709+
]
680710
},
681711
"outputs": [
682712
{
@@ -702,7 +732,10 @@
702732
"execution_count": 21,
703733
"id": "3e37500a",
704734
"metadata": {
705-
"scrolled": false
735+
"scrolled": false,
736+
"tags": [
737+
"nbval-ignore-output"
738+
]
706739
},
707740
"outputs": [
708741
{
@@ -727,7 +760,11 @@
727760
"cell_type": "code",
728761
"execution_count": 22,
729762
"id": "3891c06c",
730-
"metadata": {},
763+
"metadata": {
764+
"tags": [
765+
"nbval-ignore-output"
766+
]
767+
},
731768
"outputs": [
732769
{
733770
"data": {
@@ -780,7 +817,11 @@
780817
"cell_type": "code",
781818
"execution_count": 23,
782819
"id": "9d14ed6a",
783-
"metadata": {},
820+
"metadata": {
821+
"tags": [
822+
"nbval-ignore-output"
823+
]
824+
},
784825
"outputs": [
785826
{
786827
"data": {
@@ -805,7 +846,11 @@
805846
"cell_type": "code",
806847
"execution_count": 24,
807848
"id": "2a2011a7",
808-
"metadata": {},
849+
"metadata": {
850+
"tags": [
851+
"nbval-ignore-output"
852+
]
853+
},
809854
"outputs": [
810855
{
811856
"data": {
@@ -828,14 +873,19 @@
828873
},
829874
{
830875
"cell_type": "code",
831-
"execution_count": null,
876+
"execution_count": 25,
832877
"id": "80dab0a8",
833878
"metadata": {},
834879
"outputs": [],
835-
"source": []
880+
"source": [
881+
"assert np.isclose(np.linalg.norm(p.data), 77.93062)\n",
882+
"assert np.isclose(np.linalg.norm(v[0].data), 74.66077)\n",
883+
"assert np.isclose(np.linalg.norm(v[1].data), 13.953425)"
884+
]
836885
}
837886
],
838887
"metadata": {
888+
"celltoolbar": "Tags",
839889
"kernelspec": {
840890
"display_name": "Python 3 (ipykernel)",
841891
"language": "python",

0 commit comments

Comments
 (0)