AngelFP / VisualPIC

Data Visualization for Particle-in-Cell Codes.
GNU General Public License v3.0
47 stars 13 forks source link

Support for openPMD quasi-3D datasets #12

Closed RemiLehe closed 4 years ago

RemiLehe commented 5 years ago

This PR adds rudimentary support for quasi-3D openPMD data. Important: this requires this openPMD-viewer pull request to be merged.

More specifically, the function _ReadAllFieldData now uses the argument theta=None for openPMD-viewer's get_field, which returns the full 3D cartesian field.

In addition, I added code to extract the shape of the fields without having to read the full field. The code is not very pretty, but I think it works.

AngelFP commented 5 years ago

Hi Remi, thanks a lot for this PR and sorry for the late reply, I just came back from vacation. I will test this as soon as I can with the 3d visualization and see if any more changes are needed.

RemiLehe commented 5 years ago

Great, thanks! Let me know if you have any question in the process of doing so.

RemiLehe commented 5 years ago

Note that the above mentioned openPMD-viewer PR has been merged, but you will still need to use the devbranch of openPMD-viewer. (i.e. when doing pip install openPMD-viewer, you will not have the required feature - we are planning to release it soon, though)

AngelFP commented 4 years ago

Hi Remi,

Just commenting in this old PR because the features that this would add are now finally implemented in the new branch general_redesign. Adding support for quasi3D data in the current dev or master branches would have required lots of work also on the 3D visualizer and other components, so I instead focused on making sure this is supported in the new VisualPIC redesign.

If you want to check it out, there is now an example here on how to visualize the 3D fields which actually uses data in thetaMode geometry. Also, the render on top of the README.md is made from FBPIC data, so it works quite well!

RemiLehe commented 4 years ago

Awesome! I just tried the example and it worked really well out of the box! Thanks a lot for developing this ; I looks very useful and easy to use!

Since the current PR seems to be obsolete now, I'll close it.

AngelFP commented 4 years ago

Happy to hear that it worked! The implementation for openPMD data was initially quite straightforward, but I had to end up making a custom version of the read_field_circ method from openPMD-viewer in order to add the option to limit the resolution of the 3D reconstructed fields. Otherwise for high-resolution simulations it was too slow and heavy on the memory. You can see this in the field readers. Once I polish the code a bit more I might make a PR with this addition to openPMD-viewer.

RemiLehe commented 4 years ago

Awesome! Yes, that would certainly be handy in openPMD-viewer.

ax3l commented 4 years ago

Excellent point, I noted something similar in potential re-construction helpers for openPMD-api (lazily-evaluated access to toCylindrical()[:, :, :] and toCartesian()[:, :, :] index operators or similar): https://github.com/openPMD/openPMD-api/blob/0.11.1-alpha/examples/2a_read_thetaMode_serial.py