Source-linked AI summary
SPLASH: An interactive visualisation tool for Smoothed Particle Hydrodynamics simulations
Daniel J. Price
TL;DR
SPH visualisation is difficult because simulation data lies on moving, irregular particles and must be mapped to pixels, often yielding crude particle plots. This paper presents SPLASH, a dedicated interactive and non-interactive tool using SPH-specific visualisation algorithms across one, two, and three dimensions. SPLASH supports practical workflows including direct dump-file reading, multiple output devices, and rapid rendering of very large datasets, while its 3D streamline integration performs poorly near strong gradients and direct 3D streamlines remain absent.
Problem
SPH data requires mapping irregular particles to pixels for faithful visualisation, yet particle plots are often a crude representation.
Method
SPLASH applies dedicated SPH visualisation techniques and algorithms in interactive and non-interactive workflows across one, two, and three dimensions.
Results
SPLASH supports direct code-dump reading, scalar and vector visualisation, multiple plotting devices, and rapid rendering of very large datasets.
Takeaways & Limitations
SPLASH provides a practical way to inspect and render SPH simulation output interactively or non-interactively without relying on intermediate grids or scripting.
Takeaways & Limitations
3D streamline plotting is absent, while the implemented trapezoidal-rule integration performs poorly where vector fields have strong gradients.
Abstract
from arXiv · showhide
This paper presents SPLASH, a publicly available interactive visualisation tool for Smoothed Particle Hydrodynamics (SPH) simulations. Visualisation of SPH data is more complicated than for grid-based codes because the data is defined on a set of irregular points and therefore requires a mapping procedure to a two dimensional pixel array. This means that, in practise, many authors simply produce particle plots which offer a rather crude representation of the simulation output. Here we describe the techniques and algorithms which are utilised in SPLASH in order to provide the user with a fast, interactive and meaningful visualisation of one, two and three dimensional SPH results.
1 Introduction
SPLASH addresses the difficulty of faithfully visualising SPH data defined on moving, irregular particles rather than grids. It provides SPH-specific algorithms and interactive and non-interactive capabilities beyond simpler or less specialised tools.
- Motivation: Because many existing workflows use crude particle plots, the paper motivates a dedicated tool that applies SPH interpolation algorithms to visualisation.SPH interpolation lies at the heart of the simulation method and motivates using consistent algorithms for rendering.
- Motivation: SPH data requires mapping irregular particle positions to a two-dimensional pixel array for faithful visualisation.This makes SPH visualisation more complicated than visualisation of grid-based fluid data.
- SPLASH and related tools: SPLASH is designed specifically for SPH visualisation and supports one-, two-, and three-dimensional data in interactive and non-interactive modes.It also supports selecting and hiding particles and tracking portions of flow across multiple dump files.
- SPLASH and related tools: Unlike Splotch, which provides only raytracing-style surface rendering without interactivity, SPLASH supports multiple visualisation techniques and interactive operation.SPLASH also differs from IFrIT through its dimensional coverage and particle and timestep tracking features.
- Practical advantages: SPLASH avoids requiring scripting for complicated SPH visualisation tasks and can operate remotely where commercial-package licensing may be unavailable.Public plotting tools such as Supermongo and Gnuplot would require scripts of similar length to the SPLASH source for comparable functionality.
2 Software design
SPLASH’s software design targets interactive, reusable SPH visualisation while supporting direct data access, multiple dimensions and field types, remote use, and reproducible output.
- Design requirements: SPLASH’s requirements include annotated figures, animation sequences, direct binary-dump reading, one-, two-, and three-dimensional visualisation, and scalar and vector fields.The design also targets SPH-consistent algorithms, repeated visualisation across dump files, interactivity, remote use, and a familiar programming language.
- Design requirements: Interactive visualisation prevents SPLASH from first interpolating particles onto a three-dimensional grid using simple but inefficient procedures.The software design is constrained by the need to meet the stated visualisation requirements efficiently.
- Core architecture: SPLASH uses a Fortran 90 command-line menu with PGPLOT output devices, supporting paper figures, movies, and interactive X-windows plots.The graphics library lets the program focus on data input and manipulation while reproducing plots across devices.
- Interaction: Plot settings can be changed through command-line submenus or interactively with mouse actions and keystrokes in the plotting window.Interactive controls include zooming, colour-bar changes, particle selection, rotation, and timestep navigation.
- Data handling: SPLASH reads binary code dumps directly, reducing visualisation time and disk requirements by avoiding intermediate files, especially for simulations with ≳10^6 particles.Command-line filenames and wildcards make it easy to process all files from a simulation.
- Reproducibility and animation: Non-interactive plotting automatically cycles through command-line dump files, enabling sequences of images for animations with unchanged settings.Saved plot settings can also be restored on later invocations through Fortran 90 NAMELIST files.
3 Plot types
SPLASH supports particle and rendered plots for SPH data, with optional vector overlays and interactive features across one, two, and three dimensions. Rendered plots interpolate particles onto pixels, enabling projections, cross sections, and surface views.
- Plot pipeline: SPLASH’s plotting engine provides particle plots, rendered plots, and optional vector-arrow overlays after coordinate transformations.Transformations include logarithms, rotation, 3D perspective, and coordinate-system changes before interpolation.
- Particle plots: Particle plots display positions directly, with markers and colours configurable by particle type, selected particles, or particle quantities.Particle identity across dumps can preserve colouring from initial conditions in later visualisations.
- Rendered plots: Rendered plots interpolate particle data onto a two-dimensional pixel array for 2D projections or cross sections and 3D projections, slices, or surface renderings.Rendered plots are not used for 1D data.
- Rendered plots: 3D surface rendering presents an optically thick view of a parameter on a density-defined surface of last scattering.Using only particles below the mid-plane produces a cut-away effect; the method works best with well-defined surfaces or moderate density ranges.
- Vector plots: Vector fields are interpolated component by component before arrows are overlaid, while streamline contours work well for smooth fields but poorly across strong gradients.The paper identifies tracing three-dimensional field lines through SPH data as a desirable future feature.
4.1 SPH interpolation
SPLASH bases visualisation on SPH interpolation, replacing continuous integrals with particle summations weighted by smoothing kernels. It supports normalised and non-normalised forms, with the default chosen to avoid edge artefacts at free surfaces.
- Interpolation basis: SPH approximates an arbitrary function by replacing the Dirac delta function with a finite-width smoothing kernel whose width is h.The integral representation has error of order h^2 under an even, normalised kernel.
- Interpolation basis: The SPH summation interpolant discretises the integral over neighbouring particles and forms the basis of SPLASH’s interpolation algorithms.A normalised interpolant divides the result by the interpolation of unity.
- Smoothing kernel: SPLASH commonly uses the cubic spline kernel, whose dimensionless form depends on q, the number of spatial dimensions ν, and normalisation constants σν.The kernel is Gaussian-like, has smooth first derivatives, and vanishes beyond q = 2.
- Smoothing length: The smoothing length h is generally spatially variable and is set to control neighbour counts or relate analytically to density.Under a rigorous density–smoothing-length relation, interpolation can require only a constant weight value and the smoothing length.
- Normalisation: SPLASH uses non-normalised interpolation by default because normalised interpolation can look odd at free surfaces, whereas the non-normalised form falls away smoothly.Normalised interpolation can improve volume-rendered accuracy when free surfaces are absent by reducing particle-distribution effects.
4.2 Rendering of 2D data
SPLASH renders 2D SPH data by scattering particle contributions onto pixels, while cross-section algorithms reduce 2D fields to arbitrary 1D lines and support vector-field visualisation.
- Interpolation to pixels: 2D rendering applies the SPH interpolant by scattering each particle’s contribution to the pixels it influences.The implementation finds the contributing pixel range in x and y and adds each particle’s contribution directly to the pixel array.
- Interpolation to pixels: The smoothing length is set to the maximum of the particle smoothing length and half the pixel width.The pixel-width term is mainly used when the interpolated plot has few pixels.
- Cross sections of 2D data: A 1D cross section is defined by two points, divided evenly into pixels, and computed from particle contributions where the line intersects each smoothing circle.The method calculates the intersection points and loops over pixels between them using the 1D SPH interpolant.
- Cross sections of 2D data: For 3D data, oblique cross sections could intersect smoothing spheres, but SPLASH instead rotates particles before taking a straight cross section.This provides the equivalent cross-section workflow while simplifying the geometric calculation.
- Vector plots: Vector plots interpolate x- and y-components separately to pixels, then display arrows whose lengths are proportional to vector magnitude.Because vector plots use fewer pixels, this interpolation generally acts more like smoothing than interpolation.
- Streamlines: Streamlines are obtained by integrating the interpolated velocity field with trapezoidal-rule integration, which performs poorly where strong gradients are present.The procedure works well when the vector field is smooth but has a stated limitation at strong gradients.
4.3 Rendering of 3D data
SPLASH supports 3D projections, cross-section slices, and surface rendering by integrating or attenuating SPH contributions along viewing directions. These methods map 3D particle data to 2D images using integrated kernels, ordered ray processing, and user-controlled optical depth.
- Overview: 3D visualisation uses either a projection through the whole domain or a cross-section slice.These are the two basic ways SPLASH reduces three-dimensional data to a viewable result.
- Projections (line of sight integration): Line-of-sight integration converts the 3D SPH interpolant into a 2D interpolation using a kernel integrated over one spatial dimension.The resulting 2D kernel is evaluated numerically and stored in a table for interpolation.
- Projections (line of sight integration): A 3D column-integrated plot can show integrated density, such as the column density of a star-cluster formation simulation.The paper gives this as an example of the projection method.
- Cross sections: A 3D cross section sums contributions from particles within 2h of a fixed-coordinate plane, with oblique slices obtained by rotating particles first.Scalar and vector cross-section plots are produced by interpolating the relevant quantities in the slice.
- Surface rendering: Surface rendering ray-traces through particles, using density for optical depth and the rendered quantity for colour so low-density regions are transparent and high-density regions opaque.The method processes particle contributions to rays within each kernel radius.
- Surface rendering: SPLASH’s monochromatic surface-rendering method produces ray-averaged values while fading final colours toward the background according to total optical depth.This method treats each particle’s source function as the rendered quantity at its location and is identified as the method used.
- Surface rendering: A 3D surface-rendering example shows temperature in a simulation of two merging neutron stars.The example demonstrates the method on a neutron-star merger simulation.
4.4 Rotation & 3D perspective
SPLASH adds perspective by transforming particle positions before interpolation, using observer and screen distances to control apparent size with depth.
- 3D perspective: 3D perspective is defined by the observer distance zOBS and the distance d from observer to a screen.These parameters determine the transformation from x and y to screen coordinates.
- 3D perspective: Objects at distance d have unit magnification, while closer objects appear larger and farther objects appear smaller.The perspective transformation makes points diverge toward the viewer and converge away from it.
- 3D perspective: SPLASH defaults to a 1/10 reduction at the typical object distance, placing the observer at 10× the object size and the screen at 1× object size.The object size is taken from the current z plot limits.
- Perspective and smoothing: For interpolated plots, particle smoothing lengths are modified by perspective, but the z length scale for integrated plots remains unchanged.The unchanged integrated-plot scale is specified as the one exception.
5 Other useful techniques
SPLASH accelerates particle plotting and rendering through pixel-based subsampling, parallelisation, and symmetry-based reuse, while exposing a trade-off for regularly distributed particles.
- Fast particle plotting: Plotting many particles can be too slow for interactive work and can produce unnecessarily large vector-graphics files.This remains relevant for correlation plots and radial profiles even though SPLASH avoids raw particle plots as its main SPH representation.
- Fast particle plotting: SPLASH divides the plot into typically 500 × 500 pixels and plots at most 2 particles per cell, substantially increasing speed with almost no visible-information loss.The same criterion is reapplied after zooming, increasing effective resolution appropriately.
- Rendering performance: 3D projection and surface rendering are the slowest techniques because both require contributions from all simulation particles.Projection is parallelised with OpenMP, whereas surface rendering is harder to parallelise because contributions must be accumulated in z order.
- Accelerated rendering: Kernel spherical symmetry can provide an in-principle speedup of 4 by interpolating one quarter of the domain and copying it to the other quarters.The optimisation assumes each particle lies at the centre of its containing pixel.
- Accelerated rendering: The symmetry optimisation can create unwanted grid patterns for regularly distributed particles, so accelerated rendering is disabled by default.It otherwise produces visually identical results to the non-optimised version in the reported cases.
6 Performance and memory usage
SPLASH supports interactive rendering of very large SPH datasets, with costs driven by particle count and image size. Memory usage can become substantial, while selective reading and buffering provide speed trade-offs for different workflows.
- Interactive interpolation costs scale as N_part × N_pix^2, making larger rendered images more expensive.The default interactive image is 200 × 200 pixels; higher resolution is intended for final image production.
- 135 million particles render to a 600 × 600 column-density image in approximately 55 seconds on one processor or 12 seconds on eight cores.An accelerated rendering technique provides an additional factor of 2–3 speedup.
- 100 million particles render to a 1000 × 1000 galactic-disc image in approximately 26 seconds on one processor or 7 seconds on eight cores.Surface rendering is approximately twice as expensive as a column-integrated projection and is not currently parallelised.
- A full dump containing 10^6 particles and 10 quantities requires approximately 40 MB of memory, scaling to about 4 GB for 10^8 particles.By default, SPLASH reads an entire dump into a two-dimensional single-precision array.
- In low-memory mode, data is reread for each plot and functionality requiring additional storage, such as particle colouring, is eventually disabled.Buffering multiple dump files is faster for small datasets when sufficient memory is available.
- For simulations of roughly 10^6 particles, movie-making is often limited by disk reading, so SPLASH flags and reads only columns required for the image when supported.This optimisation applies to data formats whose columns can be read independently, including GADGET.
7 Summary/roadmap
SPLASH combines interactive and non-interactive SPH visualisation with a broad set of analysis and plotting features. Future development targets missing three-dimensional field-line rendering and limitations of the PGPLOT backend.
- Summary/roadmap: SPLASH is presented as an efficient, capable, publicly available package for making SPH visualisation straightforward.
- Summary/roadmap: SPLASH includes animation sequences, exact solutions for common test problems, coordinate transformations, particle-tracking limits, tiled multiple plots, and derived-quantity calculations.
- Summary/roadmap: SPLASH remains under active improvement through user feedback, which has already substantially improved aspects of the program.
- Summary/roadmap: SPLASH lacks a routine for plotting streamlines or field lines through three-dimensional SPH data directly from particles.The paper identifies efficient direct-from-particle rendering as desirable because interpolation to a 3D grid is highly inefficient.
- Summary/roadmap: The PGPLOT graphics library has become limiting in several places, motivating consideration of alternative libraries or OpenGL rendering.Any replacement must preserve non-interactive, annotated research graphics and application across series of dump files.