import firedrake
/home/firedrake/firedrake/lib/python3.12/site-packages/pytools/persistent_dict.py:52: RecommendedHashNotFoundWarning: Unable to import recommended hash 'siphash24.siphash13', falling back to 'hashlib.sha256'. Run 'python3 -m pip install siphash24' to install the recommended hash. warn("Unable to import recommended hash 'siphash24.siphash13', "
import viskex
import common_firedrake as common # isort: skip
Generate meshes of the unit cube by dividing each edge of the cube in 6 segments, using either a tetrahedral or hexahedral mesh.
cube_tetra = firedrake.UnitCubeMesh(6, 6, 6, hexahedral=False)
cube_hexa = firedrake.UnitCubeMesh(6, 6, 6, hexahedral=True)
Mark boundaries according to the $(x, y, z)$ position of the vertices of the mesh:
cube_tetra_with_boundaries = common.mark_boundaries(cube_tetra)
cube_hexa_with_boundaries = common.mark_boundaries(cube_hexa)
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2255: LoopyWarning: in kernel expression_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings kernel attribute to disable) warn_with_kernel(
We plot the resulting boundaries.
viskex.firedrake.plot_mesh_sets(cube_tetra_with_boundaries, 2, "boundaries")
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_mesh_sets(cube_hexa_with_boundaries, 2, "boundaries")
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
We can also plot all boundaries which belong to the mesh set $4$ (first and second plot), $2$ (third and fourth plot) or both (fifth and sixth plot), which will be displayed with colors. The rest of the mesh facets are still included in the plot, but are colored in gray.
viskex.firedrake.plot_mesh_sets(
cube_tetra_with_boundaries, 2, "boundaries_4", viskex.utils.values_in([4]))
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_mesh_sets(
cube_hexa_with_boundaries, 2, "boundaries_4", viskex.utils.values_in([4]))
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_mesh_sets(
cube_tetra_with_boundaries, 2, "boundaries_2", viskex.utils.values_in([2]))
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_mesh_sets(
cube_hexa_with_boundaries, 2, "boundaries_2", viskex.utils.values_in([2]))
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_mesh_sets(
cube_tetra_with_boundaries, 2, "boundaries_24", viskex.utils.values_in([2, 4]))
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_mesh_sets(
cube_hexa_with_boundaries, 2, "boundaries_24", viskex.utils.values_in([2, 4]))
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
The mesh sets are stored as part of the firedrake mesh object. If the mesh sets get removed, all cells will be displayed in gray in the plot.
cube_tetra.topology_dm.removeLabel(firedrake.cython.dmcommon.FACE_SETS_LABEL)
cube_hexa.topology_dm.removeLabel(firedrake.cython.dmcommon.FACE_SETS_LABEL)
viskex.firedrake.plot_mesh_sets(cube_tetra, 2, "boundaries")
/home/firedrake/firedrake/lib/python3.12/site-packages/pyvista/plotting/mapper.py:669: RuntimeWarning: All-NaN axis encountered clim = [np.nanmin(scalars), np.nanmax(scalars)] error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_mesh_sets(cube_hexa, 2, "boundaries")
/home/firedrake/firedrake/lib/python3.12/site-packages/pyvista/plotting/mapper.py:669: RuntimeWarning: All-NaN axis encountered clim = [np.nanmin(scalars), np.nanmax(scalars)] error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen