import dolfinx.mesh
import mpi4py.MPI
import viskex
Generate meshes of the unit square by dividing each edge of the square in 6 segments, using either a triangular or quadrangular mesh.
square_tria = dolfinx.mesh.create_unit_square(mpi4py.MPI.COMM_WORLD, 6, 6, dolfinx.mesh.CellType.triangle)
square_quad = dolfinx.mesh.create_unit_square(mpi4py.MPI.COMM_WORLD, 6, 6, dolfinx.mesh.CellType.quadrilateral)
Plot the meshes.
viskex.dolfinx.plot_mesh(square_tria)
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(square_quad)
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
An optional argument dim
argument controls the dimension of the entities to plotted. By default, it is equal to the topological dimension. In this example, dim=2
plots cells of the mesh (i.e., triangles or quadrilaterals), dim=1
plots facets of the mesh (i.e., segments), while dim=0
plots vertices of the mesh.
viskex.dolfinx.plot_mesh(square_tria, dim=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(square_quad, dim=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(square_tria, dim=1)
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(square_quad, dim=1)
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(square_tria, dim=0)
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(square_quad, dim=0)
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