Predicting the Number of Guard Cells for PSATD Simulations

When the computational domain is decomposed in parallel subdomains and the pseudo-spectral analytical time-domain (PSATD) method is used to solve Maxwell’s equations (by setting algo.maxwell_solver = psatd in the input file), the number of guard cells used to exchange fields between neighboring subdomains can be chosen based on the extent of the stencil of the leading term in Maxwell’s equations, in Fourier space. A measure of such stencil can be obtained by computing the inverse Fourier transform of the given term along a chosen axis and by averaging the result over the remaining axes in Fourier space. The idea is to look at how quickly such stencils fall off to machine precision, with respect to their extension in units of grid cells, and identify consequently the number of cells after which the stencils will be truncated, with the aim of balancing numerical accuracy and locality. See (Zoni et al., 2021) for reference.

A user can run the Python script, located in ./Tools/DevUtils, in order to compute such stencils and estimate the number of guard cells needed for a given PSATD simulation with domain decomposition. In particular, the script computes the minimum number of guard cells for a given error threshold, that is, the minimum number of guard cells such that the stencil measure is not larger than the error threshold. The user can modify the input parameters set in the main function in order to reproduce the simulation setup. These parameters include: cell size, time step, spectral order, Lorentz boost, whether the PSATD algorithm is based on the Galilean scheme, and error threshold (this is not an input parameter of a WarpX simulation, but rather an empirical error threshold chosen to balance numerical accuracy and locality, as mentioned above).