Skip to content

Add offline multiFab converter and tool to generate npy file#60

Merged
ruohai0925 merged 1 commit intoruohai0925:developmentfrom
bq9958:transferData
Mar 7, 2026
Merged

Add offline multiFab converter and tool to generate npy file#60
ruohai0925 merged 1 commit intoruohai0925:developmentfrom
bq9958:transferData

Conversation

@bq9958
Copy link
Copy Markdown
Contributor

@bq9958 bq9958 commented Feb 27, 2026

Summary

Updates the offline tools in Tools/multiFabConverter/offline/ for use with MPI-enabled pyAMReX: a parallel visualization script (main.py), a batch plt→npy conversion script (script_plt_to_npz.py), and a single README documenting both.

Changes

main.py

  • Targets MPI-enabled pyAMReX: boxes are distributed across ranks via AMReX's DistributionMapping when reading the plot file.
  • Prints per-rank box count (Rank r: n/N boxes) after loading the plt.
  • Gathers the full domain with input_mf[:] (collective) then, on rank 0, extracts a 2D slice of x_velocity at a given z and saves slice_z.png.

script_plt_to_npz.py

  • Single-process script (no mpirun) to convert one or more plt files to a stacked .npy array (n_samples, ncomp, nx, ny).
  • Supports multiple plot file paths; if a path is a directory containing plt* subdirs, uses the latest one.
  • Options: -o output path, -l level, -c component names (default: x_velocity, y_velocity, avg_pressure).

README.md

  • Describes both scripts in English: purpose, dependencies (including MPI pyAMReX install from conda-forge), usage, arguments, and output.

Testing

  • main.py: run with MPI and a valid plt path, e.g. mpirun -np 4 python main.py <path_to_plt>; check per-rank box output and slice_z.png on rank 0.
  • script_plt_to_npz.py: e.g. python script_plt_to_npz.py <path_to_plt> -o out.npy; verify out.npy shape and components.

@ruohai0925 ruohai0925 merged commit 25ba250 into ruohai0925:development Mar 7, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants