Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability to read xdmf dumps from Idefix #336

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dutta-alankar
Copy link
Contributor

@dutta-alankar dutta-alankar commented Oct 3, 2024

@neutrinoceros As discussed a few days ago, here is the first implementation of a working reader to parse Idefix xdmf dumps.

While developing the HDF5 IO module on Idefix, I have taken a special attention to make the files contain additional attributes that make them self-contained and hence don't need definitions.hpp or idefix.ini to process the data. I am aware that my implementation is far from being the cleanest, and simply does the job for the time being. But I believe that it is a good head start and can be trimmed and matured to a polished version. I'm open to take in comments to improve this.

To test, I'm using the following code with a KHI data dump from the following PR. I'm also sharing the data used in this test here in this link.

import yt
import yt_idefix

num = 1
ds = yt.load(f"data.{num:04d}.flt.h5")

# Create gas density slices in all three axes.
p = yt.SlicePlot(ds, "z", ("gas", "density"))
p.set_cmap(field=("gas", "density"), cmap="viridis")
p.save()

which gives the following output:

data 0001 dbl h5_Slice_z_density

I compared this with the following ParaView output:

data 0001 dbl h5_Slice_z_density_Paraview

which seems to agree well with each other.

The yt code output is the following

yt : [INFO     ] 2024-10-04 11:42:12,973 Parameters: current_time              = 0.01003431438520486
yt : [INFO     ] 2024-10-04 11:42:12,974 Parameters: domain_dimensions         = [1024  256    1]
yt : [INFO     ] 2024-10-04 11:42:12,974 Parameters: domain_left_edge          = [0. 0. 0.]
yt : [INFO     ] 2024-10-04 11:42:12,975 Parameters: domain_right_edge         = [4. 1. 1.]
yt : [INFO     ] 2024-10-04 11:42:12,975 Parameters: cosmological_simulation   = 0
yt : [INFO     ] 2024-10-04 11:42:13,137 xlim = 0.000000 4.000000
yt : [INFO     ] 2024-10-04 11:42:13,138 ylim = 0.000000 1.000000
yt : [INFO     ] 2024-10-04 11:42:13,141 xlim = 0.000000 4.000000
yt : [INFO     ] 2024-10-04 11:42:13,141 ylim = 0.000000 1.000000
yt : [INFO     ] 2024-10-04 11:42:13,143 Making a fixed resolution buffer of (('gas', 'density')) 800 by 800
yt : [INFO     ] 2024-10-04 11:42:13,586 Saving plot data.0001.flt.h5_Slice_z_density.png

@neutrinoceros
Copy link
Owner

This is awesome, thanks a lot for doing this !
I will make sure to review in detail soon, but just a couple very quick comments right off the bat:

In you test script, note that

import yt_idefix

can be omitted if you have yt>=4.2.0 (which I think yt_idefix requires anyway).
In the upcoming yt 4.4.0, you'll also be able to install as pip install 'yt[idefix]' so users don't even need to know that yt_idefix is a separate package.

Otherwise, regarding the PR itself, keep in mind we'll need to add at least one formal test for it, but as it'll require using git-lfs (which I'm allergic to), we can do that part later / separately.

@neutrinoceros neutrinoceros linked an issue Oct 4, 2024 that may be closed by this pull request
@neutrinoceros
Copy link
Owner

quick update: I have a lot going on at the moment and I don't think I'll be able to prioritize this review before next week, but I'm not forgetting about it. Thanks for your patience !

@dutta-alankar
Copy link
Contributor Author

No hurries at all.

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.

ENH: add support for idefix-xdfm
2 participants