phipict.io.export.vtk

VTK XML output of meshes and solutions, for ParaView and pyvista.

A mesh or domain is written as a multi-block file <path>.vtm that references one structured grid (.vts) per block in the directory <path>/:

from phipict.io import export

export.write_vtk(domain, "out/cylinder")            # fields of the domain
export.write_vtk(mesh, "out/cylinder_mesh")         # mesh with cell quality
export.write_vtk(domain, "out/cylinder", mesh=mesh) # with named patches

Cell fields are written as VTK cell data; 2D blocks become grids of zero thickness in z. Boundary patches of a Mesh are written as a second group of the multi-block file, one grid per patch face. The data are little-endian binary, zlib-compressed by default. Only numpy and the standard library are needed.

Functions

write_vtk(target, path, *, fields, mesh, ...)

Write a domain or mesh as a VTK multi-block file.

write_vts(path, coords[, cell_data, compress])

Write one structured grid as a .vts file.