SPH summation

SPH sums over neighbours.

plonk.analysis.sph.derivative(snap, derivative, quantity, kernel='cubic', chunk_size=None, verbose=False)

Calculate derivatives of quantities.

WARNING: This function is experimental.

Calculate derivatives such as grad, div, curl on any particle quantity using the SPH kernel gradient.

Parameters
  • snap (Snap) – The Snap object.

  • derivative (str) – Options are ‘grad’, ‘div’, ‘curl’.

  • quantity (str) – The quantity to take the derivative of. Must be a string to pass to Snap object which returns a scalar.

  • kernel (str) – Kernel to compute density. E.g. ‘cubic’, ‘quintic’, or ‘Wendland C4’.

  • chunk_size (optional) – The size of chunks, in terms of particle number, for neighbour finding. If the chunk size is too large then the neighbour finding algorithm (scipy.spatial.cKDTree.query_ball_point) runs out of memory. Default is None.

  • verbose (optional) – If True, print progress. Default is False.

Returns

The derivative of the quantity.

Return type

Quantity

plonk.analysis.sph.summation(snap, result_shape, compute_function, compute_function_kwargs, kernel='cubic', chunk_size=None, verbose=False)

Calculate SPH sums.

WARNING: This function is experimental.

Parameters
  • snap (Snap) – The Snap object.

  • result_shape (Tuple[int, ...]) – The shape, as a tuple, of the returned sum.

  • compute_function (Callable) – The function that computes the sums.

  • compute_function_kwargs (Dict[str, Any]) – The keyword arguments to the function that computes the sums.

  • kernel (str) – Kernel to compute density. E.g. ‘cubic’, ‘quintic’, or ‘Wendland C4’.

  • chunk_size (optional) – The size of chunks, in terms of particle number, for neighbour finding. If the chunk size is too large then the neighbour finding algorithm (scipy.spatial.cKDTree.query_ball_point) runs out of memory. Default is None.

  • verbose (optional) – If True, print progress. Default is False.

Returns

The result of the SPH summation.

Return type

Quantity