Not all facet tags are plotted

Hi all,

I am dealing with mixed-dimensional PDEs when I ran into an issue with computing facet tags. Trying to reproduce Dokken’s tutorial I do not see all the desired facets marked in the plot.

The MWE is

from mpi4py import MPI
import dolfinx
import numpy as np

mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 40, 40)

def Omega1(x, tol=1e-14):
    return x[0] <= 0.7 + tol

def Omega0(x, tol=1e-14):
    return 0.7-tol <= x[0]

tdim = mesh.topology.dim
cell_map = mesh.topology.index_map(tdim)
num_cells_local = cell_map.size_local + cell_map.num_ghosts
marker = np.empty(num_cells_local, dtype=np.int32)
heat_marker = 1
stokes_marker = 3

marker[dolfinx.mesh.locate_entities(mesh, tdim, Omega0)] = heat_marker
marker[dolfinx.mesh.locate_entities(mesh, tdim, Omega1)] = stokes_marker

cell_tags = dolfinx.mesh.meshtags(mesh, mesh.topology.dim,
                                    np.arange(num_cells_local, dtype=np.int32),
                                    marker)

# -

# + tags=["remove-input"]
assert len(np.unique(marker)) <= 2
# -

# This section will contain alot of figures, to illustrate the different steps.
# Expand to see the code for creating a plotter of meshes and meshtags.

# + tags=["hide-input"]
import sys, os

import pyvista

if sys.platform == "linux" and (os.getenv("CI") or pyvista.OFF_SCREEN):
    pyvista.start_xvfb(0.05)


def plot_mesh(mesh: dolfinx.mesh.Mesh, tags: dolfinx.mesh.MeshTags=None):
    plotter = pyvista.Plotter()
    mesh.topology.create_connectivity(tdim-1, tdim)
    if tags is None:
        ugrid = pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(mesh))
    else:
        # Exclude indices marked zero
        exclude_entities = tags.find(0)
        marker = np.full_like(tags.values, True, dtype=np.bool_)
        marker[exclude_entities] = False
        ugrid = pyvista.UnstructuredGrid(*dolfinx.plot.vtk_mesh(mesh, tags.dim, tags.indices[marker]))
        print(tags.indices[marker], tags.values[marker])
        ugrid.cell_data["Marker"] = tags.values[marker]

    plotter.add_mesh(ugrid, show_edges=True, line_width=3)
    plotter.show_axes()
    plotter.show()

plot_mesh(mesh, cell_tags)

# -

# Next we define the boundaries for our sub-domains

# + tags=["hide-input"]

mesh.topology.create_connectivity(tdim-1, tdim)
facet_map = mesh.topology.index_map(tdim-1)
num_facets_local = facet_map.size_local + facet_map.num_ghosts
facet_values = np.zeros(num_facets_local, dtype=np.int32)
outer_marker = 4
facet_values[dolfinx.mesh.exterior_facet_indices(mesh.topology)] = 4

def inlet(x, tol=1e-14):
    return np.isclose(x[0], 0.0) & ((x[1] >= 0.4-tol) & (x[1]<=0.6+tol))

inlet_marker = 1
facet_values[dolfinx.mesh.locate_entities_boundary(mesh, tdim-1, inlet)] = inlet_marker

def outlets(x, tol=1e-14):
    return ((np.isclose(x[1], 0.0) &  ((0.4 - tol <= x[0]) & (x[0]<=0.6 + tol))) |
            (np.isclose(x[1], 1.0) &  ((0.2 - tol <= x[0]) & (x[0] <= 0.35 + tol))))

outlet_marker = 2
facet_values[dolfinx.mesh.locate_entities_boundary(mesh, tdim-1, outlets)] = outlet_marker

interface_marker = 3
facet_values[dolfinx.mesh.locate_entities(mesh, tdim-1, lambda x: np.isclose(x[0], 0.7))] = interface_marker

facet_tags = dolfinx.mesh.meshtags(mesh, tdim-1, np.arange(num_facets_local, dtype=np.int32), facet_values)
plot_mesh(mesh, facet_tags)

and I see the follwing for the facet tags:

I guess there is a bug somewhere, but I am not sure. My env is

aiohappyeyeballs          2.6.1              pyhd8ed1ab_0    conda-forge
aiohttp                   3.11.16         py310hc74094e_0    conda-forge
aiosignal                 1.3.2              pyhd8ed1ab_0    conda-forge
anyio                     4.9.0              pyh29332c3_0    conda-forge
aom                       3.9.1                h7bae524_0    conda-forge
appnope                   0.1.4              pyhd8ed1ab_1    conda-forge
argon2-cffi               23.1.0             pyhd8ed1ab_1    conda-forge
argon2-cffi-bindings      21.2.0          py310h493c2e1_5    conda-forge
arrow                     1.3.0              pyhd8ed1ab_1    conda-forge
asttokens                 3.0.0              pyhd8ed1ab_1    conda-forge
async-lru                 2.0.5              pyh29332c3_0    conda-forge
async-timeout             5.0.1              pyhd8ed1ab_1    conda-forge
attrs                     25.3.0             pyh71513ae_0    conda-forge
babel                     2.17.0             pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.13.4             pyha770c72_0    conda-forge
bleach                    6.2.0              pyh29332c3_4    conda-forge
bleach-with-css           6.2.0                h82add2a_4    conda-forge
blosc                     1.21.6               h7dd00d9_1    conda-forge
brotli                    1.1.0                hd74edd7_2    conda-forge
brotli-bin                1.1.0                hd74edd7_2    conda-forge
brotli-python             1.1.0           py310hb4ad77e_2    conda-forge
bzip2                     1.0.8                h99b78c6_7    conda-forge
c-ares                    1.34.5               h5505292_0    conda-forge
ca-certificates           2025.1.31            hf0a4a13_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cairo                     1.18.4               h6a3b0d2_0    conda-forge
cctools_osx-arm64         1010.6               h4f2c9d0_1    conda-forge
certifi                   2025.1.31          pyhd8ed1ab_0    conda-forge
cffi                      1.17.1          py310h497396d_0    conda-forge
charset-normalizer        3.4.1              pyhd8ed1ab_0    conda-forge
clang                     16.0.6          default_h87a6e52_14    conda-forge
clang-16                  16.0.6          default_hc2ef00a_14    conda-forge
clang_impl_osx-arm64      16.0.6              hc421ffc_19    conda-forge
clang_osx-arm64           16.0.6              h54d7cd3_19    conda-forge
clangxx                   16.0.6          default_h75e0ad0_14    conda-forge
clangxx_impl_osx-arm64    16.0.6              hcd7bac0_19    conda-forge
clangxx_osx-arm64         16.0.6              h54d7cd3_19    conda-forge
comm                      0.2.2              pyhd8ed1ab_1    conda-forge
compiler-rt               16.0.6               h3808999_2    conda-forge
compiler-rt_osx-arm64     16.0.6               h3808999_2    conda-forge
contourpy                 1.3.2           py310h7f4e7e6_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_1    conda-forge
cyrus-sasl                2.1.27               h60b93bd_7    conda-forge
dav1d                     1.2.1                hb547adb_0    conda-forge
dbus                      1.13.6               h3818c69_3    conda-forge
debugpy                   1.8.14          py310h853098b_0    conda-forge
decorator                 5.2.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
double-conversion         3.3.1                h286801f_0    conda-forge
exceptiongroup            1.2.2              pyhd8ed1ab_1    conda-forge
executing                 2.1.0              pyhd8ed1ab_1    conda-forge
expat                     2.7.0                h286801f_0    conda-forge
fenics-basix              0.7.0           py310hc46d281_1    conda-forge
fenics-basix-pybind11-abi 0.4.16               hb11509e_1    conda-forge
fenics-dolfinx            0.7.3           py310h26b5a40_102    conda-forge
fenics-ffcx               0.7.0              pyh4af843d_0    conda-forge
fenics-libbasix           0.7.0                hb1687fd_1    conda-forge
fenics-libdolfinx         0.7.3              h3a14aee_102    conda-forge
fenics-ufcx               0.7.0                h4af843d_0    conda-forge
fenics-ufl                2023.2.0           pyhd8ed1ab_0    conda-forge
ffmpeg                    7.1.1           gpl_h583251a_104    conda-forge
fftw                      3.3.10          mpi_openmpi_haef8dc3_9    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 h77eed37_3    conda-forge
fontconfig                2.15.0               h1383a14_1    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.57.0          py310hc74094e_0    conda-forge
fqdn                      1.5.1              pyhd8ed1ab_1    conda-forge
freetype                  2.13.3               h1d14073_0    conda-forge
fribidi                   1.0.10               h27ca646_0    conda-forge
frozenlist                1.5.0           py310hc74094e_1    conda-forge
gdk-pixbuf                2.42.12              h7ddc832_0    conda-forge
gl2ps                     1.4.2                hc97c1ff_1    conda-forge
glew                      2.1.0                h9f76cd9_2    conda-forge
gmp                       6.3.0                h7bae524_2    conda-forge
graphite2                 1.3.13            hebf3989_1003    conda-forge
h11                       0.14.0             pyhd8ed1ab_1    conda-forge
h2                        4.2.0              pyhd8ed1ab_0    conda-forge
harfbuzz                  11.1.0               hab40de2_0    conda-forge
hdf4                      4.2.15               h2ee6834_7    conda-forge
hdf5                      1.14.3          mpi_openmpi_h7d685e0_4    conda-forge
hpack                     4.1.0              pyhd8ed1ab_0    conda-forge
httpcore                  1.0.7              pyh29332c3_1    conda-forge
httpx                     0.28.1             pyhd8ed1ab_0    conda-forge
hyperframe                6.1.0              pyhd8ed1ab_0    conda-forge
hypre                     2.28.0          mpi_openmpi_haba3941_0    conda-forge
icu                       75.1                 hfee45f7_0    conda-forge
idna                      3.10               pyhd8ed1ab_1    conda-forge
importlib-metadata        8.6.1              pyha770c72_0    conda-forge
importlib_resources       6.5.2              pyhd8ed1ab_0    conda-forge
ipykernel                 6.29.5             pyh57ce528_0    conda-forge
ipympl                    0.9.7              pyhd8ed1ab_1    conda-forge
ipython                   8.35.0             pyh907856f_0    conda-forge
ipywidgets                8.1.6              pyhd8ed1ab_0    conda-forge
isoduration               20.11.0            pyhd8ed1ab_1    conda-forge
jedi                      0.19.2             pyhd8ed1ab_1    conda-forge
jinja2                    3.1.6              pyhd8ed1ab_0    conda-forge
json5                     0.12.0             pyhd8ed1ab_0    conda-forge
jsoncpp                   1.9.6                h726d253_1    conda-forge
jsonpointer               3.0.0           py310hbe9552e_1    conda-forge
jsonschema                4.23.0             pyhd8ed1ab_1    conda-forge
jsonschema-specifications 2024.10.1          pyhd8ed1ab_1    conda-forge
jsonschema-with-format-nongpl 4.23.0               hd8ed1ab_1    conda-forge
jupyter                   1.1.1              pyhd8ed1ab_1    conda-forge
jupyter-lsp               2.2.5              pyhd8ed1ab_1    conda-forge
jupyter_client            8.6.3              pyhd8ed1ab_1    conda-forge
jupyter_console           6.6.3              pyhd8ed1ab_1    conda-forge
jupyter_core              5.7.2              pyh31011fe_1    conda-forge
jupyter_events            0.12.0             pyh29332c3_0    conda-forge
jupyter_server            2.15.0             pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.5.3              pyhd8ed1ab_1    conda-forge
jupyterlab                4.4.0              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.3.0              pyhd8ed1ab_2    conda-forge
jupyterlab_server         2.27.3             pyhd8ed1ab_1    conda-forge
jupyterlab_widgets        3.0.14             pyhd8ed1ab_0    conda-forge
kahip                     3.16            py310h9fdae5a_2    conda-forge
kahip-python              3.16            py310he2182f4_2    conda-forge
kiwisolver                1.4.7           py310h7306fd8_0    conda-forge
krb5                      1.21.3               h237132a_0    conda-forge
lame                      3.100             h1a8c8d9_1003    conda-forge
lcms2                     2.17                 h7eeda09_0    conda-forge
ld64_osx-arm64            951.9                h0605c9f_1    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libabseil                 20240722.0      cxx17_h07bc746_4    conda-forge
libadios2                 2.9.2           mpi_openmpi_h6324500_0    conda-forge
libaec                    1.1.3                hebf3989_0    conda-forge
libass                    0.17.3               h68e5b86_2    conda-forge
libblas                   3.9.0           31_h10e41b3_openblas    conda-forge
libboost                  1.84.0               hc9fb7c5_7    conda-forge
libboost-devel            1.84.0               hf450f58_7    conda-forge
libboost-headers          1.84.0               hce30654_7    conda-forge
libbrotlicommon           1.1.0                hd74edd7_2    conda-forge
libbrotlidec              1.1.0                hd74edd7_2    conda-forge
libbrotlienc              1.1.0                hd74edd7_2    conda-forge
libcblas                  3.9.0           31_hb3479ef_openblas    conda-forge
libclang-cpp16            16.0.6          default_hc2ef00a_14    conda-forge
libclang-cpp18.1          18.1.8          default_hf90f093_9    conda-forge
libclang13                20.1.3          default_hee4fbb3_0    conda-forge
libcurl                   8.13.0               h73640d1_0    conda-forge
libcxx                    20.1.3               ha82da77_0    conda-forge
libcxx-devel              16.0.6               h86353a2_2    conda-forge
libdeflate                1.23                 hec38601_0    conda-forge
libedit                   3.1.20250104    pl5321hafb1f1b_0    conda-forge
libev                     4.33                 h93a5062_2    conda-forge
libexpat                  2.7.0                h286801f_0    conda-forge
libffi                    3.4.6                h1da3d7d_1    conda-forge
libgfortran               14.2.0             heb5dd2a_105    conda-forge
libgfortran5              14.2.0             h2c44a93_105    conda-forge
libglib                   2.84.0               hdff4504_0    conda-forge
libhwloc                  2.11.2          default_hbce5d74_1001    conda-forge
libiconv                  1.18                 hfe07756_1    conda-forge
libintl                   0.23.1               h493aca8_0    conda-forge
libjpeg-turbo             3.0.0                hb547adb_1    conda-forge
liblapack                 3.9.0           31_hc9a63f6_openblas    conda-forge
libllvm16                 16.0.6               hc4b4ae8_4    conda-forge
libllvm18                 18.1.8               hc4b4ae8_3    conda-forge
libllvm20                 20.1.3               h598bca7_0    conda-forge
liblzma                   5.8.1                h39f12f2_0    conda-forge
liblzma-devel             5.8.1                h39f12f2_0    conda-forge
libnetcdf                 4.9.2           nompi_h610d594_116    conda-forge
libnghttp2                1.64.0               h6d7220d_0    conda-forge
libntlm                   1.8                  h5505292_0    conda-forge
libogg                    1.3.5                h99b78c6_0    conda-forge
libopenblas               0.3.29          openmp_hf332438_0    conda-forge
libopenvino               2025.0.0             h97facdf_0    conda-forge
libopenvino-arm-cpu-plugin 2025.0.0             h97facdf_0    conda-forge
libopenvino-auto-batch-plugin 2025.0.0             h7f72211_0    conda-forge
libopenvino-auto-plugin   2025.0.0             h7f72211_0    conda-forge
libopenvino-hetero-plugin 2025.0.0             hd3d436d_0    conda-forge
libopenvino-ir-frontend   2025.0.0             hd3d436d_0    conda-forge
libopenvino-onnx-frontend 2025.0.0             h76e6831_0    conda-forge
libopenvino-paddle-frontend 2025.0.0             h76e6831_0    conda-forge
libopenvino-pytorch-frontend 2025.0.0             h286801f_0    conda-forge
libopenvino-tensorflow-frontend 2025.0.0             he275e1d_0    conda-forge
libopenvino-tensorflow-lite-frontend 2025.0.0             h286801f_0    conda-forge
libopus                   1.5.2                h48c0fde_0    conda-forge
libpng                    1.6.47               h3783ad8_0    conda-forge
libpq                     17.4                 h6896619_1    conda-forge
libprotobuf               5.28.3               h3bd63a1_1    conda-forge
libptscotch               7.0.4                h5f5ebf5_2    conda-forge
librsvg                   2.58.4               h266df6f_3    conda-forge
libscotch                 7.0.4                h5fd1d4b_2    conda-forge
libsodium                 1.0.20               h99b78c6_0    conda-forge
libsqlite                 3.49.1               h3f77e49_2    conda-forge
libssh2                   1.11.1               h9cc3647_0    conda-forge
libtheora                 1.1.1             h99b78c6_1006    conda-forge
libtiff                   4.7.0                h551f018_3    conda-forge
libusb                    1.0.28               h5505292_0    conda-forge
libvorbis                 1.3.7                h9f76cd9_0    conda-forge
libvpx                    1.14.1               h7bae524_0    conda-forge
libwebp-base              1.5.0                h2471fea_0    conda-forge
libxcb                    1.17.0               hdb1d25a_0    conda-forge
libxml2                   2.13.7               h52572c6_1    conda-forge
libzip                    1.11.2               h1336266_0    conda-forge
libzlib                   1.3.1                h8359307_2    conda-forge
llvm-openmp               20.1.2               hdb05f8b_1    conda-forge
llvm-tools                16.0.6               hc4b4ae8_4    conda-forge
loguru                    0.7.2           py310hbe9552e_2    conda-forge
lz4-c                     1.10.0               h286801f_1    conda-forge
markupsafe                3.0.2           py310hc74094e_1    conda-forge
matplotlib-base           3.10.1          py310hadbac3a_0    conda-forge
matplotlib-inline         0.1.7              pyhd8ed1ab_1    conda-forge
metis                     5.1.0             h15f6cfe_1007    conda-forge
mistune                   3.1.3              pyh29332c3_0    conda-forge
more-itertools            10.6.0             pyhd8ed1ab_0    conda-forge
mpfr                      4.2.1                hb693164_3    conda-forge
mpi                       1.0                     openmpi    conda-forge
mpi4py                    3.1.6           py310hd3bd7df_0    conda-forge
msgpack-python            1.1.0           py310h7306fd8_0    conda-forge
multidict                 6.3.2           py310hdf261b0_0    conda-forge
mumps-include             5.6.2                hce30654_4    conda-forge
mumps-mpi                 5.6.2                hc6b315c_4    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mysql-common              9.2.0                hd7719f6_0    conda-forge
mysql-libs                9.2.0                ha8be5b7_0    conda-forge
nbclient                  0.10.2             pyhd8ed1ab_0    conda-forge
nbconvert-core            7.16.6             pyh29332c3_0    conda-forge
nbformat                  5.10.4             pyhd8ed1ab_1    conda-forge
ncurses                   6.5                  h5e97a16_3    conda-forge
nest-asyncio              1.6.0              pyhd8ed1ab_1    conda-forge
nlohmann_json             3.12.0               ha1acc90_0    conda-forge
notebook                  7.4.0              pyhd8ed1ab_0    conda-forge
notebook-shim             0.2.4              pyhd8ed1ab_1    conda-forge
numpy                     1.26.4          py310hd45542a_0    conda-forge
openh264                  2.6.0                hb5b2745_0    conda-forge
openjpeg                  2.5.3                h8a3d83b_0    conda-forge
openldap                  2.6.9                hbe55e7a_0    conda-forge
openmpi                   4.1.6              h526c993_101    conda-forge
openssl                   3.5.0                h81ee809_0    conda-forge
overrides                 7.7.0              pyhd8ed1ab_1    conda-forge
packaging                 24.2               pyhd8ed1ab_2    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
pango                     1.56.3               h5fd7515_1    conda-forge
parmetis                  4.0.3             h6eb5794_1005    conda-forge
parso                     0.8.4              pyhd8ed1ab_1    conda-forge
pcre2                     10.44                h297a79d_2    conda-forge
petsc                     3.20.6          real_hdd9ae42_100    conda-forge
petsc4py                  3.20.5          real_heb9844d_100    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_1    conda-forge
pickleshare               0.7.5           pyhd8ed1ab_1004    conda-forge
pillow                    11.1.0          py310h61efb56_0    conda-forge
pip                       25.0.1             pyh8b19718_0    conda-forge
pixman                    0.44.2               h2f9eb0b_0    conda-forge
pkg-config                0.29.2            hde07d2e_1009    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_2    conda-forge
platformdirs              4.3.7              pyh29332c3_0    conda-forge
pooch                     1.8.2              pyhd8ed1ab_1    conda-forge
proj                      9.5.1                h1318a7e_0    conda-forge
prometheus_client         0.21.1             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.51             pyha770c72_0    conda-forge
prompt_toolkit            3.0.51               hd8ed1ab_0    conda-forge
propcache                 0.3.1           py310hc74094e_0    conda-forge
psutil                    7.0.0           py310h078409c_0    conda-forge
pthread-stubs             0.4               hd74edd7_1002    conda-forge
ptscotch                  7.0.4                hc1c4572_2    conda-forge
ptyprocess                0.7.0              pyhd8ed1ab_1    conda-forge
pugixml                   1.14                 h13dd4ca_0    conda-forge
pure_eval                 0.2.3              pyhd8ed1ab_1    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycparser                 2.22               pyh29332c3_1    conda-forge
pygments                  2.19.1             pyhd8ed1ab_0    conda-forge
pyobjc-core               11.0            py310h4e4eb3c_0    conda-forge
pyobjc-framework-cocoa    11.0            py310h4e4eb3c_0    conda-forge
pyparsing                 3.2.3              pyhd8ed1ab_1    conda-forge
pysocks                   1.7.1              pyha55dd90_7    conda-forge
python                    3.10.17         h6cefb37_0_cpython    conda-forge
python-dateutil           2.9.0.post0        pyhff2d567_1    conda-forge
python-fastjsonschema     2.21.1             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python_abi                3.10                    6_cp310    conda-forge
pytz                      2025.2             pyhd8ed1ab_0    conda-forge
pyvista                   0.44.2             pyhd8ed1ab_1    conda-forge
pyyaml                    6.0.2           py310hc74094e_2    conda-forge
pyzmq                     26.4.0          py310h6d25ecc_0    conda-forge
qhull                     2020.2               h420ef59_5    conda-forge
qt6-main                  6.8.3                hca13b62_2    conda-forge
readline                  8.2                  h1d1bf99_2    conda-forge
referencing               0.36.2             pyh29332c3_0    conda-forge
requests                  2.32.3             pyhd8ed1ab_1    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_1    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rpds-py                   0.24.0          py310h31b3829_0    conda-forge
scalapack                 2.2.0                h515df86_1    conda-forge
scooby                    0.10.0             pyhd8ed1ab_1    conda-forge
scotch                    7.0.4                hc1c4572_2    conda-forge
sdl2                      2.32.54              h994913f_0    conda-forge
sdl3                      3.2.10               he842692_0    conda-forge
send2trash                1.8.3              pyh31c8845_1    conda-forge
setuptools                78.1.0             pyhff2d567_0    conda-forge
sigtool                   0.1.3                h44b9a77_0    conda-forge
six                       1.17.0             pyhd8ed1ab_0    conda-forge
slepc                     3.20.2          real_hc6ecad9_100    conda-forge
slepc4py                  3.20.2          real_h60c1eb3_100    conda-forge
snappy                    1.2.1                h98b9ce2_1    conda-forge
sniffio                   1.3.1              pyhd8ed1ab_1    conda-forge
soupsieve                 2.5                pyhd8ed1ab_1    conda-forge
sqlite                    3.49.1               hd7222ec_2    conda-forge
stack_data                0.6.3              pyhd8ed1ab_1    conda-forge
suitesparse               5.10.1               h79486c6_3    conda-forge
superlu                   7.0.0                h742a510_1    conda-forge
superlu_dist              8.2.1                h3dacc9e_1    conda-forge
svt-av1                   3.0.2                h8ab69cd_0    conda-forge
tapi                      1300.6.5             h03f4b80_0    conda-forge
tbb                       2022.1.0             h9541205_0    conda-forge
terminado                 0.18.1             pyh31c8845_0    conda-forge
tinycss2                  1.4.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tomli                     2.2.1              pyhd8ed1ab_1    conda-forge
tornado                   6.4.2           py310h078409c_0    conda-forge
traitlets                 5.14.3             pyhd8ed1ab_1    conda-forge
trame                     3.8.2              pyhd8ed1ab_0    conda-forge
trame-client              3.7.1              pyhd8ed1ab_0    conda-forge
trame-server              3.4.0              pyhd8ed1ab_0    conda-forge
trame-vtk                 2.8.15             pyhb419c8b_0    conda-forge
trame-vuetify             3.0.1              pyhd8ed1ab_0    conda-forge
types-python-dateutil     2.9.0.20241206     pyhd8ed1ab_0    conda-forge
typing-extensions         4.13.2               h0e9735f_0    conda-forge
typing_extensions         4.13.2             pyh29332c3_0    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_1    conda-forge
tzdata                    2025b                h78e105d_0    conda-forge
unicodedata2              16.0.0          py310h078409c_0    conda-forge
uri-template              1.3.0              pyhd8ed1ab_1    conda-forge
urllib3                   2.4.0              pyhd8ed1ab_0    conda-forge
utfcpp                    4.0.6                h54c0426_0    conda-forge
vtk                       9.3.1           qt_py310he4b582b_215    conda-forge
vtk-base                  9.3.1           qt_py310h9cd0699_215    conda-forge
vtk-io-ffmpeg             9.3.1           qt_py310he4b582b_215    conda-forge
wcwidth                   0.2.13             pyhd8ed1ab_1    conda-forge
webcolors                 24.11.1            pyhd8ed1ab_0    conda-forge
webencodings              0.5.1              pyhd8ed1ab_3    conda-forge
websocket-client          1.8.0              pyhd8ed1ab_1    conda-forge
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
widgetsnbextension        4.0.14             pyhd8ed1ab_0    conda-forge
wslink                    2.3.3              pyhd8ed1ab_0    conda-forge
x264                      1!164.3095           h57fd34a_2    conda-forge
x265                      3.5                  hbc6ce65_3    conda-forge
xorg-libxau               1.0.12               h5505292_0    conda-forge
xorg-libxdmcp             1.1.5                hd74edd7_0    conda-forge
xz                        5.8.1                h9a6d368_0    conda-forge
xz-gpl-tools              5.8.1                h9a6d368_0    conda-forge
xz-tools                  5.8.1                h39f12f2_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
yarl                      1.18.3          py310hc74094e_1    conda-forge
zeromq                    4.3.5                hc1bb282_7    conda-forge
zfp                       0.5.5                hcfdfaf5_8    conda-forge
zipp                      3.21.0             pyhd8ed1ab_1    conda-forge
zlib                      1.3.1                h8359307_2    conda-forge
zstandard                 0.23.0          py310h078409c_1    conda-forge
zstd                      1.5.7                h6491c7d_2    conda-forge

Any help is highly appreciated!
Thanks,
Tom

I can’t reproduce this locally (using docker with)

 docker run -ti --network=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/root/shared -w /root/shared --entrypoint /bin/bash ghcr.io/fenics/dolfinx/lab:stable

Could you report the output of your print statements

which yields

[   0    1    2 ... 3197 3198 3199] [1 1 1 ... 3 3 3]
[   0    3    4    6   12   14   23   25   37   39   54   56   74   76
   97   99  123  125  152  154  184  186  219  221  256  257  259  263
  298  300  307  342  344  354  389  391  404  439  441  457  492  494
  513  548  550  572  607  609  634  669  671  699  734  736  767  802
  804  838  873  875  912  947  949  989 1024 1026 1069 1104 1106 1152
 1187 1189 1238 1273 1275 1327 1362 1364 1419 1454 1456 1514 1549 1551
 1612 1647 1649 1713 1748 1750 1817 1852 1854 1924 1959 1961 2034 2069
 2071 2147 2182 2184 2263 2298 2300 2382 2417 2419 2504 2538 2539 2541
 2625 2656 2658 2742 2770 2772 2856 2881 2883 2967 2989 2991 3075 3094
 3096 3180 3196 3198 3282 3295 3297 3381 3391 3393 3477 3484 3486 3570
 3574 3576 3660 3661 3663 3745 3747 3826 3828 3904 3906 3979 3981 4051
 4053 4120 4122 4186 4188 4249 4251 4309 4311 4366 4368 4420 4422 4471
 4473 4519 4521 4564 4566 4606 4608 4645 4647 4681 4683 4714 4716 4744
 4746 4771 4773 4795 4797 4816 4818 4834 4836 4849 4851 4861 4863 4870
 4872 4876 4878 4879] [4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3
 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4
 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4
 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 3 4 4 4 4 4
 4 4 4 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 1 4 4 4 4 4 4 2 4 2 4 2 4 2 4 2 4 2 4
 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]

for me.

Could you try updating your DOLFINx version to a later release and see if the problem still persists?

Thanks for the reply. I am getting the exact same output (diff’ed it to be sure).

So I guess the representation within FEniCSx seems to be fine, and it’s a problem with PyVista, isn’t it?

Best,
Tom

Yes, I would assume so.