{"diffoscope-json-version": 1, "source1": "/srv/reproducible-results/rbuild-debian/r-b-build.NwuGczFb/b1/fenics-dolfinx_0.10.0.post3-1exp5_amd64.changes", "source2": "/srv/reproducible-results/rbuild-debian/r-b-build.NwuGczFb/b2/fenics-dolfinx_0.10.0.post3-1exp5_amd64.changes", "unified_diff": null, "details": [{"source1": "Files", "source2": "Files", "unified_diff": "@@ -1,9 +1,9 @@\n \n- a9ef29f10b7908d6c5c0a901eae96ab0 8875636 doc optional dolfinx-doc_0.10.0.post3-1exp5_all.deb\n+ d21bb08df69e4d864b06150ccc270803 8875540 doc optional dolfinx-doc_0.10.0.post3-1exp5_all.deb\n c1c3b69ce2c79d520c39f64f085be434 50412 libdevel optional libdolfinx-complex-dev_0.10.0.post3-1exp5_amd64.deb\n 3300b6a527b3113c46e0752759f5ed1a 13591280 debug optional libdolfinx-complex0.10-dbgsym_0.10.0.post3-1exp5_amd64.deb\n 55b734042e9aa7583988f2515b08b7c1 647352 libs optional libdolfinx-complex0.10_0.10.0.post3-1exp5_amd64.deb\n 1b34323f1677759b601479690ff13ef4 226932 libdevel optional libdolfinx-dev_0.10.0.post3-1exp5_amd64.deb\n 331d4aed10a1b9e906ea40bef77e1d2b 50404 libdevel optional libdolfinx-real-dev_0.10.0.post3-1exp5_amd64.deb\n 85d537a9882cbd4047709d2d3b98a231 13590928 debug optional libdolfinx-real0.10-dbgsym_0.10.0.post3-1exp5_amd64.deb\n c694b49395a02f8b63ea68d286fb32ff 647316 libs optional libdolfinx-real0.10_0.10.0.post3-1exp5_amd64.deb\n"}, {"source1": "dolfinx-doc_0.10.0.post3-1exp5_all.deb", "source2": "dolfinx-doc_0.10.0.post3-1exp5_all.deb", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,3 +1,3 @@\n -rw-r--r-- 0 0 0 4 2025-11-26 12:50:25.000000 debian-binary\n -rw-r--r-- 0 0 0 23848 2025-11-26 12:50:25.000000 control.tar.xz\n--rw-r--r-- 0 0 0 8851596 2025-11-26 12:50:25.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 8851500 2025-11-26 12:50:25.000000 data.tar.xz\n"}, {"source1": "control.tar.xz", "source2": "control.tar.xz", "unified_diff": null, "details": [{"source1": "control.tar", "source2": "control.tar", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "comments": ["Files differ"], "unified_diff": null}]}]}]}, {"source1": "data.tar.xz", "source2": "data.tar.xz", "unified_diff": null, "details": [{"source1": "data.tar", "source2": "data.tar", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -897,43 +897,43 @@\n -rw-r--r-- 0 root (0) root (0) 188 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/cpp/tab_sd.png\n -rw-r--r-- 0 root (0) root (0) 10560 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/cpp/tabs.css\n -rw-r--r-- 0 root (0) root (0) 3651 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/cpp/topics.html\n -rw-r--r-- 0 root (0) root (0) 3859 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/index.html\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/01cebb598a9eb6f964554459de25ce7c/\n--rw-r--r-- 0 root (0) root (0) 6928 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/01cebb598a9eb6f964554459de25ce7c/demo_stokes.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 6932 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/01cebb598a9eb6f964554459de25ce7c/demo_stokes.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/08143fa77f77a4782d22e85e7aebc523/\n--rw-r--r-- 0 root (0) root (0) 3078 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/08143fa77f77a4782d22e85e7aebc523/demo_mixed-topology.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 3079 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/08143fa77f77a4782d22e85e7aebc523/demo_mixed-topology.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/082c4b6b2083855631db76b9eac6b348/\n--rw-r--r-- 0 root (0) root (0) 2721 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/082c4b6b2083855631db76b9eac6b348/demo_pyamg.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 2719 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/082c4b6b2083855631db76b9eac6b348/demo_pyamg.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/08f65cab6d6efa886b6e864593d5544d/\n--rw-r--r-- 0 root (0) root (0) 2944 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/08f65cab6d6efa886b6e864593d5544d/demo_comm-pattern.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 2939 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/08f65cab6d6efa886b6e864593d5544d/demo_comm-pattern.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/0aed751cd0874b28f5ae7bdc73e1060e/\n--rw-r--r-- 0 root (0) root (0) 4229 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/0aed751cd0874b28f5ae7bdc73e1060e/demo_biharmonic.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 4222 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/0aed751cd0874b28f5ae7bdc73e1060e/demo_biharmonic.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/0ff7b5905586c05f3ded87f72380f93b/\n--rw-r--r-- 0 root (0) root (0) 3183 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/0ff7b5905586c05f3ded87f72380f93b/demo_lagrange_variants.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 3184 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/0ff7b5905586c05f3ded87f72380f93b/demo_lagrange_variants.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/14903818ff63fe77ad13ebe2fd3c2bfa/\n -rw-r--r-- 0 root (0) root (0) 16870 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/14903818ff63fe77ad13ebe2fd3c2bfa/demo_half_loaded_waveguide.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/16ae5ee96f6630d2b709d4fae5801c3a/\n -rw-r--r-- 0 root (0) root (0) 6740 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/16ae5ee96f6630d2b709d4fae5801c3a/demo_mixed-topology.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/1a16c2f4b29ea3e52acc5e0c69e7d325/\n -rw-r--r-- 0 root (0) root (0) 26254 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/1a16c2f4b29ea3e52acc5e0c69e7d325/demo_axis.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/1a19850a673ac0912099149a21b82fe9/\n -rw-r--r-- 0 root (0) root (0) 28277 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/1a19850a673ac0912099149a21b82fe9/demo_scattering_boundary_conditions.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/1c10919af1d1c2689ff1982d6e82b898/\n--rw-r--r-- 0 root (0) root (0) 5462 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/1c10919af1d1c2689ff1982d6e82b898/demo_navier-stokes.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 5457 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/1c10919af1d1c2689ff1982d6e82b898/demo_navier-stokes.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/244d514e5e2d1484e9f045150ae16a27/\n--rw-r--r-- 0 root (0) root (0) 2883 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/244d514e5e2d1484e9f045150ae16a27/demo_gmsh.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 2886 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/244d514e5e2d1484e9f045150ae16a27/demo_gmsh.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/2582f4d86e9cdad523ac798f84ed8877/\n -rw-r--r-- 0 root (0) root (0) 9311 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/2582f4d86e9cdad523ac798f84ed8877/demo_biharmonic.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3013bc98771f29691ef96d816a24e9b5/\n -rw-r--r-- 0 root (0) root (0) 8437 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3013bc98771f29691ef96d816a24e9b5/demo_poisson_matrix_free.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3a2e8b3062e32f7fa335a0116fae9bef/\n--rw-r--r-- 0 root (0) root (0) 4268 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3a2e8b3062e32f7fa335a0116fae9bef/demo_hdg.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 4265 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3a2e8b3062e32f7fa335a0116fae9bef/demo_hdg.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3e7291d3b77b3f22251cd7795a639a00/\n -rw-r--r-- 0 root (0) root (0) 8703 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3e7291d3b77b3f22251cd7795a639a00/demo_hdg.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3f4304da118cf34f94b5991c582738c4/\n -rw-r--r-- 0 root (0) root (0) 7065 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/3f4304da118cf34f94b5991c582738c4/demo_pyamg.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/4108f87eb9b678931168ffba26e2c302/\n -rw-r--r-- 0 root (0) root (0) 13078 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/4108f87eb9b678931168ffba26e2c302/demo_mixed-poisson.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/44f4041e8551d8a922a8c3a49107aaf9/\n@@ -943,61 +943,61 @@\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/4805c30fd9f5602435f2b34dad232ba2/\n -rw-r--r-- 0 root (0) root (0) 8745 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/4805c30fd9f5602435f2b34dad232ba2/demo_lagrange_variants.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/4cfcffe5891ed56ed48568fb00a06e67/\n -rw-r--r-- 0 root (0) root (0) 10324 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/4cfcffe5891ed56ed48568fb00a06e67/demo_static-condensation.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/51e819842c2534ea5d902f847c84b6ee/\n -rw-r--r-- 0 root (0) root (0) 5121 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/51e819842c2534ea5d902f847c84b6ee/demo_helmholtz.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/5261c2fbfdb83b277c92e92bde061504/\n--rw-r--r-- 0 root (0) root (0) 8858 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/5261c2fbfdb83b277c92e92bde061504/demo_axis.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 8860 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/5261c2fbfdb83b277c92e92bde061504/demo_axis.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/56ce7e71d8c71b4d8ef7c699176dd4fd/\n -rw-r--r-- 0 root (0) root (0) 22619 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/56ce7e71d8c71b4d8ef7c699176dd4fd/demo_stokes.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/5dc7fa0449730e3256bb33fc2b2d403b/\n--rw-r--r-- 0 root (0) root (0) 3096 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/5dc7fa0449730e3256bb33fc2b2d403b/demo_poisson.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 3097 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/5dc7fa0449730e3256bb33fc2b2d403b/demo_poisson.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/67f8546536727bd5386a27073bd16e12/\n -rw-r--r-- 0 root (0) root (0) 7983 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/67f8546536727bd5386a27073bd16e12/demo_elasticity.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/69c686705c3e4103e036ace87972a971/\n--rw-r--r-- 0 root (0) root (0) 2785 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/69c686705c3e4103e036ace87972a971/demo_types.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 2788 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/69c686705c3e4103e036ace87972a971/demo_types.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/6ad57720b461988475bd5c9286e3f111/\n -rw-r--r-- 0 root (0) root (0) 7579 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/6ad57720b461988475bd5c9286e3f111/demo_types.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/6bd0b7dbffc1fd43f16bc5cd2cfeed74/\n--rw-r--r-- 0 root (0) root (0) 4727 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/6bd0b7dbffc1fd43f16bc5cd2cfeed74/demo_static-condensation.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 4734 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/6bd0b7dbffc1fd43f16bc5cd2cfeed74/demo_static-condensation.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/7742577adb1c8360c8a19eea719713fc/\n -rw-r--r-- 0 root (0) root (0) 3759 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/7742577adb1c8360c8a19eea719713fc/demo_pyvista.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/7fc5387c9d660ce24e2f50b0f79aad08/\n -rw-r--r-- 0 root (0) root (0) 6811 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/7fc5387c9d660ce24e2f50b0f79aad08/demo_comm-pattern.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/911a7569fd30f814e5e3d622695b49c1/\n -rw-r--r-- 0 root (0) root (0) 27719 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/911a7569fd30f814e5e3d622695b49c1/demo_pml.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/94dc1fa896703fdd4c54729bdfbf969a/\n--rw-r--r-- 0 root (0) root (0) 10163 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/94dc1fa896703fdd4c54729bdfbf969a/demo_pml.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 10154 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/94dc1fa896703fdd4c54729bdfbf969a/demo_pml.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9561cf6cd1a70079b986f4eb31580cbd/\n--rw-r--r-- 0 root (0) root (0) 3876 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9561cf6cd1a70079b986f4eb31580cbd/demo_poisson_matrix_free.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 3874 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9561cf6cd1a70079b986f4eb31580cbd/demo_poisson_matrix_free.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9b362df2c2031d4138a5021a53979414/\n--rw-r--r-- 0 root (0) root (0) 5168 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9b362df2c2031d4138a5021a53979414/demo_cahn-hilliard.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 5162 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9b362df2c2031d4138a5021a53979414/demo_cahn-hilliard.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9ed4657d08dda04de30e6463e2f58d75/\n -rw-r--r-- 0 root (0) root (0) 5635 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/9ed4657d08dda04de30e6463e2f58d75/demo_mixed-poisson.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/a5df6747d3300b9568f25507c7fb2517/\n--rw-r--r-- 0 root (0) root (0) 2110 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/a5df6747d3300b9568f25507c7fb2517/demo_interpolation-io.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 2107 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/a5df6747d3300b9568f25507c7fb2517/demo_interpolation-io.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/b3f0523386e0521f7e6a5599627be9fc/\n--rw-r--r-- 0 root (0) root (0) 7063 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/b3f0523386e0521f7e6a5599627be9fc/demo_half_loaded_waveguide.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 7058 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/b3f0523386e0521f7e6a5599627be9fc/demo_half_loaded_waveguide.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/b94ac7be61dc3726ca331afd20f195d2/\n -rw-r--r-- 0 root (0) root (0) 6231 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/b94ac7be61dc3726ca331afd20f195d2/demo_poisson.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/c13ef8eb7697276d5c6443a7049d2298/\n -rw-r--r-- 0 root (0) root (0) 12043 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/c13ef8eb7697276d5c6443a7049d2298/demo_pyvista.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/c202a2458472f1e0e385ed9afdc3da0f/\n--rw-r--r-- 0 root (0) root (0) 2702 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/c202a2458472f1e0e385ed9afdc3da0f/demo_helmholtz.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 2698 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/c202a2458472f1e0e385ed9afdc3da0f/demo_helmholtz.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/e5597ff2b0334295de2749391a1ffbe1/\n--rw-r--r-- 0 root (0) root (0) 4518 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/e5597ff2b0334295de2749391a1ffbe1/demo_tnt-elements.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 4516 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/e5597ff2b0334295de2749391a1ffbe1/demo_tnt-elements.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/e8140d02a100265518e126a3cfe79d8e/\n -rw-r--r-- 0 root (0) root (0) 4245 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/e8140d02a100265518e126a3cfe79d8e/demo_interpolation-io.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/e8b180b39a27d7b04c2f666d14475ee3/\n -rw-r--r-- 0 root (0) root (0) 11391 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/e8b180b39a27d7b04c2f666d14475ee3/demo_cahn-hilliard.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/eb193fc2ce46146f29b3c38146a5a3cb/\n--rw-r--r-- 0 root (0) root (0) 10152 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/eb193fc2ce46146f29b3c38146a5a3cb/demo_scattering_boundary_conditions.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 10150 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/eb193fc2ce46146f29b3c38146a5a3cb/demo_scattering_boundary_conditions.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/f60c5654312263c726a60c7d3dcc6729/\n--rw-r--r-- 0 root (0) root (0) 3945 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/f60c5654312263c726a60c7d3dcc6729/demo_elasticity.ipynb.gz\n+-rw-r--r-- 0 root (0) root (0) 3938 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/f60c5654312263c726a60c7d3dcc6729/demo_elasticity.ipynb.gz\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/f6f3cc4d9540871af057920d1ddb5561/\n -rw-r--r-- 0 root (0) root (0) 11682 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_downloads/f6f3cc4d9540871af057920d1ddb5561/demo_tnt-elements.py\n drwxr-xr-x 0 root (0) root (0) 0 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_images/\n -rw-r--r-- 0 root (0) root (0) 67993 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_images/demo_lagrange_variants_equispaced_10.png\n -rw-r--r-- 0 root (0) root (0) 41664 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_images/demo_lagrange_variants_gll_10.png\n -rw-r--r-- 0 root (0) root (0) 42191 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_images/demo_lagrange_variants_interpolation_equispaced.png\n -rw-r--r-- 0 root (0) root (0) 41221 2025-11-26 12:50:25.000000 ./usr/share/doc/dolfinx-doc/python/_images/demo_lagrange_variants_interpolation_gll_warped.png\n"}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/01cebb598a9eb6f964554459de25ce7c/demo_stokes.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/01cebb598a9eb6f964554459de25ce7c/demo_stokes.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_stokes.ipynb", "source2": "demo_stokes.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666667%", "Differences: {\"'cells'\": \"{0: {'id': '310b29ca'}, 1: {'id': 'bd5d2cae'}, 2: {'id': 'efbbe8d3'}, 3: {'id': \"", " \"'ad367742'}, 4: {'id': 'bd23aa48'}, 5: {'id': '908b0386'}, 6: {'id': '96955e65'}, 7: \"", " \"{'id': '7dfa226b'}, 8: {'id': 'a238457d'}, 9: {'id': '1bb6e093'}, 10: {'id': \"", " \"'71c5b448'}, 11: {'id': '608c39e2'}, 12: {'id': 'd8159198'}, 13: {'id': '991437c9'}, \"", " \"14: {'id': '9398416c'}, 15: {'id': '5e564e1c'}, 16: {'id': 'b8be8fb3'}, 17: {'id': \"", " \"'8db14b7a'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"990e3519\",\n+ \"id\": \"310b29ca\",\n \"metadata\": {},\n \"source\": [\n \"# Stokes equations using Taylor-Hood elements\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_stokes.py>`\\n\",\n@@ -88,15 +88,15 @@\n \"\\n\",\n \"The required modules are first imported:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"f0367755\",\n+ \"id\": \"bd5d2cae\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n \"\\n\",\n \"import numpy as np\\n\",\n@@ -125,26 +125,26 @@\n \"from dolfinx.io import XDMFFile\\n\",\n \"from dolfinx.la.petsc import create_vector_wrap\\n\",\n \"from dolfinx.mesh import CellType, create_rectangle, locate_entities_boundary\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"243d0566\",\n+ \"id\": \"efbbe8d3\",\n \"metadata\": {},\n \"source\": [\n \"We create a {py:class}`Mesh `, define functions for\\n\",\n \"locating geometrically subsets of the boundary, and define a function\\n\",\n \"for the velocity on the lid:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"913aa620\",\n+ \"id\": \"ad367742\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"# Create mesh\\n\",\n \"msh = create_rectangle(\\n\",\n@@ -165,51 +165,51 @@\n \"# Lid velocity\\n\",\n \"def lid_velocity_expression(x):\\n\",\n \" return np.stack((np.ones(x.shape[1]), np.zeros(x.shape[1])))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"51359988\",\n+ \"id\": \"bd23aa48\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Two {py:class}`function spaces ` are\\n\",\n \"defined using different finite elements. `P2` corresponds to a\\n\",\n \"continuous piecewise quadratic basis (vector) and `P1` to a continuous\\n\",\n \"piecewise linear basis (scalar).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"427f66ea\",\n+ \"id\": \"908b0386\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"P2 = element(\\n\",\n \" \\\"Lagrange\\\", msh.basix_cell(), degree=2, shape=(msh.geometry.dim,), dtype=default_real_type\\n\",\n \")\\n\",\n \"P1 = element(\\\"Lagrange\\\", msh.basix_cell(), degree=1, dtype=default_real_type)\\n\",\n \"V, Q = functionspace(msh, P2), functionspace(msh, P1)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4d6143f4\",\n+ \"id\": \"96955e65\",\n \"metadata\": {},\n \"source\": [\n \"Boundary conditions for the velocity field are defined:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"f8c9488d\",\n+ \"id\": \"7dfa226b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# No-slip condition on boundaries where x = 0, x = 1, and y = 0\\n\",\n \"noslip = np.zeros(msh.geometry.dim, dtype=PETSc.ScalarType) # type: ignore\\n\",\n \"facets = locate_entities_boundary(msh, 1, noslip_boundary)\\n\",\n \"bc0 = dirichletbc(noslip, locate_dofs_topological(V, 1, facets), V)\\n\",\n@@ -222,25 +222,25 @@\n \"\\n\",\n \"# Collect Dirichlet boundary conditions\\n\",\n \"bcs = [bc0, bc1]\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"edd5359d\",\n+ \"id\": \"a238457d\",\n \"metadata\": {},\n \"source\": [\n \"The bilinear and linear forms for the Stokes equations are defined\\n\",\n \"using a blocked structure:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d17b2537\",\n+ \"id\": \"1bb6e093\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Define variational problem\\n\",\n \"(u, p) = ufl.TrialFunction(V), ufl.TrialFunction(Q)\\n\",\n \"(v, q) = ufl.TestFunction(V), ufl.TestFunction(Q)\\n\",\n \"f = Constant(msh, (PETSc.ScalarType(0), PETSc.ScalarType(0))) # type: ignore\\n\",\n@@ -252,37 +252,37 @@\n \"a = form(a_ufl)\\n\",\n \"L_ufl = [ufl.inner(f, v) * ufl.dx, ufl.ZeroBaseForm((q,))]\\n\",\n \"L = form(L_ufl)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"818a7edc\",\n+ \"id\": \"71c5b448\",\n \"metadata\": {},\n \"source\": [\n \"A block-diagonal preconditioner will be used with the iterative\\n\",\n \"solvers for this problem:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6d0cb8f8\",\n+ \"id\": \"608c39e2\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"a_p11 = form(ufl.inner(p, q) * ufl.dx)\\n\",\n \"a_p = [[a[0][0], None], [None, a_p11]]\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8b639284\",\n+ \"id\": \"d8159198\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"### High-level nested matrix solver\\n\",\n \"\\n\",\n \"We first use the high-level {py:class}`LinearProblem\\n\",\n@@ -290,15 +290,15 @@\n \"the linear problem. Details on the preconditioner setup are given in\\n\",\n \"{py:func}`nested_iterative_solver_low_level` below.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"20347244\",\n+ \"id\": \"991437c9\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def nested_iterative_solver_high_level():\\n\",\n \" \\\"\\\"\\\"Solve the Stokes problem using nest matrices and an iterative solver\\n\",\n@@ -360,15 +360,15 @@\n \" print(f\\\"(A) Norm of pressure coefficient vector (high-level nested, iterative): {norm_p}\\\")\\n\",\n \"\\n\",\n \" return norm_u, norm_p\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"86c4fe5b\",\n+ \"id\": \"9398416c\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"### Low-level nested matrix solver\\n\",\n \"\\n\",\n \"We assemble the bilinear form into a nested matrix `A`, and call the\\n\",\n@@ -377,15 +377,15 @@\n \"Dirichlet boundary conditions will be zeroed by the assembler, and a\\n\",\n \"value of 1 will be set on the diagonal for these rows.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"b66d479d\",\n+ \"id\": \"5e564e1c\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def nested_iterative_solver_low_level():\\n\",\n \" \\\"\\\"\\\"Solve the Stokes problem using nest matrices and an iterative\\n\",\n@@ -492,30 +492,30 @@\n \" print(f\\\"(A) Norm of pressure coefficient vector (low-level nested, iterative): {norm_p}\\\")\\n\",\n \"\\n\",\n \" return norm_u, norm_p\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"04dc25bc\",\n+ \"id\": \"b8be8fb3\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"### Monolithic block iterative solver\\n\",\n \"\\n\",\n \"We now solve the same Stokes problem, but using monolithic\\n\",\n \"(non-nested) matrices. We first create a helper function for\\n\",\n \"assembling the linear operators and the RHS vector.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"71ade828\",\n+ \"id\": \"8db14b7a\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def block_operators():\\n\",\n \" \\\"\\\"\\\"Return block operators and block RHS vector for the Stokes\\n\",\n@@ -546,27 +546,27 @@\n \" A.setNullSpace(nsp)\\n\",\n \"\\n\",\n \" return A, P, b\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"821e2d7b\",\n+ \"id\": \"b58c817e\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"The following function solves the Stokes problem using a\\n\",\n \"block-diagonal preconditioner and monolithic PETSc matrices.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5078aa67\",\n+ \"id\": \"7a5de530\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def block_iterative_solver():\\n\",\n \" \\\"\\\"\\\"Solve the Stokes problem using blocked matrices and an iterative\\n\",\n@@ -630,29 +630,29 @@\n \" print(f\\\"(B) Norm of pressure coefficient vector (blocked, iterative): {norm_p}\\\")\\n\",\n \"\\n\",\n \" return norm_u, norm_p\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c40b758d\",\n+ \"id\": \"cddc53c6\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"### Monolithic block direct solver\\n\",\n \"\\n\",\n \"We now solve the same Stokes problem again, but using monolithic\\n\",\n \"(non-nested) matrices and a direct (LU) solver.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1c6ace1e\",\n+ \"id\": \"f0860ae4\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def block_direct_solver():\\n\",\n \" \\\"\\\"\\\"Solve the Stokes problem using blocked matrices and a direct\\n\",\n@@ -696,15 +696,15 @@\n \" print(f\\\"(C) Norm of pressure coefficient vector (blocked, direct): {norm_p}\\\")\\n\",\n \"\\n\",\n \" return norm_u, norm_p\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d90faeee\",\n+ \"id\": \"675f8989\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"### Non-blocked direct solver\\n\",\n \"\\n\",\n \"We now solve the Stokes problem, but using monolithic matrix with the\\n\",\n@@ -712,15 +712,15 @@\n \"u/p block structure in the assembled matrix. A direct (LU) solver is\\n\",\n \"used.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"79dc8796\",\n+ \"id\": \"969c0783\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def mixed_direct():\\n\",\n \" # Create the Taylot-Hood function space\\n\",\n \" TH = mixed_element([P2, P1])\\n\",\n \" W = functionspace(msh, TH)\\n\",\n@@ -805,102 +805,102 @@\n \" print(f\\\"(D) Norm of pressure coefficient vector (monolithic, direct): {norm_p}\\\")\\n\",\n \"\\n\",\n \" return norm_u, norm_u\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"daa70e16\",\n+ \"id\": \"b0c93b72\",\n \"metadata\": {},\n \"source\": [\n \"Solve using LinearProblem class\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2fda166b\",\n+ \"id\": \"9da80b30\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"norm_u_0, norm_p_0 = nested_iterative_solver_high_level()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ce407466\",\n+ \"id\": \"c3ce99ef\",\n \"metadata\": {},\n \"source\": [\n \"Solve using PETSc MatNest\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d8c3fa9d\",\n+ \"id\": \"6737d78b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"norm_u_1, norm_p_1 = nested_iterative_solver_low_level()\\n\",\n \"np.testing.assert_allclose(norm_u_1, norm_u_0, rtol=1e-4)\\n\",\n \"np.testing.assert_allclose(norm_u_1, norm_u_0, rtol=1e-4)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"edebb9a4\",\n+ \"id\": \"311fafbd\",\n \"metadata\": {},\n \"source\": [\n \"Solve using PETSc block matrices and an iterative solver\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fbac1e2e\",\n+ \"id\": \"2193e80d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"norm_u_2, norm_p_2 = block_iterative_solver()\\n\",\n \"np.testing.assert_allclose(norm_u_2, norm_u_0, rtol=1e-4)\\n\",\n \"np.testing.assert_allclose(norm_u_2, norm_u_0, rtol=1e-4)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2f91fe52\",\n+ \"id\": \"21dd86ac\",\n \"metadata\": {},\n \"source\": [\n \"Solve using PETSc block matrices and an LU solver\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"37242060\",\n+ \"id\": \"1e3d0c8a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"norm_u_3, norm_p_3 = block_direct_solver()\\n\",\n \"np.testing.assert_allclose(norm_u_3, norm_u_0, rtol=1e-4)\\n\",\n \"np.testing.assert_allclose(norm_p_3, norm_p_0, rtol=1e-4)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"3fab2349\",\n+ \"id\": \"7721f947\",\n \"metadata\": {},\n \"source\": [\n \"Solve using a non-blocked matrix and an LU solver\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"30642281\",\n+ \"id\": \"38246880\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"norm_u_4, norm_p_4 = mixed_direct()\\n\",\n \"np.testing.assert_allclose(norm_u_4, norm_u_0, rtol=1e-4)\"\n ]\n }\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/08143fa77f77a4782d22e85e7aebc523/demo_mixed-topology.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/08143fa77f77a4782d22e85e7aebc523/demo_mixed-topology.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_mixed-topology.ipynb", "source2": "demo_mixed-topology.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9872685185185185%", "Differences: {\"'cells'\": \"{0: {'id': 'c669fb59'}, 1: {'id': '661f0a86'}, 2: {'id': '5434b793'}, 3: {'id': \"", " \"'bc188c2c'}, 4: {'id': 'a9cfd2ea'}, 5: {'id': 'f8549de2'}, 6: {'id': '4e50f1dc'}, 7: \"", " \"{'id': '1dc4a9b9'}, 8: {'id': '051a8805'}, 9: {'id': '9f4e966b'}, 10: {'id': \"", " \"'59baa129'}, 11: {'id': 'a133a28a'}, 12: {'id': 'd6e0d010'}, 13: {'id': '1a59152d'}, \"", " \"14: {'id': '37dbf4c0'}, 15: {'id': '1cc58abd'}, 16: {'id': '8c2457e9'}, 17: {'id': \"", " \"'d824d843'}}\"}"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ea027643\",\n+ \"id\": \"c669fb59\",\n \"metadata\": {},\n \"source\": [\n \"# Poisson equation\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_mixed-topology.py>`\\n\",\n@@ -22,15 +22,15 @@\n \"supported in DOLFINx.\\n\",\n \"```\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"393071bd\",\n+ \"id\": \"661f0a86\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n \"import numpy as np\\n\",\n \"from scipy.sparse.linalg import spsolve\\n\",\n@@ -51,37 +51,37 @@\n \"from dolfinx.io.utils import cell_perm_vtk\\n\",\n \"from dolfinx.mesh import CellType, Mesh, Topology\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"12c7569b\",\n+ \"id\": \"5434b793\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"if MPI.COMM_WORLD.size > 1:\\n\",\n \" print(\\\"Not yet running in parallel\\\")\\n\",\n \" exit(0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b39faf74\",\n+ \"id\": \"bc188c2c\",\n \"metadata\": {},\n \"source\": [\n \"## Create a mixed-topology mesh\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"edee2740\",\n+ \"id\": \"a9cfd2ea\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"nx = 16\\n\",\n \"ny = 16\\n\",\n \"nz = 16\\n\",\n \"n_cells = nx * ny * nz\\n\",\n@@ -136,25 +136,25 @@\n \"mesh = create_mesh(\\n\",\n \" MPI.COMM_WORLD, cells_np, [hexahedron._cpp_object, prism._cpp_object], geomx, part, 2\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b909a790\",\n+ \"id\": \"f8549de2\",\n \"metadata\": {},\n \"source\": [\n \"## Create a mixed-topology dofmap and function space\\n\",\n \"Create elements and dofmaps for each cell type\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9cc7c3aa\",\n+ \"id\": \"4e50f1dc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"elements = [\\n\",\n \" basix.create_element(basix.ElementFamily.P, basix.CellType.hexahedron, 1),\\n\",\n \" basix.create_element(basix.ElementFamily.P, basix.CellType.prism, 1),\\n\",\n \"]\\n\",\n@@ -172,27 +172,27 @@\n \"V_cpp = _cpp.fem.FunctionSpace_float64(\\n\",\n \" mesh, [e._cpp_object for e in dolfinx_elements], [dofmap._cpp_object for dofmap in dofmaps]\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1d783150\",\n+ \"id\": \"1dc4a9b9\",\n \"metadata\": {},\n \"source\": [\n \"## Creating and compiling a variational formulation\\n\",\n \"We create the variational forms for each cell type.\\n\",\n \"FIXME: This hack is required at the moment because UFL does not yet know\\n\",\n \"about mixed topology meshes.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fa495b10\",\n+ \"id\": \"051a8805\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"a = []\\n\",\n \"L = []\\n\",\n \"for i, cell_name in enumerate([\\\"hexahedron\\\", \\\"prism\\\"]):\\n\",\n \" print(f\\\"Creating form for {cell_name}\\\")\\n\",\n@@ -205,102 +205,102 @@\n \" a += [(ufl.inner(ufl.grad(u), ufl.grad(v)) - k**2 * u * v) * ufl.dx]\\n\",\n \" f = ufl.sin(ufl.pi * x[0]) * ufl.sin(ufl.pi * x[1])\\n\",\n \" L += [f * v * ufl.dx]\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"712c3422\",\n+ \"id\": \"9f4e966b\",\n \"metadata\": {},\n \"source\": [\n \"Compile the form\\n\",\n \"FIXME: For the time being, since UFL doesn't understand mixed topology\\n\",\n \"meshes, we have to call {py:meth}`mixed_topology_form\\n\",\n \"` instead of form.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fbf279cc\",\n+ \"id\": \"59baa129\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"a_form = mixed_topology_form(a, dtype=np.float64)\\n\",\n \"L_form = mixed_topology_form(L, dtype=np.float64)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"82d4a08b\",\n+ \"id\": \"a133a28a\",\n \"metadata\": {},\n \"source\": [\n \"## Assembling and solving the linear system\\n\",\n \"We use the native {py:class}`matrix` and\\n\",\n \"{py:class}`vector` format in DOLFINx to assemble\\n\",\n \"the left and right hand side of the linear system.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"02e80d6a\",\n+ \"id\": \"d6e0d010\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"A = assemble_matrix(a_form)\\n\",\n \"b = assemble_vector(L_form)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ba5db295\",\n+ \"id\": \"1a59152d\",\n \"metadata\": {},\n \"source\": [\n \"We use {py:func}`scipy.sparse.linalg.spsolve` to solve the\\n\",\n \"resulting linear system\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ef1d6e7e\",\n+ \"id\": \"37dbf4c0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"A_scipy = A.to_scipy()\\n\",\n \"b_scipy = b.array\\n\",\n \"x = spsolve(A_scipy, b_scipy)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d2125b63\",\n+ \"id\": \"1cc58abd\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"print(f\\\"Solution vector norm {np.linalg.norm(x)}\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"3f1538b5\",\n+ \"id\": \"8c2457e9\",\n \"metadata\": {},\n \"source\": [\n \"Mixed-topology I/O\\n\",\n \"We manually build a ASCII XDMF file to store the mesh\\n\",\n \"and solution\\n\",\n \"NOTE: this should be replaced with VTKHDF\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e3334fcf\",\n+ \"id\": \"d824d843\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"xdmf = \\\"\\\"\\\"\\n\",\n \"\\n\",\n \"\\n\",\n \" \\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/082c4b6b2083855631db76b9eac6b348/demo_pyamg.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/082c4b6b2083855631db76b9eac6b348/demo_pyamg.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_pyamg.ipynb", "source2": "demo_pyamg.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9876893939393939%", "Differences: {\"'cells'\": \"{0: {'id': '55d1930a'}, 1: {'id': 'cf210d3b'}, 2: {'id': '58dad082'}, 3: {'id': \"", " \"'be48f49b'}, 4: {'id': 'bbe7cae5'}, 5: {'id': '965c8ca1'}, 6: {'id': '489f0a34'}, 7: \"", " \"{'id': 'b370f1c0'}, 8: {'id': 'ee03480e'}, 9: {'id': '27870351'}, 10: {'id': \"", " \"'3ee9ab8a'}}\"}"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ab3dfa11\",\n+ \"id\": \"55d1930a\",\n \"metadata\": {},\n \"source\": [\n \"# Solve the Poisson and linearised elasticity equations using pyamg\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_pyamg.py>`\\n\",\n@@ -17,15 +17,15 @@\n \"[pyamg](https://github.com/pyamg/pyamg).\\n\",\n \"pyamg is not MPI-parallel, therefore this demo runs in serial only.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"71158ef8\",\n+ \"id\": \"cf210d3b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"import sys\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n@@ -50,15 +50,15 @@\n \" print(\\\"This demo works only in serial.\\\")\\n\",\n \" exit(0)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"b4e174a7\",\n+ \"id\": \"58dad082\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2,\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def poisson_problem(dtype: npt.DTypeLike, solver_type: str) -> None:\\n\",\n@@ -127,15 +127,15 @@\n \" file.write_mesh(mesh)\\n\",\n \" file.write_function(uh)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2330a530\",\n+ \"id\": \"be48f49b\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2,\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def nullspace_elasticty(Q: fem.FunctionSpace) -> list[np.ndarray]:\\n\",\n@@ -168,15 +168,15 @@\n \" B[dofs[1], 5] = -x2\\n\",\n \" return B\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ef08467e\",\n+ \"id\": \"bbe7cae5\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2,\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def elasticity_problem(dtype) -> None:\\n\",\n@@ -247,63 +247,63 @@\n \" with io.XDMFFile(mesh.comm, f\\\"out_pyamg/elasticity_{dtype.__name__}.xdmf\\\", \\\"w\\\") as file:\\n\",\n \" file.write_mesh(mesh)\\n\",\n \" file.write_function(uh)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2fb541fa\",\n+ \"id\": \"965c8ca1\",\n \"metadata\": {},\n \"source\": [\n \"Solve Poission problem with different scalar types\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"973ecf65\",\n+ \"id\": \"489f0a34\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"poisson_problem(np.float32, \\\"ruge_stuben\\\")\\n\",\n \"poisson_problem(np.float64, \\\"ruge_stuben\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8381233f\",\n+ \"id\": \"b370f1c0\",\n \"metadata\": {},\n \"source\": [\n \"For complex, pyamg requires smoothed aggregation multigrid\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1d8f0443\",\n+ \"id\": \"ee03480e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if not sys.platform.startswith(\\\"win32\\\"):\\n\",\n \" poisson_problem(np.complex64, \\\"smoothed_aggregation\\\")\\n\",\n \" poisson_problem(np.complex128, \\\"smoothed_aggregation\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4cb83b37\",\n+ \"id\": \"27870351\",\n \"metadata\": {},\n \"source\": [\n \"Solve elasticity problem with different scalar types\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1c88c1e9\",\n+ \"id\": \"3ee9ab8a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"elasticity_problem(np.float32)\\n\",\n \"elasticity_problem(np.float64)\"\n ]\n }\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/08f65cab6d6efa886b6e864593d5544d/demo_comm-pattern.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/08f65cab6d6efa886b6e864593d5544d/demo_comm-pattern.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_comm-pattern.ipynb", "source2": "demo_comm-pattern.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666666%", "Differences: {\"'cells'\": \"{0: {'id': '619fd554'}, 1: {'id': '8b291af2'}, 2: {'id': '14efe049'}, 3: {'id': \"", " \"'16187344'}, 4: {'id': 'f1f5c8a3'}, 5: {'id': '41b8f8c1'}, 6: {'id': 'd6c1b859'}, 7: \"", " \"{'id': '8bd6a81f'}, 8: {'id': '545de81e'}, 9: {'id': '3e4147c3'}, 10: {'id': \"", " \"'cbcfb2bf'}, 11: {'id': 'bcffe1ad'}, 12: {'id': '8398799b'}, 13: {'id': 'd6c153a2'}}\"}"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ee7ac276\",\n+ \"id\": \"619fd554\",\n \"metadata\": {},\n \"source\": [\n \"# Parallel communication pattern analysis\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_comm-pattern.py>`\\n\",\n@@ -25,15 +25,15 @@\n \"holds information on the ranks that the calling rank will send data to\\n\",\n \"and ranks that will send data to the caller.\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ff474c37\",\n+ \"id\": \"8b291af2\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"import itertools as it\\n\",\n \"import json\\n\",\n@@ -45,29 +45,29 @@\n \"from matplotlib.ticker import MaxNLocator\\n\",\n \"\\n\",\n \"from dolfinx import fem, graph, mesh\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f77ac5e8\",\n+ \"id\": \"14efe049\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"The following function plots a directed graph, with the edge weights\\n\",\n \"labeled. Each node is an MPI rank, and an edge represents a\\n\",\n \"communication edge. The edge weights indicate the volume of data\\n\",\n \"communicated.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7032617c\",\n+ \"id\": \"16187344\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def plot_graph(G: nx.MultiGraph, egde_labels=False):\\n\",\n \" \\\"\\\"\\\"Plot the communication graph.\\\"\\\"\\\"\\n\",\n@@ -99,28 +99,28 @@\n \" )\\n\",\n \" else:\\n\",\n \" nx.draw_networkx_edges(G, pos, width=width, edge_color=edge_color)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"055f0fb7\",\n+ \"id\": \"f1f5c8a3\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"The following function produces bar charts with the number of out-edges\\n\",\n \"per rank and the sum of the out edge weights (measure of data\\n\",\n \"volume) per rank.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"00156f2b\",\n+ \"id\": \"41b8f8c1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def plot_bar(G: nx.MultiGraph):\\n\",\n \" \\\"\\\"\\\"Plot bars charts with the degree (number of 'out-edges') and the\\n\",\n \" outward data volume for each rank.\\n\",\n \" \\\"\\\"\\\"\\n\",\n@@ -142,78 +142,78 @@\n \" ax2.set_ylabel(\\\"sum of edge weights\\\")\\n\",\n \" ax2.xaxis.set_major_locator(MaxNLocator(integer=True))\\n\",\n \" ax2.yaxis.set_major_locator(MaxNLocator(integer=True))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"618dae51\",\n+ \"id\": \"d6c1b859\",\n \"metadata\": {},\n \"source\": [\n \"Create a mesh and function space. The function space will build an\\n\",\n \"{py:class}`IndexMap ` for the\\n\",\n \"degree-of-freedom map. The {py:class}`IndexMap\\n\",\n \"` describes how the degrees-of-freedom are\\n\",\n \"distributed in parallel (across MPI ranks). From information on the\\n\",\n \"parallel distribution we will be able to compute the communication\\n\",\n \"graph.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ee28cd0c\",\n+ \"id\": \"8bd6a81f\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = mesh.create_box(\\n\",\n \" comm=MPI.COMM_WORLD,\\n\",\n \" points=[(0.0, 0.0, 0.0), (2.0, 1.0, 1.0)],\\n\",\n \" n=(22, 36, 19),\\n\",\n \" cell_type=mesh.CellType.tetrahedron,\\n\",\n \")\\n\",\n \"V = fem.functionspace(msh, (\\\"Lagrange\\\", 2))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"91966977\",\n+ \"id\": \"545de81e\",\n \"metadata\": {},\n \"source\": [\n \"The function {py:func}`comm_graph ` builds a\\n\",\n \"communication graph that represents data begin sent from the owning\\n\",\n \"rank to ranks that ghost the data. We use the degree-of-freedom map's\\n\",\n \"`IndexMap`. Building the communication data is collective across MPI\\n\",\n \"ranks. However, a non-empty graph is returned only on rank 0.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"99b480c3\",\n+ \"id\": \"3e4147c3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"comm_graph = graph.comm_graph(V.dofmap.index_map)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d43ab5f6\",\n+ \"id\": \"cbcfb2bf\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"A function for printing some communication graph metrics:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6ce213ee\",\n+ \"id\": \"bcffe1ad\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def print_stats(G):\\n\",\n \" print(\\\"Communication graph data:\\\")\\n\",\n \" print(f\\\" Num edges: {G.size()}\\\")\\n\",\n \" print(f\\\" Num local: {G.size('local')}\\\")\\n\",\n@@ -222,15 +222,15 @@\n \" print(f\\\" Average edges per node: {G.size() / G.order()}\\\")\\n\",\n \" if G.size() > 0:\\n\",\n \" print(f\\\" Average edge weight: {G.size('weight') / G.size()}\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"475b332b\",\n+ \"id\": \"8398799b\",\n \"metadata\": {},\n \"source\": [\n \"The graph data will be processed on rank 0. From the communication\\n\",\n \"graph data, edge and node data for creating a `NetworkX`` graph is build\\n\",\n \"using {py:fuc}`comm_graph_data `.\\n\",\n \"\\n\",\n \"Data for use with `NetworkX` can also be reconstructed from a JSON\\n\",\n@@ -239,15 +239,15 @@\n \"simulaton is executed and the graph data is written to file for later\\n\",\n \"analysis.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"b9aa3452\",\n+ \"id\": \"d6c153a2\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if msh.comm.rank == 0:\\n\",\n \" # To create a NetworkX directed graph we build graph data in a form\\n\",\n \" # from which we can create a NetworkX graph. Each edge will have a\\n\",\n \" # weight and a 'local(1)/remote(0)' memory indicator and each node\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/0aed751cd0874b28f5ae7bdc73e1060e/demo_biharmonic.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/0aed751cd0874b28f5ae7bdc73e1060e/demo_biharmonic.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_biharmonic.ipynb", "source2": "demo_biharmonic.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666667%", "Differences: {\"'cells'\": \"{0: {'id': 'de48fb40'}, 1: {'id': '0151ad7e'}, 2: {'id': '6db61a8e'}, 3: {'id': \"", " \"'7c7ac7db'}, 4: {'id': 'f2e91086'}, 5: {'id': 'cce6515b'}, 6: {'id': '4434b268'}, 7: \"", " \"{'id': 'c628dd3e'}, 8: {'id': '23bd9dde'}, 9: {'id': 'ed66e0e0'}, 10: {'id': \"", " \"'25a9d359'}, 11: {'id': 'eae3f0a6'}, 12: {'id': 'e82b4f6b'}, 13: {'id': '6fbc4d51'}, \"", " \"14: {'id': '80041b87'}, 15: {'id': 'b2ee2775'}, 16: {'id': 'eece07e7'}, 17: {'id': \"", " \"'71883455'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2509c85b\",\n+ \"id\": \"de48fb40\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"# Biharmonic equation\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n@@ -109,15 +109,15 @@\n \"\\n\",\n \"We first import the modules and functions that the program uses:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"aafca545\",\n+ \"id\": \"0151ad7e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n \"from petsc4py.PETSc import ScalarType # type: ignore\\n\",\n@@ -126,28 +126,28 @@\n \"from dolfinx import fem, io, mesh, plot\\n\",\n \"from dolfinx.fem.petsc import LinearProblem\\n\",\n \"from dolfinx.mesh import CellType, GhostMode\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"735368b3\",\n+ \"id\": \"6db61a8e\",\n \"metadata\": {},\n \"source\": [\n \"We begin by using {py:func}`create_rectangle\\n\",\n \"` to create a rectangular\\n\",\n \"{py:class}`Mesh ` of the domain, and creating a\\n\",\n \"finite element {py:class}`FunctionSpace `\\n\",\n \"$V$ on the mesh.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"51af6dfa\",\n+ \"id\": \"7c7ac7db\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = mesh.create_rectangle(\\n\",\n \" comm=MPI.COMM_WORLD,\\n\",\n \" points=((0.0, 0.0), (1.0, 1.0)),\\n\",\n \" n=(32, 32),\\n\",\n@@ -155,15 +155,15 @@\n \" ghost_mode=GhostMode.shared_facet,\\n\",\n \")\\n\",\n \"V = fem.functionspace(msh, (\\\"Lagrange\\\", 2))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ff88ec78\",\n+ \"id\": \"f2e91086\",\n \"metadata\": {},\n \"source\": [\n \"The second argument to {py:func}`functionspace\\n\",\n \"` is a tuple consisting of `(family,\\n\",\n \"degree)`, where `family` is the finite element family, and `degree`\\n\",\n \"specifies the polynomial degree. in this case `V` consists of\\n\",\n \"second-order, continuous Lagrange finite element functions.\\n\",\n@@ -179,68 +179,68 @@\n \"{py:func}`locate_entities_boundary\\n\",\n \"`).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"624aa167\",\n+ \"id\": \"cce6515b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"tdim = msh.topology.dim\\n\",\n \"msh.topology.create_connectivity(tdim - 1, tdim)\\n\",\n \"facets = mesh.exterior_facet_indices(msh.topology)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"49a1991d\",\n+ \"id\": \"4434b268\",\n \"metadata\": {},\n \"source\": [\n \"We now find the degrees-of-freedom that are associated with the\\n\",\n \"boundary facets using {py:func}`locate_dofs_topological\\n\",\n \"`\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"378a6e42\",\n+ \"id\": \"c628dd3e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"dofs = fem.locate_dofs_topological(V=V, entity_dim=1, entities=facets)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9905c808\",\n+ \"id\": \"23bd9dde\",\n \"metadata\": {},\n \"source\": [\n \"and use {py:func}`dirichletbc ` to create a\\n\",\n \"{py:class}`DirichletBC `\\n\",\n \"class that represents the boundary condition. In this case, we impose\\n\",\n \"Dirichlet boundary conditions with value $0$ on the entire boundary\\n\",\n \"$\\\\partial\\\\Omega$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c4930c51\",\n+ \"id\": \"ed66e0e0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"bc = fem.dirichletbc(value=ScalarType(0), dofs=dofs, V=V)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"17f313bf\",\n+ \"id\": \"25a9d359\",\n \"metadata\": {},\n \"source\": [\n \"Next, we express the variational problem using UFL.\\n\",\n \"\\n\",\n \"First, the penalty parameter $\\\\alpha$ is defined. In addition, we define\\n\",\n \"a variable `h` for the cell diameter $h_E$, a variable `n`for the\\n\",\n \"outward-facing normal vector $n$ and a variable `h_avg` for the\\n\",\n@@ -249,27 +249,27 @@\n \"`('+')` and `('-')` restricts a function to the `('+')` and `('-')`\\n\",\n \"sides of a facet.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"207c66a9\",\n+ \"id\": \"eae3f0a6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"alpha = ScalarType(8.0)\\n\",\n \"h = ufl.CellDiameter(msh)\\n\",\n \"n = ufl.FacetNormal(msh)\\n\",\n \"h_avg = (h(\\\"+\\\") + h(\\\"-\\\")) / 2.0\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"53bc8ba3\",\n+ \"id\": \"e82b4f6b\",\n \"metadata\": {},\n \"source\": [\n \"After that, we can define the variational problem consisting of the\\n\",\n \"bilinear form $a$ and the linear form $L$. The source term is prescribed\\n\",\n \"as $f = 4.0 \\\\pi^4\\\\sin(\\\\pi x)\\\\sin(\\\\pi y)$. Note that with `dS`,\\n\",\n \"integration is carried out over all the interior facets\\n\",\n \"$\\\\mathcal{E}_h^{\\\\rm int}$, whereas with `ds` it would be only the facets\\n\",\n@@ -277,15 +277,15 @@\n \"$[\\\\!\\\\![ w ]\\\\!\\\\!] = w_{+} \\\\cdot n_{+} + w_{-} \\\\cdot n_{-}$ w.r.t. the\\n\",\n \"outward-facing normal vector $n$ is in UFL available as `jump(w, n)`.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1dceb17e\",\n+ \"id\": \"6fbc4d51\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Define variational problem\\n\",\n \"u = ufl.TrialFunction(V)\\n\",\n \"v = ufl.TestFunction(V)\\n\",\n \"x = ufl.SpatialCoordinate(msh)\\n\",\n@@ -298,28 +298,28 @@\n \" + alpha / h_avg * ufl.inner(ufl.jump(ufl.grad(u), n), ufl.jump(ufl.grad(v), n)) * ufl.dS\\n\",\n \")\\n\",\n \"L = ufl.inner(f, v) * ufl.dx\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"616d8b62\",\n+ \"id\": \"80041b87\",\n \"metadata\": {},\n \"source\": [\n \"We create a {py:class}`LinearProblem `\\n\",\n \"object that brings together the variational problem, the Dirichlet\\n\",\n \"boundary condition, and which specifies the linear solver. In this\\n\",\n \"case we use a direct (LU) solver. The {py:func}`solve\\n\",\n \"` will compute a solution.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a47ebba7\",\n+ \"id\": \"b2ee2775\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"problem = LinearProblem(\\n\",\n \" a,\\n\",\n \" L,\\n\",\n \" bcs=[bc],\\n\",\n@@ -329,25 +329,25 @@\n \"uh = problem.solve()\\n\",\n \"assert isinstance(uh, fem.Function)\\n\",\n \"assert problem.solver.getConvergedReason() > 0\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9d5c8d06\",\n+ \"id\": \"eece07e7\",\n \"metadata\": {},\n \"source\": [\n \"The solution can be written to a {py:class}`XDMFFile\\n\",\n \"` file visualization with ParaView or VisIt\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"dd883aaf\",\n+ \"id\": \"71883455\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"out_folder = Path(\\\"out_biharmonic\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\\n\",\n \"with io.XDMFFile(msh.comm, out_folder / \\\"biharmonic.xdmf\\\", \\\"w\\\") as file:\\n\",\n \" V1 = fem.functionspace(msh, (\\\"Lagrange\\\", 1))\\n\",\n@@ -355,24 +355,24 @@\n \" u1.interpolate(uh)\\n\",\n \" file.write_mesh(msh)\\n\",\n \" file.write_function(u1)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"371dfdb2\",\n+ \"id\": \"adf59800\",\n \"metadata\": {},\n \"source\": [\n \"and displayed using [pyvista](https://docs.pyvista.org/).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6852cbed\",\n+ \"id\": \"f7f408cd\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"try:\\n\",\n \" import pyvista\\n\",\n \"\\n\",\n \" cells, types, x = plot.vtk_mesh(V)\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/0ff7b5905586c05f3ded87f72380f93b/demo_lagrange_variants.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/0ff7b5905586c05f3ded87f72380f93b/demo_lagrange_variants.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_lagrange_variants.ipynb", "source2": "demo_lagrange_variants.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666666%", "Differences: {\"'cells'\": \"{0: {'id': '68d8328a'}, 1: {'id': '2cf0d537'}, 2: {'id': 'bcc66f07'}, 3: {'id': \"", " \"'6dd9b83c'}, 4: {'id': '4fe46448'}, 5: {'id': 'bf584b4c'}, 6: {'id': '2cdf94e0'}, 7: \"", " \"{'id': '5786621c'}, 8: {'id': '25cf3b65'}, 9: {'id': 'c3d489b7'}, 10: {'id': \"", " \"'9146f559'}, 11: {'id': '79a12527'}, 12: {'id': '4c72ee7e'}, 13: {'id': '08f84397'}}\"}"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c648a223\",\n+ \"id\": \"68d8328a\",\n \"metadata\": {},\n \"source\": [\n \"# Variants of Lagrange elements\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_lagrange_variants.py>`\\n\",\n@@ -19,15 +19,15 @@\n \"\\n\",\n \"We begin this demo by importing the required modules.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4590c9dc\",\n+ \"id\": \"2cf0d537\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n \"import matplotlib.pylab as plt\\n\",\n \"\\n\",\n@@ -35,15 +35,15 @@\n \"import basix.ufl\\n\",\n \"import ufl\\n\",\n \"from dolfinx import default_real_type, fem, mesh\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a167e0a5\",\n+ \"id\": \"bcc66f07\",\n \"metadata\": {},\n \"source\": [\n \"## Equispaced versus Gauss--Lobatto--Legendre (GLL) points\\n\",\n \"\\n\",\n \"The basis functions of a Lagrange element are defined by placing\\n\",\n \"points on the reference element, with each basis function equal to 1\\n\",\n \"at one point and 0 at all the other points. To demonstrate the\\n\",\n@@ -57,25 +57,25 @@\n \"size is 1, so we take the slice `[0, :, :]` to get a 2-dimensional\\n\",\n \"array.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d574474e\",\n+ \"id\": \"6dd9b83c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"N = 20\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"024f1c8d\",\n+ \"id\": \"4fe46448\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"element = basix.ufl.element(\\n\",\n \" basix.ElementFamily.P,\\n\",\n \" basix.CellType.interval,\\n\",\n \" 10,\\n\",\n@@ -91,15 +91,15 @@\n \" plt.ylim([-1, 6])\\n\",\n \" plt.savefig(\\\"demo_lagrange_variants_equispaced_10.png\\\")\\n\",\n \" plt.clf()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"5e02c000\",\n+ \"id\": \"bf584b4c\",\n \"metadata\": {},\n \"source\": [\n \"![The basis functions of a degree 10 Lagrange space defined using\\n\",\n \"equispaced points.](demo_lagrange_variants_equispaced_10.png)\\n\",\n \"\\n\",\n \"The basis functions exhibit large peaks towards the ends of the\\n\",\n \"interval. This is known as [Runge's\\n\",\n@@ -112,15 +112,15 @@\n \"points](https://en.wikipedia.org/wiki/Gaussian_quadrature#Gauss%E2%80%93Lobatto_rules)\\n\",\n \"to define the basis functions.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"cdbd98fc\",\n+ \"id\": \"2cdf94e0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"element = basix.ufl.element(\\n\",\n \" basix.ElementFamily.P,\\n\",\n \" basix.CellType.interval,\\n\",\n \" 10,\\n\",\n@@ -135,15 +135,15 @@\n \" plt.ylim([-1, 6])\\n\",\n \" plt.savefig(\\\"demo_lagrange_variants_gll_10.png\\\")\\n\",\n \" plt.clf()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2f92d307\",\n+ \"id\": \"5786621c\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"![The basis functions of a degree 10 Lagrange space defined using GLL\\n\",\n \"points.](demo_lagrange_variants_gll_10.png)\\n\",\n \"\\n\",\n@@ -157,38 +157,38 @@\n \"function into a finite element space. For this example, we define a\\n\",\n \"saw tooth wave that will be interpolated.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2c1cc988\",\n+ \"id\": \"25cf3b65\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def saw_tooth(x):\\n\",\n \" f = 4 * abs(x - 0.43)\\n\",\n \" for _ in range(8):\\n\",\n \" f = abs(f - 0.3)\\n\",\n \" return f\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d7d77095\",\n+ \"id\": \"c3d489b7\",\n \"metadata\": {},\n \"source\": [\n \"We begin by interpolating the saw tooth wave with the two Lagrange\\n\",\n \"elements, and plot the finite element interpolation.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"149d86c8\",\n+ \"id\": \"9146f559\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = mesh.create_unit_interval(MPI.COMM_WORLD, N)\\n\",\n \"\\n\",\n \"x = ufl.SpatialCoordinate(msh)\\n\",\n \"u_exact = saw_tooth(x[0])\\n\",\n@@ -215,15 +215,15 @@\n \" plt.title(variant.name)\\n\",\n \" plt.savefig(f\\\"demo_lagrange_variants_interpolation_{variant.name}.png\\\")\\n\",\n \" plt.clf()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0c661bad\",\n+ \"id\": \"79a12527\",\n \"metadata\": {},\n \"source\": [\n \"![](demo_lagrange_variants_interpolation_equispaced.png)\\n\",\n \"![](demo_lagrange_variants_interpolation_gll_warped.png)\\n\",\n \"\\n\",\n \"The plots illustrate that Runge's phenomenon leads to the\\n\",\n \"interpolation being less accurate when using the equispaced variant of\\n\",\n@@ -239,15 +239,15 @@\n \"variant is considerably smaller than the error for the equispaced\\n\",\n \"variant.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2de9f964\",\n+ \"id\": \"4c72ee7e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"for variant in [basix.LagrangeVariant.equispaced, basix.LagrangeVariant.gll_warped]:\\n\",\n \" ufl_element = basix.ufl.element(\\n\",\n \" basix.ElementFamily.P, basix.CellType.interval, 10, variant, dtype=default_real_type\\n\",\n \" )\\n\",\n@@ -257,15 +257,15 @@\n \" M = fem.form((u_exact - uh) ** 2 * ufl.dx)\\n\",\n \" error = msh.comm.allreduce(fem.assemble_scalar(M), op=MPI.SUM)\\n\",\n \" print(f\\\"Computed L2 interpolation error ({variant.name}):\\\", error**0.5)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"128e008c\",\n+ \"id\": \"08f84397\",\n \"metadata\": {},\n \"source\": [\n \"## Available Lagrange variants\\n\",\n \"\\n\",\n \"Basix supports numerous Lagrange variants, including:\\n\",\n \"\\n\",\n \"- `basix.LagrangeVariant.equispaced`\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/1c10919af1d1c2689ff1982d6e82b898/demo_navier-stokes.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/1c10919af1d1c2689ff1982d6e82b898/demo_navier-stokes.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_navier-stokes.ipynb", "source2": "demo_navier-stokes.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666667%", "Differences: {\"'cells'\": \"{0: {'id': 'ea4b7f8d'}, 1: {'id': 'a0dcad5d'}, 2: {'id': 'eaa90602'}, 3: {'id': \"", " \"'ab5512f4'}, 4: {'id': '122e7e0d'}, 5: {'id': 'd748a160'}, 6: {'id': 'e037560d'}, 7: \"", " \"{'id': '5af5b555'}, 8: {'id': '600cfb46'}, 9: {'id': '1bf45cbd'}, 10: {'id': \"", " \"'d5bf99c2'}, 11: {'id': '03543b24'}, 12: {'id': '32129aae'}, 13: {'id': '628eda8c'}, \"", " \"14: {'id': '3f20b89c'}, 15: {'id': '672fffc3'}, 16: {'id': '41f1a3f0'}, 17: {'id': \"", " \"'2fc766c0'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7246f7ce\",\n+ \"id\": \"ea4b7f8d\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"# Divergence conforming discontinuous Galerkin method for the Navier--Stokes equations # noqa\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n@@ -174,15 +174,15 @@\n \"\\n\",\n \"We begin by importing the required modules and functions\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a1697db5\",\n+ \"id\": \"a0dcad5d\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n@@ -196,26 +196,26 @@\n \"if np.issubdtype(PETSc.ScalarType, np.complexfloating):\\n\",\n \" print(\\\"Demo should only be executed with DOLFINx real mode\\\")\\n\",\n \" exit(0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b12f90b3\",\n+ \"id\": \"eaa90602\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"We also define some helper functions that will be used later\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c1669be0\",\n+ \"id\": \"ab5512f4\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def norm_L2(comm, v):\\n\",\n \" \\\"\\\"\\\"Compute the L2(\\u03a9)-norm of v\\\"\\\"\\\"\\n\",\n \" return np.sqrt(\\n\",\n \" comm.allreduce(fem.assemble_scalar(fem.form(ufl.inner(v, v) * ufl.dx)), op=MPI.SUM)\\n\",\n@@ -254,49 +254,49 @@\n \"def f_expr(x):\\n\",\n \" \\\"\\\"\\\"Expression for the applied force\\\"\\\"\\\"\\n\",\n \" return np.vstack((np.zeros_like(x[0]), np.zeros_like(x[0])))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ad5f49c5\",\n+ \"id\": \"122e7e0d\",\n \"metadata\": {},\n \"source\": [\n \"We define some simulation parameters\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5e1d2da0\",\n+ \"id\": \"d748a160\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"n = 16\\n\",\n \"num_time_steps = 25\\n\",\n \"t_end = 10\\n\",\n \"Re = 25 # Reynolds Number\\n\",\n \"k = 1 # Polynomial degree\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"77600d24\",\n+ \"id\": \"e037560d\",\n \"metadata\": {},\n \"source\": [\n \"Next, we create a mesh and the required functions spaces over it.\\n\",\n \"Since the velocity uses an $H(\\\\text{div})$-conforming function space,\\n\",\n \"we also create a vector valued discontinuous Lagrange space to\\n\",\n \"interpolate into for artifact free visualisation.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4b612b91\",\n+ \"id\": \"5af5b555\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = mesh.create_unit_square(MPI.COMM_WORLD, n, n)\\n\",\n \"\\n\",\n \"# Function spaces for the velocity and for the pressure\\n\",\n \"V = fem.functionspace(msh, (\\\"Raviart-Thomas\\\", k + 1))\\n\",\n@@ -321,25 +321,25 @@\n \"\\n\",\n \"def jump(phi, n):\\n\",\n \" return ufl.outer(phi(\\\"+\\\"), n(\\\"+\\\")) + ufl.outer(phi(\\\"-\\\"), n(\\\"-\\\"))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f68a63a6\",\n+ \"id\": \"600cfb46\",\n \"metadata\": {},\n \"source\": [\n \"We set up the variational formulation of the Stokes problem for\\n\",\n \"the initial condition, omitting the convective term:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2ac6f6d2\",\n+ \"id\": \"1bf45cbd\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"a = (1.0 / Re) * (\\n\",\n \" ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx\\n\",\n \" - ufl.inner(ufl.avg(ufl.grad(u)), jump(v, n)) * ufl.dS\\n\",\n \" - ufl.inner(jump(u, n), ufl.avg(ufl.grad(v))) * ufl.dS\\n\",\n@@ -360,47 +360,47 @@\n \" + (alpha / h) * ufl.inner(ufl.outer(u_D, n), ufl.outer(v, n)) * ufl.ds\\n\",\n \")\\n\",\n \"L += ufl.inner(fem.Constant(msh, default_real_type(0.0)), q) * ufl.dx\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e8faaa76\",\n+ \"id\": \"d5bf99c2\",\n \"metadata\": {},\n \"source\": [\n \"We create the {py:class}`Dirichlet boundary condition\\n\",\n \"`\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"54b5d77e\",\n+ \"id\": \"03543b24\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh.topology.create_connectivity(msh.topology.dim - 1, msh.topology.dim)\\n\",\n \"boundary_facets = mesh.exterior_facet_indices(msh.topology)\\n\",\n \"boundary_vel_dofs = fem.locate_dofs_topological(V, msh.topology.dim - 1, boundary_facets)\\n\",\n \"bc_u = fem.dirichletbc(u_D, boundary_vel_dofs)\\n\",\n \"bcs = [bc_u]\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7c979c1c\",\n+ \"id\": \"32129aae\",\n \"metadata\": {},\n \"source\": [\n \"and solve the problem for the initial condition\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"3d612ed7\",\n+ \"id\": \"628eda8c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"solver_options = {\\n\",\n \" \\\"ksp_type\\\": \\\"preonly\\\",\\n\",\n \" \\\"pc_type\\\": \\\"lu\\\",\\n\",\n \" \\\"pc_factor_mat_solver_type\\\": \\\"mumps\\\",\\n\",\n@@ -431,43 +431,43 @@\n \" exit(0)\\n\",\n \" else:\\n\",\n \" raise e\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4d03105a\",\n+ \"id\": \"3f20b89c\",\n \"metadata\": {},\n \"source\": [\n \"Subtract the average of the pressure since it is only determined up to\\n\",\n \"a constant\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1f4f2394\",\n+ \"id\": \"672fffc3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"p_h.x.array[:] -= domain_average(msh, p_h)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"6820e388\",\n+ \"id\": \"41f1a3f0\",\n \"metadata\": {},\n \"source\": [\n \"Write initial condition to file\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fb98d3b6\",\n+ \"id\": \"2fc766c0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"t = 0.0\\n\",\n \"if has_adios2:\\n\",\n \" u_vis = fem.Function(W, name=\\\"u_init\\\")\\n\",\n \" u_vis.interpolate(u_h)\\n\",\n@@ -477,45 +477,45 @@\n \" p_file.write(t)\\n\",\n \"else:\\n\",\n \" print(\\\"File output requires ADIOS2.\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"34716c70\",\n+ \"id\": \"b2265e64\",\n \"metadata\": {},\n \"source\": [\n \"Create function to store solution and previous time step\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"425585f3\",\n+ \"id\": \"27fedeb8\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"u_n = fem.Function(V, name=\\\"u_prev\\\")\\n\",\n \"u_n.x.array[:] = u_h.x.array\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1ba403c9\",\n+ \"id\": \"1c037c2e\",\n \"metadata\": {},\n \"source\": [\n \"Now we add the time stepping and convective terms and\\n\",\n \"set up the {py:class}`LinearProblem\\n\",\n \"`\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c64f7f7a\",\n+ \"id\": \"14d3856c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"lmbda = ufl.conditional(ufl.gt(ufl.dot(u_n, n), 0), 1, 0)\\n\",\n \"u_uw = lmbda(\\\"+\\\") * u(\\\"+\\\") + lmbda(\\\"-\\\") * u(\\\"-\\\")\\n\",\n \"a += (\\n\",\n \" ufl.inner(u / delta_t, v) * ufl.dx\\n\",\n@@ -539,24 +539,24 @@\n \" petsc_options_prefix=\\\"demo_stokes__navier_stokes_problem_\\\",\\n\",\n \" petsc_options=solver_options,\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c204d4e4\",\n+ \"id\": \"8b52f301\",\n \"metadata\": {},\n \"source\": [\n \"We perform the time-stepping as a for-loop\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c40b6ffd\",\n+ \"id\": \"b4bc6a1d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"for n in range(num_time_steps):\\n\",\n \" t += delta_t.value\\n\",\n \"\\n\",\n \" navier_stokes_problem.solve()\\n\",\n@@ -576,24 +576,24 @@\n \" p_file.close()\\n\",\n \"except NameError:\\n\",\n \" pass\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e619ded3\",\n+ \"id\": \"3ba9b529\",\n \"metadata\": {},\n \"source\": [\n \"Now we compare the computed solution to the exact solution\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"035d30d8\",\n+ \"id\": \"5ca3c08a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Function spaces for exact velocity and pressure\\n\",\n \"V_e = fem.functionspace(msh, (\\\"Lagrange\\\", k + 3, (gdim,)))\\n\",\n \"Q_e = fem.functionspace(msh, (\\\"Lagrange\\\", k + 2))\\n\",\n \"\\n\",\n@@ -606,24 +606,24 @@\n \"# Compute errors\\n\",\n \"e_u = norm_L2(msh.comm, u_h - u_e)\\n\",\n \"e_div_u = norm_L2(msh.comm, ufl.div(u_h))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b3d1414f\",\n+ \"id\": \"8b5db8e2\",\n \"metadata\": {},\n \"source\": [\n \"This scheme conserves mass exactly, so we check this\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"034f423c\",\n+ \"id\": \"e39dd94a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"assert np.isclose(e_div_u, 0.0, atol=float(1.0e5 * np.finfo(default_real_type).eps))\\n\",\n \"p_e_avg = domain_average(msh, p_e)\\n\",\n \"e_p = norm_L2(msh.comm, p_h - (p_e - p_e_avg))\\n\",\n \"\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/244d514e5e2d1484e9f045150ae16a27/demo_gmsh.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/244d514e5e2d1484e9f045150ae16a27/demo_gmsh.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_gmsh.ipynb", "source2": "demo_gmsh.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9865679824561404%", "Differences: {\"'cells'\": \"{0: {'id': '076929db'}, 1: {'id': '0e88f3a4'}, 2: {'id': '7b76bee1'}, 3: {'id': \"", " \"'a3a1165f'}, 4: {'id': 'ff9be945'}, 5: {'id': '569c2d46'}, 6: {'id': '71c2dafa'}, 7: \"", " \"{'id': 'c436a1ed'}, 8: {'id': '836ff190'}, 9: {'id': 'f5f31d66'}, 10: {'id': \"", " \"'fe87604d'}, 11: {'id': '3c2fff9b'}, 12: {'id': '82349772'}, 13: {'id': 'd3383791'}, \"", " \"14: {'id': '76a71a64'}, 15: {'id': '32569e02'}, 16: {'id': 'fc06ed8b'}, 17: {'id': \"", " \"'9ec46008'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"15fa19f0\",\n+ \"id\": \"076929db\",\n \"metadata\": {},\n \"source\": [\n \"# Mesh generation with Gmsh\\n\",\n \"\\n\",\n \"Copyright (C) 2020-2023 Garth N. Wells and J\\u00f8rgen S. Dokken\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n@@ -14,53 +14,53 @@\n \"* {download}`Python script <./demo_gmsh.py>`\\n\",\n \"* {download}`Jupyter notebook <./demo_gmsh.ipynb>`\\n\",\n \"```\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"81a46998\",\n+ \"id\": \"0e88f3a4\",\n \"metadata\": {},\n \"source\": [\n \"This demo shows how to create meshes using the Gmsh Python interface.\\n\",\n \"\\n\",\n \"The Gmsh module is required for this demo.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"56abcced\",\n+ \"id\": \"7b76bee1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n \"import gmsh # type: ignore\\n\",\n \"\\n\",\n \"from dolfinx.io import XDMFFile\\n\",\n \"from dolfinx.io import gmsh as gmshio\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9681a0d8\",\n+ \"id\": \"a3a1165f\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Gmsh model builders\\n\",\n \"\\n\",\n \"The following functions add Gmsh meshes to a 'model'.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"aa3f2aef\",\n+ \"id\": \"ff9be945\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def gmsh_sphere(model: gmsh.model, name: str) -> gmsh.model:\\n\",\n \" \\\"\\\"\\\"Create a Gmsh model of a sphere and tag sub entitites\\n\",\n@@ -173,28 +173,28 @@\n \" model.addPhysicalGroup(3, volume_entities, tag=1)\\n\",\n \" model.setPhysicalName(3, 1, \\\"Mesh volume\\\")\\n\",\n \" return model\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"3b0281dc\",\n+ \"id\": \"569c2d46\",\n \"metadata\": {},\n \"source\": [\n \"## DOLFINx mesh creation and file output\\n\",\n \"\\n\",\n \"The following function creates a DOLFINx mesh from a Gmsh model, and\\n\",\n \"cell and facets tags. The mesh and the tags are written to an XDMF file\\n\",\n \"for visualisation, e.g. using ParaView.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"3817422a\",\n+ \"id\": \"71c2dafa\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"\\n\",\n \"\\n\",\n@@ -247,139 +247,139 @@\n \" mesh_data.mesh.geometry,\\n\",\n \" geometry_xpath=f\\\"/Xdmf/Domain/Grid[@Name='{name}']/Geometry\\\",\\n\",\n \" )\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"492b66e9\",\n+ \"id\": \"c436a1ed\",\n \"metadata\": {},\n \"source\": [\n \"## Generate meshes\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"00aa5cb3\",\n+ \"id\": \"836ff190\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Create a Gmsh model and set the verbosity level.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"de30b7c3\",\n+ \"id\": \"f5f31d66\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"gmsh.initialize()\\n\",\n \"gmsh.option.setNumber(\\\"General.Terminal\\\", 0)\\n\",\n \"\\n\",\n \"# Create model\\n\",\n \"model = gmsh.model()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"18cf0d9e\",\n+ \"id\": \"fe87604d\",\n \"metadata\": {},\n \"source\": [\n \"First, we create a Gmsh model of a sphere using tetrahedral cells\\n\",\n \"(linear geometry), then create independent meshes on each MPI rank and\\n\",\n \"write each mesh to an XDMF file. The MPI rank is appended to the\\n\",\n \"filename since the meshes are not distributed.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4179f2f5\",\n+ \"id\": \"3c2fff9b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"model = gmsh_sphere(model, \\\"Sphere\\\")\\n\",\n \"model.setCurrent(\\\"Sphere\\\")\\n\",\n \"create_mesh(MPI.COMM_SELF, model, \\\"sphere\\\", f\\\"out_gmsh/mesh_rank_{MPI.COMM_WORLD.rank}.xdmf\\\", \\\"w\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"6eb4bfdc\",\n+ \"id\": \"82349772\",\n \"metadata\": {},\n \"source\": [\n \"Next, we create a Gmsh model of a sphere with a box removed and using\\n\",\n \"tetrahedral cells (linear geometry), then create a distributed mesh.\\n\",\n \"The distributed mesh is written to file. The write option ``\\\"w\\\"`` is\\n\",\n \"passed to create a new XDMF file.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c5e4349b\",\n+ \"id\": \"d3383791\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"model = gmsh_sphere_minus_box(model, \\\"Sphere minus box\\\")\\n\",\n \"model.setCurrent(\\\"Sphere minus box\\\")\\n\",\n \"create_mesh(MPI.COMM_WORLD, model, \\\"ball_d1\\\", \\\"out_gmsh/mesh.xdmf\\\", \\\"w\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"673b404e\",\n+ \"id\": \"76a71a64\",\n \"metadata\": {},\n \"source\": [\n \"For the mesh of the sphere with a box remove, we can increase the\\n\",\n \"degree of the geometry representation to 2 (quadratic geometry\\n\",\n \"representation). The higher-order distributed mesh is appended to the\\n\",\n \"XDMF file.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a189e41c\",\n+ \"id\": \"32569e02\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"model.mesh.generate(3)\\n\",\n \"gmsh.option.setNumber(\\\"General.Terminal\\\", 1)\\n\",\n \"model.mesh.setOrder(2)\\n\",\n \"gmsh.option.setNumber(\\\"General.Terminal\\\", 0)\\n\",\n \"create_mesh(MPI.COMM_WORLD, model, \\\"ball_d2\\\", \\\"out_gmsh/mesh.xdmf\\\", \\\"a\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a673e4b8\",\n+ \"id\": \"fc06ed8b\",\n \"metadata\": {},\n \"source\": [\n \"Finally, we create a distributed mesh using hexahedral cells of\\n\",\n \"geometric degree 2, and append the mesh to the XDMF file.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"02c2ba7d\",\n+ \"id\": \"9ec46008\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"model = gmsh_ring(model, \\\"Hexahedral mesh\\\")\\n\",\n \"model.setCurrent(\\\"Hexahedral mesh\\\")\\n\",\n \"create_mesh(MPI.COMM_WORLD, model, \\\"hex_d2\\\", \\\"out_gmsh/mesh.xdmf\\\", \\\"a\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"421c02a1\",\n+ \"id\": \"883e5d23\",\n \"metadata\": {},\n \"source\": [\n \"The generated meshes can be visualised using\\n\",\n \"[ParaView](https://www.paraview.org/).\"\n ]\n }\n ],\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/3a2e8b3062e32f7fa335a0116fae9bef/demo_hdg.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/3a2e8b3062e32f7fa335a0116fae9bef/demo_hdg.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_hdg.ipynb", "source2": "demo_hdg.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9871323529411764%", "Differences: {\"'cells'\": \"{0: {'id': 'c9727842'}, 1: {'id': 'd388d4da'}, 2: {'id': 'a8616902'}, 3: {'id': \"", " \"'cb306978'}, 4: {'id': 'eecb0bd9'}, 5: {'id': '8c9e3e67'}, 6: {'id': '336dc124'}, 7: \"", " \"{'id': '7a5e22a3'}, 8: {'id': 'a4aa2e29'}, 9: {'id': '423cbd96'}, 10: {'id': \"", " \"'e140fab2'}, 11: {'id': '7395d7ba'}, 12: {'id': '8c7e8519'}, 13: {'id': '09533fd0'}, \"", " \"14: {'id': '8fa809dd'}, 15: {'id': '96b76d6a'}, 16: {'id': '1d88f2a5'}, 17: {'id': \"", " \"'9a52fbaf'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c30a33a9\",\n+ \"id\": \"c9727842\",\n \"metadata\": {},\n \"source\": [\n \"# HDG scheme for the Poisson equation\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_hdg.py>`\\n\",\n@@ -20,15 +20,15 @@\n \"- Use `ufl.MixedFunctionSpace` to defined blocked problems.\\n\",\n \"- Assemble mixed systems with multiple, related meshes\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ca20a7f5\",\n+ \"id\": \"d388d4da\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n@@ -48,43 +48,43 @@\n \" create_vector,\\n\",\n \" set_bc,\\n\",\n \")\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"71d38a36\",\n+ \"id\": \"a8616902\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"We start by creating two convenience functions: One to compute\\n\",\n \"the L2 norm of a UFL expression, and one to define the integration\\n\",\n \"domains for the facets of all cells in a mesh.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"87b82e2e\",\n+ \"id\": \"cb306978\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def norm_L2(v: ufl.core.expr.Expr, measure: ufl.Measure = ufl.dx) -> np.inexact:\\n\",\n \" \\\"\\\"\\\"Convenience function to compute the L2 norm of a UFL expression.\\\"\\\"\\\"\\n\",\n \" compiled_form = fem.form(ufl.inner(v, v) * measure)\\n\",\n \" comm = compiled_form.mesh.comm\\n\",\n \" return np.sqrt(comm.allreduce(fem.assemble_scalar(compiled_form), op=MPI.SUM))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"78dbeab0\",\n+ \"id\": \"eecb0bd9\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"In DOLFINx, we represent integration domains over entities of\\n\",\n \"codimension > 0 as a tuple `(cell_idx, local_entity_idx)`,\\n\",\n \"where `cell_idx` is the index of the cell in the mesh\\n\",\n@@ -93,15 +93,15 @@\n \"integrate over the facets of each cell (for internal facets,\\n\",\n \"there will be repeat entries, from the viewpoint of the connected cells).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"da9fdfc1\",\n+ \"id\": \"8c9e3e67\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def compute_cell_boundary_facets(msh: dolfinx.mesh.Mesh) -> np.ndarray:\\n\",\n \" \\\"\\\"\\\"Compute the integration entities for integrals around the\\n\",\n \" boundaries of all cells in msh.\\n\",\n \"\\n\",\n@@ -118,85 +118,85 @@\n \" n_c = msh.topology.index_map(tdim).size_local\\n\",\n \" return np.vstack((np.repeat(np.arange(n_c), n_f), np.tile(np.arange(n_f), n_c))).T.flatten()\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"3f50c134\",\n+ \"id\": \"336dc124\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def u_e(x):\\n\",\n \" \\\"\\\"\\\"Exact solution.\\\"\\\"\\\"\\n\",\n \" u_e = 1\\n\",\n \" for i in range(tdim):\\n\",\n \" u_e *= ufl.sin(ufl.pi * x[i])\\n\",\n \" return u_e\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a36c291c\",\n+ \"id\": \"7a5e22a3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"comm = MPI.COMM_WORLD\\n\",\n \"rank = comm.rank\\n\",\n \"dtype = PETSc.ScalarType\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"df2f8506\",\n+ \"id\": \"a4aa2e29\",\n \"metadata\": {},\n \"source\": [\n \"Create the mesh\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"54906eee\",\n+ \"id\": \"423cbd96\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"n = 8 # Number of elements in each direction\\n\",\n \"msh = mesh.create_unit_cube(comm, n, n, n, ghost_mode=mesh.GhostMode.none)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c1b1ccea\",\n+ \"id\": \"e140fab2\",\n \"metadata\": {},\n \"source\": [\n \"We need to create a broken Lagrange space defined over the facets of\\n\",\n \"the mesh. To do so, we require a sub-mesh of the all facets. We begin\\n\",\n \"by creating a list of all of the facets in the mesh\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"b8282592\",\n+ \"id\": \"7395d7ba\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"tdim = msh.topology.dim\\n\",\n \"fdim = tdim - 1\\n\",\n \"msh.topology.create_entities(fdim)\\n\",\n \"facet_imap = msh.topology.index_map(fdim)\\n\",\n \"num_facets = facet_imap.size_local + facet_imap.num_ghosts\\n\",\n \"facets = np.arange(num_facets, dtype=np.int32)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"357816b1\",\n+ \"id\": \"8c7e8519\",\n \"metadata\": {},\n \"source\": [\n \"The submesh is created with {py:func}`dolfinx.mesh.create_submesh`,\\n\",\n \"which takes in the mesh to extract entities from, the topological\\n\",\n \"dimension of the entities, and the set of entities to create the\\n\",\n \"submesh (indices local to process).\\n\",\n \"```{admonition} Note\\n\",\n@@ -204,157 +204,157 @@\n \"isn't necessarily the identity in parallel\\n\",\n \"```\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"231bb270\",\n+ \"id\": \"09533fd0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"facet_mesh, facet_mesh_emap = mesh.create_submesh(msh, fdim, facets)[:2]\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b2c0779b\",\n+ \"id\": \"8fa809dd\",\n \"metadata\": {},\n \"source\": [\n \"Define function spaces\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"22d08883\",\n+ \"id\": \"96b76d6a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"k = 3 # Polynomial order\\n\",\n \"V = fem.functionspace(msh, (\\\"Discontinuous Lagrange\\\", k))\\n\",\n \"Vbar = fem.functionspace(facet_mesh, (\\\"Discontinuous Lagrange\\\", k))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"fac22350\",\n+ \"id\": \"1d88f2a5\",\n \"metadata\": {},\n \"source\": [\n \"Trial and test functions in mixed space, we use {py:class}`\\n\",\n \"ufl.MixedFunctionSpace`\\n\",\n \"to create a single function space object we can extract {py:func}`\\n\",\n \"ufl.TrialFunctions`\\n\",\n \"and {py:func}`ufl.TestFunctions` from.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"62cfb3f6\",\n+ \"id\": \"9a52fbaf\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"W = ufl.MixedFunctionSpace(V, Vbar)\\n\",\n \"u, ubar = ufl.TrialFunctions(W)\\n\",\n \"v, vbar = ufl.TestFunctions(W)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7730e8f5\",\n+ \"id\": \"aba63b1e\",\n \"metadata\": {},\n \"source\": [\n \"## Define integration measures\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e18fc420\",\n+ \"id\": \"2838f44a\",\n \"metadata\": {},\n \"source\": [\n \"We define the integration measure over cells as we would do in any\\n\",\n \"other UFL form.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6bf9f4a9\",\n+ \"id\": \"f0c1591c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"dx_c = ufl.Measure(\\\"dx\\\", domain=msh)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"cc8f1371\",\n+ \"id\": \"b50f5ca2\",\n \"metadata\": {},\n \"source\": [\n \"For the cell boundaries, we need to define an integration measure to\\n\",\n \"integrate around the boundary of each cell. The integration entities\\n\",\n \"can be computed using the following convenience function.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"45fc1ed3\",\n+ \"id\": \"6f8a8fa8\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"cell_boundary_facets = compute_cell_boundary_facets(msh)\\n\",\n \"cell_boundaries = 1 # A tag\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"721fd35d\",\n+ \"id\": \"1a460b75\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# We pass the integration domains into the `ufl.Measure` through the\\n\",\n \"# `subdomain_data` keyword argument.\\n\",\n \"ds_c = ufl.Measure(\\\"ds\\\", subdomain_data=[(cell_boundaries, cell_boundary_facets)], domain=msh)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c9e20c01\",\n+ \"id\": \"d51b7c98\",\n \"metadata\": {},\n \"source\": [\n \"Create a cell integral measure over the facet mesh\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c6c1dfbd\",\n+ \"id\": \"a32b5521\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"dx_f = ufl.Measure(\\\"dx\\\", domain=facet_mesh)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"14751b59\",\n+ \"id\": \"e0959be7\",\n \"metadata\": {},\n \"source\": [\n \"## Variational formulation\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7b855c5f\",\n+ \"id\": \"22b77195\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"h = ufl.CellDiameter(msh)\\n\",\n \"n = ufl.FacetNormal(msh)\\n\",\n \"gamma = 16.0 * k**2 / h # Scaled penalty parameter\\n\",\n \"\\n\",\n@@ -370,184 +370,184 @@\n \"f = -ufl.div(c * ufl.grad(u_e(x))) # Manufacture a source term\\n\",\n \"L = ufl.inner(f, v) * dx_c\\n\",\n \"L += ufl.inner(fem.Constant(facet_mesh, dtype(0.0)), vbar) * dx_f\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"18eef791\",\n+ \"id\": \"70e95ced\",\n \"metadata\": {},\n \"source\": [\n \"Our bilinear form involves two domains (`msh` and `facet_mesh`). The\\n\",\n \"mesh passed to the measure is called the \\\"integration domain\\\". For\\n\",\n \"each additional mesh in our form, we must pass an\\n\",\n \"{py:class}`EntityMap`\\n\",\n@@ -66,15 +66,15 @@\n \"\\n\",\n \"The modules that will be used are imported:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5a02c2ec\",\n+ \"id\": \"d1af0273\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n \"from petsc4py.PETSc import ScalarType # type: ignore\\n\",\n@@ -84,51 +84,51 @@\n \"import ufl\\n\",\n \"from dolfinx import fem, io, mesh, plot\\n\",\n \"from dolfinx.fem.petsc import LinearProblem\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"93953ff5\",\n+ \"id\": \"d7905fab\",\n \"metadata\": {},\n \"source\": [\n \"Note that it is important to first `from mpi4py import MPI` to\\n\",\n \"ensure that MPI is correctly initialised.\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"72548cea\",\n+ \"id\": \"93515b63\",\n \"metadata\": {},\n \"source\": [\n \"We create a rectangular {py:class}`Mesh ` using\\n\",\n \"{py:func}`create_rectangle `, and\\n\",\n \"create a finite element {py:class}`function space\\n\",\n \"` $V$ on the mesh.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0d3a49b8\",\n+ \"id\": \"f9f88097\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = mesh.create_rectangle(\\n\",\n \" comm=MPI.COMM_WORLD,\\n\",\n \" points=((0.0, 0.0), (2.0, 1.0)),\\n\",\n \" n=(32, 16),\\n\",\n \" cell_type=mesh.CellType.triangle,\\n\",\n \")\\n\",\n \"V = fem.functionspace(msh, (\\\"Lagrange\\\", 1))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"dce4b490\",\n+ \"id\": \"10764841\",\n \"metadata\": {},\n \"source\": [\n \"The second argument to {py:func}`functionspace\\n\",\n \"` is a tuple `(family, degree)`, where\\n\",\n \"`family` is the finite element family, and `degree` specifies the\\n\",\n \"polynomial degree. In this case `V` is a space of continuous Lagrange\\n\",\n \"finite elements of degree 1. For further details of how one can specify\\n\",\n@@ -142,106 +142,106 @@\n \"with a 'marker' function that returns `True` for points `x` on the\\n\",\n \"boundary and `False` otherwise.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a8dda251\",\n+ \"id\": \"e05ef415\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"facets = mesh.locate_entities_boundary(\\n\",\n \" msh,\\n\",\n \" dim=(msh.topology.dim - 1),\\n\",\n \" marker=lambda x: np.isclose(x[0], 0.0) | np.isclose(x[0], 2.0),\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"213d5ac3\",\n+ \"id\": \"ec7a2af3\",\n \"metadata\": {},\n \"source\": [\n \"We now find the degrees-of-freedom that are associated with the\\n\",\n \"boundary facets using {py:func}`locate_dofs_topological\\n\",\n \"`:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"73fec38a\",\n+ \"id\": \"18bace49\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"dofs = fem.locate_dofs_topological(V=V, entity_dim=1, entities=facets)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"42fee1e3\",\n+ \"id\": \"59bf06ae\",\n \"metadata\": {},\n \"source\": [\n \"and use {py:func}`dirichletbc ` to create a\\n\",\n \"{py:class}`DirichletBC ` class that\\n\",\n \"represents the boundary condition:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"652fa26b\",\n+ \"id\": \"c546108c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"bc = fem.dirichletbc(value=ScalarType(0), dofs=dofs, V=V)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9b880b84\",\n+ \"id\": \"9ab32c37\",\n \"metadata\": {},\n \"source\": [\n \"Next, the variational problem is defined:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"8286422e\",\n+ \"id\": \"8a7f8617\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"u = ufl.TrialFunction(V)\\n\",\n \"v = ufl.TestFunction(V)\\n\",\n \"x = ufl.SpatialCoordinate(msh)\\n\",\n \"f = 10 * ufl.exp(-((x[0] - 0.5) ** 2 + (x[1] - 0.5) ** 2) / 0.02)\\n\",\n \"g = ufl.sin(5 * x[0])\\n\",\n \"a = ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx\\n\",\n \"L = ufl.inner(f, v) * ufl.dx + ufl.inner(g, v) * ufl.ds\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"3d54e2b3\",\n+ \"id\": \"9ff4a7f3\",\n \"metadata\": {},\n \"source\": [\n \"A {py:class}`LinearProblem ` object is\\n\",\n \"created that brings together the variational problem, the Dirichlet\\n\",\n \"boundary condition, and which specifies the linear solver. In this\\n\",\n \"case an LU solver is used, and we ask that PETSc throws an error\\n\",\n \"if the solver does not converge. The {py:func}`solve\\n\",\n \"` computes the solution.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"3912b828\",\n+ \"id\": \"f7476b43\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"problem = LinearProblem(\\n\",\n \" a,\\n\",\n \" L,\\n\",\n \" bcs=[bc],\\n\",\n@@ -250,48 +250,48 @@\n \")\\n\",\n \"uh = problem.solve()\\n\",\n \"assert isinstance(uh, fem.Function)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"cb05e2c9\",\n+ \"id\": \"f7a529f2\",\n \"metadata\": {},\n \"source\": [\n \"The solution can be written to a {py:class}`XDMFFile\\n\",\n \"` file visualization with [ParaView](https://www.paraview.org/)\\n\",\n \"or [VisIt](https://visit-dav.github.io/visit-website/):\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4b93bcdf\",\n+ \"id\": \"75f54e01\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"out_folder = Path(\\\"out_poisson\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\\n\",\n \"with io.XDMFFile(msh.comm, out_folder / \\\"poisson.xdmf\\\", \\\"w\\\") as file:\\n\",\n \" file.write_mesh(msh)\\n\",\n \" file.write_function(uh)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8021ca16\",\n+ \"id\": \"0350dc7e\",\n \"metadata\": {},\n \"source\": [\n \"and displayed using [pyvista](https://docs.pyvista.org/).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"beb31dde\",\n+ \"id\": \"ce9311bb\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"try:\\n\",\n \" import pyvista\\n\",\n \"\\n\",\n \" cells, types, x = plot.vtk_mesh(V)\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/69c686705c3e4103e036ace87972a971/demo_types.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/69c686705c3e4103e036ace87972a971/demo_types.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_types.ipynb", "source2": "demo_types.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9873046875%", "Differences: {\"'cells'\": \"{0: {'id': '239e6cf9'}, 1: {'id': '84625f75'}, 2: {'id': '713d0b4d'}, 3: {'id': \"", " \"'c4b9a648'}, 4: {'id': '4dc2d9d3'}, 5: {'id': 'd671f05f'}, 6: {'id': 'dbd867b3'}, 7: \"", " \"{'id': '37a6f096'}, 8: {'id': '87aeabfb'}, 9: {'id': '93fa0b62'}, 10: {'id': \"", " \"'a848956d'}, 11: {'id': '1b427cad'}, 12: {'id': '4d6cc720'}, 13: {'id': 'a7db7172'}, \"", " \"14: {'id': 'a946a6d9'}, 15: {'id': 'fccf27c3'}}\"}"], "unified_diff": "@@ -1,26 +1,26 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"76211e7c\",\n+ \"id\": \"239e6cf9\",\n \"metadata\": {},\n \"source\": [\n \"# Solving PDEs with different scalar (float) types\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_types.py>`\\n\",\n \"* {download}`Jupyter notebook <./demo_types.ipynb>`\\n\",\n \"```\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"fde7337f\",\n+ \"id\": \"84625f75\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"This demo shows:\\n\",\n \"\\n\",\n \"- How to solve problems using different scalar types, .e.g. single or\\n\",\n@@ -28,15 +28,15 @@\n \"- Interfacing with [SciPy](https://scipy.org/) sparse linear algebra\\n\",\n \" functionality\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"af686e5c\",\n+ \"id\": \"713d0b4d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"import sys\\n\",\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n@@ -47,66 +47,66 @@\n \"\\n\",\n \"import ufl\\n\",\n \"from dolfinx import fem, la, mesh, plot\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f95c5b60\",\n+ \"id\": \"c4b9a648\",\n \"metadata\": {},\n \"source\": [\n \"SciPy solvers do not support MPI, so all computations will be\\n\",\n \"performed on a single MPI rank\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2557fd2a\",\n+ \"id\": \"4dc2d9d3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"comm = MPI.COMM_SELF\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d53cd5e2\",\n+ \"id\": \"d671f05f\",\n \"metadata\": {},\n \"source\": [\n \"We create an output directory for storing results and figures\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2de13eba\",\n+ \"id\": \"dbd867b3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"out_folder = Path(\\\"out_types\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8243e230\",\n+ \"id\": \"37a6f096\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Create a function that solves the Poisson equation using different\\n\",\n \"precision float and complex scalar types for the finite element\\n\",\n \"solution.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0ca189a0\",\n+ \"id\": \"87aeabfb\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def display_scalar(u, name, filter=np.real):\\n\",\n \" \\\"\\\"\\\"Plot the solution using pyvista\\\"\\\"\\\"\\n\",\n \" try:\\n\",\n \" import pyvista\\n\",\n@@ -126,15 +126,15 @@\n \" except ModuleNotFoundError:\\n\",\n \" print(\\\"'pyvista' is required to visualise the solution\\\")\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5b7ab955\",\n+ \"id\": \"93fa0b62\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def display_vector(u, name, filter=np.real):\\n\",\n \" \\\"\\\"\\\"Plot the solution using pyvista\\\"\\\"\\\"\\n\",\n \" try:\\n\",\n \" import pyvista\\n\",\n@@ -154,15 +154,15 @@\n \" except ModuleNotFoundError:\\n\",\n \" print(\\\"'pyvista' is required to visualise the solution\\\")\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7df17d3b\",\n+ \"id\": \"a848956d\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def poisson(dtype):\\n\",\n \" \\\"\\\"\\\"Poisson problem solver\\n\",\n@@ -225,28 +225,28 @@\n \" uh.x.array[:] = scipy.sparse.linalg.spsolve(As, b.array)\\n\",\n \"\\n\",\n \" return uh\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ca199b20\",\n+ \"id\": \"1b427cad\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Create a function that solves the linearised elasticity equation using\\n\",\n \"different precision float and complex scalar types for the finite\\n\",\n \"element solution.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"454fc3d2\",\n+ \"id\": \"4d6cc720\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def elasticity(dtype) -> fem.Function:\\n\",\n \" \\\"\\\"\\\"Linearised elasticity problem solver.\\\"\\\"\\\"\\n\",\n@@ -307,26 +307,26 @@\n \" uh.x.array[:] = scipy.sparse.linalg.spsolve(As, b.array)\\n\",\n \"\\n\",\n \" return uh\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"47392e92\",\n+ \"id\": \"a7db7172\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Solve problems for different types\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1f4484a6\",\n+ \"id\": \"a946a6d9\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"uh = poisson(dtype=np.float32)\\n\",\n \"uh = poisson(dtype=np.float64)\\n\",\n@@ -336,15 +336,15 @@\n \"display_scalar(uh, \\\"poisson\\\", np.real)\\n\",\n \"display_scalar(uh, \\\"poisson\\\", np.imag)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"89e3e1a0\",\n+ \"id\": \"fccf27c3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"uh = elasticity(dtype=np.float32)\\n\",\n \"uh = elasticity(dtype=np.float64)\\n\",\n \"if not sys.platform.startswith(\\\"win32\\\"):\\n\",\n \" uh = elasticity(dtype=np.complex64)\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/6bd0b7dbffc1fd43f16bc5cd2cfeed74/demo_static-condensation.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/6bd0b7dbffc1fd43f16bc5cd2cfeed74/demo_static-condensation.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_static-condensation.ipynb", "source2": "demo_static-condensation.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9870975378787878%", "Differences: {\"'cells'\": \"{0: {'id': '5b39344f'}, 1: {'id': '4c875bde'}, 2: {'id': '53d6a551'}, 3: {'id': \"", " \"'99e3879b'}, 4: {'id': '5622b66c'}, 5: {'id': '255f3586'}, 6: {'id': '0cb1c95f'}, 7: \"", " \"{'id': 'e448927a'}, 8: {'id': '3cc9d6ec'}, 9: {'id': '4674b342'}, 10: {'id': \"", " \"'f0b477bb'}, 11: {'id': 'f9a77db7'}, 12: {'id': 'c38e9732'}, 13: {'id': '0b9a912a'}, \"", " \"14: {'id': 'ae7c997c'}, 15: {'id': '99902495'}, 16: {'id': '724faaae'}, 17: {'id': \"", " \"'878b8ae6'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"25749ef4\",\n+ \"id\": \"5b39344f\",\n \"metadata\": {},\n \"source\": [\n \"(demo-static-condensation)=\\n\",\n \"\\n\",\n \"# Static condensation of linear elasticity\\n\",\n \"\\n\",\n \"Copyright (C) 2020 Michal Habera and Andreas Zilian\\n\",\n@@ -26,25 +26,25 @@\n \" on variational forms made with UFL.\\n\",\n \"- Extracting JIT compiled C-kernels using {py:func}`ffcx_jit\\n\",\n \"`\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4a87fe1f\",\n+ \"id\": \"4c875bde\",\n \"metadata\": {},\n \"source\": [\n \"This demo requires more modules than usual, as it uses `numba` for\\n\",\n \"efficient static condensation.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"be5f22a5\",\n+ \"id\": \"53d6a551\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n@@ -74,41 +74,41 @@\n \"from ffcx.codegeneration.utils import empty_void_pointer\\n\",\n \"from ffcx.codegeneration.utils import numba_ufcx_kernel_signature as ufcx_signature\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"3eb7a551\",\n+ \"id\": \"99e3879b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"rtype = default_real_type\\n\",\n \"dtype = default_scalar_type\\n\",\n \"if np.issubdtype(rtype, np.float32): # type: ignore\\n\",\n \" print(\\\"float32 not yet supported for this demo.\\\")\\n\",\n \" exit(0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c2d1e791\",\n+ \"id\": \"5622b66c\",\n \"metadata\": {},\n \"source\": [\n \"We start by reading in the Cook's mesh [cooks_tri_mesh.xdmf](\\n\",\n \"https://github.com/FEniCS/dolfinx/blob/main/python/demo/data/cooks_tri_mesh.xdmf)\\n\",\n \"using {py:meth}`XDMFFile.read_mesh `.\\n\",\n \"Note that the mesh is written in plain-text format, which means we use\\n\",\n \"{py:attr}`XDMFFile.Encoding.ASCII `.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"29de791e\",\n+ \"id\": \"255f3586\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"infile = XDMFFile(\\n\",\n \" MPI.COMM_WORLD,\\n\",\n \" Path(Path(__file__).parent, \\\"data\\\", \\\"cooks_tri_mesh.xdmf\\\"),\\n\",\n \" \\\"r\\\",\\n\",\n@@ -116,146 +116,146 @@\n \")\\n\",\n \"msh = infile.read_mesh(name=\\\"Grid\\\")\\n\",\n \"infile.close()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ef88698b\",\n+ \"id\": \"0cb1c95f\",\n \"metadata\": {},\n \"source\": [\n \"We create the Stress (Se) and displacement (Ue) elements and\\n\",\n \"corresponding function spaces. Note that the stress element is symmetric.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ac573618\",\n+ \"id\": \"e448927a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"gdim = msh.geometry.dim\\n\",\n \"Se = element(\\\"DG\\\", msh.basix_cell(), 1, shape=(gdim, gdim), symmetry=True, dtype=rtype) # type: ignore\\n\",\n \"Ue = element(\\\"Lagrange\\\", msh.basix_cell(), 2, shape=(gdim,), dtype=rtype) # type: ignore\\n\",\n \"S = functionspace(msh, Se)\\n\",\n \"U = functionspace(msh, Ue)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"047c4d18\",\n+ \"id\": \"3cc9d6ec\",\n \"metadata\": {},\n \"source\": [\n \"Next, we define the trial and test functions for stress and displacement,\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9cd01af9\",\n+ \"id\": \"4674b342\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"sigma, tau = ufl.TrialFunction(S), ufl.TestFunction(S)\\n\",\n \"u, v = ufl.TrialFunction(U), ufl.TestFunction(U)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1de80ed8\",\n+ \"id\": \"f0b477bb\",\n \"metadata\": {},\n \"source\": [\n \"Locate all facets at the free end and assign them value 1. Sort the\\n\",\n \"facet indices (requirement for constructing {py:class}`MeshTags\\n\",\n \"`).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d393b49d\",\n+ \"id\": \"f9a77db7\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"tdim = msh.topology.dim\\n\",\n \"free_end_facets = np.sort(locate_entities_boundary(msh, tdim - 1, lambda x: np.isclose(x[0], 48.0)))\\n\",\n \"mt = meshtags(msh, tdim - 1, free_end_facets, 1)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8976b52a\",\n+ \"id\": \"c38e9732\",\n \"metadata\": {},\n \"source\": [\n \"Next, we create an integration measure with the facet markers.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2affed01\",\n+ \"id\": \"0b9a912a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"ds = ufl.Measure(\\\"ds\\\", subdomain_data=mt)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7e5d93e0\",\n+ \"id\": \"ae7c997c\",\n \"metadata\": {},\n \"source\": [\n \"Homogeneous boundary condition in displacement\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c7cc8c34\",\n+ \"id\": \"99902495\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"u_bc = Function(U)\\n\",\n \"u_bc.x.array[:] = 0\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"af2d86d8\",\n+ \"id\": \"724faaae\",\n \"metadata\": {},\n \"source\": [\n \"Displacement {py:class}`BC ` is applied to\\n\",\n \"the left side\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"bd68308c\",\n+ \"id\": \"878b8ae6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"left_facets = locate_entities_boundary(msh, tdim - 1, lambda x: np.isclose(x[0], 0.0))\\n\",\n \"bdofs = locate_dofs_topological(U, tdim - 1, left_facets)\\n\",\n \"bc = dirichletbc(u_bc, bdofs)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e59ba98a\",\n+ \"id\": \"7bbe0693\",\n \"metadata\": {},\n \"source\": [\n \"Elastic stiffness tensor and Poisson ratio\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7438b74c\",\n+ \"id\": \"7fffb8fd\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"E, nu = 1.0, 1.0 / 3.0\\n\",\n \"\\n\",\n \"\\n\",\n \"def sigma_u(u):\\n\",\n@@ -264,51 +264,51 @@\n \" eps = 0.5 * (ufl.grad(u) + ufl.grad(u).T)\\n\",\n \" sigma = E / (1.0 - nu**2) * ((1.0 - nu) * eps + nu * ufl.Identity(2) * ufl.tr(eps))\\n\",\n \" return sigma\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7057eca1\",\n+ \"id\": \"07b6e04b\",\n \"metadata\": {},\n \"source\": [\n \"With the definitions above, we can define the different blocks\\n\",\n \"of the variational formulation\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"8bfa881c\",\n+ \"id\": \"332db07c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"a00 = ufl.inner(sigma, tau) * ufl.dx\\n\",\n \"a10 = -ufl.inner(sigma, ufl.grad(v)) * ufl.dx\\n\",\n \"a01 = -ufl.inner(sigma_u(u), tau) * ufl.dx\\n\",\n \"\\n\",\n \"f = ufl.as_vector([0.0, 1.0 / 16])\\n\",\n \"b1 = form(-ufl.inner(f, v) * ds(1), dtype=dtype) # type: ignore\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"6ee1d185\",\n+ \"id\": \"f8774235\",\n \"metadata\": {},\n \"source\": [\n \"To generate (C-code) and JIT compile the kernels, we use\\n\",\n \"{py:func}`ffcx_jit ` for each individual block.\\n\",\n \"We extract the kernel function from the compiled form object by\\n\",\n \"getting the `tabulate_tensor_{dtype}` attribute of the compiled form.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e53efffa\",\n+ \"id\": \"d1b5696d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"ufcx00, _, _ = ffcx_jit(msh.comm, a00, form_compiler_options={\\\"scalar_type\\\": dtype}) # type: ignore\\n\",\n \"kernel00 = getattr(ufcx00.form_integrals[0], f\\\"tabulate_tensor_{np.dtype(dtype).name}\\\") # type: ignore\\n\",\n \"\\n\",\n \"ufcx01, _, _ = ffcx_jit(msh.comm, a01, form_compiler_options={\\\"scalar_type\\\": dtype}) # type: ignore\\n\",\n@@ -317,15 +317,15 @@\n \"ufcx10, _, _ = ffcx_jit(msh.comm, a10, form_compiler_options={\\\"scalar_type\\\": dtype}) # type: ignore\\n\",\n \"kernel10 = getattr(ufcx10.form_integrals[0], f\\\"tabulate_tensor_{np.dtype(dtype).name}\\\") # type: ignore\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0a7dd6d5\",\n+ \"id\": \"ee8dc70d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"ffi = cffi.FFI()\\n\",\n \"if np.issubdtype(dtype, np.complexfloating):\\n\",\n \" if cffi.__version_info__ > (1, 16, 99) and cffi.__version_info__ <= (1, 17, 1):\\n\",\n \" print(\\n\",\n@@ -334,50 +334,50 @@\n \" )\\n\",\n \" exit(0)\\n\",\n \" cffi_support.register_type(ffi.typeof(\\\"double _Complex\\\"), numba.types.complex128)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"25a988c8\",\n+ \"id\": \"131dce55\",\n \"metadata\": {},\n \"source\": [\n \"Get local dofmap sizes for later local tensor tabulations\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5312ca2c\",\n+ \"id\": \"1339d5a8\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"Ssize = S.element.space_dimension\\n\",\n \"Usize = U.element.space_dimension\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"05dba37d\",\n+ \"id\": \"3db18dc9\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Next, we define a static condensation kernel that uses the\\n\",\n \"previously defined kernels to compute the condensed local element\\n\",\n \"tensor. The kernel is decorated with {py:func}`numba.cfunc` using the\\n\",\n \"appropriate signature obtained from {py:func}`ufcx_signature`.`\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d8e31027\",\n+ \"id\": \"5c87ecdf\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"@numba.cfunc(ufcx_signature(dtype, rtype), nopython=True) # type: ignore\\n\",\n \"def tabulate_A(A_, w_, c_, coords_, entity_local_index, permutation=ffi.NULL, custom_data=None):\\n\",\n \" \\\"\\\"\\\"Element kernel that applies static condensation.\\\"\\\"\\\"\\n\",\n \"\\n\",\n@@ -420,182 +420,182 @@\n \"\\n\",\n \" # A = - A10 * A00^{-1} * A01\\n\",\n \" A[:, :] = -A10 @ np.linalg.solve(A00, A01)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ef5de91d\",\n+ \"id\": \"ce996aab\",\n \"metadata\": {},\n \"source\": [\n \"Prepare a {py:class}`Form` with a condensed\\n\",\n \"tabulation kernel. We specify the integration domains to be the\\n\",\n \"cells owned by the current process\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5c5e5601\",\n+ \"id\": \"35f12557\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"formtype = form_cpp_class(dtype) # type: ignore\\n\",\n \"cells = np.arange(msh.topology.index_map(msh.topology.dim).size_local)\\n\",\n \"integrals = {IntegralType.cell: [(0, tabulate_A.address, cells, np.array([], dtype=np.int8))]}\\n\",\n \"a_cond = Form(\\n\",\n \" formtype([U._cpp_object, U._cpp_object], integrals, [], [], False, [], mesh=msh._cpp_object)\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a925abf5\",\n+ \"id\": \"c341f0c9\",\n \"metadata\": {},\n \"source\": [\n \"Next, we pass the compiled kernel to the standard {py:func}`\\n\",\n \"assemble_matrix ` function to assemble\\n\",\n \"to the global condensed stiffness matrix. We also assemble the right-hand\\n\",\n \"side vector using {py:func}`assemble_vector\\n\",\n \"` and apply the boundary conditions by\\n\",\n \"{py:func}`applying lifting ` and\\n\",\n \"{py:meth}`set bc`.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"cc978f53\",\n+ \"id\": \"096c40ac\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"A_cond = assemble_matrix(a_cond, bcs=[bc])\\n\",\n \"A_cond.assemble()\\n\",\n \"b = assemble_vector(b1)\\n\",\n \"apply_lifting(b, [a_cond], bcs=[[bc]])\\n\",\n \"b.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE) # type: ignore\\n\",\n \"bc.set(b)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a57c5b3b\",\n+ \"id\": \"f4afa12c\",\n \"metadata\": {},\n \"source\": [\n \"We use a {py:class}`PETSc.KSP ` solver to solve the\\n\",\n \"condensed linear system. The solution is stored in a\\n\",\n \"{py:class}`Function`, while we pass the\\n\",\n \"underlying data wrapped as a {py:class}`PETSc.Vec `\\n\",\n \"to the solver by calling {py:meth}`petsc_vec\\n\",\n \"` on the\\n\",\n \"{py:meth}`vector ` attribute of the function.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e16a011e\",\n+ \"id\": \"3270662e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"uc = Function(U, name=\\\"u_from_condensation\\\")\\n\",\n \"solver = PETSc.KSP().create(A_cond.getComm()) # type: ignore\\n\",\n \"solver.setOperators(A_cond)\\n\",\n \"solver.solve(b, uc.x.petsc_vec)\\n\",\n \"solver.destroy()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d759489d\",\n+ \"id\": \"992dfa9a\",\n \"metadata\": {},\n \"source\": [\n \"We verify the condensed solution by comparing against a standard,\\n\",\n \"pure displacement based formulation\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d6cf8b24\",\n+ \"id\": \"9b83ab4a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"a = form(-ufl.inner(sigma_u(u), ufl.grad(v)) * ufl.dx)\\n\",\n \"A = assemble_matrix(a, bcs=[bc])\\n\",\n \"A.assemble()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7f0e054a\",\n+ \"id\": \"dbffbc07\",\n \"metadata\": {},\n \"source\": [\n \"Create {py:class}`BoundingBoxTree `\\n\",\n \"using {py:meth}`bb_tree ` constructor\\n\",\n \"for efficient computation of the ownership of a set of evaluation points\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ec9043b4\",\n+ \"id\": \"a83b54a1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"bb_tree = geometry.bb_tree(msh, tdim, padding=0.0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1e0793c2\",\n+ \"id\": \"94ea7fe8\",\n \"metadata\": {},\n \"source\": [\n \"Check against standard table value\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"60fa0b36\",\n+ \"id\": \"f2fe910f\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"p = np.array([[48.0, 52.0, 0.0]], dtype=np.float64)\\n\",\n \"cell_candidates = geometry.compute_collisions_points(bb_tree, p)\\n\",\n \"cells = geometry.compute_colliding_cells(msh, cell_candidates, p).array\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"48332c73\",\n+ \"id\": \"183c4bed\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"uc.x.scatter_forward()\\n\",\n \"if len(cells) > 0:\\n\",\n \" value = uc.eval(p, cells[0])\\n\",\n \" print(value[1])\\n\",\n \" assert np.isclose(value[1], 23.95, rtol=1.0e-2)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f09603e0\",\n+ \"id\": \"2926fb6c\",\n \"metadata\": {},\n \"source\": [\n \"Check the equality of displacement based and mixed condensed global\\n\",\n \"matrices, i.e. check that condensation is exact\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0b00d491\",\n+ \"id\": \"8370d1ea\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"assert np.isclose((A - A_cond).norm(), 0.0)\"\n ]\n }\n ],\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/7742577adb1c8360c8a19eea719713fc/demo_pyvista.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/7742577adb1c8360c8a19eea719713fc/demo_pyvista.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_pyvista.ipynb", "source2": "demo_pyvista.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9871794871794872%", "Differences: {\"'cells'\": \"{0: {'id': 'fb1e5682'}, 1: {'id': 'c42de33b'}, 2: {'id': 'e31492d7'}, 3: {'id': \"", " \"'944024b9'}, 4: {'id': '5faa0b46'}, 5: {'id': '8181ae0e'}, 6: {'id': 'b4876028'}, 7: \"", " \"{'id': 'aa588195'}, 8: {'id': '8fc6a429'}, 9: {'id': 'fab14534'}, 10: {'id': \"", " \"'fb4d5405'}, 11: {'id': 'b5a18fa2'}, 12: {'id': '421ce18a'}}\"}"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e3b049f7\",\n+ \"id\": \"fb1e5682\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Copyright (C) 2021-2022 J\\u00f8rgen S. Dokken and Garth N. Wells\\n\",\n \"\\n\",\n \"This file is part of DOLFINx ()\\n\",\n@@ -27,15 +27,15 @@\n \"To start, the required modules are imported and some PyVista\\n\",\n \"parameters set.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"dc0cf14a\",\n+ \"id\": \"c42de33b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n@@ -51,26 +51,26 @@\n \"figsize = 800\\n\",\n \"out_folder = Path(\\\"out_pyvista\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"441381d4\",\n+ \"id\": \"e31492d7\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Plotting a finite element Function using warp by scalar\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"733aa1cc\",\n+ \"id\": \"944024b9\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def plot_scalar():\\n\",\n \" # We start by creating a unit square mesh and interpolating a\\n\",\n@@ -127,26 +127,26 @@\n \" )\\n\",\n \" else:\\n\",\n \" subplotter.show()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"70aac082\",\n+ \"id\": \"5faa0b46\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Mesh tags and using subplots\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5ff6927a\",\n+ \"id\": \"8181ae0e\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def plot_meshtags():\\n\",\n \" # Create a mesh\\n\",\n@@ -199,28 +199,28 @@\n \" )\\n\",\n \" else:\\n\",\n \" subplotter.show()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9f904be1\",\n+ \"id\": \"b4876028\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Higher-order Functions\\n\",\n \"\\n\",\n \"Higher-order finite element function can also be plotted.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"8f9d3ef4\",\n+ \"id\": \"aa588195\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def plot_higher_order():\\n\",\n \" # Create a mesh\\n\",\n@@ -286,29 +286,29 @@\n \" )\\n\",\n \" else:\\n\",\n \" plotter.show()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c4416870\",\n+ \"id\": \"8fc6a429\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Vector-element functions\\n\",\n \"\\n\",\n \"In this section we will consider how to plot vector-element functions,\\n\",\n \"e.g. Raviart-Thomas or N\\u00e9d\\u00e9lec elements.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5a2f472f\",\n+ \"id\": \"fab14534\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def plot_nedelec():\\n\",\n \" msh = create_unit_cube(\\n\",\n@@ -365,28 +365,28 @@\n \" )\\n\",\n \" else:\\n\",\n \" plotter.show()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4948803d\",\n+ \"id\": \"fb4d5405\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Plotting streamlines\\n\",\n \"\\n\",\n \"In this section we illustrate how to visualize streamlines in 3D\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c6f23e5d\",\n+ \"id\": \"b5a18fa2\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def plot_streamlines():\\n\",\n \" msh = create_unit_cube(MPI.COMM_WORLD, 4, 4, 4, CellType.hexahedron, dtype=np.float64)\\n\",\n \" gdim = msh.geometry.dim\\n\",\n \" V = functionspace(msh, (\\\"Discontinuous Lagrange\\\", 2, (gdim,)))\\n\",\n@@ -423,15 +423,15 @@\n \" else:\\n\",\n \" plotter.show()\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4c6afdcd\",\n+ \"id\": \"421ce18a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"plot_scalar()\\n\",\n \"plot_meshtags()\\n\",\n \"plot_higher_order()\\n\",\n \"plot_nedelec()\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/94dc1fa896703fdd4c54729bdfbf969a/demo_pml.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/94dc1fa896703fdd4c54729bdfbf969a/demo_pml.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_pml.ipynb", "source2": "demo_pml.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666666%", "Differences: {\"'cells'\": \"{0: {'id': 'd0dc1975'}, 1: {'id': '4cd5ce38'}, 2: {'id': '20d5fd11'}, 3: {'id': \"", " \"'9b95f90c'}, 4: {'id': '9a6668fe'}, 5: {'id': '5bf9337b'}, 6: {'id': '04321804'}, 7: \"", " \"{'id': '9f53ae61'}, 8: {'id': '408351df'}, 9: {'id': '07d4cbb0'}, 10: {'id': \"", " \"'d72e425e'}, 11: {'id': 'c9c93840'}, 12: {'id': '6987e804'}, 13: {'id': '788f1824'}, \"", " \"14: {'id': '5855b40e'}, 15: {'id': '506e35b2'}, 16: {'id': '52eb1d38'}, 17: {'id': \"", " \"'b68b129a'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8bda9b57\",\n+ \"id\": \"d0dc1975\",\n \"metadata\": {},\n \"source\": [\n \"# Electromagnetic scattering from a wire with PML\\n\",\n \"\\n\",\n \"Copyright (C) 2022 Michele Castriotta, Igor Baratta, J\\u00f8rgen S. Dokken\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n@@ -22,15 +22,15 @@\n \"\\n\",\n \"First, we import the required modules\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d778210b\",\n+ \"id\": \"4cd5ce38\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"import sys\\n\",\n \"from functools import partial, reduce\\n\",\n \"from pathlib import Path\\n\",\n \"\\n\",\n@@ -62,47 +62,47 @@\n \"except ModuleNotFoundError:\\n\",\n \" print(\\\"pyvista and pyvistaqt are required to visualise the solution\\\")\\n\",\n \" have_pyvista = False\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f77e5f19\",\n+ \"id\": \"20d5fd11\",\n \"metadata\": {},\n \"source\": [\n \"Since we want to solve time-harmonic Maxwell's equation, we require\\n\",\n \"that the demo is executed with DOLFINx (PETSc) complex mode.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"992afd8e\",\n+ \"id\": \"9b95f90c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if not np.issubdtype(default_scalar_type, np.complexfloating):\\n\",\n \" print(\\\"Demo should only be executed with DOLFINx complex mode\\\")\\n\",\n \" exit(0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"5375cda5\",\n+ \"id\": \"9a6668fe\",\n \"metadata\": {},\n \"source\": [\n \"# Mesh generation with GMSH\\n\",\n \"The mesh is made up by a central circle (the wire), and an external\\n\",\n \"layer (the PML) divided in 4 rectangles and 4 squares at the corners.\\n\",\n \"The `generate_mesh_wire` function takes as input:\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1d2616b1\",\n+ \"id\": \"5bf9337b\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"- `radius_wire`: the radius of the wire\\n\",\n \"- `radius_scatt`: the radius of the circle where scattering efficiency\\n\",\n \" is calculated\\n\",\n@@ -122,15 +122,15 @@\n \" (together with pml_tag+1 and pml_tag+2)\\n\",\n \"\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6b34ee71\",\n+ \"id\": \"04321804\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def generate_mesh_wire(\\n\",\n \" radius_wire: float,\\n\",\n@@ -246,29 +246,29 @@\n \"\\n\",\n \" gmsh.model.mesh.generate(2)\\n\",\n \" return gmsh.model\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"25d4b862\",\n+ \"id\": \"9f53ae61\",\n \"metadata\": {},\n \"source\": [\n \"## Mathematical formulation\\n\",\n \"Following are convenience functions for the calculation of the\\n\",\n \"absorption, scattering and extinction efficiencies of a wire\\n\",\n \"being hit normally by a TM-polarized electromagnetic wave.\\n\",\n \"See {ref}`Scattering boundary conditions:\\n\",\n \"Mathematical formulation ` for a detailed description.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"14cf2528\",\n+ \"id\": \"408351df\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"\\n\",\n \"\\n\",\n@@ -298,15 +298,15 @@\n \" q_ext += c * 2 * np.real(compute_a(nu, m, alpha))\\n\",\n \" q_sca += c * 2 * np.abs(compute_a(nu, m, alpha)) ** 2\\n\",\n \" return q_ext - q_sca, q_sca, q_ext\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"df20dd94\",\n+ \"id\": \"07d4cbb0\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Perfectly matched layers (PMLs)\\n\",\n \"Now, let's consider an infinite metallic wire immersed in a background\\n\",\n \"medium (e.g. vacuum or water). Let's now consider the plane cutting\\n\",\n@@ -347,53 +347,53 @@\n \"The function `background_field` below implements this analytical\\n\",\n \"formula:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e8fd3471\",\n+ \"id\": \"d72e425e\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def background_field(theta: float, n_b: float, k0: complex, x: np.typing.NDArray[np.float64]):\\n\",\n \" kx = n_b * k0 * np.cos(theta)\\n\",\n \" ky = n_b * k0 * np.sin(theta)\\n\",\n \" phi = kx * x[0] + ky * x[1]\\n\",\n \" return (-np.sin(theta) * np.exp(1j * phi), np.cos(theta) * np.exp(1j * phi))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0826719c\",\n+ \"id\": \"c9c93840\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"For convenience, we define the $\\\\nabla\\\\times$ operator for a 2D vector\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"962ce2df\",\n+ \"id\": \"6987e804\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def curl_2d(a: fem.Function):\\n\",\n \" return ufl.as_vector((0, 0, a[1].dx(0) - a[0].dx(1)))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"668238d4\",\n+ \"id\": \"788f1824\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Let's now see how we can implement PMLs for our problem. PMLs are\\n\",\n \"artificial layers surrounding the real domain that gradually absorb\\n\",\n \"waves impinging them. Mathematically, we can use a complex coordinate\\n\",\n@@ -410,34 +410,34 @@\n \"faster the absorption). In DOLFINx, we can define this coordinate\\n\",\n \"transformation in the following way:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c147bbda\",\n+ \"id\": \"5855b40e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def pml_coordinates(x: ufl.indexed.Indexed, alpha: float, k0: complex, l_dom: float, l_pml: float):\\n\",\n \" return x + 1j * alpha / k0 * x * (ufl.algebra.Abs(x) - l_dom / 2) / (l_pml / 2 - l_dom / 2) ** 2\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"982b6f9d\",\n+ \"id\": \"506e35b2\",\n \"metadata\": {},\n \"source\": [\n \"We use the following domain specific parameters:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"20db2de3\",\n+ \"id\": \"52eb1d38\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"epsilon_0 = 8.8541878128 * 10**-12\\n\",\n \"mu_0 = 4 * np.pi * 10**-7\\n\",\n \"\\n\",\n \"# Radius of the wire and of the boundary of the domain\\n\",\n@@ -458,26 +458,26 @@\n \"bkg_tag = 2\\n\",\n \"scatt_tag = 3\\n\",\n \"pml_tag = 4\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b808233b\",\n+ \"id\": \"b68b129a\",\n \"metadata\": {},\n \"source\": [\n \"We generate the mesh using GMSH and convert it to a\\n\",\n \"{py:class}`Mesh` using\\n\",\n \"{py:func}`model_to_mesh `.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4871ad43\",\n+ \"id\": \"00d7157f\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"model = None\\n\",\n \"gmsh.initialize(sys.argv)\\n\",\n \"if MPI.COMM_WORLD.rank == 0:\\n\",\n \" model = generate_mesh_wire(\\n\",\n@@ -504,25 +504,25 @@\n \"\\n\",\n \"gmsh.finalize()\\n\",\n \"MPI.COMM_WORLD.barrier()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c5ff09fb\",\n+ \"id\": \"4360f399\",\n \"metadata\": {},\n \"source\": [\n \"We visualize the mesh and subdomains with\\n\",\n \"[PyVista](https://docs.pyvista.org/)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4397939a\",\n+ \"id\": \"fa902193\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"out_folder = Path(\\\"output_pml\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\\n\",\n \"tdim = mesh_data.mesh.topology.dim\\n\",\n \"if have_pyvista:\\n\",\n@@ -540,15 +540,15 @@\n \" plotter.show(interactive=True)\\n\",\n \" else:\\n\",\n \" figure = plotter.screenshot(out_folder / \\\"wire_mesh_pml.png\\\", window_size=[800, 800])\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"fb9d05c9\",\n+ \"id\": \"cde23222\",\n \"metadata\": {},\n \"source\": [\n \"We observe five different subdomains: one for the gold wire\\n\",\n \"(`au_tag`), one for the background medium (`bkg_tag`), one for the PML\\n\",\n \"corners (`pml_tag`), one for the PML rectangles along $x$ (`pml_tag +\\n\",\n \"1`), and one for the PML rectangles along $y$ (`pml_tag + 2`). These\\n\",\n \"different PML regions have different coordinate transformation, as\\n\",\n@@ -567,60 +567,60 @@\n \"\\n\",\n \"Now we define some other problem specific parameters:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"da85095e\",\n+ \"id\": \"31e62fcc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"wl0 = 0.4 # Wavelength of the background field\\n\",\n \"n_bkg = 1 # Background refractive index\\n\",\n \"eps_bkg = n_bkg**2 # Background relative permittivity\\n\",\n \"k0 = 2 * np.pi / wl0 # Wavevector of the background field\\n\",\n \"theta = 0 # Angle of incidence of the background field\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"96c5e0a0\",\n+ \"id\": \"5b23539e\",\n \"metadata\": {},\n \"source\": [\n \"We use a degree 3\\n\",\n \"[Nedelec (first kind)](https://defelement.org/elements/nedelec1.html)\\n\",\n \"element to represent the electric field:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"472eb7bf\",\n+ \"id\": \"01ac2921\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"degree = 3\\n\",\n \"curl_el = element(\\\"N1curl\\\", mesh_data.mesh.basix_cell(), degree, dtype=default_real_type)\\n\",\n \"V = fem.functionspace(mesh_data.mesh, curl_el)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2f293a01\",\n+ \"id\": \"a12c1a42\",\n \"metadata\": {},\n \"source\": [\n \"Next, we interpolate $\\\\mathbf{E}_b$ into the function space $V$,\\n\",\n \"define our trial and test function, and the integration domains:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"62c11ebc\",\n+ \"id\": \"04f24883\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"Eb = fem.Function(V)\\n\",\n \"f = partial(background_field, theta, n_bkg, k0)\\n\",\n \"Eb.interpolate(f)\\n\",\n \"\\n\",\n@@ -638,78 +638,78 @@\n \"dPml_xy = dx(pml_tag)\\n\",\n \"dPml_x = dx(pml_tag + 1)\\n\",\n \"dPml_y = dx(pml_tag + 2)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"eb97a755\",\n+ \"id\": \"3fb094ae\",\n \"metadata\": {},\n \"source\": [\n \"Let's now define the relative permittivity $\\\\varepsilon_m$ of the gold\\n\",\n \"wire at $400nm$ (data taken from [*Olmon et al.\\n\",\n \"2012*](https://doi.org/10.1103/PhysRevB.86.235147) , and for a quick\\n\",\n \"reference have a look at [refractiveindex.info](\\n\",\n \"https://refractiveindex.info/?shelf=main&book=Au&page=Olmon-sc)):\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"bdb025cd\",\n+ \"id\": \"84f1a00c\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"# Definition of relative permittivity for Au @400nm\\n\",\n \"eps_au = -1.0782 + 1j * 5.8089\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0470ff41\",\n+ \"id\": \"be8ba850\",\n \"metadata\": {},\n \"source\": [\n \"We can now define a space function for the permittivity $\\\\varepsilon$\\n\",\n \"that takes the value $\\\\varepsilon_m$ for cells inside the wire, while\\n\",\n \"it takes the value of the background permittivity $\\\\varepsilon_b$ in\\n\",\n \"the background region:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"085414f9\",\n+ \"id\": \"a1a2e348\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"D = fem.functionspace(mesh_data.mesh, (\\\"DG\\\", 0))\\n\",\n \"eps = fem.Function(D)\\n\",\n \"au_cells = mesh_data.cell_tags.find(au_tag)\\n\",\n \"bkg_cells = mesh_data.cell_tags.find(bkg_tag)\\n\",\n \"eps.x.array[au_cells] = np.full_like(au_cells, eps_au, dtype=eps.x.array.dtype)\\n\",\n \"eps.x.array[bkg_cells] = np.full_like(bkg_cells, eps_bkg, dtype=eps.x.array.dtype)\\n\",\n \"eps.x.scatter_forward()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d47170bf\",\n+ \"id\": \"17929712\",\n \"metadata\": {},\n \"source\": [\n \"Now we need to define our weak form in DOLFINx. Let's write the PML\\n\",\n \"weak form first. As a first step, we can define our new complex\\n\",\n \"coordinates as:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0f4436f3\",\n+ \"id\": \"4a3b66bc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"x = ufl.SpatialCoordinate(mesh_data.mesh)\\n\",\n \"alpha = 1\\n\",\n \"\\n\",\n \"# PML corners\\n\",\n@@ -722,15 +722,15 @@\n \"\\n\",\n \"# PML rectangles along y\\n\",\n \"y_pml = ufl.as_vector((x[0], pml_coordinates(x[1], alpha, k0, l_dom, l_pml)))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"751cbf93\",\n+ \"id\": \"10c041b6\",\n \"metadata\": {},\n \"source\": [\n \"We can then express this coordinate systems as a material\\n\",\n \"transformation within the PML region. In other words, the PML region\\n\",\n \"can be interpreted as a material having, in general, anisotropic,\\n\",\n \"inhomogeneous and complex permittivity\\n\",\n \"$\\\\boldsymbol{\\\\varepsilon}_{pml}$ and permeability\\n\",\n@@ -783,15 +783,15 @@\n \"$\\\\boldsymbol{\\\\varepsilon}_{pml}$ and $\\\\boldsymbol{\\\\mu}_{pml}$. The\\n\",\n \"here below function named `create_eps_mu()` serves this purpose:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"cd7a0c7f\",\n+ \"id\": \"e1051918\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"\\n\",\n \"\\n\",\n \"def create_eps_mu(\\n\",\n \" pml: ufl.tensors.ListTensor,\\n\",\n@@ -812,15 +812,15 @@\n \"eps_x, mu_x = create_eps_mu(x_pml, eps_bkg, 1)\\n\",\n \"eps_y, mu_y = create_eps_mu(y_pml, eps_bkg, 1)\\n\",\n \"eps_xy, mu_xy = create_eps_mu(xy_pml, eps_bkg, 1)\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"593b3e75\",\n+ \"id\": \"2b9f4b0c\",\n \"metadata\": {},\n \"source\": [\n \"The final weak form in the PML region is:\\n\",\n \"\\n\",\n \"$$\\n\",\n \"\\\\int_{\\\\Omega_{pml}}\\\\left[\\\\boldsymbol{\\\\mu}^{-1}_{pml} \\\\nabla \\\\times\\n\",\n \"\\\\mathbf{E} \\\\right]\\\\cdot \\\\nabla \\\\times \\\\bar{\\\\mathbf{v}}-k_{0}^{2}\\n\",\n@@ -841,15 +841,15 @@\n \"\\n\",\n \"Let's solve this equation in DOLFINx:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6ab74c14\",\n+ \"id\": \"4736d985\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Definition of the weak form\\n\",\n \"F = (\\n\",\n \" -ufl.inner(curl_2d(Es), curl_2d(v)) * dDom\\n\",\n \" + eps * (k0**2) * ufl.inner(Es, v) * dDom\\n\",\n@@ -891,52 +891,52 @@\n \")\\n\",\n \"Esh = problem.solve()\\n\",\n \"assert isinstance(Esh, fem.Function)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"eac14d7c\",\n+ \"id\": \"1981135c\",\n \"metadata\": {},\n \"source\": [\n \"Let's now save the solution in a `bp`-file. In order to do so, we need\\n\",\n \"to interpolate our solution discretized with Nedelec elements into a\\n\",\n \"compatible discontinuous Lagrange space.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"aa25da20\",\n+ \"id\": \"83c18de0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"gdim = mesh_data.mesh.geometry.dim\\n\",\n \"V_dg = fem.functionspace(mesh_data.mesh, (\\\"DG\\\", degree, (gdim,)))\\n\",\n \"Esh_dg = fem.Function(V_dg)\\n\",\n \"Esh_dg.interpolate(Esh)\\n\",\n \"\\n\",\n \"with VTXWriter(mesh_data.mesh.comm, out_folder / \\\"Esh.bp\\\", Esh_dg) as vtx:\\n\",\n \" vtx.write(0.0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4f9ce369\",\n+ \"id\": \"9f41e51e\",\n \"metadata\": {},\n \"source\": [\n \"For more information about saving and visualizing vector fields\\n\",\n \"discretized with Nedelec elements, check [this](./demo_interpolation-io)\\n\",\n \"DOLFINx demo.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0fa74345\",\n+ \"id\": \"fc1c28fd\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if have_pyvista:\\n\",\n \" V_cells, V_types, V_x = plot.vtk_mesh(V_dg)\\n\",\n \" V_grid = pyvista.UnstructuredGrid(V_cells, V_types, V_x)\\n\",\n \" Esh_values = np.zeros((V_x.shape[0], 3), dtype=np.float64)\\n\",\n@@ -953,25 +953,25 @@\n \" plotter.show()\\n\",\n \" else:\\n\",\n \" plotter.screenshot(out_folder / \\\"Esh.png\\\", window_size=[800, 800])\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2e508f4d\",\n+ \"id\": \"717f2458\",\n \"metadata\": {},\n \"source\": [\n \"Next we can calculate the total electric field\\n\",\n \"$\\\\mathbf{E}=\\\\mathbf{E}_s+\\\\mathbf{E}_b$ and save it:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"72243cd3\",\n+ \"id\": \"d0d37ffb\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"E = fem.Function(V)\\n\",\n \"E.x.array[:] = Eb.x.array[:] + Esh.x.array[:]\\n\",\n \"\\n\",\n \"E_dg = fem.Function(V_dg)\\n\",\n@@ -979,53 +979,53 @@\n \"\\n\",\n \"with VTXWriter(mesh_data.mesh.comm, out_folder / \\\"E.bp\\\", E_dg) as vtx:\\n\",\n \" vtx.write(0.0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"15c9c573\",\n+ \"id\": \"f00b819a\",\n \"metadata\": {},\n \"source\": [\n \"## Post-processing\\n\",\n \"\\n\",\n \"To validate the formulation we calculate the absorption, scattering\\n\",\n \"and extinction efficiencies, which are quantities that define how much\\n\",\n \"light is absorbed and scattered by the wire. First of all, we\\n\",\n \"calculate the analytical efficiencies with the\\n\",\n \"`calculate_analytical_efficiencies` function\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fd63efd1\",\n+ \"id\": \"7ceba1be\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"q_abs_analyt, q_sca_analyt, q_ext_analyt = calculate_analytical_efficiencies(\\n\",\n \" eps_au, n_bkg, wl0, radius_wire\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c0cae699\",\n+ \"id\": \"3bf2d894\",\n \"metadata\": {},\n \"source\": [\n \"We calculate the numerical efficiencies in the same way as done in\\n\",\n \"`demo_scattering_boundary_conditions.py`, with the only difference\\n\",\n \"that now the scattering efficiency needs to be calculated over an\\n\",\n \"inner facet, and therefore it requires a slightly different approach:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"8372f56e\",\n+ \"id\": \"d04e9a5a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"Z0 = np.sqrt(mu_0 / epsilon_0) # Vacuum impedance\\n\",\n \"Hsh_3d = -1j * curl_2d(Esh) / (Z0 * k0 * n_bkg) # Magnetic field H\\n\",\n \"Esh_3d = ufl.as_vector((Esh[0], Esh[1], 0))\\n\",\n \"E_3d = ufl.as_vector((E[0], E[1], 0))\\n\",\n@@ -1090,15 +1090,15 @@\n \"PETSc.Sys.Print(f\\\"The numerical extinction efficiency is {q_ext_fenics}\\\")\\n\",\n \"PETSc.Sys.Print(f\\\"The error is {err_ext * 100}%\\\")\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"b298a77d\",\n+ \"id\": \"91e4285d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Check if errors are smaller than 1%\\n\",\n \"assert err_abs < 0.01, \\\"Error in absorption efficiency is too large\\\"\\n\",\n \"# assert err_sca < 0.01\\n\",\n \"assert err_ext < 0.01, \\\"Error in extinction efficiency is too large\\\"\"\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/9561cf6cd1a70079b986f4eb31580cbd/demo_poisson_matrix_free.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/9561cf6cd1a70079b986f4eb31580cbd/demo_poisson_matrix_free.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_poisson_matrix_free.ipynb", "source2": "demo_poisson_matrix_free.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666667%", "Differences: {\"'cells'\": \"{0: {'id': '31c773bc'}, 1: {'id': 'f3a7de4c'}, 2: {'id': '8254048a'}, 3: {'id': \"", " \"'a4b3d279'}, 4: {'id': 'cbaceb84'}, 5: {'id': '0ea0c106'}, 6: {'id': '5bca42ed'}, 7: \"", " \"{'id': '9daafefc'}, 8: {'id': 'e25b7d00'}, 9: {'id': 'eb1b2c1d'}, 10: {'id': \"", " \"'3d75a9ff'}, 11: {'id': '5776c30a'}, 12: {'id': '59b8ecd3'}, 13: {'id': '854b1591'}, \"", " \"14: {'id': '2294e00b'}, 15: {'id': '460defb3'}, 16: {'id': '983028f0'}, 17: {'id': \"", " \"'4273b036'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"20152120\",\n+ \"id\": \"31c773bc\",\n \"metadata\": {},\n \"source\": [\n \"# Matrix-free conjugate gradient solver for the Poisson equation\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_poisson_matrix_free.py>`\\n\",\n@@ -71,57 +71,57 @@\n \"\\n\",\n \"The modules that will be used are imported:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"300ab3fd\",\n+ \"id\": \"f3a7de4c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n \"import numpy as np\\n\",\n \"\\n\",\n \"import dolfinx\\n\",\n \"import ufl\\n\",\n \"from dolfinx import fem, la\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"799018f5\",\n+ \"id\": \"8254048a\",\n \"metadata\": {},\n \"source\": [\n \"We begin by using {py:func}`create_rectangle\\n\",\n \"` to create a rectangular\\n\",\n \"{py:class}`Mesh ` of the domain, and creating a\\n\",\n \"finite element {py:class}`FunctionSpace `\\n\",\n \"on the mesh.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9a1b6d3e\",\n+ \"id\": \"a4b3d279\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"dtype = dolfinx.default_scalar_type\\n\",\n \"real_type = np.real(dtype(0.0)).dtype\\n\",\n \"comm = MPI.COMM_WORLD\\n\",\n \"mesh = dolfinx.mesh.create_rectangle(comm, [[0.0, 0.0], [1.0, 1.0]], (10, 10), dtype=real_type)\\n\",\n \"degree = 2\\n\",\n \"V = fem.functionspace(mesh, (\\\"Lagrange\\\", degree))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"edeac338\",\n+ \"id\": \"cbaceb84\",\n \"metadata\": {},\n \"source\": [\n \"The second argument to {py:class}`functionspace\\n\",\n \"` is a tuple consisting of `(family,\\n\",\n \"degree)`, where `family` is the finite element family, and `degree`\\n\",\n \"specifies the polynomial degree. In this case `V` consists of\\n\",\n \"third-order, continuous Lagrange finite element functions.\\n\",\n@@ -133,94 +133,94 @@\n \"facets on the boundary using {py:func}`exterior_facet_indices\\n\",\n \"`.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"48b66517\",\n+ \"id\": \"0ea0c106\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"tdim = mesh.topology.dim\\n\",\n \"mesh.topology.create_connectivity(tdim - 1, tdim)\\n\",\n \"facets = dolfinx.mesh.exterior_facet_indices(mesh.topology)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8f943d22\",\n+ \"id\": \"5bca42ed\",\n \"metadata\": {},\n \"source\": [\n \"We now find the degrees of freedom that are associated with the boundary\\n\",\n \"facets using\\n\",\n \"{py:func}`locate_dofs_topological `\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"038091a5\",\n+ \"id\": \"9daafefc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"dofs = fem.locate_dofs_topological(V=V, entity_dim=tdim - 1, entities=facets)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1aa0cfce\",\n+ \"id\": \"e25b7d00\",\n \"metadata\": {},\n \"source\": [\n \"and use {py:func}`dirichletbc ` to define the\\n\",\n \"essential boundary condition. On the boundary we prescribe the\\n\",\n \"{py:class}`Function ` `uD`, which we create by\\n\",\n \"interpolating the expression $u_{\\\\rm D}$ in the finite element space\\n\",\n \"$V$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1f3c7ade\",\n+ \"id\": \"eb1b2c1d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"uD = fem.Function(V, dtype=dtype)\\n\",\n \"uD.interpolate(lambda x: 1 + x[0] ** 2 + 2 * x[1] ** 2)\\n\",\n \"bc = fem.dirichletbc(value=uD, dofs=dofs)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"3ad206c9\",\n+ \"id\": \"3d75a9ff\",\n \"metadata\": {},\n \"source\": [\n \"Next, we express the variational problem using UFL.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ba6c472e\",\n+ \"id\": \"5776c30a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"x = ufl.SpatialCoordinate(mesh)\\n\",\n \"u = ufl.TrialFunction(V)\\n\",\n \"v = ufl.TestFunction(V)\\n\",\n \"f = fem.Constant(mesh, dtype(-6.0))\\n\",\n \"a = ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx\\n\",\n \"L = ufl.inner(f, v) * ufl.dx\\n\",\n \"L_fem = fem.form(L, dtype=dtype)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d6949b41\",\n+ \"id\": \"59b8ecd3\",\n \"metadata\": {},\n \"source\": [\n \"For the matrix-free solvers we also define a second linear form `M` as\\n\",\n \"the {py:class}`action ` of the bilinear form $a$ on an\\n\",\n \"arbitrary {py:class}`Function ` `ui`. This linear\\n\",\n \"form is defined as\\n\",\n \"\\n\",\n@@ -228,87 +228,87 @@\n \"M(v) = a(u_i, v) \\\\quad \\\\text{for} \\\\; \\\\ u_i \\\\in V.\\n\",\n \"$$\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"817a5638\",\n+ \"id\": \"854b1591\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"ui = fem.Function(V, dtype=dtype)\\n\",\n \"M = ufl.action(a, ui)\\n\",\n \"M_fem = fem.form(M, dtype=dtype)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"fea6cf12\",\n+ \"id\": \"2294e00b\",\n \"metadata\": {},\n \"source\": [\n \"### Matrix-free conjugate gradient solver\\n\",\n \"\\n\",\n \"The right hand side vector $b - A x_{\\\\rm bc}$ is the assembly of the\\n\",\n \"linear form $L$ where the essential Dirichlet boundary conditions are\\n\",\n \"implemented using lifting. Since we want to avoid assembling the matrix\\n\",\n \"`A`, we compute the necessary matrix-vector product using the linear form\\n\",\n \"`M` explicitly.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"8e8a86e6\",\n+ \"id\": \"460defb3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Apply lifting: b <- b - A * x_bc\\n\",\n \"b = fem.assemble_vector(L_fem)\\n\",\n \"ui.x.array[:] = 0.0\\n\",\n \"bc.set(ui.x.array, alpha=-1.0)\\n\",\n \"fem.assemble_vector(b.array, M_fem)\\n\",\n \"b.scatter_reverse(la.InsertMode.add)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"275d454d\",\n+ \"id\": \"983028f0\",\n \"metadata\": {},\n \"source\": [\n \"Set BC dofs to zero on right hand side\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"de1dc150\",\n+ \"id\": \"4273b036\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"bc.set(b.array, alpha=0.0)\\n\",\n \"b.scatter_forward()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f0cee6d4\",\n+ \"id\": \"de544556\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"To implement the matrix-free CG solver using *DOLFINx* vectors, we\\n\",\n \"define the function `action_A` to compute the matrix-vector product $y\\n\",\n \"= A x$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"caac1292\",\n+ \"id\": \"dcfd9981\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def action_A(x, y):\\n\",\n \" # Set coefficient vector of the linear form M and ensure it is\\n\",\n@@ -323,15 +323,15 @@\n \"\\n\",\n \" # Set BC dofs to zero\\n\",\n \" bc.set(y.array, alpha=0.0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0110c5cd\",\n+ \"id\": \"15ae0b03\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"### Basic conjugate gradient solver\\n\",\n \"\\n\",\n \"Solves the problem `A x = b`, using the function `action_A` as the\\n\",\n@@ -339,15 +339,15 @@\n \"right hand side vector. `comm` is the MPI Communicator, `max_iter` is\\n\",\n \"the maximum number of iterations, `rtol` is the relative tolerance.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1b97ea6a\",\n+ \"id\": \"b60be983\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def cg(comm, action_A, x: la.Vector, b: la.Vector, max_iter: int = 200, rtol: float = 1e-6):\\n\",\n \" rtol2 = rtol**2\\n\",\n \"\\n\",\n \" nr = b.index_map.size_local\\n\",\n@@ -385,66 +385,66 @@\n \" p.array[:] = beta * p.array + r\\n\",\n \"\\n\",\n \" raise RuntimeError(f\\\"Solver exceeded max iterations ({max_iter}).\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f6edf38e\",\n+ \"id\": \"b79a4728\",\n \"metadata\": {},\n \"source\": [\n \"This matrix-free solver is now used to compute the finite element\\n\",\n \"solution. The finite element solution's approximation error as\\n\",\n \"compared with the exact solution is measured in the $L_2$-norm.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9e874f6d\",\n+ \"id\": \"656517a1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"rtol = 1e-6\\n\",\n \"u = fem.Function(V, dtype=dtype)\\n\",\n \"iter_cg1 = cg(mesh.comm, action_A, u.x, b, max_iter=200, rtol=rtol)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a8db570a\",\n+ \"id\": \"f5bb3f7d\",\n \"metadata\": {},\n \"source\": [\n \"Set BC values in the solution vector\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9222affd\",\n+ \"id\": \"d0563f8d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"bc.set(u.x.array, alpha=1.0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"dca3deda\",\n+ \"id\": \"1ec5a7ca\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Print CG iteration number and error\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"cb5fc741\",\n+ \"id\": \"26778a57\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def L2Norm(u):\\n\",\n \" val = fem.assemble_scalar(fem.form(ufl.inner(u, u) * ufl.dx, dtype=dtype))\\n\",\n \" return np.sqrt(comm.allreduce(val, op=MPI.SUM))\\n\",\n \"\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/9b362df2c2031d4138a5021a53979414/demo_cahn-hilliard.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/9b362df2c2031d4138a5021a53979414/demo_cahn-hilliard.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_cahn-hilliard.ipynb", "source2": "demo_cahn-hilliard.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9870631720430108%", "Differences: {\"'cells'\": \"{0: {'id': 'f5962267'}, 1: {'id': 'efea76b6'}, 2: {'id': '92a3fdcc'}, 3: {'id': \"", " \"'adc0de17'}, 4: {'id': '3f12ff12'}, 5: {'id': 'ef33caad'}, 6: {'id': 'a58a3192'}, 7: \"", " \"{'id': '82beecc8'}, 8: {'id': '15193a0f'}, 9: {'id': '9cd441e6'}, 10: {'id': \"", " \"'4026d21d'}, 11: {'id': '7df284ac'}, 12: {'id': '673df270'}, 13: {'id': '25f97ffc'}, \"", " \"14: {'id': 'f5772db9'}, 15: {'id': '55d1a795'}, 16: {'id': '74e90bd7'}, 17: {'id': \"", " \"'ea2251f3'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"93c47337\",\n+ \"id\": \"f5962267\",\n \"metadata\": {},\n \"source\": [\n \"# Cahn-Hilliard equation\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_cahn-hilliard.py>`\\n\",\n@@ -114,15 +114,15 @@\n \"\\n\",\n \"## Implementation\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d20159a5\",\n+ \"id\": \"efea76b6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"import os\\n\",\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n@@ -150,77 +150,77 @@\n \"\\n\",\n \"# Save all logging to file\\n\",\n \"log.set_output_file(\\\"log.txt\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a4d825f3\",\n+ \"id\": \"92a3fdcc\",\n \"metadata\": {},\n \"source\": [\n \"Next, various model parameters are defined:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a2e494a2\",\n+ \"id\": \"adc0de17\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"lmbda = 1.0e-02 # surface parameter\\n\",\n \"dt = 5.0e-06 # time step\\n\",\n \"theta = 0.5 # time stepping family, e.g. theta=1 -> backward Euler, theta=0.5 -> Crank-Nicholson\\n\",\n \"t = 0.0 # Current time\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"54cdd4d0\",\n+ \"id\": \"3f12ff12\",\n \"metadata\": {},\n \"source\": [\n \"A unit square mesh with 96 cells edges in each direction is created,\\n\",\n \"and on this mesh a\\n\",\n \"{py:class}`FunctionSpace ` `ME` is built\\n\",\n \"using a pair of linear Lagrange elements.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2d82f452\",\n+ \"id\": \"ef33caad\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = create_unit_square(MPI.COMM_WORLD, 96, 96, CellType.triangle)\\n\",\n \"P1 = element(\\\"Lagrange\\\", msh.basix_cell(), 1, dtype=default_real_type)\\n\",\n \"ME = functionspace(msh, mixed_element([P1, P1]))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ba02cd23\",\n+ \"id\": \"a58a3192\",\n \"metadata\": {},\n \"source\": [\n \"Trial and test functions of the space `ME` are now defined:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2d0bcece\",\n+ \"id\": \"82beecc8\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"q, v = ufl.TestFunctions(ME)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"53e6b77b\",\n+ \"id\": \"15193a0f\",\n \"metadata\": {},\n \"source\": [\n \"```{index} split functions\\n\",\n \"```\\n\",\n \"\\n\",\n \"For the test functions, {py:func}`TestFunctions` (note the 's' at the end) is used to\\n\",\n@@ -229,29 +229,29 @@\n \"are defined to represent $u = (c_{n+1}, \\\\mu_{n+1})$ and $u0 = (c_{n},\\n\",\n \"\\\\mu_{n})$, and these are then split into sub-functions:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7b5d2194\",\n+ \"id\": \"9cd441e6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"u = Function(ME) # current solution\\n\",\n \"u0 = Function(ME) # solution from previous converged step\\n\",\n \"\\n\",\n \"# Split mixed functions\\n\",\n \"c, mu = ufl.split(u)\\n\",\n \"c0, mu0 = ufl.split(u0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"931d617a\",\n+ \"id\": \"4026d21d\",\n \"metadata\": {},\n \"source\": [\n \"The line `c, mu = split(u)` permits direct access to the\\n\",\n \"components of a mixed function. Note that `c` and `mu` are references\\n\",\n \"for components of `u`, and not copies.\\n\",\n \"\\n\",\n \"```{index} single: interpolating functions; (in Cahn-Hilliard demo)\\n\",\n@@ -259,28 +259,28 @@\n \"\\n\",\n \"The initial conditions are interpolated into a finite element space:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"cd8840f0\",\n+ \"id\": \"7df284ac\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"\\n\",\n \"# Interpolate initial condition\\n\",\n \"rng = np.random.default_rng(42)\\n\",\n \"u.sub(0).interpolate(lambda x: 0.63 + 0.02 * (0.5 - rng.random(x.shape[1])))\\n\",\n \"u.x.scatter_forward()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"70df5bc0\",\n+ \"id\": \"673df270\",\n \"metadata\": {},\n \"source\": [\n \"The first line creates an object of type `InitialConditions`. The\\n\",\n \"following two lines make `u` and `u0` interpolants of `u_init` (since\\n\",\n \"`u` and `u0` are finite element functions, they may not be able to\\n\",\n \"represent a given function exactly, but the function can be\\n\",\n \"approximated by interpolating it in a finite element space).\\n\",\n@@ -291,59 +291,59 @@\n \"The chemical potential $df/dc$ is computed using UFL automatic\\n\",\n \"differentiation:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9f23ba10\",\n+ \"id\": \"25f97ffc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Compute the chemical potential df/dc\\n\",\n \"c = ufl.variable(c)\\n\",\n \"f = 100 * c**2 * (1 - c) ** 2\\n\",\n \"dfdc = ufl.diff(f, c)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"44fc6f68\",\n+ \"id\": \"f5772db9\",\n \"metadata\": {},\n \"source\": [\n \"The first line declares that `c` is a variable that some function can\\n\",\n \"be differentiated with respect to. The next line is the function $f$\\n\",\n \"defined in the problem statement, and the third line performs the\\n\",\n \"differentiation of `f` with respect to the variable `c`.\\n\",\n \"\\n\",\n \"It is convenient to introduce an expression for $\\\\mu_{n+\\\\theta}$:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"def47499\",\n+ \"id\": \"55d1a795\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"mu_mid = (1.0 - theta) * mu0 + theta * mu # mu_(n+theta)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"8f116089\",\n+ \"id\": \"74e90bd7\",\n \"metadata\": {},\n \"source\": [\n \"which is then used in the definition of the variational forms:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1b96d51b\",\n+ \"id\": \"ea2251f3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Weak statement of the equations\\n\",\n \"F0 = (\\n\",\n \" ufl.inner(c, q) * ufl.dx\\n\",\n \" - ufl.inner(c0, q) * ufl.dx\\n\",\n@@ -355,15 +355,15 @@\n \" - lmbda * ufl.inner(ufl.grad(c), ufl.grad(v)) * ufl.dx\\n\",\n \")\\n\",\n \"F = F0 + F1\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"cdf8e97d\",\n+ \"id\": \"5c6763d4\",\n \"metadata\": {},\n \"source\": [\n \"This is a statement of the time-discrete equations presented as part\\n\",\n \"of the problem statement, using UFL syntax.\\n\",\n \"\\n\",\n \"```{index} single: Newton solver; (in Cahn-Hilliard demo)\\n\",\n \"```\\n\",\n@@ -378,15 +378,15 @@\n \"[`SNES convegence tests`](https://petsc.org/release/manual/snes/#convergence-tests)\\n\",\n \"for further details.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e11603d5\",\n+ \"id\": \"2edeadad\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"use_superlu = PETSc.IntType == np.int64 # or PETSc.ScalarType == np.complex64\\n\",\n \"sys = PETSc.Sys() # type: ignore\\n\",\n \"if sys.hasExternalPackage(\\\"mumps\\\") and not use_superlu:\\n\",\n \" linear_solver = \\\"mumps\\\"\\n\",\n@@ -408,65 +408,65 @@\n \"problem = NonlinearProblem(\\n\",\n \" F, u, petsc_options_prefix=\\\"demo_cahn-hilliard_\\\", petsc_options=petsc_options\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e96104f4\",\n+ \"id\": \"bdfeaffc\",\n \"metadata\": {},\n \"source\": [\n \"We prepare output files and pyvista for time-dependent visualization:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ab5f0896\",\n+ \"id\": \"3984e764\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"out_folder = Path(\\\"demo_ch\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\\n\",\n \"file = XDMFFile(MPI.COMM_WORLD, out_folder / \\\"output.xdmf\\\", \\\"w\\\") # Output file\\n\",\n \"file.write_mesh(msh)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0da2bb27\",\n+ \"id\": \"c16d4922\",\n \"metadata\": {},\n \"source\": [\n \"Get the sub-space for c and the corresponding dofs in the mixed space\\n\",\n \"vector. This is used for visualization on the collapsed subspace with\\n\",\n \"pyvista.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d09b8e7c\",\n+ \"id\": \"223467ea\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"V0, dofs = ME.sub(0).collapse()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9d87c323\",\n+ \"id\": \"cc7e649e\",\n \"metadata\": {},\n \"source\": [\n \"Prepare viewer for plotting the solution during the computation\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fc7f0ccd\",\n+ \"id\": \"7c121fd1\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"if have_pyvista:\\n\",\n \" # Create a VTK 'mesh' with 'nodes' at the function dofs\\n\",\n@@ -482,38 +482,38 @@\n \" p.view_xy(negative=True)\\n\",\n \" p.add_text(f\\\"time: {t}\\\", font_size=12, name=\\\"timelabel\\\")\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"934fa708\",\n+ \"id\": \"cdabb6fc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Reduce run time if on test (CI) server\\n\",\n \"if \\\"CI\\\" in os.environ.keys() or \\\"GITHUB_ACTIONS\\\" in os.environ.keys():\\n\",\n \" T = 3 * dt\\n\",\n \"else:\\n\",\n \" T = 50 * dt\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f2550729\",\n+ \"id\": \"31960528\",\n \"metadata\": {},\n \"source\": [\n \"The solver is advanced in time from $t_{n}$ to\\n\",\n \"$t_{n+1}$ until a terminal time $T$ is reached\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d170de5e\",\n+ \"id\": \"e4c77736\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"c = u.sub(0)\\n\",\n \"u0.x.array[:] = u.x.array\\n\",\n \"step = 0\\n\",\n \"while t < T:\\n\",\n@@ -538,24 +538,24 @@\n \" p.app.processEvents()\\n\",\n \"\\n\",\n \"file.close()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b774f50d\",\n+ \"id\": \"be5e17ce\",\n \"metadata\": {},\n \"source\": [\n \"Update plot\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"cb678cc5\",\n+ \"id\": \"31eeffd0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if have_pyvista:\\n\",\n \" grid.point_data[\\\"c\\\"] = u.x.array[dofs].real\\n\",\n \" screenshot = out_folder / \\\"ch.png\\\" if pv.OFF_SCREEN else None\\n\",\n \" pv.plot(grid, show_edges=True, screenshot=screenshot)\"\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/9ed4657d08dda04de30e6463e2f58d75/demo_mixed-poisson.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/9ed4657d08dda04de30e6463e2f58d75/demo_mixed-poisson.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_mixed-poisson.ipynb", "source2": "demo_mixed-poisson.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666667%", "Differences: {\"'cells'\": \"{0: {'id': '66a979ed'}, 1: {'id': 'db2f71d5'}, 2: {'id': '4a7ec385'}, 3: {'id': \"", " \"'8053216b'}, 4: {'id': '72ca089a'}, 5: {'id': '1f564d93'}, 6: {'id': '1b4da9ae'}, 7: \"", " \"{'id': 'b6928c5a'}, 8: {'id': 'd1bf29dc'}, 9: {'id': 'f33772ab'}, 10: {'id': \"", " \"'2fef4c6c'}, 11: {'id': '58c5c0af'}, 12: {'id': 'b7d590e6'}, 13: {'id': '478a2d2a'}, \"", " \"14: {'id': 'd29763a2'}, 15: {'id': 'fce9a6fb'}, 16: {'id': '9e5cb5ea'}, 17: {'id': \"", " \"'e9344568'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7c5f058e\",\n+ \"id\": \"66a979ed\",\n \"metadata\": {},\n \"source\": [\n \"# Mixed formulation of the Poisson equation with a block-preconditioner/solver # noqa\\n\",\n \"\\n\",\n \"This demo illustrates how to solve the Poisson equation using a mixed\\n\",\n \"(two-field) formulation and a block-preconditioned iterative solver.\\n\",\n \"In particular, it illustrates how to\\n\",\n@@ -83,27 +83,27 @@\n \"iterative method with a block-diagonal preconditioner that is based on\\n\",\n \"the Riesz map, see for example this\\n\",\n \"[paper](https://doi.org/10.1002/(SICI)1099-1506(199601/02)3:1%3C1::AID-NLA67%3E3.0.CO;2-E).\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c654e725\",\n+ \"id\": \"db2f71d5\",\n \"metadata\": {},\n \"source\": [\n \"\\n\",\n \"## Implementation\\n\",\n \"\\n\",\n \"Import the required modules:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7eab2b14\",\n+ \"id\": \"4a7ec385\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n \"\\n\",\n \"import numpy as np\\n\",\n@@ -119,38 +119,38 @@\n \"# types\\n\",\n \"dtype = dolfinx.default_scalar_type\\n\",\n \"xdtype = dolfinx.default_real_type\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"181ae3c9\",\n+ \"id\": \"8053216b\",\n \"metadata\": {},\n \"source\": [\n \"Create a two-dimensional mesh. The iterative solver constructed\\n\",\n \"later requires special construction that is specific to two\\n\",\n \"dimensions. Application in three-dimensions would require a number of\\n\",\n \"changes to the linear solver.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a32ff357\",\n+ \"id\": \"72ca089a\",\n \"metadata\": {\n \"lines_to_next_cell\": 0\n },\n \"outputs\": [],\n \"source\": [\n \"msh = create_unit_square(MPI.COMM_WORLD, 96, 96, CellType.triangle, dtype=xdtype)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4f3b015e\",\n+ \"id\": \"1f564d93\",\n \"metadata\": {},\n \"source\": [\n \"\\n\",\n \"Here we construct compatible function spaces for the mixed Poisson\\n\",\n \"problem. The `V` Raviart-Thomas ($\\\\mathbb{RT}$) space is a\\n\",\n \"vector-valued $H({\\\\rm div})$ conforming space. The `W` space is a\\n\",\n \"space of discontinuous Lagrange function of degree `k`.\\n\",\n@@ -161,81 +161,81 @@\n \"In the lowest-order case $k=1$. It can be increased, by the\\n\",\n \"convergence of the iterative solver will degrade.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4b0a5805\",\n+ \"id\": \"1b4da9ae\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"k = 1\\n\",\n \"V = fem.functionspace(msh, element(\\\"RT\\\", msh.basix_cell(), k, dtype=xdtype))\\n\",\n \"W = fem.functionspace(msh, element(\\\"Discontinuous Lagrange\\\", msh.basix_cell(), k - 1, dtype=xdtype))\\n\",\n \"Q = ufl.MixedFunctionSpace(V, W)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"6f90379f\",\n+ \"id\": \"b6928c5a\",\n \"metadata\": {},\n \"source\": [\n \"Trial functions for $\\\\sigma$ and $u$ are declared on the space $V$ and\\n\",\n \"$W$, with corresponding test functions $\\\\tau$ and $v$:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c1005e1a\",\n+ \"id\": \"d1bf29dc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"sigma, u = ufl.TrialFunctions(Q)\\n\",\n \"tau, v = ufl.TestFunctions(Q)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"405bffde\",\n+ \"id\": \"f33772ab\",\n \"metadata\": {},\n \"source\": [\n \"The source function is set to be $f = 10\\\\exp(-((x_{0} - 0.5)^2 +\\n\",\n \"(x_{1} - 0.5)^2) / 0.02)$:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"eea72afe\",\n+ \"id\": \"2fef4c6c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"x = ufl.SpatialCoordinate(msh)\\n\",\n \"f = 10 * ufl.exp(-((x[0] - 0.5) * (x[0] - 0.5) + (x[1] - 0.5) * (x[1] - 0.5)) / 0.02)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"99a2fac2\",\n+ \"id\": \"58c5c0af\",\n \"metadata\": {},\n \"source\": [\n \"We now declare the blocked bilinear and linear forms. We use\\n\",\n \"`ufl.extract_blocks` to extract the block structure of the bilinear\\n\",\n \"and linear form. For the first block of the right-hand side, we provide\\n\",\n \"a form that efficiently is 0. We do this to preserve knowledge of the\\n\",\n \"test space in the block. *Note that the defined `L` corresponds to\\n\",\n \"$u_{0} = 0$ on $\\\\Gamma_{D}$.*\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ef32579e\",\n+ \"id\": \"b7d590e6\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"dx = ufl.Measure(\\\"dx\\\", msh)\\n\",\n \"\\n\",\n@@ -243,15 +243,15 @@\n \" ufl.inner(sigma, tau) * dx + ufl.inner(u, ufl.div(tau)) * dx + ufl.inner(ufl.div(sigma), v) * dx\\n\",\n \")\\n\",\n \"L = [ufl.ZeroBaseForm((tau,)), -ufl.inner(f, v) * dx]\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"bd8ff04e\",\n+ \"id\": \"478a2d2a\",\n \"metadata\": {},\n \"source\": [\n \"In preparation for Dirichlet boundary conditions, we use the function\\n\",\n \"{py:func}`locate_entities_boundary\\n\",\n \"` to locate mesh entities\\n\",\n \"(facets) with which degree-of-freedoms to be constrained are\\n\",\n \"associated with, and then use {py:func}`locate_dofs_topological\\n\",\n@@ -260,52 +260,52 @@\n \"degree-of-freedom in `V` on the (i) top ($x_{1} = 1$)\\n\",\n \"and (ii) bottom ($x_{1} = 0$) of the mesh/domain.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7cff4c7a\",\n+ \"id\": \"d29763a2\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"fdim = msh.topology.dim - 1\\n\",\n \"facets_top = mesh.locate_entities_boundary(msh, fdim, lambda x: np.isclose(x[1], 1.0))\\n\",\n \"facets_bottom = mesh.locate_entities_boundary(msh, fdim, lambda x: np.isclose(x[1], 0.0))\\n\",\n \"dofs_top = fem.locate_dofs_topological(V, fdim, facets_top)\\n\",\n \"dofs_bottom = fem.locate_dofs_topological(V, fdim, facets_bottom)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"bf63400f\",\n+ \"id\": \"fce9a6fb\",\n \"metadata\": {},\n \"source\": [\n \"Now, we create Dirichlet boundary objects for the condition $\\\\sigma\\n\",\n \"\\\\cdot n = \\\\sin(5 x_(0)$ on the top and bottom boundaries:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"af4f8e81\",\n+ \"id\": \"9e5cb5ea\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"cells_top_ = mesh.compute_incident_entities(msh.topology, facets_top, fdim, fdim + 1)\\n\",\n \"cells_bottom = mesh.compute_incident_entities(msh.topology, facets_bottom, fdim, fdim + 1)\\n\",\n \"g = fem.Function(V, dtype=dtype)\\n\",\n \"g.interpolate(lambda x: np.vstack((np.zeros_like(x[0]), np.sin(5 * x[0]))), cells0=cells_top_)\\n\",\n \"g.interpolate(lambda x: np.vstack((np.zeros_like(x[0]), -np.sin(5 * x[0]))), cells0=cells_bottom)\\n\",\n \"bcs = [fem.dirichletbc(g, dofs_top), fem.dirichletbc(g, dofs_bottom)]\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"520c550b\",\n+ \"id\": \"e9344568\",\n \"metadata\": {},\n \"source\": [\n \"Rather than solving the linear system $A x = b$, we will solve the\\n\",\n \"preconditioned problem $P^{-1} A x = P^{-1} b$. Commonly $P = A$, but\\n\",\n \"this does not lead to efficient solvers for saddle point problems.\\n\",\n \"\\n\",\n \"For this problem, we introduce the preconditioner\\n\",\n@@ -319,60 +319,60 @@\n \"\\n\",\n \"and assemble it into the matrix `P`:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2f6ce6cc\",\n+ \"id\": \"c023e2f6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"a_p = ufl.extract_blocks(\\n\",\n \" ufl.inner(sigma, tau) * dx + ufl.inner(ufl.div(sigma), ufl.div(tau)) * dx + ufl.inner(u, v) * dx\\n\",\n \")\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0d7db876\",\n+ \"id\": \"7af2eeba\",\n \"metadata\": {},\n \"source\": [\n \"We create finite element functions that will hold the $\\\\sigma$ and $u$\\n\",\n \"solutions:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"8556c94c\",\n+ \"id\": \"47e6f052\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"sigma, u = fem.Function(V, name=\\\"sigma\\\", dtype=dtype), fem.Function(W, name=\\\"u\\\", dtype=dtype)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9ee78177\",\n+ \"id\": \"90fd77dc\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"We now create a linear problem solver for the mixed problem.\\n\",\n \"As we will use different preconditions for the individual blocks of\\n\",\n \"the saddle point problem, we specify the matrix kind to be \\\"nest\\\",\\n\",\n \"so that we can use [`fieldsplit`](https://petsc.org/release/manual/ksp/#sec-block-matrices)\\n\",\n \"(block) type and set the 'splits' between the $\\\\sigma$ and $u$ fields.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"275832e0\",\n+ \"id\": \"54ead6ba\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"\\n\",\n \"problem = fem.petsc.LinearProblem(\\n\",\n@@ -393,27 +393,27 @@\n \" },\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0a2f4d94\",\n+ \"id\": \"9cd48a66\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"ksp = problem.solver\\n\",\n \"ksp.setMonitor(\\n\",\n \" lambda _, its, rnorm: PETSc.Sys.Print(f\\\"Iteration: {its:>4d}, residual: {rnorm:.3e}\\\")\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4a7054e8\",\n+ \"id\": \"86a2b195\",\n \"metadata\": {},\n \"source\": [\n \"For the $P_{11}$ block, which is the discontinuous Lagrange mass\\n\",\n \"matrix, we let the preconditioner be the default, which is incomplete\\n\",\n \"LU factorisation and which can solve the block exactly in one\\n\",\n \"iteration. The $P_{00}$ requires careful handling as $H({\\\\rm div})$\\n\",\n \"problems require special preconditioners to be efficient.\\n\",\n@@ -425,15 +425,15 @@\n \"$H({\\\\rm div})$ and $H({\\\\rm curl})$ spaces are effectively the same in\\n\",\n \"two-dimensions, just rotated by $\\\\pi/2.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a0ecf484\",\n+ \"id\": \"42d584a6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"ksp_sigma, ksp_u = ksp.getPC().getFieldSplitSubKSP()\\n\",\n \"pc_sigma = ksp_sigma.getPC()\\n\",\n \"if PETSc.Sys().hasExternalPackage(\\\"hypre\\\") and not np.issubdtype(dtype, np.complexfloating):\\n\",\n \" pc_sigma.setType(\\\"hypre\\\")\\n\",\n@@ -485,49 +485,49 @@\n \" pc_sigma.setFactorSolverType(\\\"mumps\\\")\\n\",\n \" elif PETSc.Sys().hasExternalPackage(\\\"superlu_dist\\\"):\\n\",\n \" pc_sigma.setFactorSolverType(\\\"superlu_dist\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b5551043\",\n+ \"id\": \"3f2e5353\",\n \"metadata\": {},\n \"source\": [\n \"Once we have set the preconditioners for the two blocks, we can\\n\",\n \"solve the linear system.\\n\",\n \"{py:class}`LinearProblem` will\\n\",\n \"automatically assemble the linear system, apply the boundary\\n\",\n \"conditions, call the Krylov solver and update the solution\\n\",\n \"vectors `u` and `sigma`.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"db8492a9\",\n+ \"id\": \"7ff00bb6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"problem.solve()\\n\",\n \"converged_reason = problem.solver.getConvergedReason()\\n\",\n \"assert converged_reason > 0, f\\\"Krylov solver has not converged, reason: {converged_reason}.\\\"\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"41280c0e\",\n+ \"id\": \"41c391c7\",\n \"metadata\": {},\n \"source\": [\n \"We save the solution `u` in VTX format:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d2f5c5b7\",\n+ \"id\": \"6eb5c63a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if dolfinx.has_adios2:\\n\",\n \" from dolfinx.io import VTXWriter\\n\",\n \"\\n\",\n \" with VTXWriter(msh.comm, \\\"output_mixed_poisson.bp\\\", u) as f:\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/a5df6747d3300b9568f25507c7fb2517/demo_interpolation-io.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/a5df6747d3300b9568f25507c7fb2517/demo_interpolation-io.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_interpolation-io.ipynb", "source2": "demo_interpolation-io.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666666%", "Differences: {\"'cells'\": \"{0: {'id': '55999a4b'}, 1: {'id': '7f513e3e'}, 2: {'id': '92720016'}, 3: {'id': \"", " \"'18007811'}, 4: {'id': '7ac874dd'}, 5: {'id': '9dec2c9a'}, 6: {'id': '13feb13a'}, 7: \"", " \"{'id': '39624aae'}, 8: {'id': '2aab222f'}, 9: {'id': '96041bdd'}, 10: {'id': \"", " \"'f124c3cd'}, 11: {'id': 'bf198d13'}, 12: {'id': '72aa4dcc'}, 13: {'id': 'f8a9836c'}, \"", " \"14: {'id': 'b6960f7b'}, 15: {'id': '76472cb3'}}\"}"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c3264477\",\n+ \"id\": \"55999a4b\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"# Interpolation and IO\\n\",\n \"\\n\",\n \"Copyright (C) 2022 Garth N. Wells\\n\",\n@@ -26,15 +26,15 @@\n \"these special finite elements in discontinuous Lagrange spaces for\\n\",\n \"artifact-free visualisation.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a6c20fe9\",\n+ \"id\": \"7f513e3e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n@@ -44,128 +44,128 @@\n \"from dolfinx import default_scalar_type, has_adios2, plot\\n\",\n \"from dolfinx.fem import Function, functionspace\\n\",\n \"from dolfinx.mesh import CellType, create_rectangle, locate_entities\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"97a2021f\",\n+ \"id\": \"92720016\",\n \"metadata\": {},\n \"source\": [\n \"Create a mesh. For later in the demo we need to ensure that a boundary\\n\",\n \"between cells is located at $x_0=0.5$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"52f01314\",\n+ \"id\": \"18007811\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = create_rectangle(MPI.COMM_WORLD, ((0.0, 0.0), (1.0, 1.0)), (16, 16), CellType.triangle)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"726e218a\",\n+ \"id\": \"7ac874dd\",\n \"metadata\": {},\n \"source\": [\n \"Create a N\\u00e9d\\u00e9lec function space and finite element Function\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7ba1e37c\",\n+ \"id\": \"9dec2c9a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"V = functionspace(msh, (\\\"Nedelec 1st kind H(curl)\\\", 1))\\n\",\n \"u = Function(V, dtype=default_scalar_type)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"5649e076\",\n+ \"id\": \"13feb13a\",\n \"metadata\": {},\n \"source\": [\n \"Find cells with *all* vertices (0) $x_0 <= 0.5$ or (1) $x_0 >= 0.5$:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ac2969a7\",\n+ \"id\": \"39624aae\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"tdim = msh.topology.dim\\n\",\n \"cells0 = locate_entities(msh, tdim, lambda x: x[0] <= 0.5)\\n\",\n \"cells1 = locate_entities(msh, tdim, lambda x: x[0] >= 0.5)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e77c858e\",\n+ \"id\": \"2aab222f\",\n \"metadata\": {},\n \"source\": [\n \"Interpolate in the N\\u00e9d\\u00e9lec/H(curl) space a vector-valued expression\\n\",\n \"`f`, where $f \\\\cdot n$ is discontinuous at $x_0 = 0.5$ and $f \\\\cdot\\n\",\n \"e$ is continuous.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a8f558a5\",\n+ \"id\": \"96041bdd\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"u.interpolate(lambda x: np.vstack((x[0], x[1])), cells0)\\n\",\n \"u.interpolate(lambda x: np.vstack((x[0] + 1, x[1])), cells1)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1024f34d\",\n+ \"id\": \"f124c3cd\",\n \"metadata\": {},\n \"source\": [\n \"Create a vector-valued discontinuous Lagrange space and function, and\\n\",\n \"interpolate the $H({\\\\rm curl})$ function `u`\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"40bbfd4d\",\n+ \"id\": \"bf198d13\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"gdim = msh.geometry.dim\\n\",\n \"V0 = functionspace(msh, (\\\"Discontinuous Lagrange\\\", 1, (gdim,)))\\n\",\n \"u0 = Function(V0, dtype=default_scalar_type)\\n\",\n \"u0.interpolate(u)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e4ba9d97\",\n+ \"id\": \"72aa4dcc\",\n \"metadata\": {},\n \"source\": [\n \"We save the interpolated function `u0` in VTX format. When visualising\\n\",\n \"the field, at $x_0 = 0.5$ the $x_0$-component should appear\\n\",\n \"discontinuous and the $x_1$-component should appear continuous.\\n\",\n \"We use the {py:class}`dolfinx.io.VTXWriter` to store the data.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"13f769fb\",\n+ \"id\": \"f8a9836c\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"out_folder = Path(\\\"output_nedelec\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\\n\",\n@@ -176,24 +176,24 @@\n \" f.write(0.0)\\n\",\n \"else:\\n\",\n \" print(\\\"ADIOS2 required for VTX output\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7b2e87d0\",\n+ \"id\": \"b6960f7b\",\n \"metadata\": {},\n \"source\": [\n \"Plot the functions\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"98417526\",\n+ \"id\": \"76472cb3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"try:\\n\",\n \" import pyvista\\n\",\n \"\\n\",\n \" cells, types, x = plot.vtk_mesh(V0)\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/b3f0523386e0521f7e6a5599627be9fc/demo_half_loaded_waveguide.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/b3f0523386e0521f7e6a5599627be9fc/demo_half_loaded_waveguide.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_half_loaded_waveguide.ipynb", "source2": "demo_half_loaded_waveguide.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869186046511628%", "Differences: {\"'cells'\": \"{0: {'id': '93aa84f0'}, 1: {'id': '179c8d14'}, 2: {'id': 'f12adaaf'}, 3: {'id': \"", " \"'8ddd2639'}, 4: {'id': '60357d02'}, 5: {'id': '85e249f4'}, 6: {'id': 'd06fbd81'}, 7: \"", " \"{'id': 'cb219308'}, 8: {'id': 'c90e1382'}, 9: {'id': '51b922bd'}, 10: {'id': \"", " \"'49789e72'}, 11: {'id': '3e827480'}, 12: {'id': '8108e8b9'}, 13: {'id': '5881702b'}, \"", " \"14: {'id': '666ee5b7'}, 15: {'id': 'f1b4f01c'}, 16: {'id': '3b01d218'}, 17: {'id': \"", " \"'418032e8'}, 1 [\u2026]"], "unified_diff": "@@ -1,20 +1,20 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"585c1ff4\",\n+ \"id\": \"93aa84f0\",\n \"metadata\": {},\n \"source\": [\n \"# Electromagnetic modal analysis for a waveguide\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ecfcc795\",\n+ \"id\": \"179c8d14\",\n \"metadata\": {},\n \"source\": [\n \"Copyright (C) 2022 Michele Castriotta, Igor Baratta, J\\u00f8rgen S. Dokken\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n \":class: download\\n\",\n \"* {download}`Python script <./demo_half_loaded_waveguide.py>`\\n\",\n@@ -37,15 +37,15 @@\n \"First of all, let's import the modules we need for solving the\\n\",\n \"problem:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7cb9c65e\",\n+ \"id\": \"f12adaaf\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n@@ -80,15 +80,15 @@\n \"except ImportError:\\n\",\n \" print(\\\"VTXWriter not available, solution will not be saved.\\\")\\n\",\n \" has_vtx = False\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"040b8d21\",\n+ \"id\": \"8ddd2639\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Analytical solutions for the half-loaded waveguide\\n\",\n \"\\n\",\n \"The analytical solutions for the half-loaded waveguide with perfect\\n\",\n@@ -136,40 +136,40 @@\n \"\\n\",\n \"Let's define the set of equations with the $\\\\tan$ and $\\\\cot$ function:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"92b844e8\",\n+ \"id\": \"60357d02\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def TMx_condition(\\n\",\n \" kx_d: complex, kx_v: complex, eps_d: complex, eps_v: complex, d: float, h: float\\n\",\n \") -> float:\\n\",\n \" return kx_d / eps_d * np.tan(kx_d * d) + kx_v / eps_v * np.tan(kx_v * (h - d))\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"23282f5f\",\n+ \"id\": \"85e249f4\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def TEx_condition(kx_d: complex, kx_v: complex, d: float, h: float) -> float:\\n\",\n \" return kx_d / np.tan(kx_d * d) + kx_v / np.tan(kx_v * (h - d))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7930c927\",\n+ \"id\": \"d06fbd81\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Then, we can define the `verify_mode` function, to check whether a\\n\",\n \"certain $k_z$ satisfy the equations (below a certain threshold). In\\n\",\n \"other words, we provide a certain $k_z$, together with the geometrical\\n\",\n@@ -177,15 +177,15 @@\n \"whether the last equations for the $\\\\mathrm{TE}_x$ or $\\\\mathrm{TM}_x$\\n\",\n \"modes are close to $0$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"162a79a0\",\n+ \"id\": \"cb219308\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def verify_mode(\\n\",\n \" kz: complex,\\n\",\n \" w: float,\\n\",\n \" h: float,\\n\",\n@@ -205,26 +205,26 @@\n \" f_tm = TMx_condition(kx_d, kx_v, eps_d, eps_v, d, h)\\n\",\n \" f_te = TEx_condition(kx_d, kx_v, d, h)\\n\",\n \" return np.isclose(f_tm, 0, atol=threshold) or np.isclose(f_te, 0, atol=threshold)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e274c6d2\",\n+ \"id\": \"c90e1382\",\n \"metadata\": {},\n \"source\": [\n \"We now define the domain. It is a rectangular domain with width $w$\\n\",\n \"and height $h = 0.45w$, with the dielectric medium filling the\\n\",\n \"lower-half of the domain, with a height of $d=0.5h$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e1aa36d9\",\n+ \"id\": \"51b922bd\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"w = 1\\n\",\n \"h = 0.45 * w\\n\",\n \"d = 0.5 * h\\n\",\n \"nx = 300\\n\",\n@@ -232,26 +232,26 @@\n \"\\n\",\n \"msh = create_rectangle(MPI.COMM_WORLD, np.array([[0, 0], [w, h]]), (nx, ny), CellType.quadrilateral)\\n\",\n \"msh.topology.create_connectivity(msh.topology.dim - 1, msh.topology.dim)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c17f8a17\",\n+ \"id\": \"49789e72\",\n \"metadata\": {},\n \"source\": [\n \"Now we can define the dielectric permittivity $\\\\varepsilon_r$ over the\\n\",\n \"domain as $\\\\varepsilon_r = \\\\varepsilon_v = 1$ in the vacuum, and as\\n\",\n \"$\\\\varepsilon_r = \\\\varepsilon_d = 2.45$ in the dielectric:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"f965e3cb\",\n+ \"id\": \"3e827480\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps_v = 1\\n\",\n \"eps_d = 2.45\\n\",\n \"\\n\",\n \"D = fem.functionspace(msh, (\\\"DQ\\\", 0))\\n\",\n@@ -261,15 +261,15 @@\n \"\\n\",\n \"eps.x.array[:] = eps_v\\n\",\n \"eps.x.array[cells_d] = eps_d\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"70a190ac\",\n+ \"id\": \"8108e8b9\",\n \"metadata\": {},\n \"source\": [\n \"In order to find the weak form of our problem, the starting point are\\n\",\n \"Maxwell's equation and the perfect electric conductor condition on the\\n\",\n \"waveguide wall:\\n\",\n \"\\n\",\n \"$$\\n\",\n@@ -349,36 +349,36 @@\n \"Lagrange elements. This hybrid formulation is implemented with\\n\",\n \"`mixed_element`:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a405e081\",\n+ \"id\": \"5881702b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"degree = 1\\n\",\n \"RTCE = element(\\\"RTCE\\\", msh.basix_cell(), degree, dtype=PETSc.RealType)\\n\",\n \"Q = element(\\\"Lagrange\\\", msh.basix_cell(), degree, dtype=PETSc.RealType)\\n\",\n \"V = fem.functionspace(msh, mixed_element([RTCE, Q]))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"cdee8214\",\n+ \"id\": \"666ee5b7\",\n \"metadata\": {},\n \"source\": [\n \"Now we can define our weak form:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"488046ca\",\n+ \"id\": \"f1b4f01c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"lmbd0 = h / 0.2\\n\",\n \"k0 = 2 * np.pi / lmbd0\\n\",\n \"\\n\",\n \"et, ez = ufl.TrialFunctions(V)\\n\",\n@@ -392,150 +392,150 @@\n \"\\n\",\n \"a = fem.form(a_tt)\\n\",\n \"b = fem.form(b_tt + b_tz + b_zt + b_zz)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"6562ade0\",\n+ \"id\": \"3b01d218\",\n \"metadata\": {},\n \"source\": [\n \"Let's add the perfect electric conductor conditions on the waveguide\\n\",\n \"wall:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a79d83cf\",\n+ \"id\": \"418032e8\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"bc_facets = exterior_facet_indices(msh.topology)\\n\",\n \"bc_dofs = fem.locate_dofs_topological(V, msh.topology.dim - 1, bc_facets)\\n\",\n \"u_bc = fem.Function(V)\\n\",\n \"with u_bc.x.petsc_vec.localForm() as loc:\\n\",\n \" loc.set(0)\\n\",\n \"bc = fem.dirichletbc(u_bc, bc_dofs)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"f46d03c8\",\n+ \"id\": \"611b9604\",\n \"metadata\": {},\n \"source\": [\n \"## Solve the problem in SLEPc\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"3d75b870\",\n+ \"id\": \"30320f40\",\n \"metadata\": {},\n \"source\": [\n \"Now we can solve the problem with SLEPc. First of all, we need to\\n\",\n \"assemble our $A$ and $B$ matrices with PETSc in this way:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0948d133\",\n+ \"id\": \"2a136c10\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"A = assemble_matrix(a, bcs=[bc])\\n\",\n \"A.assemble()\\n\",\n \"B = assemble_matrix(b, bcs=[bc])\\n\",\n \"B.assemble()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"32288097\",\n+ \"id\": \"0479f8ee\",\n \"metadata\": {},\n \"source\": [\n \"Now, we need to create the eigenvalue problem in SLEPc. Our problem is\\n\",\n \"a linear eigenvalue problem, that in SLEPc is solved with the `EPS`\\n\",\n \"module. We can initialize this solver in the following way:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"cbee55a4\",\n+ \"id\": \"cbb9c09c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps = SLEPc.EPS().create(msh.comm)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"655abab3\",\n+ \"id\": \"0d5857dc\",\n \"metadata\": {},\n \"source\": [\n \"We can pass to `EPS` our matrices by using the `setOperators` routine:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"566f3990\",\n+ \"id\": \"2a210527\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps.setOperators(A, B)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b76f3030\",\n+ \"id\": \"ef8663fa\",\n \"metadata\": {},\n \"source\": [\n \"If the matrices in the problem have known properties (e.g.\\n\",\n \"hermiticity) we can use this information in SLEPc to accelerate the\\n\",\n \"calculation with the `setProblemType` function. For this problem,\\n\",\n \"there is no property that can be exploited, and therefore we define it\\n\",\n \"as a generalized non-Hermitian eigenvalue problem with the\\n\",\n \"`SLEPc.EPS.ProblemType.GNHEP` object:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"44d1bb8e\",\n+ \"id\": \"224d5a77\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps.setProblemType(SLEPc.EPS.ProblemType.GNHEP)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"020a5da6\",\n+ \"id\": \"278c32c3\",\n \"metadata\": {},\n \"source\": [\n \"Next, we need to specify a tolerance for the iterative solver, so that\\n\",\n \"it knows when to stop:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"17f9e98a\",\n+ \"id\": \"72a4c7da\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"tol = 1e-9\\n\",\n \"eps.setTolerances(tol=tol)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a5f09578\",\n+ \"id\": \"12d49155\",\n \"metadata\": {},\n \"source\": [\n \"Now we need to set the eigensolver for our problem. SLEPc offers\\n\",\n \"different built-in algorithms, and also wrappers to external\\n\",\n \"libraries. Some of these can only solve Hermitian problems and/or\\n\",\n \"problems with eigenvalues in a certain portion of the spectrum.\\n\",\n \"However, the choice of the particular method to choose to solve a\\n\",\n@@ -545,51 +545,51 @@\n \"problem, we will use the Krylov-Schur method, which we can set by\\n\",\n \"calling the `setType` function:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"242ec295\",\n+ \"id\": \"0b0d297c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps.setType(SLEPc.EPS.Type.KRYLOVSCHUR)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0552ef42\",\n+ \"id\": \"dfd23308\",\n \"metadata\": {},\n \"source\": [\n \"In order to accelerate the calculation of our solutions, we can also\\n\",\n \"use a so-called *spectral transformation*, a technique which maps the\\n\",\n \"original eigenvalues into another position of the spectrum without\\n\",\n \"affecting the eigenvectors. In our case, we can use the\\n\",\n \"shift-and-invert transformation with the `SLEPc.ST.Type.SINVERT`\\n\",\n \"object:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"25f8115a\",\n+ \"id\": \"df5b9724\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Get ST context from eps\\n\",\n \"st = eps.getST()\\n\",\n \"\\n\",\n \"# Set shift-and-invert transformation\\n\",\n \"st.setType(SLEPc.ST.Type.SINVERT)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2398524a\",\n+ \"id\": \"5d571b54\",\n \"metadata\": {},\n \"source\": [\n \"The spectral transformation needs a target value for the eigenvalues\\n\",\n \"we are looking for. Since the eigenvalues for our problem can be\\n\",\n \"complex numbers, we need to specify whether we are searching for\\n\",\n \"specific values in the real part, in the imaginary part, or in the\\n\",\n \"magnitude. In our case, we are interested in propagating modes, and\\n\",\n@@ -598,101 +598,101 @@\n \"real part of the eigenvalue, with the `SLEPc.EPS.Which.TARGET_REAL`\\n\",\n \"object:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"61fabbe2\",\n+ \"id\": \"89f62046\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps.setWhichEigenpairs(SLEPc.EPS.Which.TARGET_REAL)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"d33e0051\",\n+ \"id\": \"dbdf2557\",\n \"metadata\": {},\n \"source\": [\n \"For specifying the target value, we can use the `setTarget` function.\\n\",\n \"Even though we cannot know a good target value a priori, we can guess\\n\",\n \"that $k_z$ will be quite close to $k_0$ in value, for instance $k_z =\\n\",\n \"0.5k_0^2$. Therefore, we can set a target value of $-(0.5k_0^2)$:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"68ad663e\",\n+ \"id\": \"ccf2fe02\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps.setTarget(-((0.5 * k0) ** 2))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a14530ae\",\n+ \"id\": \"c14aa94f\",\n \"metadata\": {},\n \"source\": [\n \"Then, we need to define the number of eigenvalues we want to\\n\",\n \"calculate. We can do this with the `setDimensions` function, where we\\n\",\n \"specify that we are looking for just one eigenvalue:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"43d77463\",\n+ \"id\": \"bbc21f54\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps.setDimensions(nev=1)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e4fa3b5f\",\n+ \"id\": \"edadccb8\",\n \"metadata\": {},\n \"source\": [\n \"We can finally solve the problem with the `solve` function. To gain a\\n\",\n \"deeper insight over the simulation, we also print an output message\\n\",\n \"from SLEPc by calling the `view` and `errorView` function:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"37d43ddf\",\n+ \"id\": \"4fd35e7e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps.solve()\\n\",\n \"eps.view()\\n\",\n \"eps.errorView()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"97078be2\",\n+ \"id\": \"e8d48d68\",\n \"metadata\": {},\n \"source\": [\n \"## Verification of computed eigenvalues\\n\",\n \"Now we can get the eigenvalues and eigenvectors calculated by SLEPc\\n\",\n \"with the following code. We also verify if the numerical $k_z$ are\\n\",\n \"consistent with the analytical equations of the half-loaded waveguide\\n\",\n \"modes, with the `verify_mode()` function defined in\\n\",\n \"`analytical_modes.py`:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"01d6a02e\",\n+ \"id\": \"f5a7246b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Save the kz\\n\",\n \"vals = [(i, np.sqrt(-eps.getEigenvalue(i))) for i in range(eps.getConverged())]\\n\",\n \"\\n\",\n \"# Sort kz by real part\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/c202a2458472f1e0e385ed9afdc3da0f/demo_helmholtz.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/c202a2458472f1e0e385ed9afdc3da0f/demo_helmholtz.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_helmholtz.ipynb", "source2": "demo_helmholtz.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9869791666666666%", "Differences: {\"'cells'\": \"{0: {'id': '71392ac0'}, 1: {'id': '14c9e030'}, 2: {'id': '04f3b677'}, 3: {'id': \"", " \"'50a3c1e7'}, 4: {'id': '9a96f3e8'}, 5: {'id': '50dce898'}, 6: {'id': '02a7a2b8'}, 7: \"", " \"{'id': 'a1feb51f'}, 8: {'id': 'd6443d59'}, 9: {'id': '3a8882f9'}, 10: {'id': \"", " \"'603634d7'}, 11: {'id': '63fb0b70'}, 12: {'id': 'fc0d7bae'}, 13: {'id': 'bedd3a4d'}, \"", " \"14: {'id': '6fd19129'}, 15: {'id': '92e15300'}, 16: {'id': '9afc273b'}, 17: {'id': \"", " \"'df31417a'}}\"}"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0a01b37f\",\n+ \"id\": \"71392ac0\",\n \"metadata\": {},\n \"source\": [\n \"# Helmholtz equation\\n\",\n \"\\n\",\n \"Copyright (C) 2018-2025 Samuel Groth and J\\u00f8rgen S. Dokken\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n@@ -26,24 +26,24 @@\n \"In real mode, the exact solution corresponds to\\n\",\n \"the real part of the plane wave (a sin function which also solves the\\n\",\n \"homogeneous Helmholtz equation).\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9c865edb\",\n+ \"id\": \"14c9e030\",\n \"metadata\": {},\n \"source\": [\n \"We start by importing the necessary modules\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2d805ec1\",\n+ \"id\": \"04f3b677\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n \"\\n\",\n \"import numpy as np\\n\",\n@@ -61,56 +61,56 @@\n \"from dolfinx.fem.petsc import LinearProblem\\n\",\n \"from dolfinx.io import XDMFFile\\n\",\n \"from dolfinx.mesh import create_unit_square\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"bc7717b2\",\n+ \"id\": \"50a3c1e7\",\n \"metadata\": {},\n \"source\": [\n \"We define the necessary parameters for the discretized problem\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"3be3841f\",\n+ \"id\": \"9a96f3e8\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"k0 = 4 * np.pi # Wavenumber\\n\",\n \"deg = 1 # Approximation space polynomial degree\\n\",\n \"n_elem = 64 # Number of elements in each direction of the mesh\\n\",\n \"A = 1 # Source amplitude\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"bd9fe325\",\n+ \"id\": \"50dce898\",\n \"metadata\": {},\n \"source\": [\n \"Next, we create the discrete domain, a unit square and set up the\\n\",\n \"discrete function space.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6d4b7c42\",\n+ \"id\": \"02a7a2b8\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = create_unit_square(MPI.COMM_WORLD, n_elem, n_elem)\\n\",\n \"V = functionspace(msh, (\\\"Lagrange\\\", deg))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"7460056e\",\n+ \"id\": \"a1feb51f\",\n \"metadata\": {},\n \"source\": [\n \"## Define variational problem.\\n\",\n \"The Helmholtz equation can be discretized in the same way for both the\\n\",\n \"real and complex valued formulation. However, note that we use\\n\",\n \"`ufl.inner` instead of `ufl.dot` or the ` * ` operator between\\n\",\n \"the test and trial function, and that the test-function is\\n\",\n@@ -119,38 +119,38 @@\n \"one requires a sesquilinear two-form, with the inner product being\\n\",\n \"$(a,b)=\\\\int_\\\\Omega a \\\\cdot \\\\bar{b}~\\\\mathrm{d}x$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e1f32f10\",\n+ \"id\": \"d6443d59\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"u, v = ufl.TrialFunction(V), ufl.TestFunction(V)\\n\",\n \"a = ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx - k0**2 * ufl.inner(u, v) * ufl.dx\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"901814dd\",\n+ \"id\": \"3a8882f9\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"We solve for plane wave with mixed Dirichlet and Neumann BCs.\\n\",\n \"We use ufl to manufacture an exact solution and corresponding\\n\",\n \"boundary conditions.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"8ee8eb49\",\n+ \"id\": \"603634d7\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"theta = np.pi / 4\\n\",\n \"V_exact = functionspace(\\n\",\n \" msh, (\\\"Lagrange\\\", deg + 3)\\n\",\n \") # Exact solution should be in a higher order space\\n\",\n@@ -167,26 +167,26 @@\n \"u_bc = Function(V)\\n\",\n \"u_bc.interpolate(Expression(u_exact, V.element.interpolation_points))\\n\",\n \"bcs = [dirichletbc(u_bc, dofs_D)]\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"dff82d19\",\n+ \"id\": \"63fb0b70\",\n \"metadata\": {},\n \"source\": [\n \"In this problem, we rely on PETSc as the linear algebra backend.\\n\",\n \"PETSc can only be configured for a either real of complex valued matrices\\n\",\n \"and vectors. We can check how PETSc is configured by calling\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e9107b6b\",\n+ \"id\": \"fc0d7bae\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"is_complex_mode = np.issubdtype(PETSc.ScalarType, np.complexfloating)\\n\",\n \"PETSc.Sys.Print(f\\\"PETSc is configured in complex mode: {is_complex_mode}\\\")\\n\",\n \"\\n\",\n \"uh = Function(V)\\n\",\n@@ -200,48 +200,48 @@\n \" petsc_options={\\\"ksp_type\\\": \\\"preonly\\\", \\\"pc_type\\\": \\\"lu\\\", \\\"ksp_error_if_not_converged\\\": True},\\n\",\n \")\\n\",\n \"_ = problem.solve()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"03515193\",\n+ \"id\": \"bedd3a4d\",\n \"metadata\": {},\n \"source\": [\n \"Save solution in XDMF format (to be viewed in ParaView, for example)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6e74eec5\",\n+ \"id\": \"6fd19129\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"with XDMFFile(\\n\",\n \" MPI.COMM_WORLD, \\\"out_helmholtz/plane_wave.xdmf\\\", \\\"w\\\", encoding=XDMFFile.Encoding.HDF5\\n\",\n \") as file:\\n\",\n \" file.write_mesh(msh)\\n\",\n \" file.write_function(uh)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"80b1cab9\",\n+ \"id\": \"92e15300\",\n \"metadata\": {},\n \"source\": [\n \"Calculate $L_2$ and $H_0^1$ errors of FEM solution and best\\n\",\n \"approximation. This demonstrates the error bounds given in Ihlenburg.\\n\",\n \"Pollution errors are evident for high wavenumbers.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"f82a65e0\",\n+ \"id\": \"9afc273b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"diff = uh - u_exact\\n\",\n \"H1_diff = msh.comm.allreduce(\\n\",\n \" assemble_scalar(form(ufl.inner(ufl.grad(diff), ufl.grad(diff)) * ufl.dx)), op=MPI.SUM\\n\",\n \")\\n\",\n@@ -250,15 +250,15 @@\n \")\\n\",\n \"PETSc.Sys.Print(\\\"Relative H1 error of FEM solution:\\\", abs(np.sqrt(H1_diff) / np.sqrt(H1_exact)))\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"574a3512\",\n+ \"id\": \"df31417a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"L2_diff = msh.comm.allreduce(assemble_scalar(form(ufl.inner(diff, diff) * ufl.dx)), op=MPI.SUM)\\n\",\n \"L2_exact = msh.comm.allreduce(\\n\",\n \" assemble_scalar(form(ufl.inner(u_exact, u_exact) * ufl.dx)), op=MPI.SUM\\n\",\n \")\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/e5597ff2b0334295de2749391a1ffbe1/demo_tnt-elements.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/e5597ff2b0334295de2749391a1ffbe1/demo_tnt-elements.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_tnt-elements.ipynb", "source2": "demo_tnt-elements.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.986875%", "Differences: {\"'cells'\": \"{0: {'id': '6f0a3540'}, 1: {'id': 'dcca8bf5'}, 2: {'id': '72c5aa86'}, 3: {'id': \"", " \"'c0f73f4e'}, 4: {'id': '273e4616'}, 5: {'id': 'b5cb97fb'}, 6: {'id': '27da13cf'}, 7: \"", " \"{'id': '0a31fe5f'}, 8: {'id': 'd08e0fc4'}, 9: {'id': 'ceb6d20d'}, 10: {'id': \"", " \"'75969cad'}, 11: {'id': '536095f1'}, 12: {'id': '27750985'}, 13: {'id': '9c0182c2'}, \"", " \"14: {'id': '8780074b'}, 15: {'id': '372d8681'}, 16: {'id': '1b10ded4'}, 17: {'id': \"", " \"'d1e5bddc'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"efc8021c\",\n+ \"id\": \"6f0a3540\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"# Creating TNT elements using Basix's custom element interface\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n@@ -24,15 +24,15 @@\n \"\\n\",\n \"We begin this demo by importing the required modules.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d6610135\",\n+ \"id\": \"dcca8bf5\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"\\n\",\n \"import matplotlib as mpl\\n\",\n \"import matplotlib.pylab as plt\\n\",\n@@ -45,15 +45,15 @@\n \"from dolfinx.fem.petsc import LinearProblem\\n\",\n \"\\n\",\n \"mpl.use(\\\"agg\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"5f35b7cf\",\n+ \"id\": \"72c5aa86\",\n \"metadata\": {},\n \"source\": [\n \"## Defining a degree 1 TNT element\\n\",\n \"\\n\",\n \"We will define [tiniest tensor\\n\",\n \"(TNT)](https://defelement.org/elements/tnt.html) elements on a\\n\",\n \"quadrilateral ([Commuting diagrams for the TNT elements on cubes\\n\",\n@@ -73,24 +73,24 @@\n \"in the polynomial sets for each cell can be found in the [Basix\\n\",\n \"documentation](https://docs.fenicsproject.org/basix/main/polyset-order.html).\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"56606017\",\n+ \"id\": \"c0f73f4e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"wcoeffs = np.eye(8, 9)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1b2867e3\",\n+ \"id\": \"273e4616\",\n \"metadata\": {},\n \"source\": [\n \"For elements where the coefficients matrix is not an identity, we can\\n\",\n \"use the properties of orthonormal polynomials to compute `wcoeffs`.\\n\",\n \"Let $\\\\{q_0, q_1,\\\\dots\\\\}$ be the orthonormal polynomials of a given\\n\",\n \"degree for a given cell, and suppose that we're trying to represent a\\n\",\n \"function $f_i\\\\in\\\\operatorname{span}\\\\{q_1, q_2,\\\\dots\\\\}$ (as\\n\",\n@@ -101,15 +101,15 @@\n \"$a_{ij}=\\\\int_R f_iq_j\\\\,\\\\mathrm{d}\\\\mathbf{x}$.\\n\",\n \"Hence we could compute `wcoeffs` as follows:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"07dc4a13\",\n+ \"id\": \"b5cb97fb\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"wcoeffs2 = np.empty((8, 9))\\n\",\n \"pts, wts = basix.make_quadrature(basix.CellType.quadrilateral, 4)\\n\",\n \"evals = basix.tabulate_polynomials(\\n\",\n \" basix.PolynomialType.legendre, basix.CellType.quadrilateral, 2, pts\\n\",\n@@ -122,28 +122,28 @@\n \" wcoeffs2[3, j] = sum(v * pts[:, 0] * pts[:, 1] * wts) # xy\\n\",\n \" wcoeffs2[4, j] = sum(v * pts[:, 0] * pts[:, 1] ** 2 * wts) # xy^2\\n\",\n \" wcoeffs2[5, j] = sum(v * pts[:, 0] ** 2 * pts[:, 1] * wts) # x^2y\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9daca318\",\n+ \"id\": \"27da13cf\",\n \"metadata\": {},\n \"source\": [\n \"### Interpolation operators\\n\",\n \"\\n\",\n \"We provide the information that defines the DOFs associated with each\\n\",\n \"sub-entity of the cell. First, we associate a point evaluation with\\n\",\n \"each vertex.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9fbeeba9\",\n+ \"id\": \"0a31fe5f\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"geometry = basix.geometry(basix.CellType.quadrilateral)\\n\",\n \"topology = basix.topology(basix.CellType.quadrilateral)\\n\",\n \"x = [[], [], [], []] # type: ignore [var-annotated]\\n\",\n \"M = [[], [], [], []] # type: ignore [var-annotated]\\n\",\n@@ -151,27 +151,27 @@\n \"for v in topology[0]:\\n\",\n \" x[0].append(np.array(geometry[v]))\\n\",\n \" M[0].append(np.array([[[[1.0]]]]))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a61fb648\",\n+ \"id\": \"d08e0fc4\",\n \"metadata\": {},\n \"source\": [\n \"For each edge, we define points and a matrix that represent the\\n\",\n \"integral of the function along that edge. We do this by mapping\\n\",\n \"quadrature points to the edge and putting quadrature points in the\\n\",\n \"matrix.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"75aaf214\",\n+ \"id\": \"ceb6d20d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"pts, wts = basix.make_quadrature(basix.CellType.interval, 2)\\n\",\n \"for e in topology[1]:\\n\",\n \" v0 = geometry[e[0]]\\n\",\n \" v1 = geometry[e[1]]\\n\",\n@@ -181,48 +181,48 @@\n \" mat = np.zeros((1, 1, pts.shape[0], 1))\\n\",\n \" mat[0, 0, :, 0] = wts\\n\",\n \" M[1].append(mat)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"2d1036ac\",\n+ \"id\": \"75969cad\",\n \"metadata\": {},\n \"source\": [\n \"There are no DOFs associated with the interior of the cell for the\\n\",\n \"lowest order TNT element, so we associate an empty list of points and\\n\",\n \"an empty matrix with the interior.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"885b73d2\",\n+ \"id\": \"536095f1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"x[2].append(np.zeros([0, 2]))\\n\",\n \"M[2].append(np.zeros([0, 1, 0, 1]))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"6c111464\",\n+ \"id\": \"27750985\",\n \"metadata\": {},\n \"source\": [\n \"### Creating the Basix element\\n\",\n \"\\n\",\n \"We now create the element. Using the Basix UFL interface, we can wrap\\n\",\n \"this element so that it can be used with FFCx/DOLFINx.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"25fbd204\",\n+ \"id\": \"9c0182c2\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"tnt_degree1 = basix.ufl.custom_element(\\n\",\n \" basix.CellType.quadrilateral,\\n\",\n \" [],\\n\",\n \" wcoeffs,\\n\",\n@@ -236,29 +236,29 @@\n \" 2,\\n\",\n \" dtype=default_real_type,\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4a73fce6\",\n+ \"id\": \"8780074b\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Creating higher degree TNT elements\\n\",\n \"\\n\",\n \"The following function follows the same method as above to define\\n\",\n \"arbitrary degree TNT elements.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fa7d5412\",\n+ \"id\": \"372d8681\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def create_tnt_quad(degree):\\n\",\n \" assert degree > 1\\n\",\n@@ -336,15 +336,15 @@\n \" degree + 1,\\n\",\n \" dtype=default_real_type,\\n\",\n \" )\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9a519a8c\",\n+ \"id\": \"1b10ded4\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Comparing TNT elements and Q elements\\n\",\n \"\\n\",\n \"We now use the code above to compare TNT elements and\\n\",\n@@ -353,15 +353,15 @@\n \"as input, and solves a Poisson problem and returns the $L_2$ error of\\n\",\n \"the solution.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"7e1b6195\",\n+ \"id\": \"d1e5bddc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def poisson_error(V: fem.FunctionSpace):\\n\",\n \" msh = V.mesh\\n\",\n \" u, v = ufl.TrialFunction(V), ufl.TestFunction(V)\\n\",\n \"\\n\",\n@@ -401,27 +401,27 @@\n \" M = fem.form(M)\\n\",\n \" error = msh.comm.allreduce(fem.assemble_scalar(M), op=MPI.SUM)\\n\",\n \" return error**0.5\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"565a704b\",\n+ \"id\": \"cb7317f2\",\n \"metadata\": {},\n \"source\": [\n \"We create a mesh, then solve the Poisson problem using our TNT\\n\",\n \"elements of degree 1 to 8. We then do the same with Q elements of\\n\",\n \"degree 1 to 9. For the TNT elements, we store a number 1 larger than\\n\",\n \"the degree as this is the highest degree polynomial in the space.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"5d3df684\",\n+ \"id\": \"d3595bc0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = mesh.create_unit_square(MPI.COMM_WORLD, 15, 15, mesh.CellType.quadrilateral)\\n\",\n \"\\n\",\n \"tnt_ndofs = []\\n\",\n \"tnt_degrees = []\\n\",\n@@ -448,26 +448,26 @@\n \" q_ndofs.append(V.dofmap.index_map.size_global)\\n\",\n \" q_errors.append(poisson_error(V))\\n\",\n \" print(f\\\"Q degree {degree} error: {q_errors[-1]}\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9e6e91c3\",\n+ \"id\": \"2ed82b3a\",\n \"metadata\": {},\n \"source\": [\n \"We now plot the data that we have obtained. First we plot the error\\n\",\n \"against the polynomial degree for the two elements. The two elements\\n\",\n \"appear to perform equally well.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e6f21dca\",\n+ \"id\": \"8b281f4d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if MPI.COMM_WORLD.rank == 0: # Only plot on one rank\\n\",\n \" plt.plot(q_degrees, q_errors, \\\"bo-\\\")\\n\",\n \" plt.plot(tnt_degrees, tnt_errors, \\\"gs-\\\")\\n\",\n \" plt.yscale(\\\"log\\\")\\n\",\n@@ -476,29 +476,29 @@\n \" plt.legend([\\\"Q\\\", \\\"TNT\\\"])\\n\",\n \" plt.savefig(\\\"demo_tnt-elements_degrees_vs_error.png\\\")\\n\",\n \" plt.clf()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"77487d9f\",\n+ \"id\": \"5ae4d826\",\n \"metadata\": {},\n \"source\": [\n \"![](demo_tnt-elements_degrees_vs_error.png)\\n\",\n \"\\n\",\n \"A key advantage of TNT elements is that for a given degree, they span\\n\",\n \"a smaller polynomial space than Q elements. This can be observed in\\n\",\n \"the following diagram, where we plot the error against the square root\\n\",\n \"of the number of DOFs (providing a measure of cell size in 2D)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d5c87152\",\n+ \"id\": \"0f846ab6\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"if MPI.COMM_WORLD.rank == 0: # Only plot on one rank\\n\",\n \" plt.plot(np.sqrt(q_ndofs), q_errors, \\\"bo-\\\")\\n\",\n \" plt.plot(np.sqrt(tnt_ndofs), tnt_errors, \\\"gs-\\\")\\n\",\n \" plt.yscale(\\\"log\\\")\\n\",\n@@ -507,15 +507,15 @@\n \" plt.legend([\\\"Q\\\", \\\"TNT\\\"])\\n\",\n \" plt.savefig(\\\"demo_tnt-elements_ndofs_vs_error.png\\\")\\n\",\n \" plt.clf()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ca7e37c6\",\n+ \"id\": \"58e552ff\",\n \"metadata\": {},\n \"source\": [\n \"![](demo_tnt-elements_ndofs_vs_error.png)\"\n ]\n }\n ],\n \"metadata\": {\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/eb193fc2ce46146f29b3c38146a5a3cb/demo_scattering_boundary_conditions.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/eb193fc2ce46146f29b3c38146a5a3cb/demo_scattering_boundary_conditions.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_scattering_boundary_conditions.ipynb", "source2": "demo_scattering_boundary_conditions.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9870265151515152%", "Differences: {\"'cells'\": \"{0: {'id': '0185de0b'}, 1: {'id': '8e87b753'}, 2: {'id': '6510ff28'}, 3: {'id': \"", " \"'a703905c'}, 4: {'id': '1da602af'}, 5: {'id': '55b7d19f'}, 6: {'id': '54cc3b6e'}, 7: \"", " \"{'id': '8429d8f2'}, 8: {'id': '2ae784ac'}, 9: {'id': 'af4ddd8f'}, 10: {'id': \"", " \"'fd86326b'}, 11: {'id': 'e340cf78'}, 12: {'id': '0e748089'}, 13: {'id': '593cd492'}, \"", " \"14: {'id': '692a036a'}, 15: {'id': '36deaaa2'}, 16: {'id': '03d7e3d1'}, 17: {'id': \"", " \"'8c9a6444'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"98c0b4bf\",\n+ \"id\": \"0185de0b\",\n \"metadata\": {},\n \"source\": [\n \"# Electromagnetic scattering from a wire with scattering BCs\\n\",\n \"\\n\",\n \"Copyright (C) 2022 Michele Castriotta, Igor Baratta, J\\u00f8rgen S. Dokken\\n\",\n \"\\n\",\n \"```{admonition} Download sources\\n\",\n@@ -25,15 +25,15 @@\n \"\\n\",\n \"First of all, let's import the modules that will be used:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"b7c919d6\",\n+ \"id\": \"8e87b753\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"import sys\\n\",\n \"from pathlib import Path\\n\",\n \"\\n\",\n \"from mpi4py import MPI\\n\",\n@@ -61,15 +61,15 @@\n \" # Note: when PETSc.IntType == np.int32, superlu_dist is used rather\\n\",\n \" # than MUMPS and does not trigger memory failures.\\n\",\n \" exit(0)\\n\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"dc12ab71\",\n+ \"id\": \"6510ff28\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Mesh generation\\n\",\n \"First, we define the `generate_mesh_wire` function, which is used to\\n\",\n \"generate the mesh used for scattering boundary conditions demo. The\\n\",\n@@ -96,15 +96,15 @@\n \"scattering efficiency calculation) while keenp.ping a coarser size over\\n\",\n \"the rest of the domain.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"38c7655a\",\n+ \"id\": \"a703905c\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def generate_mesh_wire(\\n\",\n \" radius_wire: float,\\n\",\n@@ -157,15 +157,15 @@\n \" gmsh.model.mesh.generate(2)\\n\",\n \"\\n\",\n \" return gmsh.model\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e3d5f678\",\n+ \"id\": \"1da602af\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"(em_efficiencies)=\\n\",\n \"## Mathematical formulation\\n\",\n \"Next, we define the mathematical formulation for the calculation of the\\n\",\n@@ -214,15 +214,15 @@\n \"& q_{\\\\mathrm{abs}} = q_{\\\\mathrm{ext}} - q_{\\\\mathrm{sca}}\\n\",\n \"$$\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"662add06\",\n+ \"id\": \"55b7d19f\",\n \"metadata\": {\n \"lines_to_next_cell\": 0\n },\n \"outputs\": [],\n \"source\": [\n \"# The functions that we import from `scipy.special` correspond to:\\n\",\n \"#\\n\",\n@@ -243,15 +243,15 @@\n \"# final calculation of the efficiencies, the summation over the different\\n\",\n \"# orders of the Bessel functions is truncated at $\\\\nu=50$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"4f5531df\",\n+ \"id\": \"54cc3b6e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"def compute_a(nu: int, m: complex, alpha: float) -> float:\\n\",\n \" J_nu_alpha = jv(nu, alpha)\\n\",\n \" J_nu_malpha = jv(nu, m * alpha)\\n\",\n \" J_nu_alpha_p = jvp(nu, alpha, 1)\\n\",\n@@ -277,39 +277,39 @@\n \" q_ext += c * 2 * np.real(compute_a(nu, m, alpha))\\n\",\n \" q_sca += c * 2 * np.abs(compute_a(nu, m, alpha)) ** 2\\n\",\n \" return q_ext - q_sca, q_sca, q_ext\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"dbf95c2f\",\n+ \"id\": \"8429d8f2\",\n \"metadata\": {},\n \"source\": [\n \"Since we want to solve time-harmonic Maxwell's equation, we need to\\n\",\n \"solve a complex-valued PDE, and therefore need to use PETSc compiled\\n\",\n \"with complex numbers.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"669a9050\",\n+ \"id\": \"2ae784ac\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"if not np.issubdtype(default_scalar_type, np.complexfloating):\\n\",\n \" print(\\\"Demo should only be executed with DOLFINx complex mode\\\")\\n\",\n \" exit(0)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b8f6b31c\",\n+ \"id\": \"af4ddd8f\",\n \"metadata\": {},\n \"source\": [\n \"Now, let's consider an infinite metallic wire immersed in a background\\n\",\n \"medium (e.g. vacuum or water). Let's now consider the plane cutting\\n\",\n \"the wire perpendicularly to its axis at a generic point. Such plane\\n\",\n \"$\\\\Omega=\\\\Omega_{m} \\\\cup\\\\Omega_{b}$ is formed by the cross-section of\\n\",\n \"the wire $\\\\Omega_m$ and the background medium $\\\\Omega_{b}$ surrounding\\n\",\n@@ -346,15 +346,15 @@\n \"function are the angle $\\\\theta$, the background refractive index $n_b$\\n\",\n \"and the vacuum wavevector $k_0$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ab73d5b2\",\n+ \"id\": \"fd86326b\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"\\n\",\n \"\\n\",\n@@ -372,15 +372,15 @@\n \" phi = kx * x[0] + ky * x[1]\\n\",\n \" ax, ay = np.sin(self.theta), np.cos(self.theta)\\n\",\n \" return (-ax * np.exp(1j * phi), ay * np.exp(1j * phi))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"799ddbc0\",\n+ \"id\": \"e340cf78\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"The Maxwell's equation for scattering problems takes the following\\n\",\n \"form:\\n\",\n \"\\n\",\n@@ -432,15 +432,15 @@\n \"The radial distance function $r(x)$ and $\\\\nabla \\\\times$ operator for a\\n\",\n \"2D vector (in UFL syntax) is defined below.\\n\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0f03f3fa\",\n+ \"id\": \"0e748089\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def radial_distance(x: ufl.SpatialCoordinate):\\n\",\n \" \\\"\\\"\\\"Returns the radial distance from the origin\\\"\\\"\\\"\\n\",\n@@ -450,27 +450,27 @@\n \"def curl_2d(f: fem.Function):\\n\",\n \" \\\"\\\"\\\"Returns the curl of two 2D vectors as a 3D vector\\\"\\\"\\\"\\n\",\n \" return ufl.as_vector((0, 0, f[1].dx(0) - f[0].dx(1)))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"6a24f2ec\",\n+ \"id\": \"593cd492\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Next we define some mesh specific parameters. Please notice that the\\n\",\n \"length units are normalized with respect to $1\\\\mu m$.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6ac192c0\",\n+ \"id\": \"692a036a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"pi = np.pi\\n\",\n \"epsilon_0 = 8.8541878128 * 10**-12\\n\",\n \"mu_0 = 4 * pi * 10**-7\\n\",\n \"\\n\",\n@@ -497,26 +497,26 @@\n \"au_tag = 1 # gold wire\\n\",\n \"bkg_tag = 2 # background\\n\",\n \"boundary_tag = 3 # boundary\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"268146f0\",\n+ \"id\": \"36deaaa2\",\n \"metadata\": {},\n \"source\": [\n \"We generate the mesh using GMSH and convert it to a\\n\",\n \"{py:class}`Mesh` using\\n\",\n \"{py:func}`model_to_mesh `.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"6c0686ee\",\n+ \"id\": \"03d7e3d1\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"model = None\\n\",\n \"gmsh.initialize(sys.argv)\\n\",\n \"if MPI.COMM_WORLD.rank == 0:\\n\",\n \" model = generate_mesh_wire(\\n\",\n@@ -539,15 +539,15 @@\n \"gmsh.finalize()\\n\",\n \"MPI.COMM_WORLD.barrier()\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1b6fcfdc\",\n+ \"id\": \"8c9a6444\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# The mesh is visualized with [PyVista](https://docs.pyvista.org/)\\n\",\n \"out_folder = Path(\\\"out_scattering_boundary_conditions\\\")\\n\",\n \"out_folder.mkdir(parents=True, exist_ok=True)\\n\",\n \"if have_pyvista:\\n\",\n@@ -565,68 +565,68 @@\n \" plotter.show()\\n\",\n \" else:\\n\",\n \" figure = plotter.screenshot(out_folder / \\\"wire_mesh.png\\\", window_size=[8000, 8000])\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1b30f7fc\",\n+ \"id\": \"99c3e069\",\n \"metadata\": {},\n \"source\": [\n \"Now we define some other problem specific parameters:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c82170ee\",\n+ \"id\": \"bb5baab5\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"wl0 = 0.4 # Wavelength of the background field\\n\",\n \"n_bkg = 1.33 # Background refractive index\\n\",\n \"eps_bkg = n_bkg**2 # Background relative permittivity\\n\",\n \"k0 = 2 * np.pi / wl0 # Wavevector of the background field\\n\",\n \"theta = np.pi / 4 # Angle of incidence of the background field\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4704f6be\",\n+ \"id\": \"084be277\",\n \"metadata\": {},\n \"source\": [\n \"We use a function space consisting of degree 3 [Nedelec (first\\n\",\n \"kind)](https://defelement.org/elements/nedelec1.html) elements to\\n\",\n \"represent the electric field\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"44899f82\",\n+ \"id\": \"213e8859\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"degree = 3\\n\",\n \"curl_el = element(\\\"N1curl\\\", mesh_data.mesh.basix_cell(), degree, dtype=default_real_type)\\n\",\n \"V = fem.functionspace(mesh_data.mesh, curl_el)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"a2317c80\",\n+ \"id\": \"9e51e73a\",\n \"metadata\": {},\n \"source\": [\n \"Next, we can interpolate $\\\\mathbf{E}_b$ into the function space $V$:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1e6ec9fc\",\n+ \"id\": \"da06b7d4\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"f = BackgroundElectricField(theta, n_bkg, k0)\\n\",\n \"Eb = fem.Function(V)\\n\",\n \"Eb.interpolate(f.eval)\\n\",\n \"\\n\",\n@@ -650,64 +650,64 @@\n \"# Normal to the boundary\\n\",\n \"n = ufl.FacetNormal(mesh_data.mesh)\\n\",\n \"n_3d = ufl.as_vector((n[0], n[1], 0))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1c201c76\",\n+ \"id\": \"7e4d6f08\",\n \"metadata\": {},\n \"source\": [\n \"We turn our focus to the permittivity $\\\\varepsilon$. First, we define\\n\",\n \"the relative permittivity $\\\\varepsilon_m$ of the gold wire at $400nm$.\\n\",\n \"This data can be found in [*Olmon et al.\\n\",\n \"2012*](https://doi.org/10.1103/PhysRevB.86.235147) or at\\n\",\n \"[refractiveindex.info](\\n\",\n \"https://refractiveindex.info/?shelf=main&book=Au&page=Olmon-sc)):\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9ebca161\",\n+ \"id\": \"8175ffce\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"eps_au = -1.0782 + 1j * 5.8089\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ca720640\",\n+ \"id\": \"0ba7f8c4\",\n \"metadata\": {},\n \"source\": [\n \"We define a permittivity function $\\\\varepsilon$ that takes the value\\n\",\n \"of the gold permittivity $\\\\varepsilon_m$ for cells inside the wire,\\n\",\n \"while it takes the value of the background permittivity otherwise:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"e32153cf\",\n+ \"id\": \"1384d3c5\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"D = fem.functionspace(mesh_data.mesh, (\\\"DG\\\", 0))\\n\",\n \"eps = fem.Function(D)\\n\",\n \"au_cells = mesh_data.cell_tags.find(au_tag)\\n\",\n \"bkg_cells = mesh_data.cell_tags.find(bkg_tag)\\n\",\n \"eps.x.array[au_cells] = np.full_like(au_cells, eps_au, dtype=eps.x.array.dtype)\\n\",\n \"eps.x.array[bkg_cells] = np.full_like(bkg_cells, eps_bkg, dtype=eps.x.array.dtype)\\n\",\n \"eps.x.scatter_forward()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e65beb9c\",\n+ \"id\": \"e61cd6b2\",\n \"metadata\": {},\n \"source\": [\n \"### Derivation of the weak formulation\\n\",\n \"Next we derive the weak formulation of the Maxwell's equation plus\\n\",\n \"with scattering boundary conditions. First, we take the inner products\\n\",\n \"of the equations with a complex test function $\\\\mathbf{v}$, and\\n\",\n \"integrate the terms over the corresponding domains:\\n\",\n@@ -785,15 +785,15 @@\n \"We use the [UFL](https://github.com/FEniCS/ufl/) to implement the\\n\",\n \"residual\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"541b031b\",\n+ \"id\": \"8780d06d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Weak form\\n\",\n \"F = (\\n\",\n \" -ufl.inner(ufl.curl(Es), ufl.curl(v)) * dDom\\n\",\n \" + eps * (k0**2) * ufl.inner(Es, v) * dDom\\n\",\n@@ -802,34 +802,34 @@\n \" * ufl.inner(ufl.cross(Es_3d, n_3d), ufl.cross(v_3d, n_3d))\\n\",\n \" * dsbc\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c37f0b03\",\n+ \"id\": \"7f91613a\",\n \"metadata\": {},\n \"source\": [\n \"## Solving the variational problem\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"5583c131\",\n+ \"id\": \"4ba62088\",\n \"metadata\": {},\n \"source\": [\n \"We split the residual into a sesquilinear (lhs) and linear (rhs) form\\n\",\n \"and solve the problem. We store the scattered field $\\\\mathbf{E}_s$ as\\n\",\n \"`Esh`:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"2000fc84\",\n+ \"id\": \"193c2639\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"a, L = ufl.lhs(F), ufl.rhs(F)\\n\",\n \"problem = LinearProblem(\\n\",\n \" a,\\n\",\n \" L,\\n\",\n@@ -839,28 +839,28 @@\n \")\\n\",\n \"Esh = problem.solve()\\n\",\n \"assert problem.solver.getConvergedReason() > 0\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"57b26004\",\n+ \"id\": \"7d4c0432\",\n \"metadata\": {},\n \"source\": [\n \"We save the solution as an [ADIOS2\\n\",\n \"bp](https://adios2.readthedocs.io/en/latest/ecosystem/visualization.html)\\n\",\n \"folder. In order to do so, we need to interpolate our solution\\n\",\n \"discretized with Nedelec elements into a suitable discontinuous\\n\",\n \"Lagrange space.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"947e6468\",\n+ \"id\": \"ad42fac5\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"gdim = mesh_data.mesh.geometry.dim\\n\",\n \"V_dg = fem.functionspace(mesh_data.mesh, (\\\"Discontinuous Lagrange\\\", degree, (gdim,)))\\n\",\n \"Esh_dg = fem.Function(V_dg)\\n\",\n \"assert isinstance(Esh, fem.Function)\\n\",\n@@ -871,28 +871,28 @@\n \" vtx.write(0.0)\\n\",\n \"else:\\n\",\n \" print(\\\"Cannot write Esh.bp: VTXWriter (adios2) is not available\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"47b6e453\",\n+ \"id\": \"e40670a9\",\n \"metadata\": {},\n \"source\": [\n \"We visualize the solution using PyVista. For more information about\\n\",\n \"saving and visualizing vector fields discretized with Nedelec\\n\",\n \"elements, check [this](\\n\",\n \"https://docs.fenicsproject.org/dolfinx/main/python/demos/demo_interpolation-io.html)\\n\",\n \"DOLFINx demo.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"346f3627\",\n+ \"id\": \"e9c9619f\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"if have_pyvista:\\n\",\n \" V_cells, V_types, V_x = plot.vtk_mesh(V_dg)\\n\",\n@@ -913,25 +913,25 @@\n \" plotter.screenshot(out_folder / \\\"Esh.png\\\", window_size=[800, 800])\\n\",\n \" else:\\n\",\n \" plotter.show()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"40525055\",\n+ \"id\": \"72c12528\",\n \"metadata\": {},\n \"source\": [\n \"Next we can calculate the total electric field\\n\",\n \"$\\\\mathbf{E}=\\\\mathbf{E}_s+\\\\mathbf{E}_b$ and save it.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"83d70241\",\n+ \"id\": \"259e2531\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"E = fem.Function(V)\\n\",\n \"E.x.array[:] = Eb.x.array[:] + Esh.x.array[:]\\n\",\n \"E_dg = fem.Function(V_dg)\\n\",\n \"E_dg.interpolate(E)\\n\",\n@@ -940,41 +940,41 @@\n \" vtx.write(0.0)\\n\",\n \"else:\\n\",\n \" print(\\\"Cannot write E.bp: VTXWriter (adios2) is not available\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"0ea71bbd\",\n+ \"id\": \"0bc1c9b4\",\n \"metadata\": {},\n \"source\": [\n \"We validate our numerical solution by computing the absorption,\\n\",\n \"scattering and extinction efficiencies, which are quantities that\\n\",\n \"define how much light is absorbed and scattered by the wire. First of\\n\",\n \"all, we calculate the analytical efficiencies with the\\n\",\n \"`calculate_analytical_efficiencies` function defined in a separate\\n\",\n \"file:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"06725d5f\",\n+ \"id\": \"c01cadff\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Calculation of analytical efficiencies\\n\",\n \"q_abs_analyt, q_sca_analyt, q_ext_analyt = calculate_analytical_efficiencies(\\n\",\n \" eps_au, n_bkg, wl0, radius_wire\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"15fa4907\",\n+ \"id\": \"18ba771e\",\n \"metadata\": {},\n \"source\": [\n \"## Calculation of the numerical efficiencies\\n\",\n \"Now we can calculate the numerical efficiencies. The formula for the\\n\",\n \"absorption, scattering and extinction are:\\n\",\n \"\\n\",\n \"$$\\n\",\n@@ -1006,15 +1006,15 @@\n \"\\n\",\n \"We can calculate these values in the following way:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"fe1b50b4\",\n+ \"id\": \"6a77e13f\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"Z0 = np.sqrt(mu_0 / epsilon_0) # Vacuum impedance\\n\",\n \"Hsh_3d = -1j * curl_2d(Esh) / (Z0 * k0 * n_bkg) # Magnetic field H\\n\",\n \"Esh_3d = ufl.as_vector((Esh[0], Esh[1], 0))\\n\",\n \"E_3d = ufl.as_vector((E[0], E[1], 0))\\n\",\n@@ -1023,120 +1023,120 @@\n \"# np.sqrt(ax**2 + ay**2) = 1, see background_electric_field\\n\",\n \"I0 = 0.5 / Z0\\n\",\n \"gcs = 2 * radius_wire # Geometrical cross section of the wire\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c8e9a5da\",\n+ \"id\": \"b02265ee\",\n \"metadata\": {},\n \"source\": [\n \"Quantities for the calculation of efficiencies\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ea00159e\",\n+ \"id\": \"c7673ba2\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"P = 0.5 * ufl.inner(ufl.cross(Esh_3d, ufl.conj(Hsh_3d)), n_3d)\\n\",\n \"Q = 0.5 * np.imag(eps_au) * k0 * (ufl.inner(E_3d, E_3d)) / Z0 / n_bkg\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"b36c9d65\",\n+ \"id\": \"45486221\",\n \"metadata\": {},\n \"source\": [\n \"Normalized absorption efficiency\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"eed3815d\",\n+ \"id\": \"f133941c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"dAu = dx(au_tag) # Define integration domain for the wire\\n\",\n \"q_abs_fenics_proc = (fem.assemble_scalar(fem.form(Q * dAu)) / gcs / I0).real\\n\",\n \"q_abs_fenics = mesh_data.mesh.comm.allreduce(q_abs_fenics_proc, op=MPI.SUM)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"4c5e4fe8\",\n+ \"id\": \"b7e5b93e\",\n \"metadata\": {},\n \"source\": [\n \"Normalized scattering efficiency\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"49191cbd\",\n+ \"id\": \"6a6b2238\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"q_sca_fenics_proc = (fem.assemble_scalar(fem.form(P * dsbc)) / gcs / I0).real\\n\",\n \"q_sca_fenics = mesh_data.mesh.comm.allreduce(q_sca_fenics_proc, op=MPI.SUM)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"491b9416\",\n+ \"id\": \"f26cccf0\",\n \"metadata\": {},\n \"source\": [\n \"Extinction efficiency\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"9295ccfb\",\n+ \"id\": \"b10b98b8\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"q_ext_fenics = q_abs_fenics + q_sca_fenics\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"fdc8cbff\",\n+ \"id\": \"4e2a5e7c\",\n \"metadata\": {},\n \"source\": [\n \"Error calculation\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"ff2d17ed\",\n+ \"id\": \"bd0190cb\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"err_abs = np.abs(q_abs_analyt - q_abs_fenics) / q_abs_analyt\\n\",\n \"err_sca = np.abs(q_sca_analyt - q_sca_fenics) / q_sca_analyt\\n\",\n \"err_ext = np.abs(q_ext_analyt - q_ext_fenics) / q_ext_analyt\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"ccdd13f7\",\n+ \"id\": \"a2b7e207\",\n \"metadata\": {},\n \"source\": [\n \"Check if errors are smaller than 1%\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a5ad89ea\",\n+ \"id\": \"385e758e\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"assert err_abs < 0.01, \\\"Error in absorption efficiency is too large\\\"\\n\",\n \"assert err_sca < 0.01, \\\"Error in scattering efficiency is too large\\\"\\n\",\n \"assert err_ext < 0.01, \\\"Error in Extinction efficiency is too large\\\"\\n\",\n \"\\n\",\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/_downloads/f60c5654312263c726a60c7d3dcc6729/demo_elasticity.ipynb.gz", "source2": "./usr/share/doc/dolfinx-doc/python/_downloads/f60c5654312263c726a60c7d3dcc6729/demo_elasticity.ipynb.gz", "unified_diff": null, "details": [{"source1": "demo_elasticity.ipynb", "source2": "demo_elasticity.ipynb", "unified_diff": null, "details": [{"source1": "Pretty-printed", "source2": "Pretty-printed", "comments": ["Similarity: 0.9868259803921569%", "Differences: {\"'cells'\": \"{0: {'id': 'e46cbce2'}, 1: {'id': '44a6d35d'}, 2: {'id': 'bf301c91'}, 3: {'id': \"", " \"'e30671ca'}, 4: {'id': 'c1ad6509'}, 5: {'id': 'cf0de4e8'}, 6: {'id': '8034a26c'}, 7: \"", " \"{'id': '757a1ae1'}, 8: {'id': '54c4ecbe'}, 9: {'id': '493f9025'}, 10: {'id': \"", " \"'2c3b9bc5'}, 11: {'id': 'b3f024c0'}, 12: {'id': '8e709647'}, 13: {'id': 'e48405b8'}, \"", " \"14: {'id': '51d0d680'}, 15: {'id': 'a8f9ec5b'}, 16: {'id': '64600c5a'}, 17: {'id': \"", " \"'08e1fc5d'}, 1 [\u2026]"], "unified_diff": "@@ -1,12 +1,12 @@\n {\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"553f0897\",\n+ \"id\": \"e46cbce2\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"# Elasticity using algebraic multigrid\\n\",\n \"\\n\",\n \"Copyright \\u00a9 2020-2022 Garth N. Wells and Michal Habera\\n\",\n@@ -25,15 +25,15 @@\n \"\\n\",\n \"The required modules are first imported:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"470b97eb\",\n+ \"id\": \"44a6d35d\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from mpi4py import MPI\\n\",\n \"from petsc4py import PETSc\\n\",\n \"\\n\",\n \"import numpy as np\\n\",\n@@ -54,15 +54,15 @@\n \"from dolfinx.mesh import CellType, GhostMode, create_box, locate_entities_boundary\\n\",\n \"\\n\",\n \"dtype = PETSc.ScalarType\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e5599bc5\",\n+ \"id\": \"bf301c91\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"## Create the operator near-nullspace\\n\",\n \"\\n\",\n \"Smooth aggregation algebraic multigrid solvers require the so-called\\n\",\n@@ -72,15 +72,15 @@\n \"spanned by six vectors -- three translation modes and three rotation\\n\",\n \"modes.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"f1793b04\",\n+ \"id\": \"e30671ca\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"def build_nullspace(V: FunctionSpace):\\n\",\n \" \\\"\\\"\\\"Build PETSc nullspace for 3D elasticity\\\"\\\"\\\"\\n\",\n@@ -115,79 +115,79 @@\n \" PETSc.Vec().createWithArray(x[: bs * length0], bsize=3, comm=V.mesh.comm) for x in b\\n\",\n \" ]\\n\",\n \" return PETSc.NullSpace().create(vectors=basis_petsc)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"745222cf\",\n+ \"id\": \"c1ad6509\",\n \"metadata\": {},\n \"source\": [\n \"## Problem definition\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c2814d54\",\n+ \"id\": \"cf0de4e8\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"Create a {py:func}`box mesh`:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c3cb9388\",\n+ \"id\": \"8034a26c\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"msh = create_box(\\n\",\n \" MPI.COMM_WORLD,\\n\",\n \" [np.array([0.0, 0.0, 0.0]), np.array([2.0, 1.0, 1.0])],\\n\",\n \" (16, 16, 16),\\n\",\n \" CellType.tetrahedron,\\n\",\n \" ghost_mode=GhostMode.shared_facet,\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"58051067\",\n+ \"id\": \"757a1ae1\",\n \"metadata\": {},\n \"source\": [\n \"Create a centripetal source term $f = \\\\rho \\\\omega^2 [x_0, \\\\, x_1]$:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"bec0ccd4\",\n+ \"id\": \"54c4ecbe\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"\\u03c9, \\u03c1 = 300.0, 10.0\\n\",\n \"x = ufl.SpatialCoordinate(msh)\\n\",\n \"f = ufl.as_vector((\\u03c1 * \\u03c9**2 * x[0], \\u03c1 * \\u03c9**2 * x[1], 0.0))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"53e469b2\",\n+ \"id\": \"493f9025\",\n \"metadata\": {},\n \"source\": [\n \"Define the elasticity parameters and create a function that computes\\n\",\n \"an expression for the stress given a displacement field.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"781ed138\",\n+ \"id\": \"2c3b9bc5\",\n \"metadata\": {\n \"lines_to_end_of_cell_marker\": 2\n },\n \"outputs\": [],\n \"source\": [\n \"E = 1.0e9\\n\",\n \"\\u03bd = 0.3\\n\",\n@@ -198,144 +198,144 @@\n \"def \\u03c3(v):\\n\",\n \" \\\"\\\"\\\"Return an expression for the stress \\u03c3 given a displacement field\\\"\\\"\\\"\\n\",\n \" return 2.0 * \\u03bc * ufl.sym(ufl.grad(v)) + \\u03bb * ufl.tr(ufl.sym(ufl.grad(v))) * ufl.Identity(len(v))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"9cb7d482\",\n+ \"id\": \"b3f024c0\",\n \"metadata\": {\n \"lines_to_next_cell\": 2\n },\n \"source\": [\n \"A function space space is created and the elasticity variational\\n\",\n \"problem defined:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"d184d5f3\",\n+ \"id\": \"8e709647\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"V = functionspace(msh, (\\\"Lagrange\\\", 1, (msh.geometry.dim,)))\\n\",\n \"u, v = ufl.TrialFunction(V), ufl.TestFunction(V)\\n\",\n \"a = form(ufl.inner(\\u03c3(u), ufl.grad(v)) * ufl.dx)\\n\",\n \"L = form(ufl.inner(f, v) * ufl.dx)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"eb768721\",\n+ \"id\": \"e48405b8\",\n \"metadata\": {},\n \"source\": [\n \"A homogeneous (zero) boundary condition is created on $x_0 = 0$ and\\n\",\n \"$x_1 = 1$ by finding all facets on these boundaries, and then creating\\n\",\n \"a Dirichlet boundary condition object.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"66b4669d\",\n+ \"id\": \"51d0d680\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"facets = locate_entities_boundary(\\n\",\n \" msh, dim=2, marker=lambda x: np.isclose(x[0], 0.0) | np.isclose(x[1], 1.0)\\n\",\n \")\\n\",\n \"bc = dirichletbc(\\n\",\n \" np.zeros(3, dtype=dtype), locate_dofs_topological(V, entity_dim=2, entities=facets), V=V\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"cfa362a3\",\n+ \"id\": \"a8f9ec5b\",\n \"metadata\": {},\n \"source\": [\n \"## Assemble and solve\\n\",\n \"\\n\",\n \"The bilinear form `a` is assembled into a matrix `A`, with\\n\",\n \"modifications for the Dirichlet boundary conditions. The call\\n\",\n \"`A.assemble()` completes any parallel communication required to\\n\",\n \"compute the matrix.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"67f2a996\",\n+ \"id\": \"64600c5a\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"A = assemble_matrix(a, bcs=[bc])\\n\",\n \"A.assemble()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c1332183\",\n+ \"id\": \"08e1fc5d\",\n \"metadata\": {},\n \"source\": [\n \"The linear form `L` is assembled into a vector `b`, and then modified\\n\",\n \"by {py:func}`apply_lifting ` to\\n\",\n \"account for the Dirichlet boundary conditions. After calling\\n\",\n \"{py:func}`apply_lifting `, the method\\n\",\n \"`ghostUpdate` accumulates entries on the owning rank, and this is\\n\",\n \"followed by setting the boundary values in `b`.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"b5b17ccd\",\n+ \"id\": \"8f0d1587\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"b = assemble_vector(L)\\n\",\n \"apply_lifting(b, [a], bcs=[[bc]])\\n\",\n \"b.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE)\\n\",\n \"bc.set(b.array_w)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"e86de834\",\n+ \"id\": \"64a6ce9f\",\n \"metadata\": {},\n \"source\": [\n \"Create the near-nullspace and attach it to the PETSc matrix:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"104c80ff\",\n+ \"id\": \"e5015ccf\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"ns = build_nullspace(V)\\n\",\n \"A.setNearNullSpace(ns)\\n\",\n \"A.setOption(PETSc.Mat.Option.SPD, True)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"30479358\",\n+ \"id\": \"518511f9\",\n \"metadata\": {},\n \"source\": [\n \"Set PETSc solver options, create a PETSc Krylov solver, and attach the\\n\",\n \"matrix `A` to the solver:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a4cfb916\",\n+ \"id\": \"d68af887\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"# Set solver options\\n\",\n \"opts = PETSc.Options()\\n\",\n \"opts[\\\"ksp_type\\\"] = \\\"cg\\\"\\n\",\n \"opts[\\\"ksp_rtol\\\"] = 1.0e-8\\n\",\n@@ -354,25 +354,25 @@\n \"\\n\",\n \"# Set matrix operator\\n\",\n \"solver.setOperators(A)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"251dce82\",\n+ \"id\": \"9b6c3e41\",\n \"metadata\": {},\n \"source\": [\n \"Create a solution {py:class}`Function` `uh` and\\n\",\n \"solve:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"1bc7cc40\",\n+ \"id\": \"1b2f837b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"uh = Function(V)\\n\",\n \"\\n\",\n \"# Set a monitor, solve linear system, and display the solver\\n\",\n \"# configuration\\n\",\n@@ -382,71 +382,71 @@\n \"\\n\",\n \"# Scatter forward the solution vector to update ghost values\\n\",\n \"uh.x.scatter_forward()\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"3a725666\",\n+ \"id\": \"8c836137\",\n \"metadata\": {},\n \"source\": [\n \"## Post-processing\\n\",\n \"\\n\",\n \"The computed solution is now post-processed. Expressions for the\\n\",\n \"deviatoric and Von Mises stress are defined:\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"c2273f57\",\n+ \"id\": \"9a57dcbc\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"sigma_dev = \\u03c3(uh) - (1 / 3) * ufl.tr(\\u03c3(uh)) * ufl.Identity(len(uh))\\n\",\n \"sigma_vm = ufl.sqrt((3 / 2) * ufl.inner(sigma_dev, sigma_dev))\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"1433ceeb\",\n+ \"id\": \"ab4ec086\",\n \"metadata\": {},\n \"source\": [\n \"Next, the Von Mises stress is interpolated in a piecewise-constant\\n\",\n \"space by creating an {py:class}`Expression`\\n\",\n \"that is interpolated into the\\n\",\n \"{py:class}`Function` `sigma_vm_h`.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"25c2f23a\",\n+ \"id\": \"4405d7e0\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"W = functionspace(msh, (\\\"Discontinuous Lagrange\\\", 0))\\n\",\n \"sigma_vm_expr = Expression(sigma_vm, W.element.interpolation_points)\\n\",\n \"sigma_vm_h = Function(W)\\n\",\n \"sigma_vm_h.interpolate(sigma_vm_expr)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"97e862f8\",\n+ \"id\": \"5fba2ba1\",\n \"metadata\": {},\n \"source\": [\n \"Save displacement field `uh` and the Von Mises stress `sigma_vm_h` in\\n\",\n \"XDMF format files.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"0dcf03d0\",\n+ \"id\": \"a38614d3\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"with XDMFFile(msh.comm, \\\"out_elasticity/displacements.xdmf\\\", \\\"w\\\") as file:\\n\",\n \" file.write_mesh(msh)\\n\",\n \" file.write_function(uh)\\n\",\n \"\\n\",\n@@ -454,38 +454,38 @@\n \"with XDMFFile(msh.comm, \\\"out_elasticity/von_mises_stress.xdmf\\\", \\\"w\\\") as file:\\n\",\n \" file.write_mesh(msh)\\n\",\n \" file.write_function(sigma_vm_h)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"c4f9016f\",\n+ \"id\": \"53fba4ff\",\n \"metadata\": {},\n \"source\": [\n \"Finally, we compute the $L^2$ norm of the displacement solution\\n\",\n \"vector. This is a collective operation (i.e., the method\\n\",\n \"{py:func}`norm` must be called from all MPI ranks),\\n\",\n \"but we print the norm only on rank 0.\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": null,\n- \"id\": \"a764a82c\",\n+ \"id\": \"19a2ee14\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"unorm = la.norm(uh.x)\\n\",\n \"if msh.comm.rank == 0:\\n\",\n \" print(\\\"Solution vector norm:\\\", unorm)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n- \"id\": \"40123121\",\n+ \"id\": \"a9f72175\",\n \"metadata\": {},\n \"source\": [\n \"The solution vector norm can be a useful check that the solver is\\n\",\n \"computing the same result when running in serial and in parallel.\"\n ]\n }\n ],\n"}]}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/generated/dolfinx.fem.petsc.html", "source2": "./usr/share/doc/dolfinx-doc/python/generated/dolfinx.fem.petsc.html", "unified_diff": "@@ -952,22 +952,22 @@\n WARNING = 3\uf0c1\n
\n \n \n \n
\n
\n-MatSetValuesBlockedLocal = <cdata 'int(*)(void *, int32_t, int32_t *, int32_t, int32_t *, double *, int)' 0x7ff119b79e40>\uf0c1
\n+MatSetValuesBlockedLocal = <cdata 'int(*)(void *, int32_t, int32_t *, int32_t, int32_t *, double *, int)' 0x7f9175179e40>\uf0c1\n

See PETSc MatSetValuesBlockedLocal\n documentation.

\n
\n \n
\n
\n-MatSetValuesLocal = <cdata 'int(*)(void *, int32_t, int32_t *, int32_t, int32_t *, double *, int)' 0x7ff119b6ee70>\uf0c1
\n+MatSetValuesLocal = <cdata 'int(*)(void *, int32_t, int32_t *, int32_t, int32_t *, double *, int)' 0x7f917516ee70>\uf0c1\n

See PETSc MatSetValuesLocal\n documentation.

\n
\n \n
\n
\n log = <nanobind.nb_func object>\uf0c1
\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -539,18 +539,18 @@\n DEBUG = 1\uf0c1\n ERROR = 4\uf0c1\n INFO = 2\uf0c1\n OFF = 6\uf0c1\n TRACE = 0\uf0c1\n WARNING = 3\uf0c1\n MatSetValuesBlockedLocal = \uf0c1\n+ int32_t, int32_t *, double *, int)' 0x7f9175179e40>\uf0c1\n See PETSc MatSetValuesBlockedLocal documentation.\n MatSetValuesLocal = \uf0c1\n+ int32_t *, double *, int)' 0x7f917516ee70>\uf0c1\n See PETSc MatSetValuesLocal documentation.\n log = \uf0c1\n dolfinx.fem.petsc.create_matrix(a: Form | Sequence[Sequence[Form]], kind: str\n | Sequence[Sequence[str]] | None = None) \u2192 Mat[source]\uf0c1\n Create a PETSc matrix that is compatible with the (sequence) of bilinear\n form(s).\n Three cases are supported:\n"}]}, {"source1": "./usr/share/doc/dolfinx-doc/python/searchindex.js", "source2": "./usr/share/doc/dolfinx-doc/python/searchindex.js", "unified_diff": null, "details": [{"source1": "js-beautify {}", "source2": "js-beautify {}", "unified_diff": "@@ -5150,16 +5150,16 @@\n \"08\": 12,\n \"0e\": [3, 5, 7, 17, 22, 23],\n \"0e5\": 16,\n \"0e6\": 26,\n \"0e9\": [7, 20],\n \"0j\": 9,\n \"0th\": 13,\n- \"0x7ff119b6ee70\": 42,\n- \"0x7ff119b79e40\": 42,\n+ \"0x7f917516ee70\": 42,\n+ \"0x7f9175179e40\": 42,\n \"1\": [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 29, 32, 34, 35, 36, 37, 40, 41, 42, 43, 44, 45, 46, 49, 50, 51, 56, 57],\n \"10\": [3, 5, 7, 13, 14, 16, 17, 18, 19, 20, 22, 25, 26, 55],\n \"100\": [3, 5, 14, 17, 22],\n \"11\": [3, 13, 14, 17, 58],\n \"12\": [3, 5, 6, 12, 14, 15, 17, 21, 22, 42, 49, 50],\n \"13\": 3,\n \"139\": 11,\n"}]}]}]}]}]}