Smoothed particle hydrodynamics analysis and visualization with Python.
Project description
Plonk
Smoothed particle hydrodynamics analysis and visualization with Python.
Usage
Plonk supports the following SPH file formats:
Note: you can convert Phantom non-HDF5 snapshots to HDF5. See the Phantom docs.
Accessing data
To read in a simulation with snapshot files like disc_00000.h5
, and global quantity time series files like disc01.ev
, in the current directory, and see what snapshots there are:
>>> import plonk
>>> simulation = plonk.load_sim(prefix='disc')
>>> simulation.snaps
[<plonk.Snap: "disc_00000.h5">,
...
<plonk.Snap: "disc_01000.h5">]
The Snap objects contain the particle arrays, lazily loaded from the HDF5 file, as well as simulation metadata properties stored as a dictionary.
Visualization
To render the density on a snapshot:
>>> snap = plonk.load_snap('disc_00000.h5')
>>> plonk.visualize.render(snap=snap, quantity='density')
For a more complicated example, here is the deviation from Keplerian velocity around a planet embedded in a protoplanetary disc.
Deviation from Keplerian velocity around a planet: at the disc midplane (left), and 10 (middle) and 20 au (right) above the disc midplane. Data from a Phantom simulation.
More
For further usage, see examples
folder and documentation. The code is internally documented with docstrings. Try, for example, help(plonk.Snap)
or help(plonk.load_snap)
.
Install
Conda
The easiest and recommended way to install Plonk is via the package manager Conda
conda install plonk --channel dmentipl
Note: Using this method you don't need to have this repository on your machine.
This will install the required dependencies. For details on Conda, see https://docs.conda.io/.
Getting help
If you need help, try the following, in order:
- Check the documentation.
- Ask questions on Stack Overflow using the plonk tag.
- File an issue, as a bug report or feature request, using the issue tracker.
If you don't get an immediate response, please be patient. Plonk is maintained by one person, @dmentipl.
Contributing
Thank you for considering contributing to Plonk. Contributions are welcome.
See CONTRIBUTING.md for guidelines on how to contribute.
Citation
If you use Plonk in a scientific publication, please cite
Plonk: Smoothed particle hydrodynamics data analysis and visualization
You should also consider citing any other scientific software packages that you use.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.