Skip to content

ParaView Plugin

MicPy provides a plugin that allows MICRESS simulation data to be loaded and explored directly inside ParaView. Once installed, MICRESS binary files, such as concentration and phase fields, can be opened without any conversion step. Unlike exported .vti files, the plugin also allows switching between CellData, PointData (averaged), and PointData (direct) representations directly from ParaView's Properties panel, without reopening the file or converting the dataset.

Phase interfaces visualized in ParaView via a 0.5 iso-surface contour of MICRESS phase fraction data (A019_02_MgAl6_E_Dendritic_3D_TQ.frac).

Choosing the Data Representation

After loading a MICRESS file, its VTK data representation can be changed using the corresponding drop-down list in ParaView's Properties panel. Select one of the following representations and click Apply.

  • CellData stores the field as VTK CellData, with one value assigned to each cell.
  • PointData (averaged) converts the field to VTK PointData by averaging adjacent cell values at each grid point. Additional boundary points are generated so that the original dataset bounds are preserved.
  • PointData (direct) stores the field as VTK PointData without averaging. No additional boundary points are generated, so the resulting dataset is one cell smaller in each spatial direction and its bounds are reduced by one grid spacing.

Switching between representations does not require reopening the file or regenerating the dataset.

Requirements

To use the MicPy ParaView plugin, ParaView must be able to import the MicPy Python package at runtime. The simplest way to ensure this is to run ParaView from a dedicated conda environment in which MicPy is installed.

The following instructions describe a recommended setup using conda and pip.

Installation

1. Create a conda environment with ParaView and MicPy

First, create a new conda environment for ParaView and MicPy. Make sure to select a Python version that is compatible with both ParaView and MicPy.

# Install ParaView and Python in a new conda environment
conda create -y -n micpy-pv -c conda-forge paraview=5.13 python=3.10

# Activate the environment
conda activate micpy-pv

# Install MicPy via pip
pip install micress-micpy
# Install ParaView and Python in a new conda environment
conda create -y -n micpy-pv -c conda-forge paraview=5.12 python=3.10

# Activate the environment
conda activate micpy-pv

# Install MicPy via pip
pip install micress-micpy
# Install ParaView and Python in a new conda environment
conda create -y -n micpy-pv -c conda-forge paraview=5.11 python=3.9

# Activate the environment
conda activate micpy-pv

# Install MicPy via pip
pip install micress-micpy

ParaView 6.x (conda-forge, Windows)

The conda-forge builds of ParaView 6.x have a known issue rendering vtkImageData containing CellData on Windows. Use PointData (averaged) or PointData (direct) as a workaround, or install the official ParaView release instead.

See the conda-forge issue for details.

# Install ParaView and Python in a new conda environment
conda create -y -n micpy-pv -c conda-forge paraview=6.0 python=3.12

# Activate the environment
conda activate micpy-pv

# Install MicPy via pip
pip install micress-micpy

At this point, ParaView's Python interpreter (when launched from this environment) will be able to import MicPy.

2. Loading the plugin in ParaView

Once ParaView and MicPy are installed in the same environment, the plugin can be loaded in one of two ways:

  1. Activate the conda environment:
    conda activate micpy-pv
    
  2. Launch ParaView:
    paraview
    
  3. In ParaView, open Tools → Manage Plugins…
  4. Click Load New… and select the MicPy.py plugin file located in the MicPy installation directory (site-packages). You can find the exact path by running the following command in the same conda environment:
    python -c "import micpy.bin as b; print(b.pv_plugin_path())"
    
  5. (Optional) Enable Auto Load to load the plugin automatically in future sessions

ParaView can automatically discover plugins if their directory is listed in the PV_PLUGIN_PATH environment variable.

MicPy provides a helper function to locate the plugin file:

python -c "import micpy.bin as b; print(b.pv_plugin_path())"

Set PV_PLUGIN_PATH on the conda environment using:

conda env config vars set PV_PLUGIN_PATH="$(python -c "import micpy.bin as b; print(b.pv_plugin_path())")"

Reactivate the environment to apply the change:

conda deactivate
conda activate micpy-pv

When ParaView is launched from this environment, the plugin will be discovered and loaded automatically.