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.
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.
- 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.
method (str, optional) – Grid assignment scheme, either ‘NGP’, ‘CIC’, ‘TSC’ or ‘PCS’.
periodic (bool or list, optional) – Assign particles with periodic boundaries.
- 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.
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.
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_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:
- 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:
- 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.