diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index fb09390..5438622 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -20,11 +20,10 @@ jobs: container: ubuntu:22.04 env: PYVISTA_OFF_SCREEN: false - PYVISTA_JUPYTER_BACKEND: "panel" + PYVISTA_JUPYTER_BACKEND: "html" steps: - - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install common packages uses: ./.github/actions/install-dependencies @@ -36,10 +35,9 @@ jobs: key: jupyter-cache-${{ hashFiles('environment.yml') }} - name: Build the book - run: - jupyter-book build . -W + run: jupyter-book build . -W - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 # always upload artifact, which can include error messages if: always() with: diff --git a/docker/Dockerfile b/docker/Dockerfile index 91ee6bf..e5efa84 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ FROM condaforge/mambaforge ENV DEBIAN_FRONTEND=noninteractive -ENV PYVISTA_JUPYTER_BACKEND=panel +ENV PYVISTA_JUPYTER_BACKEND=html ENV PYVISTA_OFF_SCREEN=False # Install ssh (missing dependency to run conda envs) diff --git a/environment.yml b/environment.yml index 2060eb2..c6e9364 100644 --- a/environment.yml +++ b/environment.yml @@ -6,14 +6,15 @@ dependencies: - cycler - mpich - ipyparallel>=8.6 - - ipywidgets - jupyter-book - matplotlib-base - mpi4py - numpy - pandas - - pyvista + - pyvista>=0.43.* - autopep8 - - fenics-dolfinx + - jupyterlab + - fenics-dolfinx==0.6.* - petsc4py - - panel + - trame + - ipywidgets diff --git a/notebooks/dolfinx_MPI_tutorial.ipynb b/notebooks/dolfinx_MPI_tutorial.ipynb index 2b36f15..7aabfa5 100644 --- a/notebooks/dolfinx_MPI_tutorial.ipynb +++ b/notebooks/dolfinx_MPI_tutorial.ipynb @@ -45,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "3c140fdc", "metadata": { "tags": [] @@ -61,7 +61,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "340f7a76cd4641e1bf4685025a2d9508", + "model_id": "3824c33e82734ec2a08e71231230b548", "version_major": 2, "version_minor": 0 }, @@ -91,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "09fec8d4-2f90-4c5c-89fe-b32e8c78cdf8", "metadata": { "tags": [] @@ -124,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "6d77bdc4-d4c2-4326-b2ca-ed9b43272229", "metadata": { "tags": [] @@ -133,13 +133,13 @@ { "data": { "text/plain": [ - "[stdout:0] Cell (dim = 2) to facet (dim = 1) connectivity:\n", - "Rank 0: with 6 nodes\n", - " 0: [5 4 0 ]\n", - " 1: [6 1 5 ]\n", - " 2: [3 1 2 ]\n", - " 3: [7 8 6 ]\n", - " 4: [10 4 9 ]\n", + "[stdout:1] Cell (dim = 2) to facet (dim = 1) connectivity:\n", + "Rank 1: with 6 nodes\n", + " 0: [1 7 0 ]\n", + " 1: [3 2 1 ]\n", + " 2: [5 2 4 ]\n", + " 3: [6 8 3 ]\n", + " 4: [10 7 9 ]\n", " 5: [12 8 11 ]\n", "\n" ] @@ -150,14 +150,14 @@ { "data": { "text/plain": [ - "[stdout:1] Cell (dim = 2) to facet (dim = 1) connectivity:\n", - "Rank 1: with 6 nodes\n", - " 0: [0 8 7 ]\n", - " 1: [2 1 0 ]\n", - " 2: [4 1 3 ]\n", - " 3: [6 5 2 ]\n", - " 4: [9 8 10 ]\n", - " 5: [12 5 11 ]\n", + "[stdout:0] Cell (dim = 2) to facet (dim = 1) connectivity:\n", + "Rank 0: with 6 nodes\n", + " 0: [5 8 4 ]\n", + " 1: [6 0 5 ]\n", + " 2: [2 0 1 ]\n", + " 3: [3 7 6 ]\n", + " 4: [10 8 9 ]\n", + " 5: [11 7 12 ]\n", "\n" ] }, @@ -182,7 +182,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "8d8e71e5-ba72-4aa3-83df-24692e01cab6", "metadata": { "tags": [] @@ -191,7 +191,7 @@ { "data": { "text/plain": [ - "[stdout:1] Rank 1: Ghost cells (global numbering): [0 3]\n" + "[stdout:0] Rank 0: Ghost cells (global numbering): [4 7]\n" ] }, "metadata": {}, @@ -200,7 +200,7 @@ { "data": { "text/plain": [ - "[stdout:0] Rank 0: Ghost cells (global numbering): [4 7]\n" + "[stdout:1] Rank 1: Ghost cells (global numbering): [0 3]\n" ] }, "metadata": {}, @@ -225,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "ca8b487d-09e4-45c4-bd90-784f511f74d3", "metadata": { "tags": [] @@ -236,7 +236,7 @@ "text/plain": [ "[stdout:0] Rank 0: Global dofmap size: 9\n", "Rank 0: Local dofmap size: 4\n", - "Rank 0: Ghosts: [5 8 4 6]\n" + "Rank 0: Ghosts: [4 6 5 7]\n" ] }, "metadata": {}, @@ -247,7 +247,7 @@ "text/plain": [ "[stdout:1] Rank 1: Global dofmap size: 9\n", "Rank 1: Local dofmap size: 5\n", - "Rank 1: Ghosts: [0 1 2]\n" + "Rank 1: Ghosts: [3 0 1]\n" ] }, "metadata": {}, @@ -274,7 +274,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "8fa7a806-d9ee-405c-965e-6fec591e028c", "metadata": { "tags": [] @@ -283,8 +283,8 @@ { "data": { "text/plain": [ - "[stdout:1] Rank 1: Local size of array: 5\n", - "Rank 1: Global size of array: 9\n" + "[stdout:0] Rank 0: Local size of array: 4\n", + "Rank 0: Global size of array: 9\n" ] }, "metadata": {}, @@ -293,8 +293,8 @@ { "data": { "text/plain": [ - "[stdout:0] Rank 0: Local size of array: 4\n", - "Rank 0: Global size of array: 9\n" + "[stdout:1] Rank 1: Local size of array: 5\n", + "Rank 1: Global size of array: 9\n" ] }, "metadata": {}, @@ -320,7 +320,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "0699659e-9d73-48d2-a0be-36f3288dedea", "metadata": { "tags": [] @@ -329,7 +329,7 @@ { "data": { "text/plain": [ - "[stdout:0] Rank 0: Ghosts: [5 8 4 6]\n", + "[stdout:0] Rank 0: Ghosts: [4 6 5 7]\n", "Rank 0: Ghost owners: [1 1 1 1]\n" ] }, @@ -339,7 +339,7 @@ { "data": { "text/plain": [ - "[stdout:1] Rank 1: Ghosts: [0 1 2]\n", + "[stdout:1] Rank 1: Ghosts: [3 0 1]\n", "Rank 1: Ghost owners: [0 0 0]\n" ] }, @@ -364,7 +364,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "230c3bb9-3b52-4450-870a-f2d8541b6457", "metadata": { "tags": [] @@ -392,7 +392,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "3f8dbf3b-12ac-428e-a078-906277074abc", "metadata": { "tags": [] @@ -401,7 +401,7 @@ { "data": { "text/plain": [ - "\u001b[0;31mOut[0:8]: \u001b[0m" + "\u001b[0;31mOut[0:8]: \u001b[0m" ] }, "metadata": { @@ -409,12 +409,12 @@ "completed": null, "data": {}, "engine_id": 0, - "engine_uuid": "ab8ab8ad-ea13d585d7987ff2f39f3103", + "engine_uuid": "a3acd193-f5de95f14ec6420dd3d690db", "error": null, "execute_input": "\nimport ufl\n\n# UFL form of right-hand side\nL = ufl.inner(1.0, v) * ufl.dx\nL = dfx.fem.form(L)\n\n# Assemble UFL form into a vector\n_b = dfx.fem.Function(V)\ndfx.fem.petsc.assemble_vector(_b.vector, L)\n", "execute_result": { "data": { - "text/plain": "" + "text/plain": "" }, "execution_count": 8, "metadata": {} @@ -427,14 +427,14 @@ "status": null, "stderr": "", "stdout": "", - "submitted": "2023-04-17T10:43:51.863477Z" + "submitted": "2024-01-05T13:24:08.239508Z" }, "output_type": "display_data" }, { "data": { "text/plain": [ - "\u001b[0;31mOut[1:8]: \u001b[0m" + "\u001b[0;31mOut[1:8]: \u001b[0m" ] }, "metadata": { @@ -442,12 +442,12 @@ "completed": null, "data": {}, "engine_id": 1, - "engine_uuid": "c786becc-278c25074ac2c61bc33ce670", + "engine_uuid": "a29d2826-5c940569d592fb790538480e", "error": null, "execute_input": "\nimport ufl\n\n# UFL form of right-hand side\nL = ufl.inner(1.0, v) * ufl.dx\nL = dfx.fem.form(L)\n\n# Assemble UFL form into a vector\n_b = dfx.fem.Function(V)\ndfx.fem.petsc.assemble_vector(_b.vector, L)\n", "execute_result": { "data": { - "text/plain": "" + "text/plain": "" }, "execution_count": 8, "metadata": {} @@ -460,7 +460,7 @@ "status": null, "stderr": "", "stdout": "", - "submitted": "2023-04-17T10:43:51.863538Z" + "submitted": "2024-01-05T13:24:08.239653Z" }, "output_type": "display_data" } @@ -489,7 +489,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "b2a21284-0e1e-4c60-ac48-4018c36e0681", "metadata": { "tags": [] @@ -498,8 +498,8 @@ { "data": { "text/plain": [ - "[stdout:1] After assembly, prior to communication\n", - "Rank 1: [0.125 0.125 0.125 0.04166667 0.04166667 0.04166667\n", + "[stdout:0] After assembly, prior to communication\n", + "Rank 0: [0.125 0.125 0.04166667 0.04166667 0.04166667 0.125\n", " 0. 0. ]\n" ] }, @@ -509,8 +509,8 @@ { "data": { "text/plain": [ - "[stdout:0] After assembly, prior to communication\n", - "Rank 0: [0.04166667 0.125 0.125 0.04166667 0.125 0.04166667\n", + "[stdout:1] After assembly, prior to communication\n", + "Rank 1: [0.04166667 0.125 0.125 0.125 0.04166667 0.04166667\n", " 0. 0. ]\n" ] }, @@ -534,7 +534,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "e8e1b2fe-944b-4944-970d-908ec9ab068b", "metadata": { "tags": [] @@ -543,8 +543,8 @@ { "data": { "text/plain": [ - "[stdout:1] After ADD/REVERSE update\n", - "Rank 1: [0.125 0.25 0.125 0.04166667 0.08333333 0.04166667\n", + "[stdout:0] After ADD/REVERSE update\n", + "Rank 0: [0.125 0.125 0.04166667 0.08333333 0.04166667 0.125\n", " 0. 0. ]\n" ] }, @@ -554,8 +554,8 @@ { "data": { "text/plain": [ - "[stdout:0] After ADD/REVERSE update\n", - "Rank 0: [0.08333333 0.125 0.125 0.04166667 0.125 0.04166667\n", + "[stdout:1] After ADD/REVERSE update\n", + "Rank 1: [0.08333333 0.125 0.25 0.125 0.04166667 0.04166667\n", " 0. 0. ]\n" ] }, @@ -583,7 +583,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "id": "6f7059a8-e73c-49d7-8b0c-417f80a8f065", "metadata": { "tags": [] @@ -593,7 +593,7 @@ "data": { "text/plain": [ "[stdout:1] After INSERT/FORWARD update\n", - "Rank 1: [0.125 0.25 0.125 0.04166667 0.08333333 0.08333333\n", + "Rank 1: [0.08333333 0.125 0.25 0.125 0.04166667 0.08333333\n", " 0.125 0.125 ]\n" ] }, @@ -604,7 +604,7 @@ "data": { "text/plain": [ "[stdout:0] After INSERT/FORWARD update\n", - "Rank 0: [0.08333333 0.125 0.125 0.04166667 0.25 0.08333333\n", + "Rank 0: [0.125 0.125 0.04166667 0.08333333 0.08333333 0.25\n", " 0.125 0.125 ]\n" ] }, @@ -673,75 +673,25 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 14, "id": "1bd0b245-b1e4-4d1f-9e11-a12e652a4bcb", "metadata": { "tags": [] }, "outputs": [ { - "name": "stderr", - "output_type": "stream", - "text": [ - "[0:execute]\n", - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n", - "\u001b[0;31mOSError\u001b[0m Traceback (most recent call last)\n", - "Cell \u001b[0;32mIn[22], line 4\u001b[0m\n", - "\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpetsc4py\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m PETSc\n", - "\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpyvista\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpv\u001b[39;00m\n", - "\u001b[0;32m----> 4\u001b[0m \u001b[43mpv\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart_xvfb\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "\u001b[1;32m 5\u001b[0m comm \u001b[38;5;241m=\u001b[39m MPI\u001b[38;5;241m.\u001b[39mCOMM_WORLD \u001b[38;5;66;03m# MPI communicator\u001b[39;00m\n", - "\u001b[1;32m 7\u001b[0m Nx, Ny \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m2\u001b[39m \u001b[38;5;66;03m# Mesh size\u001b[39;00m\n", - "\n", - "File \u001b[0;32m/opt/anaconda3/envs/fenicsx/lib/python3.10/site-packages/pyvista/utilities/xvfb.py:47\u001b[0m, in \u001b[0;36mstart_xvfb\u001b[0;34m(wait, window_size)\u001b[0m\n", - "\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m`start_xvfb` is only supported on Linux\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", - "\u001b[1;32m 46\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39msystem(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mwhich Xvfb > /dev/null\u001b[39m\u001b[38;5;124m'\u001b[39m):\n", - "\u001b[0;32m---> 47\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(XVFB_INSTALL_NOTES)\n", - "\u001b[1;32m 49\u001b[0m \u001b[38;5;66;03m# use current default window size\u001b[39;00m\n", - "\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m window_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", - "\n", - "\u001b[0;31mOSError\u001b[0m: Please install Xvfb with:\n", - "\n", - "Debian\n", - "$ sudo apt install libgl1-mesa-glx xvfb\n", - "\n", - "CentOS / RHL\n", - "$ sudo yum install libgl1-mesa-glx xvfb\n", - "\n", - "[1:execute]\n", - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n", - "\u001b[0;31mOSError\u001b[0m Traceback (most recent call last)\n", - "Cell \u001b[0;32mIn[22], line 4\u001b[0m\n", - "\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpetsc4py\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m PETSc\n", - "\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpyvista\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpv\u001b[39;00m\n", - "\u001b[0;32m----> 4\u001b[0m \u001b[43mpv\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart_xvfb\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "\u001b[1;32m 5\u001b[0m comm \u001b[38;5;241m=\u001b[39m MPI\u001b[38;5;241m.\u001b[39mCOMM_WORLD \u001b[38;5;66;03m# MPI communicator\u001b[39;00m\n", - "\u001b[1;32m 7\u001b[0m Nx, Ny \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m2\u001b[39m \u001b[38;5;66;03m# Mesh size\u001b[39;00m\n", - "\n", - "File \u001b[0;32m/opt/anaconda3/envs/fenicsx/lib/python3.10/site-packages/pyvista/utilities/xvfb.py:47\u001b[0m, in \u001b[0;36mstart_xvfb\u001b[0;34m(wait, window_size)\u001b[0m\n", - "\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m`start_xvfb` is only supported on Linux\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", - "\u001b[1;32m 46\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m os\u001b[38;5;241m.\u001b[39msystem(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mwhich Xvfb > /dev/null\u001b[39m\u001b[38;5;124m'\u001b[39m):\n", - "\u001b[0;32m---> 47\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(XVFB_INSTALL_NOTES)\n", - "\u001b[1;32m 49\u001b[0m \u001b[38;5;66;03m# use current default window size\u001b[39;00m\n", - "\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m window_size \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", - "\n", - "\u001b[0;31mOSError\u001b[0m: Please install Xvfb with:\n", - "\n", - "Debian\n", - "$ sudo apt install libgl1-mesa-glx xvfb\n", - "\n", - "CentOS / RHL\n", - "$ sudo yum install libgl1-mesa-glx xvfb\n", - "\n" - ] - }, - { - "ename": "AlreadyDisplayedError", - "evalue": "2 errors", - "output_type": "error", - "traceback": [ - "2 errors" - ] + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "88ccb6e2923645158224db0e634205f7", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "%px: 0%| | 0/2 [00:00>)\n", + "handle: >)>\n", + "Traceback (most recent call last):\n", + " File \"/home/dokken/src/mambaforge/envs/mpi-tutorial/lib/python3.10/asyncio/events.py\", line 80, in _run\n", + " self._context.run(self._callback, *self._args)\n", + "RuntimeError: Cannot enter into task wait_for=> cb=[_chain_future.._call_set_state() at /home/dokken/src/mambaforge/envs/mpi-tutorial/lib/python3.10/asyncio/futures.py:392]> while another task cb=[IOLoop.add_future..() at /home/dokken/.local/lib/python3.10/site-packages/tornado/ioloop.py:687]> is being executed.\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "[stderr:0] ERROR:asyncio:Exception in callback Task.task_wakeup(>)\n", + "handle: >)>\n", + "Traceback (most recent call last):\n", + " File \"/home/dokken/src/mambaforge/envs/mpi-tutorial/lib/python3.10/asyncio/events.py\", line 80, in _run\n", + " self._context.run(self._callback, *self._args)\n", + "RuntimeError: Cannot enter into task wait_for=> cb=[_chain_future.._call_set_state() at /home/dokken/src/mambaforge/envs/mpi-tutorial/lib/python3.10/asyncio/futures.py:392]> while another task cb=[IOLoop.add_future..() at /home/dokken/.local/lib/python3.10/site-packages/tornado/ioloop.py:687]> is being executed.\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "text/plain": [ @@ -1057,12 +1035,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "94aeb5b8783d441f8ef39c0f2a7c25b0", + "model_id": "f68788b8f4624d1eab2ceb9243f3d19e", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "ViewInteractiveWidget(height=768, layout=Layout(height='auto', width='100%'), width=1024)" + "EmbeddableWidget(value='