import dolfinx.mesh
import mpi4py.MPI
import viskex
import common_dolfinx as common # isort: skip
Generate a mesh of the unit interval, divided into six cells.
interval = dolfinx.mesh.create_unit_interval(mpi4py.MPI.COMM_WORLD, 6)
Mark boundaries according to the $x$ position of the vertices of the mesh:
interval_subdomains = common.mark_subdomains(interval)
interval_boundaries = common.mark_boundaries(interval, interval_subdomains)
We plot the resulting boundaries.
viskex.dolfinx.plot_mesh_tags(interval, interval_boundaries, "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 with tag equal to $4$ (first plot), $2$ (second plot) or both (third 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.dolfinx.plot_mesh_tags(
interval, interval_boundaries, "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.dolfinx.plot_mesh_tags(
interval, interval_boundaries, "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.dolfinx.plot_mesh_tags(
interval, interval_boundaries, "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