Any Python script to extract data from MFIX-Exa plt files? Thanks!!!
There is not—at least AFAIK—a way to read amrex plot files directly. There is, however, a visualization package, yt, that I’ve leveraged to do that. (FWIW Andrew Myers is a developer of both, so he’s the guy to ping w/ difficult questions.) You’ll need to install yt. I did this in a yt-specific conda env, but that’s up to you. Once you have it installed, here’s a script that pulls a bunch of simple stats:
calc_zero_order_stats.py.txt (2.9 KB)
This is how I’m calculating the mixing index in my small-scale CFD-DEM test harness. Here’s the script for that:
calc_mixing_index.py (1.2 KB)
I’ll also note you can use yt in a jupyter nb which is pretty handy.
I was tempted to whip something up but of course it already exists
I did a little searching and found yt which Will already mentioned - this seems to be the standard way to get Amrex data into numpy arrays
import yt
# Load plotfile with particles
ds = yt.load("plt00000")
# Check if particles are present
if "all" in ds.particle_types:
ad = ds.all_data()
# Access particle properties
particle_mass = ad["particle_mass"].to_ndarray()
particle_velocity_x = ad["particle_velocity_x"].to_ndarray()
particle_radius = ad["particle_radius"].to_ndarray()
# For DEM particles specifically
if "particle_id" in ds.field_list:
particle_ids = ad["particle_id"].to_ndarray()
I also found another project called “Amrex Kitchen”, I have no idea if this is any good but it looks interesting
Not that there’s anything wrong w/ yt, but I would be interested in mfix-exa → hdf5 → python for post processing. I know there are python hdf5 readers out there. And I know Jordan put in the capability to export data in HDF5 format for Aytekin. But we didn’t end up using that in our ALCC project. So, as far as I know, that feature is completely untested and potentially depreciated.