Skip to content

Classes to support AMReX HDF5 Output#5118

Open
kelseasouders wants to merge 3 commits into
yt-project:mainfrom
kelseasouders:amrex-hdf5-fix
Open

Classes to support AMReX HDF5 Output#5118
kelseasouders wants to merge 3 commits into
yt-project:mainfrom
kelseasouders:amrex-hdf5-fix

Conversation

@kelseasouders
Copy link
Copy Markdown

@kelseasouders kelseasouders commented Feb 12, 2025

PR Summary

Supersedes #5117 - creating PR from unique branch so that pre-commit stays happy. I have closed the previous PR.

The HDF5 plot file output produced by PeleC (and presumably all amrex-based codes) does not work directly with the existing ChomboDataset class. This is most easily observable through the dimensionality - the Chombo I/O handler works with self.dim = self._handle["Chombo_global/"].attrs["SpaceDim"], however self.dim is not correctly read as an integer when reading the amrex-produced files, so I have fixed it by explicitly setting self.dim = int(self._handle["Chombo_global/"].attrs["SpaceDim"]). I've made this change in a few locations in this PR.

I also observed some errors in the spatial positioning when working with the PeleC HDF5 output files, which appeared to come from the _calc_left_edge() and _calc_right_edge() methods assuming that the domain starts at [0, 0, 0]. The PeleC HDF5 output files contain the edge information directly, so I have elected to read them directly from the file (since amrex includes that in the attributes anyway), which has fixed the spatial misalignment.

I was torn between adding these classes to the amrex frontend or chombo frontend, but decided that the chombo frontend would be more appropriate since the two share the same underlying functionality. I believe that it would be fairly straightforward to integrate these changes into the ChomboDataset class directly, but I refrained since I was unsure if they would lead to issues in other types of chombo data.

Update: I did overwrite the _is_valid() method from the ChomboDataset by checking the datatype of the dim attribute as it is read from the HDF5 file. For regular chombo files, this should be correctly read as a integer, but it is read as a list from the AMReX HDF5 plot files. I also have it check for the bounding box in the level_0 data (which should always exist), since that is used for determining the spatial information for the domain and grids.

@chrishavlin chrishavlin added enhancement Making something better frontend: amrex labels Feb 18, 2025
@chrishavlin
Copy link
Copy Markdown
Contributor

thanks for fixing the branch!

One other thing -- with new frontend components it's nice to add tests to make sure they at least can identify and load the data they're aimed to cover. Do you happen to have any small real or synthetic datasets that you'd be willing to add? I'm happy to help with getting the data where it needs to go (also happy to help write tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Making something better frontend: amrex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants