Skip to content
henry2004yPublic

About

FLEKS Python toolkit

Topics

Resources

Contributing

Stars

3 stars

Watchers

2 watching

Forks

Repository files navigation

flekspy: FLEKS Python toolkit

PyPI version

Python package for processing FLEKS (FLexible Exascale Kinetic Simulator) data.

Installation

python -m pip install flekspy

Usage

flekspy can load files generated from FLEKS.

import flekspy

ds = flekspy.load("sample_data/3*amrex")

Plotting is supported via Matplotlib and YT. For more detailed usage and contribution guide, please refer to the documentation.

PyVista meshes

Install the optional reader with python -m pip install 'flekspy[pyvista]'. ASCII Tecplot .dat and VTK .vtk, .vtu, .vts, .vtr, .vti, .vtp, and .vtm files return native PyVista objects:

import flekspy as fs

mesh = fs.load("simulation/snapshot.vtu")
print(mesh.array_names, mesh.bounds)
slice_mesh = mesh.slice(normal="z", origin=(0, 0, 0))

zones = fs.load("simulation/snapshot.dat")
print(zones.n_blocks, zones[0].array_names)

DAT files always return a pyvista.MultiBlock, preserving every zone. Their variable names have bracketed units removed, and coordinate names such as X AU become X for the Tecplot reader. The source file is unchanged. VTK datasets retain their arrays, metadata, and multiblock hierarchy. No physical unit conversion or required magnetic/velocity fields are imposed. The direct reader fs.read_pyvista(path) is also available.

ParaView Plugin

flekspy provides a ParaView plugin for visualizing FLEKS data. To use the plugin, follow these steps:

  1. Make sure the ParaView version is 5.13 or higher.

  2. Install flekspy for pvpython.

  • Go into the ParaView directory and create a virtual environment for Python
./bin/pvpython -m venv .venv
  • Check the Python version of pvpython
./bin/pvpython -c "import sys; print(sys.version)"
  • Install flekspy in the directory right in the venv. You may need to adjust the target path if pvpython does not detect flekspy. Assuming the Python version is 3.10.11, run
python3 -m pip  install --only-binary=:all: --python-version 3.10.11 --target ./.venv/lib/python3.10/site-packages/ flekspy
  1. Launch ParaView with the virtual environment
./bin/paraview --venv .venv
  1. In Tools > Manage Plugins, load the BATSRUSReader plugin.

License

flekspy is licensed under the terms of the MIT license.

About

FLEKS Python toolkit

Topics

Resources

Contributing

Stars

3 stars

Watchers

2 watching

Forks

Used by

Contributors

Languages