Do AMR writers create a file for each AMRBox/block?

Hello all,

I am trying to make our AMR code write out a data format that paraview understands natively without having to convert to an unstructured grid. The AMR code does have the 2:1 refinement restriction usual to AMR and it seems like vtkXMLPHierarchicalBoxDataWriter is the only option. However after playing around with it (and the overlapping AMR analog) it seems that this writer ends up writing and xml file for each amrbox. Given that I can have up to 300,000 of them, writing a file for each one does not seem feasible. Is there something I am missing/not understanding in the process, or will I just need to write my own reader?

Thank you all in advance,

I am unfamiliar with the AMR datasets/file types but if you decide to create your own reader, it isn’t all that difficult using ParaView 5.6’s new Python Algorithm plugin capability.

Check out this post and this snippet from PVGeo for details on making your own file writers!

I indeed wouldn’t recommend vtkXMLPHierarchicalBoxDataWriter for large data at scale – at least the way it is currently. ParaView can read in BoxLib (and soon AMReX), Flash AMR files as well. Maybe that’d be better approach.

Thank you for the response. Do you by any chance have an example Flash AMR file that I can use as a reference? I may still go to the personal reader route, but it would be nice to have two options.

Thank you Bane,

If I can create a reader in python that would be great. And I looked over the example and it looks fairly straight forward, but one question…

—Once I write the reader, what are the steps to actually plug it into Paraview so I can open a file and read it using that reader?

Thank you in advance

If you follow the example in that snippet, then simply load the .py file as a plugin to ParaView 5.6 (won’t work on older versions) through the plugin manager.

Tools -> Plugin Manager -> Load New…

Also, to be clear, are you making a reader or a writer? That snippet explains the writers. Readers are a bit more straightforward but I could provide another example from PVGeo if needed

I’m only writing a reader for now. And that is easy! Thank you!

1 Like

Actually one more question now that I think about it. And thank you for all the help, btw. If I need this reader to work with client/server, is there another step that I need?

Thank you!

I’m not too sure… I think @utkarsh.ayachit would be the expert on that

Hi @banesullivan, I think I’m close to getting a basic version going, but whenever I load it into paraview, I get an error message that reads like this: “is either not designed to run on windows or it contains an error”. However I have basic script that seems to work outside of paraview. I believe that I have followed the steps minus all the time stamp issue since I’m not worried about that at the moment.

The test case is very simple, it’s just a dummy AMR file that I’m trying to make paraview see. Do you see anything glaringly wrong about the approach (attached) since you’re very knowledgeable on the topic?

We’ve done something similar with some XDMF modifications, but since the error gives no hint as to what the problem is, this is hard to debug.

Thank you in advance. (5.5 KB) (526 Bytes)

Double check that h5py is available in your Python environment. Unfortunately, simple import errors/typos can cause the message your seeing.

I’ve never been able to get the h5py package to work in ParaView…
I usually try to use lighter weight alternatives for handling h5 files, but if you build ParaView yourself you can get h5py in there… @Daan_van_Vugt has experience with this I think?

Otherwise it looks good to me (though I am working remotely via an iPad and can’t give it a try for a few days)

Thanks Bane! Yeah it seems that pvpython does not have h5py in it, so the solution seems to be install paraview with the system python. @utkarsh.ayachit, is there any thing on the horizon to have h5py included in pvpython?

Thank you for all your help guys!

1 Like