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)
Interpolate the scalar field $x^3$, and store it either in a dolfinx function or a UFL expression.
interval_scalar_field, interval_scalar_field_ufl = common.prepare_scalar_field_cases(
interval, lambda x: x[0]**3)
Plot the scalar field on the mesh.
viskex.dolfinx.plot_scalar_field(interval_scalar_field, "scalar")
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_scalar_field(interval_scalar_field_ufl, "scalar")
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
Warp mesh according to scalar field.
viskex.dolfinx.plot_scalar_field(interval_scalar_field, "scalar", warp_factor=0.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