swiftsimio.visualisation.smoothing_length_generation module
Routines for generating (approximate) smoothing lengths for particles that do not usually carry a smoothing length field (e.g. dark matter).
- swiftsimio.visualisation.smoothing_length_generation.generate_smoothing_lengths(coordinates: unyt_array | cosmo_array, boxsize: unyt_array | cosmo_array, kernel_gamma: float32, neighbours=32, speedup_fac=2, dimension=3)[source]
Generates smoothing lengths that encompass a number of neighbours specified here.
- Parameters:
coordinates (unyt_array or cosmo_array) – a cosmo_array that gives the co-ordinates of all particles
boxsize (unyt_array or cosmo_array) – the size of the box (3D)
kernel_gamma (float32) – the kernel gamma of the kernel being used
neighbours (int, optional) – the number of neighbours to encompass
speedup_fac (int, optional) – a parameter that neighbours is divided by to provide a speed-up by only searching for a lower number of neighbours. For example, if neighbours is 32, and speedup_fac is 2, we only search for 16 (32 / 2) neighbours, and extend the smoothing length out to (speedup)**(1/dimension) such that we encompass an approximately higher number of neighbours. A factor of 2 gives smoothing lengths the same as the full search within 10%, good enough for visualisation.
dimension (int, optional) – the dimensionality of the problem (used for speedup_fac calculation).
- Returns:
smoothing lengths – an unyt array of smoothing lengths.
- Return type:
unyt_array