|
7 | 7 | "source": [ |
8 | 8 | "# 1st-order exact solution comparison\n", |
9 | 9 | "\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." |
11 | 11 | ] |
12 | 12 | }, |
13 | 13 | { |
14 | 14 | "cell_type": "code", |
15 | 15 | "execution_count": 1, |
16 | 16 | "id": "5fb0a3a7", |
17 | 17 | "metadata": { |
18 | | - "scrolled": false |
| 18 | + "scrolled": false, |
| 19 | + "tags": [ |
| 20 | + "nbval-ignore-output" |
| 21 | + ] |
19 | 22 | }, |
20 | 23 | "outputs": [ |
21 | 24 | { |
|
205 | 208 | "cell_type": "code", |
206 | 209 | "execution_count": 4, |
207 | 210 | "id": "6ea21c04", |
208 | | - "metadata": {}, |
| 211 | + "metadata": { |
| 212 | + "tags": [ |
| 213 | + "nbval-ignore-output" |
| 214 | + ] |
| 215 | + }, |
209 | 216 | "outputs": [ |
210 | 217 | { |
211 | 218 | "name": "stderr", |
|
257 | 264 | "cell_type": "code", |
258 | 265 | "execution_count": 6, |
259 | 266 | "id": "db7e40b9", |
260 | | - "metadata": {}, |
| 267 | + "metadata": { |
| 268 | + "tags": [ |
| 269 | + "nbval-ignore-output" |
| 270 | + ] |
| 271 | + }, |
261 | 272 | "outputs": [ |
262 | 273 | { |
263 | 274 | "data": { |
|
279 | 290 | "cel_data_full = np.concatenate((cel_data[-5:-1], cel_data, cel_data[1:5]))\n", |
280 | 291 | "cel.data[:, :-4] = cel_data_full[:]\n", |
281 | 292 | "\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", |
283 | 296 | "plt.title(\"Celerity field\")\n", |
284 | 297 | "plt.colorbar()\n", |
285 | 298 | "plt.show()" |
|
300 | 313 | "cell_type": "code", |
301 | 314 | "execution_count": 8, |
302 | 315 | "id": "53bb70bd", |
303 | | - "metadata": {}, |
| 316 | + "metadata": { |
| 317 | + "tags": [ |
| 318 | + "nbval-ignore-output" |
| 319 | + ] |
| 320 | + }, |
304 | 321 | "outputs": [ |
305 | 322 | { |
306 | 323 | "data": { |
|
365 | 382 | "cell_type": "code", |
366 | 383 | "execution_count": 9, |
367 | 384 | "id": "e8559026", |
368 | | - "metadata": {}, |
| 385 | + "metadata": { |
| 386 | + "tags": [ |
| 387 | + "nbval-ignore-output" |
| 388 | + ] |
| 389 | + }, |
369 | 390 | "outputs": [ |
370 | 391 | { |
371 | 392 | "data": { |
|
484 | 505 | "Generating stencils for Derivative(p(t, x, y), x)\n", |
485 | 506 | "Generating stencils for Derivative(p(t, x, y), y)\n", |
486 | 507 | "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" |
492 | 509 | ] |
493 | 510 | } |
494 | 511 | ], |
|
610 | 627 | "cell_type": "code", |
611 | 628 | "execution_count": 18, |
612 | 629 | "id": "924f66fc", |
613 | | - "metadata": {}, |
| 630 | + "metadata": { |
| 631 | + "tags": [ |
| 632 | + "nbval-ignore-output" |
| 633 | + ] |
| 634 | + }, |
614 | 635 | "outputs": [ |
615 | 636 | { |
616 | 637 | "name": "stderr", |
617 | 638 | "output_type": "stream", |
618 | 639 | "text": [ |
619 | | - "Operator `Kernel` ran in 86.33 s\n" |
| 640 | + "Operator `Kernel` ran in 93.14 s\n" |
620 | 641 | ] |
621 | 642 | }, |
622 | 643 | { |
623 | 644 | "data": { |
624 | 645 | "text/plain": [ |
625 | 646 | "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", |
627 | 648 | " (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", |
629 | 650 | " (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", |
631 | 652 | " (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", |
633 | 654 | " (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=[]))])" |
635 | 658 | ] |
636 | 659 | }, |
637 | 660 | "execution_count": 18, |
|
647 | 670 | "cell_type": "code", |
648 | 671 | "execution_count": 19, |
649 | 672 | "id": "174a4bdf", |
650 | | - "metadata": {}, |
| 673 | + "metadata": { |
| 674 | + "tags": [ |
| 675 | + "nbval-ignore-output" |
| 676 | + ] |
| 677 | + }, |
651 | 678 | "outputs": [ |
652 | 679 | { |
653 | 680 | "data": { |
|
676 | 703 | "execution_count": 20, |
677 | 704 | "id": "7d898c47", |
678 | 705 | "metadata": { |
679 | | - "scrolled": false |
| 706 | + "scrolled": false, |
| 707 | + "tags": [ |
| 708 | + "nbval-ignore-output" |
| 709 | + ] |
680 | 710 | }, |
681 | 711 | "outputs": [ |
682 | 712 | { |
|
702 | 732 | "execution_count": 21, |
703 | 733 | "id": "3e37500a", |
704 | 734 | "metadata": { |
705 | | - "scrolled": false |
| 735 | + "scrolled": false, |
| 736 | + "tags": [ |
| 737 | + "nbval-ignore-output" |
| 738 | + ] |
706 | 739 | }, |
707 | 740 | "outputs": [ |
708 | 741 | { |
|
727 | 760 | "cell_type": "code", |
728 | 761 | "execution_count": 22, |
729 | 762 | "id": "3891c06c", |
730 | | - "metadata": {}, |
| 763 | + "metadata": { |
| 764 | + "tags": [ |
| 765 | + "nbval-ignore-output" |
| 766 | + ] |
| 767 | + }, |
731 | 768 | "outputs": [ |
732 | 769 | { |
733 | 770 | "data": { |
|
780 | 817 | "cell_type": "code", |
781 | 818 | "execution_count": 23, |
782 | 819 | "id": "9d14ed6a", |
783 | | - "metadata": {}, |
| 820 | + "metadata": { |
| 821 | + "tags": [ |
| 822 | + "nbval-ignore-output" |
| 823 | + ] |
| 824 | + }, |
784 | 825 | "outputs": [ |
785 | 826 | { |
786 | 827 | "data": { |
|
805 | 846 | "cell_type": "code", |
806 | 847 | "execution_count": 24, |
807 | 848 | "id": "2a2011a7", |
808 | | - "metadata": {}, |
| 849 | + "metadata": { |
| 850 | + "tags": [ |
| 851 | + "nbval-ignore-output" |
| 852 | + ] |
| 853 | + }, |
809 | 854 | "outputs": [ |
810 | 855 | { |
811 | 856 | "data": { |
|
828 | 873 | }, |
829 | 874 | { |
830 | 875 | "cell_type": "code", |
831 | | - "execution_count": null, |
| 876 | + "execution_count": 25, |
832 | 877 | "id": "80dab0a8", |
833 | 878 | "metadata": {}, |
834 | 879 | "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 | + ] |
836 | 885 | } |
837 | 886 | ], |
838 | 887 | "metadata": { |
| 888 | + "celltoolbar": "Tags", |
839 | 889 | "kernelspec": { |
840 | 890 | "display_name": "Python 3 (ipykernel)", |
841 | 891 | "language": "python", |
|
0 commit comments