# mpyvisualize This tool provides visualization capabilities for result files from CFD simulations. The visualization includes: - Configurable slice plane orientation and position - Visualizes scalar fields, vector fields not supported yet - Optional switch from cell data to point data - Optional perspective view with adjustable angles ## Usage ```bash mpyvisualize [options] command [args ...] FIELD INPUT ``` ## Slice Command The `slice` command extracts a 2D slice through a 3D VTK dataset and saves it as an image file. The slice plane is defined by an origin point and a normal vector. ## Examples ### Basic Slice Extract a slice through the mesh center with normal vector along the z-axis: ```bash mpyvisualize slice alpha.water result.vtk ``` This creates `slice.png` with the alpha field, using cell data and a horizontal slice plane. ### Custom Slice Plane and Output File Define both the origin and normal vector: ```bash mpyvisualize slice alpha.water result.vtk \ --origin "(0.5,0.5,0.5)" \ --normal "(0,1,0)" \ --output alpha_water_slice.png ``` ### Perspective View Get a perspective view with mesh boundaries shown: ```bash mpyvisualize slice alpha.water result.vtk \ --perspective \ --perspective-azimuth 45 \ --perspective-elevation 30 ``` ### Visualizing Point Data Use point data instead of the default cell data: ```bash mpyvisualize slice alpha result.vtk --pointdata ``` ### Usage with Results from OpenFOAM Foundation Software ```bash foamToVTK -latestTime ``` and ```bash mpyvisualize slice alpha.water VTK/.vtk ``` ## Output The tool generates image files with: - Viridis colormap applied to the field - Vertical color bar showing value range - 3D axes for orientation ## 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 It supports the following output formats: - PNG, JPEG, TIFF, BMP