Particle to Grid

Particle mass assignment schemes with and without MPI and associated deconvolution.

Particle to grid assignment

fiesta.p2g.part2grid2D(x: ndarray, y: ndarray, f: ndarray, boxsize: float | List[float], ngrid: int | List[int], method: str = 'TSC', periodic: bool | List[bool] = True, origin: float | List[float] = 0.0) ndarray

Returns the density contrast for the nearest grid point grid assignment.

Parameters:
  • x (array) – X coordinates of the particle.

  • y (array) – Y coordinates of the particle.

  • f (array) – Value of each particle to be assigned to the grid.

  • boxsize (float or list) – Box size.

  • ngrid (int) – Grid divisions across one axis.

  • method (str, optional) – Grid assignment scheme, either ‘NGP’, ‘CIC’, ‘TSC’ or ‘PCS’.

  • periodic (bool or list, optional) – Assign particles with periodic boundaries.

  • origin (float or list, optional) – Origin.

Returns:

fgrid – Grid assigned values.

Return type:

array

fiesta.p2g.part2grid3D(x: ndarray, y: ndarray, z: ndarray, f: ndarray, boxsize: float | List[float], ngrid: float | List[float], method: str = 'TSC', periodic: bool | List[bool] = True, origin: float | List[float] = 0.0) ndarray

Returns the density contrast for the nearest grid point grid assignment.

Parameters:
  • x (array) – X coordinates of the particle.

  • y (array) – Y coordinates of the particle.

  • z (array) – Z coordinates of the particle.

  • f (array) – Value of each particle to be assigned to the grid.

  • boxsize (float or list) – Box size.

  • ngrid (int or list) – Grid divisions across one axis.

  • method (str, optional) – Grid assignment scheme, either ‘NGP’, ‘CIC’, ‘TSC’ or ‘PCS’.

  • periodic (bool or list, optional) – Assign particles with periodic boundaries.

  • origin (float or list, optional) – Origin.

Returns:

fgrid – Grid assigned values.

Return type:

array

fiesta.p2g.mpi_part2grid2D(x: ndarray, y: ndarray, f: ndarray, boxsize: float | List[float], ngrid: int | List[int], MPI: object, method: str = 'TSC', periodic: bool | List[bool] = True, origin: float | List[float] = 0.0) ndarray

Returns the density contrast for the nearest grid point grid assignment.

Parameters:
  • x (array) – X coordinates of the particle.

  • y (array) – Y coordinates of the particle.

  • f (array) – Value of each particle to be assigned to the grid.

  • boxsize (float or list) – Box size.

  • ngrid (int or list) – Grid divisions across one axis.

  • MPI (class) – MPIutils MPI class object.

  • method (str, optional) – Grid assignment scheme, either ‘NGP’, ‘CIC’, ‘TSC’, ‘PCS’.

  • periodic (bool or list, optional) – Assign particles with periodic boundaries.

  • origin (float, optional) – Origin.

Returns:

fgrid – Grid assigned values.

Return type:

array

fiesta.p2g.mpi_part2grid3D(x: ndarray, y: ndarray, z: ndarray, f: ndarray, boxsize: float | List[float], ngrid: int | List[int], MPI: object, method: str = 'TSC', periodic: bool | List[bool] = True, origin: float | List[float] = 0.0) ndarray

Returns the density contrast for the nearest grid point grid assignment.

Parameters:
  • x (array) – X coordinates of the particle.

  • y (array) – Y coordinates of the particle.

  • z (array) – Z coordinates of the particle.

  • f (array) – Value of each particle to be assigned to the grid.

  • boxsize (float or list) – Box size.

  • ngrid (int or list) – Grid divisions across one axis.

  • MPI (class) – MPIutils MPI class object.

  • method (str, optional) – Grid assignment scheme, either ‘NGP’, ‘CIC’ or ‘TSC’.

  • periodic (bool or list, optional) – Assign particles with periodic boundaries.

  • origin (float, optional) – Origin.

Returns:

fgrid – Grid assigned values.

Return type:

array

Deconvolution

fiesta.p2g.get_deconvol_p(method: str) int

Returns the deconvolution power.

Parameters:

method (str) – grid assignment scheme, either NGP, CIC, TSC or PCS.

Returns:

p – Deconvolution power.

Return type:

float

fiesta.p2g.get_part2grid2D_kernel(kx2d: float | ndarray, ky2d: float | ndarray, ngrid: int | List[int], boxsize: float | List[float], method: str = 'TSC') ndarray

Returns the convolution kernel for particle-to-grid assignment scheme on a Fourier space grid.

Parameters:
  • kx2d (float or array) – Fourier coefficients along the x and y axis.

  • ky2d (float or array) – Fourier coefficients along the x and y axis.

  • ngrid (int or list) – Grid dimensions.

  • boxsize (float or list) – Box size.

  • method (str) – grid assignment scheme, either NGP, CIC, TSC or PCS.

Returns:

Wk – The part-to-grid mass assignment kernel in Fourier space.

Return type:

array

fiesta.p2g.get_part2grid3D_kernel(kx3d: float | ndarray, ky3d: float | ndarray, kz3d: float | ndarray, ngrid: int | List[int], boxsize: float | List[float], method: str = 'TSC') ndarray

Returns the convolution kernel for particle-to-grid assignment scheme on a Fourier space grid.

Parameters:
  • kx3d (float or array) – Fourier coefficients along the x, y and z axis.

  • ky3d (float or array) – Fourier coefficients along the x, y and z axis.

  • kz3d (float or array) – Fourier coefficients along the x, y and z axis.

  • ngrid (int or list) – Grid dimensions.

  • boxsize (float or list) – Box size.

  • method (str) – grid assignment scheme, either NGP, CIC, TSC or PCS.

Returns:

Wk – The part-to-grid mass assignment kernel in Fourier space.

Return type:

array

fiesta.p2g.deconvolve_part2grid2D(field: ndarray, boxsize: float | List[float], method: str = 'TSC') ndarray

Deconvolve the grid assignment scheme in Fourier space.

Parameters:
  • field (ndarray) – Grid assigned field.

  • boxsize (float or list) – Box size.

  • method (str) – grid assignment scheme, either NGP, CIC, TSC or PCS.

fiesta.p2g.deconvolve_part2grid3D(field: ndarray, boxsize: float | List[float], method: str = 'TSC') ndarray

Deconvolve the grid assignment scheme in Fourier space.

Parameters:
  • field (ndarray) – Grid assigned field.

  • boxsize (float or list) – Box size.

  • method (str) – grid assignment scheme, either NGP, CIC, TSC or PCS.