Skip to content

[WIP] add utility to convert plotfiles to openPMD w/ compression#1507

Draft
BenWibking wants to merge 2 commits intodevelopmentfrom
BenWibking/plotfile-to-openpmd
Draft

[WIP] add utility to convert plotfiles to openPMD w/ compression#1507
BenWibking wants to merge 2 commits intodevelopmentfrom
BenWibking/plotfile-to-openpmd

Conversation

@BenWibking
Copy link
Collaborator

@BenWibking BenWibking commented Dec 11, 2025

Description

This allows us to use convert AMReX plotfiles to openPMD/ADIOS2 with highly efficient lossy compression.

NOTE: Particles are IGNORED completely in the conversion process.

Related issues

N/A

Checklist

Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an x inside the square brackets [ ] in the Markdown source below:

  • I have added a description (see above).
  • I have added a link to any related issues (if applicable; see above).
  • I have read the Contributing Guide.
  • I have added tests for any new physics that this PR adds to the code.
  • (For quokka-astro org members) I have manually triggered the GPU tests with the magic comment /azp run.

@sonarqubecloud
Copy link

@BenWibking
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +128 to +133
void SetupMesh(openPMD::Mesh &mesh, const amrex::Geometry &geom,
const amrex::IntVect &nodal) {
amrex::Box const &global_box = geom.Domain();
auto const global_size = ToReversedVector(global_box.size());
auto const grid_spacing = ToReversedVector(geom.CellSize());
auto const global_offset = ToReversedVector(geom.ProbLo());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resize datasets for nodal plotfile variables

In SetupMesh the dataset extent is derived from geom.Domain().size() irrespective of whether the MultiFab is nodal (nodal_flags argument). For nodal/face/edge-centered variables the boxes returned by PlotFileData::get are one cell larger than the cell-centered domain, so global_size underestimates the dataset dimensions while storeChunkRaw later uses the larger nodal local_box.size(). When converting any nodal variable, the chunk offset/size will fall outside the declared dataset and the openPMD write will error or truncate data. Compute the dataset size from a nodal version of the domain (e.g., amrex::convert(geom.Domain(), nodal).size()) before creating the dataset.

Useful? React with 👍 / 👎.

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.

1 participant