mpyvisualize
This tool creates slice visualizations of scalar fields from CFD simulation result files and saves them as image files.
Usage
mpyvisualize [options] slice [options] FIELD INPUT
Commands
slice - Slice Plot
Extract a 2D slice through a VTK dataset and save it as an image. The slice
plane is defined by an origin point and a normal vector. FIELD accepts glob
patterns; when the pattern matches multiple fields, one image is produced per
matched field with the field name appended to the output stem (e.g.
slice.alpha.water.png).
mpyvisualize slice [options] FIELD INPUT
Options:
--output FILE- Output image file path (default:slice.<field>.png)--normal VECTOR- Normal vector of the slice plane (default:(0,0,1))--origin POINT- Origin point of the slice plane (default: mesh center)--perspective/--no-perspective- Use perspective view instead of parallel projection (default: off)--perspective-azimuth FLOAT- Camera azimuth angle in degrees (default: 15)--perspective-elevation FLOAT- Camera elevation angle in degrees (default: 15)--feature-edges/--no-feature-edges- Overlay mesh feature edges in black (default: on in perspective mode, off otherwise)--color-map, --cmap NAME- Colormap name (default:Fast). Fast is a perceptually uniform colormap and the default in ParaView. Any matplotlib colormap is also accepted.--color-limits, --clim MIN,MAX- Fix colormap range, e.g.[0,1](default: auto-detected)--size WIDTHxHEIGHT- Output image dimensions in pixels (default:1024x768)--font-size INT- Font size for axis labels and scalar bar (default: 12)--pointdata- Use point data instead of cell data
Example:
mpyvisualize slice alpha.water result.vtk
Examples
Field Selection with Wildcards
mpyvisualize slice "alpha*" result.vtk
Custom Slice Plane
mpyvisualize slice alpha.water result.vtk \
--origin "(0.5,0.5,0.5)" \
--normal "(0,1,0)"
Perspective View with Feature Edges
mpyvisualize slice alpha.water result.vtk \
--perspective \
--perspective-azimuth 45 \
--perspective-elevation 30 \
--feature-edges
Fixed Color Limits
mpyvisualize slice alpha.water result.vtk --color-limits "[0,1]"
High-Resolution Output
mpyvisualize slice alpha.water result.vtk --size "1920x1080" --font-size 18
Usage with Results from OpenFOAM Foundation Software
foamToVTK -latestTime
mpyvisualize slice alpha.water VTK/<filename>.vtk
Supported File Formats
The tool supports all result file formats readable by PyVista:
Legacy VTK format (.vtk)
VTK XML formats (.vtu, .vtp, .vti, .vts, .vtr)
EnSight format (.case, .encas)
Plot3D format (.xyz, .q)
And many others supported by PyVista
Supported output image formats: PNG, JPEG, TIFF, BMP.