Grid SPH

Functions for computing gridSPH.

Integral Image or 2D/3D Summation Table

fiesta.gridsph.get_integral_image2D(fgrid: ndarray) ndarray

Computes the 2D integral image.

Parameters:

fgrid (array) – The 2D field grid.

Returns:

igrid – The 2D integral image.

Return type:

array

fiesta.gridsph.get_integral_image3D(fgrid: ndarray) ndarray

Computes the 3D integral image.

Parameters:

fgrid (array) – The 3D field grid.

Returns:

igrid – The 3D integral image.

Return type:

array

GridSPH 2D/3D

fiesta.gridsph.gridSPH2D(x: ndarray, y: ndarray, boxsize: float | List[float], ngrid: int, minpart: int = 1, w: ndarray | None = None, f: ndarray | None = None, periodic: bool | List[bool] = True, dgrid: ndarray | None = None, fgrid: ndarray | None = None) Tuple[ndarray, ndarray]

The grid SPH method. This method is similar to a k-Nearest Neighbour method although performed on a grid for speed.

Parameters:
  • x (array) – X and Y coordinates of the points.

  • y (array) – X and Y coordinates of the points.

  • boxsize (float or list) – Size of the 2D grid.

  • ngrid (int or list) – Grid size.

  • minpart (int, optional) – Minimum number of particles.

  • w (array, optional) – Weights for the points, if None assumed to be unitary for all.

  • f (array, optional) – Field values for the points, if None it is assumed the intention is to compute density.

  • periodic (bool or list, optional) – Periodic boundary condition.

  • dgrid (array, optional) – Precomputed density grid, computed using p2g.part2grid2D.

  • fgrid (array, optional) – Precomputed field grid, computed using p2g.part2grid2D, and unnormalised by density.

Returns:

  • dgridSPH (array) – Grid SPH density estimation.

  • fgridSPH (array) – If f is not None then the field is estimated via SPH.

fiesta.gridsph.gridSPH3D(x: ndarray, y: ndarray, z: ndarray, boxsize: float | List[float], ngrid: int, minpart: int = 1, w: ndarray | None = None, f: ndarray | None = None, periodic: bool | List[bool] = True, dgrid: ndarray | None = None, fgrid: ndarray | None = None) Tuple[ndarray, ndarray]

The grid SPH method. This method is similar to a k-Nearest Neighbour method although performed on a grid for speed.

Parameters:
  • x (array) – X, Y, and Z coordinates of the points.

  • y (array) – X, Y, and Z coordinates of the points.

  • z (array) – X, Y, and Z coordinates of the points.

  • boxsize (float) – Size of the 3D grid.

  • ngrid (int) – Grid size.

  • minpart (int, optional) – Minimum number of particles.

  • w (array, optional) – Weights for the points, if None assumed to be unitary for all.

  • f (array, optional) – Field values for the points, if None it is assumed the intention is to compute density.

  • periodic (bool, optional) – Periodic boundary condition.

  • dgrid (array, optional) – Precomputed density grid, computed using p2g.part2grid3D.

  • fgrid (array, optional) – Precomputed field grid, computed using p2g.part2grid3D, and unnormalised by density.

Returns:

  • dgridSPH (array) – Grid SPH density estimation.

  • fgridSPH (array) – If f is not None then the field is estimated via SPH.

fiesta.gridsph.mpi_gridSPH2D(x: ndarray, y: ndarray, boxsize: float | List[float], ngrid: int, MPI: object, minpart: int = 1, w: ndarray | None = None, f: ndarray | None = None, periodic: bool | List[bool] = True, buffer_size: int = 2, dgrid: ndarray | None = None, fgrid: ndarray | None = None) Tuple[ndarray, ndarray]

The grid SPH method. This method is similar to a k-Nearest Neighbour method although performed on a grid for speed.

Parameters:
  • x (array) – X and Y coordinates of the points.

  • y (array) – X and Y coordinates of the points.

  • boxsize (float or list) – Size of the 2D grid.

  • ngrid (int or list) – Grid size.

  • MPI (class) – MPIutils MPI class object.

  • minpart (int, optional) – Minimum number of particles.

  • w (array, optional) – Weights for the points, if None assumed to be unitary for all.

  • f (array, optional) – Field values for the points, if None it is assumed the intention is to compute density.

  • periodic (bool or list, optional) – Periodic boundary condition.

  • buffer_size (float, optional) – Buffer size for MPI communication for padding the grid for the SPH estimation. This should be at least the size of the largest SPH kernel in units of the grid cell size.

  • dgrid (array, optional) – Precomputed density grid, computed using p2g.mpi_part2grid2D.

  • fgrid (array, optional) – Precomputed field grid, computed using p2g.mpi_part2grid2D, and unnormalised by density.

Returns:

  • dgridSPH (array) – Grid SPH density estimation.

  • fgridSPH (array) – If f is not None then the field is estimated via SPH.

fiesta.gridsph.mpi_gridSPH3D(x: ndarray, y: ndarray, z: ndarray, boxsize: float | List[float], ngrid: int, MPI: object, minpart: int = 1, w: ndarray | None = None, f: ndarray | None = None, periodic: bool | List[bool] = True, buffer_size: int = 2, dgrid: ndarray | None = None, fgrid: ndarray | None = None) Tuple[ndarray, ndarray]

The grid SPH method. This method is similar to a k-Nearest Neighbour method although performed on a grid for speed.

Parameters:
  • x (array) – X, Y, and Z coordinates of the points.

  • y (array) – X, Y, and Z coordinates of the points.

  • z (array) – X, Y, and Z coordinates of the points.

  • boxsize (float or list) – Size of the 3D grid.

  • ngrid (int or list) – Grid size.

  • MPI (class) – MPIutils MPI class object.

  • minpart (int, optional) – Minimum number of particles.

  • w (array, optional) – Weights for the points, if None assumed to be unitary for all.

  • f (array, optional) – Field values for the points, if None it is assumed the intention is to compute density.

  • periodic (bool or list, optional) – Periodic boundary condition.

  • buffer_size (float, optional) – Buffer size for MPI communication for padding the grid for the SPH estimation. This should be at least the size of the largest SPH kernel in units of the grid cell size.

  • dgrid (array, optional) – Precomputed density grid, computed using p2g.mpi_part2grid3D.

  • fgrid (array, optional) – Precomputed field grid, computed using p2g.mpi_part2grid3D, and unnormalised by density.

Returns:

  • dgridSPH (array) – Grid SPH density estimation.

  • fgridSPH (array) – If f is not None then the field is estimated via SPH.