Implementation of a Mesh refinement algorithm into the quasi-static PIC code QuickPIC

Q. Su [email protected] F. Li W. An V. Decyk Y. Zhao L. Hildebrand T. N. Dalichaouch S. Zhou E. P. Alves A. S. Almgren W. B. Mori
Abstract

Plasma-based acceleration (PBA) has emerged as a promising candidate for the accelerator technology used to build a future linear collider and/or an advanced light source. In PBA, a trailing or witness particle beam is accelerated in the plasma wave wakefield (WF) created by a laser or particle beam driver. The WF is often nonlinear and involves the crossing of plasma particle trajectories in real space and thus particle-in-cell methods are used. The distance over which the drive beam evolves is several orders of magnitude larger than the wake wavelength. This large disparity in length scales is amenable to the quasi-static approach. Three-dimensional (3D), quasi-static (QS), particle-in-cell (PIC) codes, e.g., QuickPIC, have been shown to provide high fidelity simulation capability with 2-4 orders of magnitude speedup over 3D fully explicit PIC codes. In PBA, the witness beam needs to be matched to the focusing forces of the WF to reduce the emittance growth. In some linear collider designs, the matched spot size of the witness beam can be 2 to 3 orders of magnitude smaller than the spot size (and wavelength) of the wakefield. Such an additional disparity in length scales is ideal for mesh refinement where the WF within the witness beam is described on a finer mesh than the rest of the WF. We describe a mesh refinement scheme that has been implemented into the 3D QS PIC code, QuickPIC. We use a very fine (high) resolution in a small spatial region that includes the witness beam and progressively coarser resolutions in the rest of the simulation domain. A fast multigrid Poisson solver has been implemented for the field solve on the refined meshes and a Fast Fourier Transform (FFT) based Poisson solver is used for the coarse mesh. The code has been parallelized with both MPI and OpenMP, and the parallel scalability has also been improved by using pipelining. A preliminary adaptive mesh refinement technique is described to optimize the computational time for simulations with an evolving witness beam size. Several test problems are used to verify that the mesh refinement algorithm provides accurate results. The results are also compared to highly resolved simulations with near azimuthal symmetry using a new hybrid QS PIC code QPAD that uses a PIC description in the coordinates (r𝑟ritalic_r, ctz𝑐𝑡𝑧ct-zitalic_c italic_t - italic_z) and a gridless description in the azimuthal angle, ϕitalic-ϕ\phiitalic_ϕ.

\affiliation

[ucla]organization=Department of Electrical and Computer Engineering, University of California,city=Los Angeles, postcode=90095, state=CA, country=USA \affiliation[uclap]organization=Department of Physics and Astronomy, University of California,city=Los Angeles, postcode=90095, state=CA, country=USA

\affiliation

[uclat]organization=Mani L. Bhaumik Institute for Theoretical Physics, University of California,city=Los Angeles, postcode=90095, state=CA, country=USA

\affiliation

[tsinghua]organization=Department of Engineering Physics, Tsinghua University,city=Bei**g, postcode=100084, country=China

\affiliation

[normal]organization=Institute for Frontiers in Astronomy and Astrophysics, Bei**g Normal University,city=Bei**g, postcode=102206, country=China

\affiliation

[normal2]organization=Department of Astronomy, Bei**g Normal University,city=Bei**g, postcode=100875, country=China \affiliation[lbnl]organization=Lawrence Berkeley National Laboratory,city=Berkeley, postcode=94720, country=USA

1 Introduction

The study of interactions between intense lasers or beams and particles has become a vibrant and rapidly develo** area of plasma and beam physics research. One of the applications of this field of research is the development of plasma-based accelerators (PBA) [1, 2], which can be used for next generation advanced light sources and a future linear collider. In PBA, an intense laser (LWFA) [3] or a particle beam (PWFA) [4] is sent through a tenuous plasma. The radiation pressure of the laser or the space charge fields of a particle beam can create a plasma wave wakefield (WF) in PBA, which has a phase velocity that is close to the speed of light. There have been many successful experimental results in PWFA and LWFA [5, 6, 7, 8, 9, 10, 11], demonstrating the potential of PBAs for various applications.

The success of these experiments has benefited from advanced plasma simulation tools. The standard electromagnetic (EM) particle-in-cell (PIC) methods [12] have been developed to study PWFA and LWFA. The standard PIC code advances the fields forward in time by solving the full set of temporally and spatially discretized Maxwell’s equations. The current and charge density in these equations is computed by summing the contributions from each particle. Each particle contributes a fraction of its current and charge to each grid point based on a chosen deposition order. The updated fields on the grid are then interpolated at the particle locations. These interpolated fields are then used to update the particle’s momentum and position. Depending on the type of Maxwell solver the fields and currents/charge densities are defined on the grid or within a cell. These full EM PIC codes have been very successful at studying a variety of problems in plasma physics, including PBA, where details on the trajectories of individual particles are required. However, the computational expenses of the full 3D PIC algorithms can be formidable for some applications due to the Courant-Friedrichs-Lewy (CFL) condition [13], which sets a limit on the time step size.

In PBA, the duration (length) of the driver and the period (wavelength) of the wakefield are comparable while the propagation distance is more than three orders of magnitude larger. The quasi-static approximation (QSA) [14] was proposed to exploit this disparity of scales for efficient simulations of intense laser or beam plasma interactions. The QSA takes advantage of the difference in time scales between the high-energy beam or laser and the plasma wake evolution. The QSA uses variables (x,y,ξ=ctz;s=z)formulae-sequence𝑥𝑦𝜉𝑐𝑡𝑧𝑠𝑧(x,y,\xi=ct-z;s=z)( italic_x , italic_y , italic_ξ = italic_c italic_t - italic_z ; italic_s = italic_z ) to describe the field equations and plasma dynamics instead of (x,y,z;t)𝑥𝑦𝑧𝑡(x,y,z;t)( italic_x , italic_y , italic_z ; italic_t ), where c is the speed of light. The evolution of all quantities can be separated into two time scales, one for ξ𝜉\xiitalic_ξ and the other for s𝑠sitalic_s.

In the QSA, the driver is assumed to not evolve, i.e., it is static, during the time it takes to pass by a plasma particle. Thus, plasma electrons are assumed to have longitudinal speeds vzsubscript𝑣𝑧v_{z}italic_v start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT such that (vbvz)/c>ϵsubscript𝑣𝑏subscript𝑣𝑧𝑐italic-ϵ(v_{b}-v_{z})/c>\epsilon( italic_v start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT - italic_v start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ) / italic_c > italic_ϵ where vbsubscript𝑣𝑏v_{b}italic_v start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT is the beam velocity and ϵitalic-ϵ\epsilonitalic_ϵ is a smallness parameter that scales 1/(kβcτ)1subscript𝑘𝛽𝑐𝜏1/(k_{\beta}c\tau)1 / ( italic_k start_POSTSUBSCRIPT italic_β end_POSTSUBSCRIPT italic_c italic_τ ), where τ𝜏\tauitalic_τ is the driver pulse length and kβkp/2γsubscript𝑘𝛽subscript𝑘𝑝2𝛾k_{\beta}\equiv k_{p}/\sqrt{2\gamma}italic_k start_POSTSUBSCRIPT italic_β end_POSTSUBSCRIPT ≡ italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT / square-root start_ARG 2 italic_γ end_ARG is the betatron wavelength of the beam (for a laser vbsubscript𝑣𝑏v_{b}italic_v start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT is the group velocity of light in plasma and kβ1superscriptsubscript𝑘𝛽1k_{\beta}^{-1}italic_k start_POSTSUBSCRIPT italic_β end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT is replaced with the Rayleigh length), where kpωp/csubscript𝑘𝑝subscript𝜔𝑝𝑐k_{p}\equiv\omega_{p}/citalic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ≡ italic_ω start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT / italic_c, and ωpsubscript𝜔𝑝\omega_{p}italic_ω start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT is the plasma frequency. Under these conditions, ssubscript𝑠\partial_{s}∂ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT for plasma quantities (the change with the lab frame distance along the beam direction) is much smaller than ξsubscript𝜉\partial_{\xi}∂ start_POSTSUBSCRIPT italic_ξ end_POSTSUBSCRIPT (the change with the position in the co-moving window), which allows for a simplified description of the system. A quasi-static PIC code can be developed by assuming the driver quantities (e.g. laser or beam) are fixed when solving for the plasma related quantities. After solving for the plasma quantities, the fields can then be used to advance the beam particles for a single “large” time step. The updated beam particles are then utilized to solve for plasma quantities in the next 3D step. Several PIC codes have been developed based on the QSA, such as WAKE [15], LCODE [16], QuickPIC [17, 18], HiPACE+++++ + [19, 20], INF&RNO [21], WANDPIC [22], and QPAD  [23]. WAKE, LCODE, and INF&RNO are 2D (r-z geometry) quasi-static PIC codes, while QuickPIC, HiPACE++, and WANDPIC are 3D. QPAD is a quasi-3D QSA based PIC code where the fields are expanded into a truncated series of azimuthal harmonics. QuickPIC is a 3D QS PIC code that has been fully parallelized (MPI+OpenMP with pipelining). It has been shown to achieve speedups of 102104similar-tosuperscript102superscript10410^{2}\sim 10^{4}10 start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ∼ 10 start_POSTSUPERSCRIPT 4 end_POSTSUPERSCRIPT without loss in accuracy compared with a full PIC code (e.g. OSIRIS [24]).

Despite the high speedup compared to a full PIC code, quasi-static PIC codes may still incur high computational expenses in situations where there is a significant discrepancy in scale between the transverse dimensions of the acceleration structure and the witness beams. For example, in the design of a plasma wakefield acceleration (PWFA) based linear collider for electron acceleration [25], a relativistic drive beam excites a plasma wake, with the trailing beam placed in the accelerating phase of the wake. In future linear collider designs, the accelerated beam must meet certain requirements, one of which is high luminosity. The luminosity is calculated as L=(fN2/4πσxσy)𝐿𝑓superscript𝑁24𝜋subscript𝜎𝑥subscript𝜎𝑦L=\left(fN^{2}/4\pi\sigma_{x}\sigma_{y}\right)italic_L = ( italic_f italic_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / 4 italic_π italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ), where N𝑁Nitalic_N represents the number of particles in each bunch, f𝑓fitalic_f is the frequency of the collisions, and σx,σysubscript𝜎𝑥subscript𝜎𝑦\sigma_{x},\sigma_{y}italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT , italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT is the spot size of the bunch at the interaction point. To achieve or exceed the luminosity goal of a linear collider, L1034cm2s1similar-to𝐿superscript1034superscriptcm2superscripts1L\sim 10^{34}\mathrm{~{}cm}^{-2}\mathrm{~{}s}^{-1}italic_L ∼ 10 start_POSTSUPERSCRIPT 34 end_POSTSUPERSCRIPT roman_cm start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT roman_s start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT, a witness beam must be focused to a small spot size at the interaction or collision point. This necessitates that the beam have a normalized emittance of 100nmsimilar-toabsent100nm\sim 100\mathrm{~{}nm}∼ 100 roman_nm and charge of 1nCsimilar-toabsent1nC\sim 1~{}\mathrm{nC}∼ 1 roman_nC. As the electron and positron beams collide they pinch which can lead to large amounts of radiation. The use of asymmetric beams with the same RMS spot size can reduce this beamstrahlung for the same luminosity [25]. This is achieved through the use of asymmetric emittances. In some designs, asymmetries of σx/σy100similar-tosubscript𝜎𝑥subscript𝜎𝑦100\sigma_{x}/\sigma_{y}\sim 100italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT / italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ∼ 100 are utilized [25]. To suppress the emittance growth within the uniform plasma accelerator stage, a beam needs to have a matched spot size σr=(2ϵN2/γ)1/4subscript𝜎𝑟superscript2superscriptsubscriptitalic-ϵ𝑁2𝛾14\sigma_{r}=\left(2\epsilon_{N}^{2}/\gamma\right)^{1/4}italic_σ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT = ( 2 italic_ϵ start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / italic_γ ) start_POSTSUPERSCRIPT 1 / 4 end_POSTSUPERSCRIPT, where ϵNsubscriptitalic-ϵ𝑁\epsilon_{N}italic_ϵ start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT represents the normalized emittance of the beam and γ𝛾\gammaitalic_γ denotes the relativistic Lorentz factor of the beam. For such a tightly focused high current beam, the Coulomb field will pull the ions inward  [26, 27] within the transit time of the beam. In order to properly resolve the ion motion, the simulation must resolve the spot size of the beam and the simulation window must encompass the entire acceleration structure. For linear collider parameters, the matched spot size of the trailing beam can be hundreds of times smaller than the acceleration bubble radius. The computational demands to model the entire domain are substantial even with a 3D quasi-static code. This is challenging for contemporary supercomputers due to both memory and CPU requirements. In Ref. [28], this was addressed by only modeling a small region near the witness beam. However, in order to model the effects of ion motion on beam loading and hosing instabilities, the entire WF region must be included. Thus, enhancing the computational efficiency of the quasi-static code is vital for linear collider simulations.

Several strategies have been proposed to address these challenges. One such approach is azimuthal Fourier decomposition  [29]. In this hybrid method, the fields and charge densities (or current densities) are decomposed into multiple azimuthal modes, and the high-order modes with low amplitude can be truncated based on the degree of asymmetry. A PIC description is used on an rz𝑟𝑧r-zitalic_r - italic_z grid, and a gridless description is used for the azimuthal angle ϕitalic-ϕ\phiitalic_ϕ. For example, an azimuthally symmetric beam can be fully represented by the first harmonic. This method has been applied to full PIC codes [29, 30, 31]. However, even with this approach the use of full PIC simulations is not feasible due to the CFL [13] limit and physics constraints on the time step for small transverse cell sizes. Recently, the azimuthal mode expansion has also been applied to the QuickPIC workflow, resulting in a new code QPAD [23]. This provides speedups of around O(N)𝑂𝑁O(N)italic_O ( italic_N ) for problems with low azimuthal asymmetry, where N𝑁Nitalic_N is the grid numbers in one transverse direction. Another approach is mesh refinement (MR), which involves increasing the resolution in areas where a high level of detail is needed. Some mesh refinement capability has been implemented into full PIC codes [32], however, time step constraints based on the smallest cell sizes are still present. Mesh refinement has also been implemented into 2D  [33] and 3D  [34, 20] quasi-static codes. The quasi-static algorithm necessitates solving a series of 2D Poisson like equations. The basic MR idea is to solve these equations globally on a coarse grid and then use the solutions to obtain boundary conditions for solving the same equations on a fine mesh within a much smaller domain. However, there is limited published detail on the implementations and on benchmarking the existing algorithms.

In this article, we describe in much detail how a mesh refinement algorithm is implemented into the quasi-static PIC code QuickPIC. The code applies high resolution refined meshes in specific regions surrounding the trailing beam, and the grid sizes of those meshes progressively change to coarser resolutions in the remaining parts of the simulation domain. A fast multigrid Poisson solver has been implemented to solve 2D Poisson like equations on the refined meshes, and the solver has been parallelized with both MPI and OpenMP. The equations for the coarsest mesh can be solved using either Fast Fourier Transform (FFT) or multigrid algorithms. In the current implementation, we use FFTs to solve the equations on the coarsest mesh that covers the whole simulation domain.

In order to tackle the issue of imbalanced computational workload, we distribute the Poisson solvers on the fine grids, usually concentrated in a single location, to all processors. Afterwards, we collect the results to the appropriate processor so that the particles can be pushed to new momenta and positions. The scalability of the code has also been improved significantly by using pipelining  [35] in the ξ𝜉\xiitalic_ξ direction. Additionally, the code allows for inhomogeneous particle loading, which enables the initialization of a greater number of plasma particles within the fine mesh region when necessary, while employing a lower number of particles in the coarse mesh regions. A preliminary adaptive mesh refinement technique is also implemented in order to optimize the computational time for simulations with an evolving beam size. This is achieved by modifying the refined mesh size and resolution to meet the simulation’s demands.

In this work, we do not directly address the self forces at the refinement boundary [36, 37]. However, for all results shown, there is no spurious behavior at the refinement boundary, and this is partly due to two reasons. To control issues with particles moving between domains with different resolutions, we implemented a hierarchy of resolution layers between the coarsest and finest resolutions. In addition, we choose the locations of the boundaries between different layers of resolution to be in regions where there are not large amounts of particles crossing.

Several problems of interest are chosen to test and benchmark the algorithm. The obtained results demonstrate consistency with those previously reported in published papers using QuickPIC. Furthermore, the benchmarking has benefited from the use of the quasi-3D QPAD, enabling simulations where the finest resolution is applied uniformly across the entire domain. Adaptive mesh refinement has also been used to simulate the evolution of an unmatched beam with mobile ions, and the results agree with fully resolved QPAD simulations.

2 The implementations of mesh refinement in QuickPIC

2.1 The quasi-static loop with mesh refinement

In this section, we provide details for how the quasi-static PIC loop in QuickPIC is modified to incorporate mesh refinement.

2.1.1 Review of quasi-static loop in QuickPIC

We start with a review of the basic quasi-static PIC loop and equations in QuickPIC [17, 18]. To simplify the equations we use normalized units. Charge is normalized to electron charge e𝑒eitalic_e; density to the plasma density n0subscript𝑛0n_{0}italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT; length to the plasma skin depth kp1superscriptsubscript𝑘𝑝1k_{p}^{-1}italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT defined as c/ωp𝑐subscript𝜔𝑝c/\omega_{p}italic_c / italic_ω start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, where ωpsubscript𝜔𝑝\omega_{p}italic_ω start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT is the plasma oscillation frequency and c𝑐citalic_c the speed of light; charge density ρ𝜌\rhoitalic_ρ to enp𝑒subscript𝑛𝑝en_{p}italic_e italic_n start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT; current density J𝐽\vec{J}over→ start_ARG italic_J end_ARG to enpc𝑒subscript𝑛𝑝𝑐en_{p}citalic_e italic_n start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_c; particle momentum to mc𝑚𝑐mcitalic_m italic_c; electric and magnetic fields (E,B)𝐸𝐵(\vec{E},\vec{B})( over→ start_ARG italic_E end_ARG , over→ start_ARG italic_B end_ARG ) to mcωp/e𝑚𝑐subscript𝜔𝑝𝑒mc\omega_{p}/eitalic_m italic_c italic_ω start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT / italic_e; and potentials (ϕ,A)italic-ϕ𝐴(\phi,\vec{A})( italic_ϕ , over→ start_ARG italic_A end_ARG ) to mc2/e𝑚superscript𝑐2𝑒mc^{2}/eitalic_m italic_c start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / italic_e. In the physical examples used throughout this article, we will assume a plasma density and then the translation from normalized units to physical units can be calculated accordingly.

The quasi-static equations are derived by making a mathematical transformation from (x,y,z,t)𝑥𝑦𝑧𝑡(x,y,z,t)( italic_x , italic_y , italic_z , italic_t ) to the co-moving frame variables (x,y,ξ=ctz,s=z)formulae-sequence𝑥𝑦𝜉𝑐𝑡𝑧𝑠𝑧(x,y,\xi=ct-z,s=z)( italic_x , italic_y , italic_ξ = italic_c italic_t - italic_z , italic_s = italic_z ). The partial derivatives with respect to t𝑡titalic_t and z𝑧zitalic_z are then transformed to z=sξsubscript𝑧subscript𝑠subscript𝜉\partial_{z}=\partial_{s}-\partial_{\xi}∂ start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT = ∂ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT - ∂ start_POSTSUBSCRIPT italic_ξ end_POSTSUBSCRIPT and t=cξsubscript𝑡𝑐subscript𝜉\partial_{t}=c\partial_{\xi}∂ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_c ∂ start_POSTSUBSCRIPT italic_ξ end_POSTSUBSCRIPT. Mathematically, the quasi-static approximation assumes that ssubscript𝑠\partial_{s}∂ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT is much smaller than ξsubscript𝜉\partial_{\xi}∂ start_POSTSUBSCRIPT italic_ξ end_POSTSUBSCRIPT for the fields. Thus, the evolution of all plasma quantities in PBA simulations can be separated into a fast time (spatial) scale ξ𝜉\xiitalic_ξ and a slower scale s𝑠sitalic_s. The workflow of the QuickPIC quasi-static loop is shown in Fig. 1. By applying quasi-static approximation sξmuch-less-thansubscript𝑠subscript𝜉\partial_{s}\ll\partial_{\xi}∂ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT ≪ ∂ start_POSTSUBSCRIPT italic_ξ end_POSTSUBSCRIPT, the wave equations in the Lorenz gauge can be simplified into a set of 2D Poisson like equations [18]:

2ψ=(ρJz),2B=z^×(ξJ+Jz),2Bz=×J,2E=ρ+ξJ,2Ez=J,superscriptsubscriptperpendicular-to2𝜓𝜌subscript𝐽𝑧superscriptsubscriptperpendicular-to2subscript𝐵perpendicular-to^𝑧𝜉subscript𝐽perpendicular-tosubscriptperpendicular-tosubscript𝐽𝑧superscriptsubscriptperpendicular-to2subscript𝐵𝑧subscriptperpendicular-tosubscript𝐽perpendicular-tosuperscriptsubscriptperpendicular-to2subscript𝐸perpendicular-tosubscriptperpendicular-to𝜌𝜉subscript𝐽perpendicular-tosuperscriptsubscriptperpendicular-to2subscript𝐸𝑧subscriptperpendicular-tosubscript𝐽perpendicular-to\begin{array}[]{l}{\nabla_{\perp}^{2}\psi=-\left(\rho-J_{z}\right)},\\ {\nabla_{\perp}^{2}\vec{B}_{\perp}=\hat{z}\times\left(\frac{\partial}{\partial% \xi}\vec{J}_{\perp}+\nabla_{\perp}J_{z}\right)},\\ {\nabla_{\perp}^{2}B_{z}=-\nabla_{\perp}\times\vec{J}_{\perp}},\\ {\nabla_{\perp}^{2}\vec{E}_{\perp}=\nabla_{\perp}\rho+\frac{\partial}{\partial% \xi}\vec{J}_{\perp}},\\ {\nabla_{\perp}^{2}E_{z}=\nabla_{\perp}\cdot\vec{J}_{\perp}},\end{array}start_ARRAY start_ROW start_CELL ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_ψ = - ( italic_ρ - italic_J start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ) , end_CELL end_ROW start_ROW start_CELL ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT over→ start_ARG italic_B end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT = over^ start_ARG italic_z end_ARG × ( divide start_ARG ∂ end_ARG start_ARG ∂ italic_ξ end_ARG over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT + ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT italic_J start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ) , end_CELL end_ROW start_ROW start_CELL ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_B start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT = - ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT × over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT , end_CELL end_ROW start_ROW start_CELL ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT over→ start_ARG italic_E end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT = ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT italic_ρ + divide start_ARG ∂ end_ARG start_ARG ∂ italic_ξ end_ARG over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT , end_CELL end_ROW start_ROW start_CELL ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_E start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT = ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ⋅ over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT , end_CELL end_ROW end_ARRAY (1)

where x^x+y^ysubscriptperpendicular-to^𝑥subscript𝑥^𝑦subscript𝑦\nabla_{\perp}\equiv\hat{x}\partial_{x}+\hat{y}\partial_{y}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ≡ over^ start_ARG italic_x end_ARG ∂ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT + over^ start_ARG italic_y end_ARG ∂ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT, ψϕAz𝜓italic-ϕsubscript𝐴𝑧\psi\equiv\phi-A_{z}italic_ψ ≡ italic_ϕ - italic_A start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT is the wake potential. QuickPIC uses FFTs to solve these equations on a uniform grid with equidistant points. The equation for 2Esuperscriptsubscriptperpendicular-to2subscript𝐸perpendicular-to\nabla_{\perp}^{2}\vec{E}_{\perp}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT over→ start_ARG italic_E end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT is not directly solved in QuickPIC. Instead, the transverse electric field Esubscript𝐸perpendicular-to\vec{E}_{\perp}over→ start_ARG italic_E end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT is obtained indirectly through the gradient of the scalar potential ψ𝜓\psiitalic_ψ and the transverse magnetic field Bsubscript𝐵perpendicular-toB_{\perp}italic_B start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT, E+z^×B=ψsubscript𝐸perpendicular-to^𝑧subscript𝐵perpendicular-tosubscriptperpendicular-to𝜓\vec{E}_{\perp}+\hat{z}\times\vec{B}_{\perp}=-\nabla_{\perp}\psiover→ start_ARG italic_E end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT + over^ start_ARG italic_z end_ARG × over→ start_ARG italic_B end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT = - ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT italic_ψ. The source terms used in Eq. 1 are obtained from operations on plasma density and current deposited from 2D plasma particles, and beam density deposited from 3D beam particles. Details can be found in Ref. [18].

Refer to caption
Fig. 1: The quasi-static loop in QuickPIC is comprised of two primary nested loops: The inner loop in ξ𝜉\xiitalic_ξ involves 2D field solves and plasma particle pushing, and the outer loop in s𝑠sitalic_s is associated with beam particle operations. In the ξ𝜉\xiitalic_ξ loop, the sources of the 2D equations (Eq. 1) consist of operations on the deposited plasma particles and beam particles. The plasma particles are advanced in ξ𝜉\xiitalic_ξ for a fixed s𝑠sitalic_s based on the 2D field solutions. The outer loop consists of advancing the beam particles forward in s𝑠sitalic_s using the plasma quantities and fields for all ξ𝜉\xiitalic_ξ at a fixed s𝑠sitalic_s obtained in the inner loop. Subsequently, the beam particles are deposited onto the 3D grid for use in the next ξ𝜉\xiitalic_ξ loop, and the process repeats itself in the next loop iteration. In mesh refinement algorithm, each operation within the ξ𝜉\xiitalic_ξ and s𝑠sitalic_s loops is performed on both refined and coarse meshes.

At a fixed s𝑠sitalic_s, the plasma particles move in a 5 dimensional (5D) phase space, x,y,px,py,pz𝑥𝑦subscript𝑝𝑥subscript𝑝𝑦subscript𝑝𝑧x,y,p_{x},p_{y},p_{z}italic_x , italic_y , italic_p start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT where ξ𝜉\xiitalic_ξ is a time like variable. This phase space is updated every 2D step. The transverse momentum of plasma particles Ppsubscript𝑃perpendicular-topabsent\vec{P}_{\mathrm{p}\perp}over→ start_ARG italic_P end_ARG start_POSTSUBSCRIPT roman_p ⟂ end_POSTSUBSCRIPT are advanced through the equation of motion,

dPpdξ=qp1Vpz[E+(Vp×B)],dsubscript𝑃perpendicular-topabsentd𝜉subscript𝑞p1subscript𝑉p𝑧delimited-[]subscript𝐸perpendicular-tosubscriptsubscript𝑉p𝐵perpendicular-to\frac{\mathrm{d}\vec{P}_{\mathrm{p}\perp}}{\mathrm{d}\xi}=\frac{q_{\mathrm{p}}% }{1-V_{\mathrm{p}z}}\left[\vec{E}_{\perp}+\left(\vec{V}_{\mathrm{p}}\times\vec% {B}\right)_{\perp}\right],divide start_ARG roman_d over→ start_ARG italic_P end_ARG start_POSTSUBSCRIPT roman_p ⟂ end_POSTSUBSCRIPT end_ARG start_ARG roman_d italic_ξ end_ARG = divide start_ARG italic_q start_POSTSUBSCRIPT roman_p end_POSTSUBSCRIPT end_ARG start_ARG 1 - italic_V start_POSTSUBSCRIPT roman_p italic_z end_POSTSUBSCRIPT end_ARG [ over→ start_ARG italic_E end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT + ( over→ start_ARG italic_V end_ARG start_POSTSUBSCRIPT roman_p end_POSTSUBSCRIPT × over→ start_ARG italic_B end_ARG ) start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ] , (2)

where Vpsubscript𝑉p\vec{V}_{\mathrm{p}}over→ start_ARG italic_V end_ARG start_POSTSUBSCRIPT roman_p end_POSTSUBSCRIPT is the velocity of plasma particles and qpsubscript𝑞𝑝q_{p}italic_q start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT represents the normalized charge of plasma particles. The momentum of plasma particles in the z direction Ppzsubscript𝑃p𝑧P_{\mathrm{p}z}italic_P start_POSTSUBSCRIPT roman_p italic_z end_POSTSUBSCRIPT is derived from the conservation equation γpPpz=1qpψsubscript𝛾psubscript𝑃p𝑧1subscript𝑞p𝜓\gamma_{\mathrm{p}}-P_{\mathrm{p}z}=1-q_{\mathrm{p}}\psiitalic_γ start_POSTSUBSCRIPT roman_p end_POSTSUBSCRIPT - italic_P start_POSTSUBSCRIPT roman_p italic_z end_POSTSUBSCRIPT = 1 - italic_q start_POSTSUBSCRIPT roman_p end_POSTSUBSCRIPT italic_ψ , leading to

Ppz=1+Pp2[1qpψ]22[1qpψ].subscript𝑃p𝑧1superscriptsubscript𝑃perpendicular-topabsent2superscriptdelimited-[]1subscript𝑞p𝜓22delimited-[]1subscript𝑞p𝜓P_{\mathrm{p}z}=\frac{1+P_{\mathrm{p}\perp}^{2}-\left[1-q_{\mathrm{p}}\psi% \right]^{2}}{2\left[1-q_{\mathrm{p}}\psi\right]}.italic_P start_POSTSUBSCRIPT roman_p italic_z end_POSTSUBSCRIPT = divide start_ARG 1 + italic_P start_POSTSUBSCRIPT roman_p ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - [ 1 - italic_q start_POSTSUBSCRIPT roman_p end_POSTSUBSCRIPT italic_ψ ] start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG 2 [ 1 - italic_q start_POSTSUBSCRIPT roman_p end_POSTSUBSCRIPT italic_ψ ] end_ARG . (3)

The plasma particles are then pushed to their new positions using,

dxpdξ=Pp1qbψ,dsubscript𝑥perpendicular-topabsentd𝜉subscript𝑃perpendicular-topabsent1subscript𝑞𝑏𝜓\frac{\mathrm{d}\vec{x}_{\mathrm{p}\perp}}{\mathrm{d}\xi}=\frac{\vec{P}_{% \mathrm{p}\perp}}{1-q_{b}\psi},divide start_ARG roman_d over→ start_ARG italic_x end_ARG start_POSTSUBSCRIPT roman_p ⟂ end_POSTSUBSCRIPT end_ARG start_ARG roman_d italic_ξ end_ARG = divide start_ARG over→ start_ARG italic_P end_ARG start_POSTSUBSCRIPT roman_p ⟂ end_POSTSUBSCRIPT end_ARG start_ARG 1 - italic_q start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT italic_ψ end_ARG , (4)

The 3D beam particles are advanced in time using the variable s𝑠sitalic_s,

dPbds=qbψ,dPbzds=qbEz.formulae-sequencedsubscript𝑃perpendicular-tobabsentd𝑠subscript𝑞bsubscriptperpendicular-to𝜓dsubscript𝑃b𝑧d𝑠subscript𝑞bsubscript𝐸𝑧\frac{\mathrm{d}\vec{P}_{\mathrm{b}\perp}}{\mathrm{d}s}=-q_{\mathrm{b}}\nabla_% {\perp}\psi,\frac{\mathrm{d}P_{\mathrm{b}z}}{\mathrm{~{}d}s}=q_{\mathrm{b}}E_{% z}.divide start_ARG roman_d over→ start_ARG italic_P end_ARG start_POSTSUBSCRIPT roman_b ⟂ end_POSTSUBSCRIPT end_ARG start_ARG roman_d italic_s end_ARG = - italic_q start_POSTSUBSCRIPT roman_b end_POSTSUBSCRIPT ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT italic_ψ , divide start_ARG roman_d italic_P start_POSTSUBSCRIPT roman_b italic_z end_POSTSUBSCRIPT end_ARG start_ARG roman_d italic_s end_ARG = italic_q start_POSTSUBSCRIPT roman_b end_POSTSUBSCRIPT italic_E start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT . (5)

The scale difference that follows from the quasi-static approximation, sξmuch-less-thansubscript𝑠subscript𝜉\partial_{s}\ll\partial_{\xi}∂ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT ≪ ∂ start_POSTSUBSCRIPT italic_ξ end_POSTSUBSCRIPT, enables QuickPIC to use a relatively larger step for ΔsΔ𝑠\Delta sroman_Δ italic_s than for ΔξΔ𝜉\Delta\xiroman_Δ italic_ξ, resulting in significant computational time savings compared to a full PIC code.

QuickPIC uses a predictor-corrector iteration loop as described in [18]. The challenge is that the system of equations is not properly time-centered. This is due to the Jsubscript𝐽perpendicular-to\vec{J}_{\perp}over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT and ξJ𝜉subscript𝐽perpendicular-to\frac{\partial}{\partial\xi}\vec{J}_{\perp}divide start_ARG ∂ end_ARG start_ARG ∂ italic_ξ end_ARG over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT terms in Eq. 1. Thus at each index for ξ𝜉\xiitalic_ξ where the particle momenta and positions are updated, Jsubscript𝐽perpendicular-to\vec{J}_{\perp}over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT and ξJ𝜉subscript𝐽perpendicular-to\frac{\partial}{\partial\xi}\vec{J}_{\perp}divide start_ARG ∂ end_ARG start_ARG ∂ italic_ξ end_ARG over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT are first predicted based on a previous index for ξ𝜉\xiitalic_ξ. During each iteration, the resulting fields from this prediction are then used to advance the plasma particles. This iterative process results in more accurate estimates for Jsubscript𝐽perpendicular-to\vec{J}_{\perp}over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT and ξJ𝜉subscript𝐽perpendicular-to\frac{\partial}{\partial\xi}\vec{J}_{\perp}divide start_ARG ∂ end_ARG start_ARG ∂ italic_ξ end_ARG over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT which are then used to obtain more accurate values for the fields and particle momenta and locations. This iteration is carried out until a targeted level of accuracy is achieved. During this iteration process, the transverse magnetic field Bsubscript𝐵perpendicular-toB_{\perp}italic_B start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT is updated using the following equation:

2Bnew Bnew =z^×(ξJ+Jz)Bold .superscriptsubscriptperpendicular-to2superscriptsubscript𝐵perpendicular-tonew superscriptsubscript𝐵perpendicular-tonew ^𝑧𝜉subscript𝐽perpendicular-tosubscriptperpendicular-tosubscript𝐽𝑧superscriptsubscript𝐵perpendicular-toold \nabla_{\perp}^{2}\vec{B}_{\perp}^{\text{new }}-\vec{B}_{\perp}^{\text{new }}=% \hat{z}\times\left(\frac{\partial}{\partial\xi}\vec{J}_{\perp}+\nabla_{\perp}% \cdot J_{z}\right)-\vec{B}_{\perp}^{\text{old }}.∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT over→ start_ARG italic_B end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT new end_POSTSUPERSCRIPT - over→ start_ARG italic_B end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT new end_POSTSUPERSCRIPT = over^ start_ARG italic_z end_ARG × ( divide start_ARG ∂ end_ARG start_ARG ∂ italic_ξ end_ARG over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT + ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ⋅ italic_J start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ) - over→ start_ARG italic_B end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT old end_POSTSUPERSCRIPT . (6)

2.1.2 Mesh refinement implementation in QuickPIC

The mesh refinement code inherits the general workflow of the QuickPIC quasi-static loop, as depicted in Fig. 1. It initializes refined 2D meshes to solve equations (Eq. 1) progressively with higher resolution surrounding regions where increased precision is needed. In this paper, we assume square cells in each domain. We designate each level of resolution with two variables: l𝑙litalic_l denotes the refinement level, while r𝑟ritalic_r represents the logarithm base 2 of the refinement ratio between the current level l𝑙litalic_l and the next coarser level l1𝑙1l-1italic_l - 1. This ensures that the refinement ratios between l𝑙litalic_l and l1𝑙1l-1italic_l - 1 are constrained to be 2rsuperscript2𝑟2^{r}2 start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT. The mesh refinement calculations are conducted on a hierarchy of meshes denoted by Ωl,rsubscriptΩ𝑙𝑟\Omega_{l,r}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT. For instance, if there are three levels of refinement in total, with the second level of refinement having a refinement ratio of 8, and the third level of refinement having a refinement ratio of 4 to the second level, we will denote the three levels of meshes as Ω1,1subscriptΩ11\Omega_{1,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT, Ω2,3subscriptΩ23\Omega_{2,3}roman_Ω start_POSTSUBSCRIPT 2 , 3 end_POSTSUBSCRIPT, and Ω3,2subscriptΩ32\Omega_{3,2}roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT. Then the domain with the finest resolution in the simulation has grid size 32 times smaller in x𝑥xitalic_x and y𝑦yitalic_y than the coarsest resolution. In this paper,when information of the refinement ratios is given, we sometimes omit r𝑟ritalic_r and represent Ωl,rsubscriptΩ𝑙𝑟\Omega_{l,r}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT as ΩlsubscriptΩ𝑙\Omega_{l}roman_Ω start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT.

A PBA example is illustrated in Fig. 2, where an electron drive beam (red) is sent through a tenuous plasma and excites a nonlinear wake by expelling (blowing out) the plasma electrons (blue). A narrow witness beam (red) with high current is placed behind the drive beam at an appropriate phase of the wakefield where it is accelerated and focused. As described in the introduction, the space charge field of this tightly focused witness beam pulls ions inward where they collapse on the axis creating a very narrow density filament. The transverse dimension of this region is more than two orders of magnitude smaller than the WF width. Thus, the region near the witness beam requires much higher resolution than the rest of simulation domain. We initialize 3D refined meshes encompassing the narrow trailing beam, ensuring accuracy in the region where ion motion takes place. The hierarchical refinement system allows for multiple levels of refinement (Ωl,rsubscriptΩ𝑙𝑟\Omega_{l,r}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT), with each higher level containing a finer resolution mesh enclosed within a coarser mesh of the lower level. The refinement ratio between any two adjacent levels is adjustable as 2rsuperscript2𝑟2^{r}2 start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT. In the example in Fig. 2, there are three levels of resolution.

Refer to caption
Fig. 2: An example of simulating PWFA with mesh refinement. A 3D fine mesh is set up around the trailing beam with a small spot size. An intermediate level (blue grid) is employed to create a gradual transition between the fine and coarse mesh boundaries.

Both the field solver and particle advance, including field interpolation and source deposit components of the quasi-static loop (Fig. 1) have been modified to accommodate the new grid hierarchy. An FFT+multigrid solver (A) is implemented to replace the original FFT solver that can only solve homogeneous grids. We apply the multigrid solver to solve the 2D Poisson like equations for each refinement level of Eq. 1, except for the coarse grid, which continues to be solved by the FFT solver. We deposit and push plasma particles using both the fine and coarse resolution solutions, based on their respective positions. The particle operations needed for the source depositions, (e.g. ρ,J𝜌𝐽\rho,Jitalic_ρ , italic_J), on the right hand side of Eq. 1 are performed on a hybrid grid consisting of both coarse and fine meshes. The same approach is applied to beam particles as well. Further details regarding these modifications are elaborated below.

Refer to caption
Fig. 3: Illustration of the grid configuration near a Coarse-Fine (C-F) refinement boundary. The left-hand side exhibits the fine mesh, represented by solid black dots indicating inner points. The hollow square and triangle points represents the grid points on the C-F boundary, where the square points are shared by the coarse grid. The hollow dots represent the grid that is only covered by the coarse grid. When solving Poisson like equations on the fine mesh, only the sources within the inner region of the fine mesh are considered. A single plasma particle is denoted by a red dot, and its charge or current is deposited onto the fine mesh. Particles are deposited on the fine mesh extending one coarse cell (dashed-gray grids) beyond the boundary of the region where a field quantity is being solved.

For simplicity, we express and generalize these Poisson like equations in Eq. 1 as 2F=S,2FF=Sformulae-sequencesuperscriptsubscriptperpendicular-to2𝐹𝑆superscriptsubscriptperpendicular-to2𝐹𝐹𝑆\nabla_{\perp}^{2}F=S,\nabla_{\perp}^{2}F-F=S∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F = italic_S , ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F - italic_F = italic_S, with F𝐹Fitalic_F representing fields such as ψ,E𝜓𝐸\psi,\vec{E}italic_ψ , over→ start_ARG italic_E end_ARG and B𝐵\vec{B}over→ start_ARG italic_B end_ARG. Multiple refinement grids Ωl,rsubscriptΩ𝑙𝑟\Omega_{l,r}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT identified by index l𝑙litalic_l and r𝑟ritalic_r are created with grid sizes hl=2rhl1subscript𝑙superscript2𝑟subscript𝑙1h_{l}=2^{-r}h_{l-1}italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - italic_r end_POSTSUPERSCRIPT italic_h start_POSTSUBSCRIPT italic_l - 1 end_POSTSUBSCRIPT (Fig. 2). Both the fields F𝐹Fitalic_F and sources S𝑆Sitalic_S are defined on different levels of l𝑙litalic_l as Fl,r=Flsubscript𝐹𝑙𝑟subscript𝐹𝑙F_{l,r}=F_{l}italic_F start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT = italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT and Sl,r=Slsubscript𝑆𝑙𝑟subscript𝑆𝑙S_{l,r}=S_{l}italic_S start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT within a given domain. The coarsest grid corresponds to l=1𝑙1l=1italic_l = 1 and the ratio of the grid size in level l𝑙litalic_l to that in level 1111 can be obtained recursively by hl=2rhl1subscript𝑙superscript2𝑟subscript𝑙1h_{l}=2^{-r}h_{l-1}italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - italic_r end_POSTSUPERSCRIPT italic_h start_POSTSUBSCRIPT italic_l - 1 end_POSTSUBSCRIPT. Thus, the grid size hlsubscript𝑙h_{l}italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT decreases as l𝑙litalic_l increases. As an example, consider a case where there are 3 levels Ω1,1subscriptΩ11\Omega_{1,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT, Ω2,2subscriptΩ22\Omega_{2,2}roman_Ω start_POSTSUBSCRIPT 2 , 2 end_POSTSUBSCRIPT, Ω3,1subscriptΩ31\Omega_{3,1}roman_Ω start_POSTSUBSCRIPT 3 , 1 end_POSTSUBSCRIPT. The cell size for level 3 is h3=h1/8subscript3subscript18h_{3}=h_{1}/8italic_h start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT = italic_h start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT / 8. The equations to solve at level l𝑙litalic_l can be expressed as:

2Fl=Sl,2FlFl=Sl.formulae-sequencesuperscriptsubscriptperpendicular-to2subscript𝐹𝑙subscript𝑆𝑙superscriptsubscriptperpendicular-to2subscript𝐹𝑙subscript𝐹𝑙subscript𝑆𝑙\nabla_{\perp}^{2}F_{l}=S_{l},\nabla_{\perp}^{2}F_{l}-F_{l}=S_{l}.∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT , ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT - italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT . (7)

Here, Slsubscript𝑆𝑙S_{l}italic_S start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT represents the right-hand side of the equations in (Eq. 1), involving operations associated with the charge and current sources deposited on grid l𝑙litalic_l. In the original QuickPIC implementation, the operations 2superscriptsubscriptperpendicular-to2\nabla_{\perp}^{2}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT are performed in the Fourier space using a Fast Fourier Transform (FFT) library. In the mesh refinement code, the FFT library is still used to manage the 2superscriptsubscriptperpendicular-to2\nabla_{\perp}^{2}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT operations in equations Eq. 7 for the coarsest level l=1𝑙1l=1italic_l = 1, which encompasses the entire simulation box. For refined meshes with l>1𝑙1l>1italic_l > 1, a finite difference method is applied to handle these operations.

Currently, we maintain uniform grid spacing in both the x𝑥xitalic_x and y𝑦yitalic_y directions for each level with hl=hl,rsubscript𝑙subscript𝑙𝑟h_{l}=h_{l,r}italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = italic_h start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT (and based on our notation, hl=2rhl1subscript𝑙superscript2𝑟subscript𝑙1h_{l}=2^{-r}h_{l-1}italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - italic_r end_POSTSUPERSCRIPT italic_h start_POSTSUBSCRIPT italic_l - 1 end_POSTSUBSCRIPT). We use a first order discretization of the Laplace operator 2Flsuperscriptsubscriptperpendicular-to2subscript𝐹𝑙\nabla_{\perp}^{2}F_{l}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT at grid point (i,j)𝑖𝑗(i,j)( italic_i , italic_j ) that takes the form 2Fl=(Fl(i+1,j)+Fl(i1,j)+Fl(i,j+1)+Fl(i,j1)4Fl(i,j))/hl2superscriptsubscriptperpendicular-to2subscript𝐹𝑙subscript𝐹𝑙𝑖1𝑗subscript𝐹𝑙𝑖1𝑗subscript𝐹𝑙𝑖𝑗1subscript𝐹𝑙𝑖𝑗14subscript𝐹𝑙𝑖𝑗superscriptsubscript𝑙2\nabla_{\perp}^{2}F_{l}=(F_{l}(i+1,j)+F_{l}(i-1,j)+F_{l}(i,j+1)+F_{l}(i,j-1)-4% F_{l}(i,j))/h_{l}^{2}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = ( italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i + 1 , italic_j ) + italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i - 1 , italic_j ) + italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i , italic_j + 1 ) + italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i , italic_j - 1 ) - 4 italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i , italic_j ) ) / italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT. We do not define and use intermediate grid points within a cell. For the right hand side of Eq. 7, there will be operations related to subscriptperpendicular-to\nabla_{\perp}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT, for example divergence or gradient. We use central difference approximations to discretize the derivatives subscriptperpendicular-to\nabla_{\perp}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT in the x𝑥xitalic_x and y𝑦yitalic_y directions for each level l𝑙litalic_l. The central difference approximation for the x𝑥xitalic_x-component of the derivative on grid (i,j)𝑖𝑗(i,j)( italic_i , italic_j ) is given by: Flx|(i,j)Fl(i+1,j)Fl(i1,j)2hlevaluated-atsubscript𝐹𝑙𝑥𝑖𝑗subscript𝐹𝑙𝑖1𝑗subscript𝐹𝑙𝑖1𝑗2subscript𝑙\frac{\partial F_{l}}{\partial x}\bigg{|}_{(i,j)}\approx\frac{F_{l}(i+1,j)-F_{% l}(i-1,j)}{2h_{l}}divide start_ARG ∂ italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT end_ARG start_ARG ∂ italic_x end_ARG | start_POSTSUBSCRIPT ( italic_i , italic_j ) end_POSTSUBSCRIPT ≈ divide start_ARG italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i + 1 , italic_j ) - italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i - 1 , italic_j ) end_ARG start_ARG 2 italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT end_ARG. Similarly, the central difference approximation for the y𝑦yitalic_y-component of the derivative on grid (i,j)𝑖𝑗(i,j)( italic_i , italic_j ) is given by: Fly|(i,j)Fl(i,j+1)Fl(i,j1)2hlevaluated-atsubscript𝐹𝑙𝑦𝑖𝑗subscript𝐹𝑙𝑖𝑗1subscript𝐹𝑙𝑖𝑗12subscript𝑙\frac{\partial F_{l}}{\partial y}\bigg{|}_{(i,j)}\approx\frac{F_{l}(i,j+1)-F_{% l}(i,j-1)}{2h_{l}}divide start_ARG ∂ italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT end_ARG start_ARG ∂ italic_y end_ARG | start_POSTSUBSCRIPT ( italic_i , italic_j ) end_POSTSUBSCRIPT ≈ divide start_ARG italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i , italic_j + 1 ) - italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ( italic_i , italic_j - 1 ) end_ARG start_ARG 2 italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT end_ARG. For example the divergence of the current in Eq. 1 at level l𝑙litalic_l can be expressed as

J=12hl(Jx(i+1,j)Jx(i1,j)+Jy(i,j+1)Jy(i,j1))subscriptperpendicular-tosubscript𝐽perpendicular-to12subscript𝑙subscript𝐽𝑥𝑖1𝑗subscript𝐽𝑥𝑖1𝑗subscript𝐽𝑦𝑖𝑗1subscript𝐽𝑦𝑖𝑗1\nabla_{\perp}\cdot\vec{J}_{\perp}=\frac{1}{2h_{l}}(J_{x}(i+1,j)-J_{x}(i-1,j)+% J_{y}(i,j+1)-J_{y}(i,j-1))∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT ⋅ over→ start_ARG italic_J end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT = divide start_ARG 1 end_ARG start_ARG 2 italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT end_ARG ( italic_J start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ( italic_i + 1 , italic_j ) - italic_J start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ( italic_i - 1 , italic_j ) + italic_J start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ( italic_i , italic_j + 1 ) - italic_J start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ( italic_i , italic_j - 1 ) ) (8)

We show in Fig. 3 the grid structures near a refinement boundary with a refinement ratio of 2. The deposition of charge density (ρ𝜌\rhoitalic_ρ) and current density (J𝐽\vec{J}over→ start_ARG italic_J end_ARG) are performed on each refinement level l>1𝑙1l>1italic_l > 1 with an extended mesh shown in Fig. 3 as the dashed-gray grid. For the equations where the gradient is not included in the source term, e.g., 2ψ=(ρJz)superscriptsubscriptperpendicular-to2𝜓𝜌subscript𝐽𝑧{\nabla_{\perp}^{2}\psi=-\left(\rho-J_{z}\right)}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_ψ = - ( italic_ρ - italic_J start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ), the deposited densities ρ𝜌\rhoitalic_ρ and J𝐽Jitalic_J are only required for the inner grids noted by solid dots. However, when there are terms including subscriptperpendicular-to\nabla_{\perp}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT present for the source term of Poisson like equations (e.g., in the equation for Bzsubscript𝐵𝑧B_{z}italic_B start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT) , the density ρ𝜌\rhoitalic_ρ and J𝐽Jitalic_J have to be deposited on the refinement boundary, shown as squares and triangles, which means particles outside the refinement mesh (shown as red dot) contributes to the source terms for the refined mesh. To handle this, we deposit the plasma particle quantities on the fine mesh with the domain extended by one coarse cell (shown as the dashed-gray grid) compared to the fine mesh used to solve the fields. To improve the efficiency, we choose a strategy where particles are only deposited on the finest extended mesh that encompasses them. Subsequently, the density on lower refinement levels, which overlaps an area with higher refinement levels, is obtained through a coarsening (averaging) process from the meshes of higher levels.

We next describe the structure for solving the discretized equations of Eq. 7. We use the Fast Fourier Transform (FFT) solver from the original QuickPIC to solve for the fields on the coarsest grid, denoted as level l=1𝑙1l=1italic_l = 1, which encompasses the entire simulation box. We then interpolate these fields, denoted as, Flsubscript𝐹𝑙F_{l}italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT, onto the the boundary of grid level l+1𝑙1l+1italic_l + 1 as its Dirichlet boundary condition for Fl+1subscript𝐹𝑙1F_{l+1}italic_F start_POSTSUBSCRIPT italic_l + 1 end_POSTSUBSCRIPT. For the refined grids at levels l>1𝑙1l>1italic_l > 1, a geometric multigrid solver (A) is used. The fields, Flmaxsubscript𝐹subscript𝑙𝑚𝑎𝑥F_{l_{max}}italic_F start_POSTSUBSCRIPT italic_l start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT end_POSTSUBSCRIPT, for the highest value of l𝑙litalic_l at the location of the particle, obtained by solving for the Poisson like equations, are used to advance both plasma particles in each 2D step (Eq. 2 and 3), as well as beam particles in each 3D step (Eq. 5).

2.1.3 Parallelization schemes in mesh refinement for load balance

The original QuickPIC utilized a hybrid parallelization approach where MPI is used across nodes and OpenMP is used within a node. This hybrid MPI-OpenMP parallelization together with a pipelining method provides high parallel scalability. Pipelining [35] takes advantage of the lack of /s𝑠\partial/\partial s∂ / ∂ italic_s in the field equations and causality. Once a 2D slice at a fixed s𝑠sitalic_s has been advanced to a value of ξ1subscript𝜉1\xi_{1}italic_ξ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, all the fields required to advance beam particles with ξξ1much-less-than𝜉subscript𝜉1\xi\ll\xi_{1}italic_ξ ≪ italic_ξ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT forward to a new value of s=s+Δs𝑠𝑠Δ𝑠s=s+\Delta sitalic_s = italic_s + roman_Δ italic_s are known. At this point a new 2D slice can be initialized at ξ=0𝜉0\xi=0italic_ξ = 0, and then advanced forward in ξ𝜉\xiitalic_ξ. Thus, a series of “stages” which correspond to advancing a 2D slice at a different value of s𝑠sitalic_s can be processed in parallel. However, when mesh refinement is included in the simulation with high refinement ratios, load balancing issues can arise due to the clustering of a refined mesh to one or two parallel partitions or a small number of stages.

To overcome this load balancing challenge, we employ two strategies. The first strategy focuses on the 2D field solves. In the original QuickPIC implementation, the coarse grid covering the entire simulation domain is divided into multiple partitions along the y𝑦yitalic_y-direction, with each partition occupying a separate MPI node and maintaining identical physical dimensions. However, in certain scenarios, computational load on the fine meshes may heavily concentrate on only a few MPI nodes, causing long wait time for other MPI nodes. To address this load imbalance issue, a mechanism is implemented: when the number of fine grids surpasses a predetermined threshold, field data and solving processes are redistributed across all processors. After the multigrid cycles are finished, the data is then gathered back to enable the pushing of particles that were not redistributed. The second strategy is aimed at addressing the pipelining algorithm. We divide the 3D grids into slabs with nonuniform thicknesses in ξ𝜉\xiitalic_ξ. The thickness of each slab is chosen such that the total number of grids, which includes all cells from the coarsest mesh and all refinement meshes within a slab, is close to the number of grids in every other slab. This technique helps to ensure that the computational load is balanced across the pipelining partitions.

2.2 Adaptive mesh refinement for evolving beams

In PWFA simulations, the size of the beam can vary significantly depending on the specific application. For instance, as beams propagate through plasma matching sections, where the plasma density changes adiabatically, the beam size can undergo drastic changes by several orders of magnitude [38, 39]. Even if a beam’s spot size is evolving, a static refinement domain can be used where the cell sizes resolve the smallest spot size for the evolving beam and the width of the box is larger than the largest spot size. However, the computational cost can become prohibitively expensive for cases where the beam size changes by more than one order of magnitude.

To address this issue, we have developed an adaptive mesh refinement scheme that allows the size and resolution of the refined mesh to dynamically adjust according to the beam’s changing size. We denote the transverse spot sizes of the beam as σxsubscript𝜎𝑥\sigma_{x}italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT and σysubscript𝜎𝑦\sigma_{y}italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT, the cell sizes of the finest mesh as ΔxsubscriptΔ𝑥\Delta_{x}roman_Δ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT and ΔysubscriptΔ𝑦\Delta_{y}roman_Δ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT, and the dimensions of the box size as lxsubscript𝑙𝑥l_{x}italic_l start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT and lysubscript𝑙𝑦l_{y}italic_l start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT. The parameters of the refined mesh (cell size and dimensions) are determined empirically, considering factors such as maintaining result consistency while avoiding anomalies near the boundary. For instance, in scenarios where we simulate ion motion induced by intense beams, we aim to maintain adequate resolution for both the beam size and ion motion while optimizing computational resources. To achieve this, we establish criteria such as 5Δxσx10Δx5subscriptΔ𝑥subscript𝜎𝑥10subscriptΔ𝑥5\Delta_{x}\leq\sigma_{x}\leq 10\Delta_{x}5 roman_Δ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ≤ italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ≤ 10 roman_Δ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT and 5Δyσy10Δy5subscriptΔ𝑦subscript𝜎𝑦10subscriptΔ𝑦5\Delta_{y}\leq\sigma_{y}\leq 10\Delta_{y}5 roman_Δ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ≤ italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ≤ 10 roman_Δ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT. Additionally, we set the box size to ensure that it surrounds the whole beam while reducing numerical errors. For example, we may use 3σxlx10σx3subscript𝜎𝑥subscript𝑙𝑥10subscript𝜎𝑥3\sigma_{x}\leq l_{x}\leq 10\sigma_{x}3 italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ≤ italic_l start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ≤ 10 italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT and 3σyly10σy3subscript𝜎𝑦subscript𝑙𝑦10subscript𝜎𝑦3\sigma_{y}\leq l_{y}\leq 10\sigma_{y}3 italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ≤ italic_l start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ≤ 10 italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT as our criteria. These parameters can also be adjusted if a higher resolution is required or if there are abnormalities near the boundary.

3 Benchmark test of mesh refinement code and performance evaluations

The mesh refinement code is an effective tool for simulating applications that require ultra-high resolution in specific small regions. However, achieving high refinement ratios can be challenging as simulation errors may be amplified by inaccuracies at the refinement boundaries. Moreover, performing fine resolution everywhere in 3D quasi-static simulations can be computationally expensive and memory-intensive. As a result, the “true” results for problems of interest may not be available for comparison. For these reasons, benchmarking the mesh refinement algorithm must be done through a variety of methods.

In this section, we present benchmarks of the mesh refinement code for two bunch PWFA simulations where wakes from electron beam drivers accelerate witness beams of either electrons or positrons. In some cases we conduct simulations using parameters from previous publications. We evaluate the accuracy and efficiency of the mesh refinement code in scenarios requiring ultra-high resolution only in small regions. We consider some cases where there is a high degree of azimuthal symmetry. This allows us to compare mesh refinement results obtained from QuickPIC with those from QPAD, where high resolution is applied across the entire simulation domain. For the positron witness beam case, it is possible to compare the mesh refinement results with a one-step QuickPIC simulation where the finest resolution is used throughout. Additionally, we investigate the mesh refinement algorithm’s performance in a scenario featuring a high degree of azimuthal asymmetry in the witness beam’s transverse cross-section. This case is also compared with a one-step QuickPIC simulations employing the finest resolution across the entire domain. By carefully assessing the performance of the mesh refinement code for these scenarios, we can better understand its strengths and limitations and identify opportunities for further improvement.

3.1 A symmetric PWFA simulation with ion motion

Emittance growth, resulting from the perturbation of focusing forces due to ion motion induced by tightly focused, matched beams, is a topic of importance for plasma based acceleration [27]. This was previously investigated for PWFA in the blowout regime using QuickPIC [28]. However, the simulation technique used in that study was not entirely self-consistent. Simulations covering the whole simulation domain were carried out with the finest resolution possible at that time. Based on those results they then isolated the evolution of the witness beam by simulating only a small region of the ion column which contained the witness beam with a very fine resolution, and surrounded it with a ring of immobile negative charge. This permitted an accurate examination for how the the ion motion affected the focusing fields but not the accelerating fields. Within this small region, they were able to use small enough cell sizes to resolve the ion collapse and witness beam spot size. This approach did not take into account the potential effects of the drive beam evolution on the ion motion nor how ion motion affects the accelerating fields.

Refer to caption
Refer to caption
Fig. 4: Setup for a mesh refinement simulation in a PWFA scenario with a symmetric trailing beam. (a) Two-dimensional cut of the three-dimensional charge density including plasma electrons and beams in the ξx𝜉𝑥\xi-xitalic_ξ - italic_x plane at y=0𝑦0y=0italic_y = 0. The red box surrounding the trailing beam represents the mesh refinement boundary with the highest resolution. (b) The zoomed-in grid setup near the trailing beam. All refinement meshes start at the same ξ𝜉\xiitalic_ξ. As the grid approaches the x=0𝑥0x=0italic_x = 0 axis, the resolution in the x𝑥xitalic_x direction progressively increases. In the illustration, for clarity, we present meshes with cell sizes eight times larger in x𝑥xitalic_x and sixteen times larger in ξ𝜉\xiitalic_ξ for each level, compared to the cell sizes employed in the actual simulation.

We re-examine the symmetric PWFA scenario in [28] with fully self-consistent simulations of the entire domain using the mesh refinement method. We simulate the ion motion with the symmetric beam parameters presented in [28], where a matched drive beam and trailing beam (both are bi-Gaussian with definitions of σrsubscript𝜎𝑟\sigma_{r}italic_σ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT and σzsubscript𝜎𝑧\sigma_{z}italic_σ start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT) are loaded in a uniform plasma with density n0=1.0×1017cm3subscript𝑛01.0superscript1017superscriptcm3n_{0}=1.0\times 10^{17}\mathrm{~{}cm}^{-3}italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 1.0 × 10 start_POSTSUPERSCRIPT 17 end_POSTSUPERSCRIPT roman_cm start_POSTSUPERSCRIPT - 3 end_POSTSUPERSCRIPT (Fig. 4 (a)). The initial energy of the drive beam and trailing beam are both 25GeV25GeV25~{}\mathrm{GeV}25 roman_GeV. The plasma skin depth is kp1=16.8μmsuperscriptsubscript𝑘𝑝116.8𝜇mk_{p}^{-1}=16.8~{}\mathrm{\mu m}italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT = 16.8 italic_μ roman_m. The matched drive beam has an rms spot size of σrd=10.37μmsubscript𝜎𝑟𝑑10.37𝜇m\sigma_{rd}=10.37~{}\mu\mathrm{m}italic_σ start_POSTSUBSCRIPT italic_r italic_d end_POSTSUBSCRIPT = 10.37 italic_μ roman_m and pulse length of σzd=30.0μmsubscript𝜎𝑧𝑑30.0𝜇m\sigma_{zd}=30.0~{}\mu\mathrm{m}italic_σ start_POSTSUBSCRIPT italic_z italic_d end_POSTSUBSCRIPT = 30.0 italic_μ roman_m. The trailing beam is loaded 115μm115𝜇m115~{}\mu\mathrm{m}115 italic_μ roman_m behind the drive beam with a spot size of σrt=0.1μmsubscript𝜎𝑟𝑡0.1𝜇m\sigma_{rt}=0.1~{}\mu\mathrm{m}italic_σ start_POSTSUBSCRIPT italic_r italic_t end_POSTSUBSCRIPT = 0.1 italic_μ roman_m and a pulse length of σzt=10μmsubscript𝜎𝑧𝑡10𝜇m\sigma_{zt}=10~{}\mu\mathrm{m}italic_σ start_POSTSUBSCRIPT italic_z italic_t end_POSTSUBSCRIPT = 10 italic_μ roman_m.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Fig. 5: Simulation results using the setup depicted in Fig. 4. (a) Lineouts of the focusing field ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT at y=0𝑦0y=0italic_y = 0 solved by the 4-level mesh refinement at different ξ𝜉\xiitalic_ξ values. We present the focusing fields for the coarsest level (L1) Ω1,1subscriptΩ11\Omega_{1,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT and refinement level 2 (L2) Ω2,2subscriptΩ22\Omega_{2,2}roman_Ω start_POSTSUBSCRIPT 2 , 2 end_POSTSUBSCRIPT. The trailing beam density is represented by the dotted-gray line. The focusing fields of level 1 (L1) at ξ=1.0,0.0,1.0𝜉1.00.01.0\xi=-1.0,0.0,1.0italic_ξ = - 1.0 , 0.0 , 1.0 are illustrated by the gray, red, and blue lines, respectively. The focusing fields of level 2 (L2) at ξ=1.0𝜉1.0\xi=-1.0italic_ξ = - 1.0 (dashed black), ξ=0.0𝜉0.0\xi=0.0italic_ξ = 0.0 (dashed red), and ξ=1.0𝜉1.0\xi=1.0italic_ξ = 1.0 (dashed blue) are also depicted. (b) Lineouts of the focusing field ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT at y=0𝑦0y=0italic_y = 0 for refinement levels 3 (L3) Ω3,2subscriptΩ32\Omega_{3,2}roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT and 4 (L4) Ω4,2subscriptΩ42\Omega_{4,2}roman_Ω start_POSTSUBSCRIPT 4 , 2 end_POSTSUBSCRIPT. The dotted-gray line represents the trailing beam density. The dashed lines represent focusing fields of level 4 (L4) at ξ=1.0(dashed black),0.0(dashed red),1.0(dashed blue)𝜉1.0(dashed black)0.0(dashed red)1.0(dashed blue)\xi=-1.0~{}\text{(dashed black)},0.0~{}\text{(dashed red)},1.0~{}\text{(dashed% blue)}italic_ξ = - 1.0 (dashed black) , 0.0 (dashed red) , 1.0 (dashed blue). The gray line, red line and blue line represent the focusing field of level 3 (L3) at ξ=1.0,0.0,1.0𝜉1.00.01.0\xi=-1.0,0.0,1.0italic_ξ = - 1.0 , 0.0 , 1.0 respectively. (c) Lineouts of the focusing field ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT at y=0𝑦0y=0italic_y = 0 solved by mesh refinement with only 2 levels at different ξ𝜉\xiitalic_ξ values. Here we show focusing fields of the coarsest level (L1) Ω1,1subscriptΩ11\Omega_{1,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT and refinement level 2 (L2) Ω2,6subscriptΩ26\Omega_{2,6}roman_Ω start_POSTSUBSCRIPT 2 , 6 end_POSTSUBSCRIPT. It’s noteworthy that level 2 has the same resolution as level 4 in the previous 4-level refinement simulation. The dotted-gray line represents the trailing beam density. The gray line, red line and blue line represent the focusing fields of level 1 (L1) at ξ=1.0,0.0,1.0𝜉1.00.01.0\xi=-1.0,0.0,1.0italic_ξ = - 1.0 , 0.0 , 1.0 respectively. The dashed lines represent focusing fields of level 2 (L2) at ξ=1.0(dashed-black),0.0(dashed-red),1.0(dashed-blue)𝜉1.0(dashed-black)0.0(dashed-red)1.0(dashed-blue)\xi=-1.0~{}\text{(dashed-black)},0.0~{}\text{(dashed-red)},1.0~{}\text{(dashed% -blue)}italic_ξ = - 1.0 (dashed-black) , 0.0 (dashed-red) , 1.0 (dashed-blue). With only one level of high resolution refinement, the field near the refinement boundary show abnormalities. (d) The emittance evolution of the trailing beam using mesh refinement, both projected (dashed-green) and in slices at ξ=1𝜉1\xi=-1italic_ξ = - 1 (brown) and ξ=1.0𝜉1.0\xi=1.0italic_ξ = 1.0 (blue), is shown. The projected emittance growth of the trailing beam, simulated by QPAD, is presented as the dashed-red line, and QuickPIC coarse resolution without mesh refinement is depicted by the dashed-black line.

For the coarsest grid, we use a simulation box with 1024×1024×10241024102410241024\times 1024\times 10241024 × 1024 × 1024 cells and a ±12.0×±12.0×13.0kp1\pm 12.0\times\pm 12.0\times 13.0~{}k_{p}^{-1}± 12.0 × ± 12.0 × 13.0 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT physical dimension in x,y𝑥𝑦x,yitalic_x , italic_y, and ξ𝜉\xiitalic_ξ, respectively. The resolution of the coarse grid is 0.0234×0.0234×0.0127kp10.02340.02340.0127superscriptsubscript𝑘𝑝10.0234\times 0.0234\times 0.0127~{}k_{p}^{-1}0.0234 × 0.0234 × 0.0127 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT, corresponding to 393.86×393.86×213.34nm393.86393.86213.34nm393.86\times 393.86\times 213.34\mathrm{~{}nm}393.86 × 393.86 × 213.34 roman_nm. This resolution is insufficient to resolve the spot size of the trailing beam. The finest resolution of the refined grid is 6.15×6.15×213.34nm6.156.15213.34nm6.15\times 6.15\times 213.34\mathrm{~{}nm}6.15 × 6.15 × 213.34 roman_nm, where the transverse grid size is 64646464 times smaller than the coarsest grid. This finer resolution matches the resolution used in the isolated small domain described in [28] .

We use four refinement levels denoted by Ω1,1,Ω2,2,Ω3,2,Ω4,2subscriptΩ11subscriptΩ22subscriptΩ32subscriptΩ42\Omega_{1,1},\Omega_{2,2},\Omega_{3,2},\Omega_{4,2}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 2 , 2 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 4 , 2 end_POSTSUBSCRIPT to gradually change the resolutions to h4,2=h1,1/64subscript42subscript1164h_{4,2}=h_{1,1}/64italic_h start_POSTSUBSCRIPT 4 , 2 end_POSTSUBSCRIPT = italic_h start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT / 64 (Fig. 4 (b)). We define the trailing beam center as (0.0,0.0,0.0)0.00.00.0(0.0,0.0,0.0)( 0.0 , 0.0 , 0.0 ) in Cartesian coordinates. The domain of the grid with the finest resolution Ω4,2subscriptΩ42\Omega_{4,2}roman_Ω start_POSTSUBSCRIPT 4 , 2 end_POSTSUBSCRIPT extends to ±0.023kp1plus-or-minus0.023superscriptsubscript𝑘𝑝1\pm 0.023~{}k_{p}^{-1}± 0.023 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT in both x𝑥xitalic_x and y𝑦yitalic_y direction, and starts from 2.7kp12.7superscriptsubscript𝑘𝑝1-2.7~{}k_{p}^{-1}- 2.7 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT and ends at 1.15kp11.15superscriptsubscript𝑘𝑝11.15~{}k_{p}^{-1}1.15 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT in the ξ𝜉\xiitalic_ξ direction. The other refinement levels are initialized to have the same dimension in ξ𝜉\xiitalic_ξ. The dimensions of the second refinement level Ω2,2subscriptΩ22\Omega_{2,2}roman_Ω start_POSTSUBSCRIPT 2 , 2 end_POSTSUBSCRIPT are ±0.12kp1plus-or-minus0.12superscriptsubscript𝑘𝑝1\pm 0.12~{}k_{p}^{-1}± 0.12 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT in the x𝑥xitalic_x and y𝑦yitalic_y directions, respectively. The third refinement level Ω3,2subscriptΩ32\Omega_{3,2}roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT has dimensions of ±0.047kp1plus-or-minus0.047superscriptsubscript𝑘𝑝1\pm 0.047~{}k_{p}^{-1}± 0.047 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT in the x𝑥xitalic_x and y𝑦yitalic_y directions.

Figs. 5 (a) and (b) present the focusing field ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT in the x𝑥xitalic_x direction for various slices in ξ𝜉\xiitalic_ξ obtained using mesh refinement with multiple refinement levels Ω1,1,Ω2,2,Ω3,2,Ω4,2subscriptΩ11subscriptΩ22subscriptΩ32subscriptΩ42\Omega_{1,1},\Omega_{2,2},\Omega_{3,2},\Omega_{4,2}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 2 , 2 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 4 , 2 end_POSTSUBSCRIPT. The fields correspond to when the drive beam has propagated one s𝑠sitalic_s time step, 10.0kp110.0superscriptsubscript𝑘𝑝110.0~{}k_{p}^{-1}10.0 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT, into the plasma. As can be seen, from Fig. 5 (b), the values for ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT and its gradient both smoothly match between levels 3 and 4. To illustrate the benefits of employing multiple refinement levels with progressively changing resolutions, we also present a one step simulation in Fig. 5 (c) featuring only two levels Ω1,1,Ω2,6subscriptΩ11subscriptΩ26\Omega_{1,1},\Omega_{2,6}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 2 , 6 end_POSTSUBSCRIPT. The resolution of the fine mesh is identical to that of L4 shown in Fig. 5 (b). In this case, spurious fields near the refinement boundary are observed (Fig. 5 (c) near x=±0.07c/ωp𝑥plus-or-minus0.07𝑐subscript𝜔𝑝x=\pm 0.07~{}c/\omega_{p}italic_x = ± 0.07 italic_c / italic_ω start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT). Recall that in QuickPIC, the focusing field of beam particles is indirectly solved by the gradient of ψ𝜓\psiitalic_ψ: E+z^×B=ψsubscript𝐸perpendicular-to^𝑧subscript𝐵perpendicular-tosubscriptperpendicular-to𝜓\vec{E}_{\perp}+\hat{z}\times\vec{B}_{\perp}=-\nabla_{\perp}\psiover→ start_ARG italic_E end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT + over^ start_ARG italic_z end_ARG × over→ start_ARG italic_B end_ARG start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT = - ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT italic_ψ, with ψ𝜓\psiitalic_ψ solved by 2ψ=(ρJz)superscriptsubscriptperpendicular-to2𝜓𝜌subscript𝐽𝑧\nabla_{\perp}^{2}\psi=-\left(\rho-J_{z}\right)∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_ψ = - ( italic_ρ - italic_J start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ). As described above, we only match the Dirichlet boundary for each level of refinement when solving ψ𝜓\psiitalic_ψ; thus the gradient is not matched. We note that we have experimented with iterating back and forth between coarse and fine meshes such that both Dirichlet and Neumann conditions are satisfied. This does lead to smaller spurious signals near the boundary, however, this requires a more complicated source deposit. We find that the use of Dirichlet boundary conditions works well particularly if the boundaries are chosen far enough away from high order fields or sources. With only two refinement levels, bilinear interpolation at the boundary can introduce significant errors, resulting in the abnormal fields near the refinement boundary as shown in Fig. 5 (c). Therefore, utilizing multiple refinement levels provides more accurate solutions near the boundary and reduces errors caused by discrepancies in the field gradients. We note that for the case with 4 levels the results within the L4 domain in Fig. 5 (b) look similar to those for the L2 domain in Fig. 5 (c) except at the boundary. Hence, by setting the refinement boundary far away from the trailing beam, the wakefield near the beam for only two levels can closely approximate what we observe with the four levels of refinement.

Additionally, in Fig. 5 (d) we present the emittance growth over long propagation distances obtained using four levels of mesh refinement Ω1,1,Ω2,2,Ω3,2,Ω4,2subscriptΩ11subscriptΩ22subscriptΩ32subscriptΩ42\Omega_{1,1},\Omega_{2,2},\Omega_{3,2},\Omega_{4,2}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 2 , 2 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 4 , 2 end_POSTSUBSCRIPT, and the same setup as shown in Figs. 5 (a)(b). Using QPAD, we can simulate the entire domain using the finest resolution. All normalized beam and plasma parameters are kept the same, and the agreement can be seen in Fig. 5 (d) where the emittance growth from the QPAD simulation is shown. Through self-consistent mesh refinement simulations, we obtained emittance evolution that is also consistent with the results from [28], that only modeled a small region of the ion channel. It is noteworthy that when employing only the coarse mesh Ω1,1subscriptΩ11\Omega_{1,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT without mesh refinement, the emittance growth from ion motion cannot be fully resolved, as indicated by the dashed-black line in Fig. 5 (d).

3.2 PWFA simulation with ion motion for an asymmetric trailing beam

As mentioned above, for simulations characterized by high degrees of azimuthal symmetry, the quasi-3D QS code QPAD, can be used to greatly reduce the computational requirements by truncating the number of azimuthal modes to a low number. Additionally, fine resolution can be used throughout in QPAD. However, in certain PWFA applications, such as those involving linear collider parameters, the disparity in spot sizes between different transverse directions can be significant. In such scenarios, a quasi-3D QS code like QPAD may necessitate more than ten azimuthal modes, resulting in slower computation speeds and increased memory requirements.

With mesh refinement, the computational time and memory costs for a 3D quasi-static simulation need not increase significantly if the refined grids remain confined to a smaller region. We next benchmark the mesh refinement algorithm in a case where the trailing beam exhibits large asymmetry and significant ion motion is triggered. We compare the emittance growth from the mesh refinement simulation, where the entire wakefield is modeled, with the results from the reduced-domain simulation as presented in [28]. Additionally, we compare the focusing fields at a single 3D time step with those obtained from a QuickPIC simulation where the finest grid size is applied throughout the entire simulation domain. We note that this is feasible because in this case the finest resolution is coarser than that required for the symmetric case described earlier as the ion collapse is not as severe or narrow as was the case for the symmetric case.

Refer to caption
Refer to caption
Fig. 6: PWFA simulation with mesh refinement for an asymmetric trailing beam. (a) Two-dimensional ξx𝜉𝑥\xi-xitalic_ξ - italic_x slices of the three-dimensional data at y=0𝑦0y=0italic_y = 0 for the charge density of plasma electrons excited by a bi-Gaussian drive beam and an asymmetric trailing beam. The red box surrounding the trailing beam represents the mesh refinement boundary with the highest resolution. (b) Two-dimensional ξy𝜉𝑦\xi-yitalic_ξ - italic_y slices of the three-dimensional data at x=0𝑥0x=0italic_x = 0 for the charge density of plasma electrons excited by a bi-Gaussian drive beam and an asymmetric trailing beam. The red box surrounding the trailing beam represents the mesh refinement boundary with the highest resolution.

We perform a PWFA simulation with the same drive beam parameters and plasma density as the symmetric PWFA simulation in Sec. 3.1, but with an asymmetric trailing beam. The same parameters were also investigated in [28]. The center of the trailing beam is loaded 115μm115𝜇m115~{}\mathrm{\mu m}115 italic_μ roman_m behind the center of the drive beam and initialized with emittances ϵNx=2.0μm,ϵNy=0.005μmformulae-sequencesubscriptitalic-ϵ𝑁𝑥2.0𝜇msubscriptitalic-ϵ𝑁𝑦0.005𝜇m\epsilon_{Nx}=2.0\mathrm{~{}\mu m},\epsilon_{Ny}=0.005\mathrm{~{}\mu m}italic_ϵ start_POSTSUBSCRIPT italic_N italic_x end_POSTSUBSCRIPT = 2.0 italic_μ roman_m , italic_ϵ start_POSTSUBSCRIPT italic_N italic_y end_POSTSUBSCRIPT = 0.005 italic_μ roman_m in the transverse plane. The initial spot sizes are σx=463.9nmsubscript𝜎𝑥463.9nm\sigma_{x}=463.9\mathrm{~{}nm}italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT = 463.9 roman_nm and σy=23.2nmsubscript𝜎𝑦23.2nm\sigma_{y}=23.2\mathrm{~{}nm}italic_σ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT = 23.2 roman_nm (Figs. 6 (a) and (b)) which are the matched spot sizes for the unperturbed focusing field. The same simulation box with identical cells and physical dimensions as described in Sec. 3.1 is used for the coarsest grid. In this simulation we use three refinement levels Ω1,1,Ω2,2,Ω3,2subscriptΩ11subscriptΩ22subscriptΩ32\Omega_{1,1},\Omega_{2,2},\Omega_{3,2}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 2 , 2 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT where the grid is shown in Fig. 7 (a), and the refinement domains are chosen so that increasing resolution or the physical dimension does not impact the results within the desired accuracy. The finest grid resolution is 16161616 times smaller than the coarsest grid resolution and has a rectangular shape where the grid boundaries are at lx,ly=±0.26,±0.07kp1formulae-sequence𝑙𝑥𝑙𝑦plus-or-minus0.26plus-or-minus0.07superscriptsubscript𝑘𝑝1lx,ly=\pm 0.26,\pm 0.07~{}k_{p}^{-1}italic_l italic_x , italic_l italic_y = ± 0.26 , ± 0.07 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT. The resolution of the finest mesh is 0.0015kp10.0015superscriptsubscript𝑘𝑝10.0015~{}k_{p}^{-1}0.0015 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT, which resolves the smaller transverse spot size of the trailing beam.

Figs. 7 (b) and (c) present the focusing field ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT and Ey+Bxsubscript𝐸𝑦subscript𝐵𝑥E_{y}+B_{x}italic_E start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT + italic_B start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT obtained using mesh refinement on Ω3,2subscriptΩ32\Omega_{3,2}roman_Ω start_POSTSUBSCRIPT 3 , 2 end_POSTSUBSCRIPT for various slices in ξ𝜉\xiitalic_ξ. The fields correspond to when the drive beam has propagated one s𝑠sitalic_s time step 10.0kp110.0superscriptsubscript𝑘𝑝110.0~{}k_{p}^{-1}10.0 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT into the plasma. The results agree with the full 3D QuickPIC simulation that used the finest resolution 0.0015kp10.0015superscriptsubscript𝑘𝑝10.0015~{}k_{p}^{-1}0.0015 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT uniformly throughout the simulation window. The emittance growth of the trailing beam in the x and y directions is shown in Fig. 7 (d), where the larger emittance in x𝑥xitalic_x, ϵNxsubscriptitalic-ϵ𝑁𝑥\epsilon_{Nx}italic_ϵ start_POSTSUBSCRIPT italic_N italic_x end_POSTSUBSCRIPT, grows by only 11%percent1111\%11 %, and ϵNysubscriptitalic-ϵ𝑁𝑦\epsilon_{Ny}italic_ϵ start_POSTSUBSCRIPT italic_N italic_y end_POSTSUBSCRIPT grows by 155%percent155155\%155 %. The emittance growth we obtained is slightly higher than but still close to that found in the high resolution Ref. [28], validating the effectiveness of mesh refinement code for highly asymmetric problems. We note that in both the symmetric and asymmetric witness beam simulations, we did not incorporate quasi-adiabatic matching sections [39], which can mitigate emittance growth effectively.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Fig. 7: This figure illustrates the refined meshes and presents simulation results using the setup depicted in Fig. 6. (a) A zoomed-in slice in the xy𝑥𝑦x-yitalic_x - italic_y plane at ξ=0𝜉0\xi=0italic_ξ = 0 depicting the trailing beam density of level 1. A quarter of the beam is shown, with symmetry along both the x𝑥xitalic_x and y𝑦yitalic_y axes. We also show the refined grid with levels of progressively varying resolutions that covers the trailing beam. To distinctly illustrate the nesting of levels in the figure, we present meshes with cell sizes four times larger for each level compared to the sizes employed in the simulation. (b) Lineouts of the focusing field ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT along x𝑥xitalic_x at y=0𝑦0y=0italic_y = 0 for various slices of the trailing beam from a mesh refinement simulation. The dotted-gray line represents the beam density of the trailing beam. The focusing field at slices ξ=𝜉absent\xi=italic_ξ = -0.45 , 0.0 , 0.45 is shown as dashed-black, dashed-red and dashed-blue line for mesh refinement solution at level 3, which agrees with the fine-resolution everywhere QuickPIC solution at ξ=𝜉absent\xi=italic_ξ = -0.45 (gray) , 0.0 (red), 0.45 (blue). (c) Lineouts of the focusing field Ey+Bxsubscript𝐸𝑦subscript𝐵𝑥E_{y}+B_{x}italic_E start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT + italic_B start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT along y𝑦yitalic_y at x=0𝑥0x=0italic_x = 0 for various slices of the trailing beam from a mesh refinement simulation. The dotted-gray line represents the beam density of the trailing beam. The focusing field at slices ξ=𝜉absent\xi=italic_ξ = -0.45 , 0.0 , 0.45 is shown as dashed-black, dashed-red and dashed-blue line for mesh refinement solution at level 3, which agrees with the fine-resolution everywhere QuickPIC solution at ξ=𝜉absent\xi=italic_ξ = -0.45 (gray) , 0.0 (red), 0.45 (blue). (d) Normalized emittance growth in the x𝑥xitalic_x plane, denoted as ϵNxsubscriptitalic-ϵ𝑁𝑥\epsilon_{Nx}italic_ϵ start_POSTSUBSCRIPT italic_N italic_x end_POSTSUBSCRIPT (red line), and in the y𝑦yitalic_y plane, denoted as ϵNysubscriptitalic-ϵ𝑁𝑦\epsilon_{Ny}italic_ϵ start_POSTSUBSCRIPT italic_N italic_y end_POSTSUBSCRIPT (blue line). Additionally, the normalized emittance growth simulated with coarse resolution without mesh refinement is shown as dashed lines (red in the x𝑥xitalic_x plane, blue in the y𝑦yitalic_y plane).

3.3 Simulation of plasma-based positron acceleration

Simulating plasma-based positron acceleration with mesh refinement introduces additional challenges. Several PBA schemes have been proposed to accelerate positron beams in plasma [40, 41, 42, 43, 44]. In many of these regimes, the focusing field is generated by a narrow electron filament that forms along the axis. Setting up a refinement mesh around the positron beam can have a large cluster of particles crossing the refinement boundary. Previous studies have shown that particles passing the refinement boundary can suffer from spurious self-forces [36]. In this study, we do not explicitly examine the self-force issue that arises as particles cross the boundary; rather we mitigate spurious boundary effects by carefully establishing a hierarchy of resolution layers and positioning the refinement boundary away from clusters of a large number of particles. Subsequently, we compare the fields solved by mesh refinement with those obtained using the QuickPIC where a fine mesh is used for the entire simulation domain.

Refer to caption
Refer to caption
Refer to caption
Fig. 8: Mesh refinement simulation results of positron acceleration using a two-beam setup, the one-step results are compared with a fine-resolution everywhere QuickPIC simulation. (a) A cross-section of the three-dimensional charge density data for plasma electrons excited by a bi-Gaussian drive electron beam centered at ξ=5.9𝜉5.9\xi=-5.9italic_ξ = - 5.9 and a trailing positron beam loaded at ξ=0.0𝜉0.0\xi=0.0italic_ξ = 0.0. The charge density of both the drive beam and the following beam is also illustrated. (b) The focusing field for various slices of the trailing beam solved by mesh refinement. The dotted-gray line represents the beam density of the trailing beam. The focusing field at slices ξ=𝜉absent\xi=italic_ξ = -0.5, 0.0, 0.5 is shown as dashed-black, dashed-red and dashed-blue lines for the mesh refinement solution at level 4, which agrees with the fine-resolution everywhere QuickPIC solution at ξ=𝜉absent\xi=italic_ξ = -0.5 (gray), 0.0 (red), 0.5 (blue). (c) On-axis electric field Ez(ξ)subscript𝐸𝑧𝜉E_{z}(\xi)italic_E start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ( italic_ξ ) of the coarsest level (L1) Ω1,1subscriptΩ11\Omega_{1,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT (dash-dotted gray) and finest level (L4) Ω4,1subscriptΩ41\Omega_{4,1}roman_Ω start_POSTSUBSCRIPT 4 , 1 end_POSTSUBSCRIPT (dashed red) simulated by mesh refinement, the results agree with the fine-resolution everywhere QuickPIC solution (blue).

We present results on the use of mesh refinement in simulating positron acceleration using a two-beam setup consisting of an electron drive beam and a positron trailing beam. In Fig. 8 (a) we present a slice in the ξx𝜉𝑥\xi-xitalic_ξ - italic_x plane for the the total density (blue is net negative and red is net positive) for a two-beam simulation where the drive beam has a bi-Gaussian profile centered at kpξ=5.9subscript𝑘𝑝𝜉5.9k_{p}\xi=-5.9italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_ξ = - 5.9 with kpσz=0.6subscript𝑘𝑝subscript𝜎𝑧0.6k_{p}\sigma_{z}=0.6italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_σ start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT = 0.6, kpσr=0.3subscript𝑘𝑝subscript𝜎𝑟0.3k_{p}\sigma_{r}=0.3italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_σ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT = 0.3 and peak density n/n0=1.0𝑛subscript𝑛01.0n/n_{0}=1.0italic_n / italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 1.0. The trailing beam has a bi-Gaussian profile and is loaded at kpξ=0.0subscript𝑘𝑝𝜉0.0k_{p}\xi=0.0italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_ξ = 0.0 with kpσz=0.4subscript𝑘𝑝subscript𝜎𝑧0.4k_{p}\sigma_{z}=0.4italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_σ start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT = 0.4, kpσr=0.03subscript𝑘𝑝subscript𝜎𝑟0.03k_{p}\sigma_{r}=0.03italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_σ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT = 0.03 and peak density n/n0=50.0𝑛subscript𝑛050.0n/n_{0}=50.0italic_n / italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 50.0. The simulation window has a size of 12.0×12.0×10.0kp112.012.010.0superscriptsubscript𝑘𝑝112.0\times 12.0\times 10.0~{}k_{p}^{-1}12.0 × 12.0 × 10.0 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT in x,y,z𝑥𝑦𝑧x,y,zitalic_x , italic_y , italic_z, and the whole simulation domain is discretized into 512×512×10245125121024512\times 512\times 1024512 × 512 × 1024 coarse grids. We use four levels of refinement Ω1,1,Ω2,1,Ω3,1 and Ω4,1subscriptΩ11subscriptΩ21subscriptΩ31 and subscriptΩ41\Omega_{1,1},\Omega_{2,1},\Omega_{3,1}\text{ and }\Omega_{4,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 2 , 1 end_POSTSUBSCRIPT , roman_Ω start_POSTSUBSCRIPT 3 , 1 end_POSTSUBSCRIPT and roman_Ω start_POSTSUBSCRIPT 4 , 1 end_POSTSUBSCRIPT. The refinement meshes are shown in Fig. 8 (a) and the resolution in x𝑥xitalic_x and y𝑦yitalic_y is progressively increased to 0.003kp10.003superscriptsubscript𝑘𝑝10.003~{}k_{p}^{-1}0.003 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT that is 8888 times smaller than the coarsest resolution. In Fig. 8 (b) we show lineouts along x𝑥xitalic_x of the the focusing field, ExBysubscript𝐸𝑥subscript𝐵𝑦E_{x}-B_{y}italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT - italic_B start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT, for axial slices at ξ=0.5 (dashed-black),0.0 (dashed-red), and 0.5 (dashed-blue)𝜉0.5 (dashed-black)0.0 (dashed-red) and 0.5 (dashed-blue)\xi=-0.5\text{ (dashed-black)},0.0\text{ (dashed-red)},\text{ and }0.5\text{ (% dashed-blue)}italic_ξ = - 0.5 (dashed-black) , 0.0 (dashed-red) , and 0.5 (dashed-blue). A lineout of the positron beam density profile (dotted-gray) at ξ=0.0𝜉0.0\xi=0.0italic_ξ = 0.0 is shown for reference. Fig. 8 (c) shows the on-axis electric field Ez(ξ)subscript𝐸𝑧𝜉E_{z}(\xi)italic_E start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ( italic_ξ ) of the coarsest level (L1) Ω1,1subscriptΩ11\Omega_{1,1}roman_Ω start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT (dash-dotted gray) and finest level (L4) Ω4,1subscriptΩ41\Omega_{4,1}roman_Ω start_POSTSUBSCRIPT 4 , 1 end_POSTSUBSCRIPT (dashed red) simulated by mesh refinement. Without mesh refinement, the coarse resolution fails to resolve the narrow spike of electrons drawn to the axis, with a width of less than 0.0050.0050.0050.005. With four levels of refinement, both the focusing field and accelerating field agree with those obtained from a 3D QuickPIC simulation where fine resolution is used throughout, which is referred to as the reference case.

3.4 Adaptive mesh refinement for an evolving beam

To benchmark the adaptive mesh refinement module for evolving beams, we use the same parameter set described in Section 3.1 that produced Figs. 4 and 5. The position and charge of the trailing beam remain unchanged. However, instead of using a matched trailing beam with a spot size of 0.1μm=0.006kp10.1𝜇m0.006superscriptsubscript𝑘𝑝10.1~{}\mathrm{\mu m}=0.006~{}k_{p}^{-1}0.1 italic_μ roman_m = 0.006 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT, we use an initially unmatched monoenergetic trailing beam with a relativistic factor of γ=5000𝛾5000\gamma=5000italic_γ = 5000 and a spot size of σr=0.09kp1subscript𝜎𝑟0.09superscriptsubscript𝑘𝑝1\sigma_{r}=0.09~{}k_{p}^{-1}italic_σ start_POSTSUBSCRIPT italic_r end_POSTSUBSCRIPT = 0.09 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT, along with a momentum divergence of σp=0.1mecsubscript𝜎𝑝0.1subscript𝑚𝑒𝑐\sigma_{p}=0.1~{}m_{e}citalic_σ start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT = 0.1 italic_m start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT italic_c, where mesubscript𝑚𝑒m_{e}italic_m start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT is the electron mass. In this setup, we set the ion mass to be 200me200subscript𝑚𝑒200~{}m_{e}200 italic_m start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT instead of the proton mass 1836me1836subscript𝑚𝑒1836~{}m_{e}1836 italic_m start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT, relaxing the resolution requirement to resolve the ion motion for benchmarking. The spot size of the unmatched beam will evolve dramatically during the simulation (blue curve in Fig. 9 (d)). It reaches its minimum value at approximately 0.03kp10.03superscriptsubscript𝑘𝑝10.03~{}k_{p}^{-1}0.03 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT. The refinement box size and resolution will evolve with the beam size to include the beam and at the same time resolve the ion motion. In the simulation, the smallest grid size of the refinement mesh is 0.003kp10.003superscriptsubscript𝑘𝑝10.003~{}k_{p}^{-1}0.003 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT. The evolution of the region with the finest grid is shown in Figs. 9 (a) (b) and (c). This case has been tested on a local desktop, where a full resolution QuickPIC simulation would not be possible and instead it was run on a supercomputer. The evolution of emittance growth and spot size is shown in Fig. 9 (d). The results agree with a 0-mode QPAD simulation where a fine mesh with a resolution of 0.003kp10.003superscriptsubscript𝑘𝑝10.003~{}k_{p}^{-1}0.003 italic_k start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT is used throughout the entire domain and for all time steps.

Refer to caption
Fig. 9: The plot shows the evolution of emittance growth (ϵNx/ϵ0subscriptitalic-ϵ𝑁𝑥subscriptitalic-ϵ0\epsilon_{Nx}/\epsilon_{0}italic_ϵ start_POSTSUBSCRIPT italic_N italic_x end_POSTSUBSCRIPT / italic_ϵ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, indicated by the red line, ϵ0subscriptitalic-ϵ0\epsilon_{0}italic_ϵ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is the initial normalized emittance) and bunch size (σxsubscript𝜎𝑥\sigma_{x}italic_σ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT, represented by the blue line) of an unmatched trailing beam. The emittance growth (red line) and evolving spot size (blue line) simulated by the mesh refinement are compared with those obtained from QPAD (dashed-red line for emittance growth and dashed-blue line for spot size). The projected beam density on the transverse plane at ξ=0.3kβ1(a),0.8kβ1(b),1.5kβ1(c)𝜉0.3superscriptsubscript𝑘𝛽1(a)0.8superscriptsubscript𝑘𝛽1(b)1.5superscriptsubscript𝑘𝛽1(c)\xi=0.3~{}k_{\beta}^{-1}\text{(a)},0.8~{}k_{\beta}^{-1}\text{(b)},1.5~{}k_{% \beta}^{-1}\text{(c)}italic_ξ = 0.3 italic_k start_POSTSUBSCRIPT italic_β end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT (a) , 0.8 italic_k start_POSTSUBSCRIPT italic_β end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT (b) , 1.5 italic_k start_POSTSUBSCRIPT italic_β end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT (c) is also presented (we utilize a logarithmic scale for the particle density to visualize not only the high-density beam regions but also the low-density beam boundary). As the beam size changes, the refinement box size and resolution dynamically evolve to encompass the beam while simultaneously resolving the ion motion. The evolution of grids at the highest refinement level is shown on top of the beam density, highlighting the changes in mesh boundary and resolution corresponding to the beam size.

3.5 Performance evaluation

The mesh refinement code will accelerate the time to solution for the 3D simulation in QuickPIC due to the decrease in computational load from a reduction in cells in the transverse (x𝑥xitalic_x and y𝑦yitalic_y) and longitudinal (ξ𝜉\xiitalic_ξ) directions. However, quantifying the speed up is complicated as the algorithm includes field solves, particle pushes, and iterations. Furthermore, the number of particles per cell does not need to be kept constant as one decreases the cell sizes. The speedup of mesh refinement code highly depends on the scale difference of the physics problem, and has the best performance where the simulation only requires high resolution at a small region and can use a coarser resolution elsewhere, and where the refinement ratio is large. However, for such a problem, the nonuniform grid in mesh refinement will influence the load balance and limit the parallelization scaling in the transverse direction. As mentioned before, we distribute the refined meshes to other MPI ranks and use pipelining to boost the performance of these problems.

To assess the potential speedup achievable with the mesh refinement approach, we examine several scenarios where uniform-grid QuickPIC simulations can be conducted across the entire simulation domain. The estimated speedup is based on simulations tested on NERSC Perlmutter nodes. In Section 3.2, we conducted simulations involving an asymmetric electron witness beam inducing ion motion. Employing mesh refinement with a maximum refinement ratio of 16 and 1024×1024×10241024102410241024\times 1024\times 10241024 × 1024 × 1024 cells for the coarsest resolution, we achieved speedup of around 350 compared to a fully resolved QuickPIC simulation for a single s𝑠sitalic_s step simulation. The mesh refinement simulation used inhomogeneous particle loading and loaded 1 ion particle per cell regardless of the cell size and the uniform-grid simulation loads 1 particle per cell. In Section 3.3, the positron simulation utilized a grid size of 512×512×10245125121024512\times 512\times 1024512 × 512 × 1024 cells for the coarsest resolution, with a refinement ratio of 8. In this case, the speedup achieved with mesh refinement was approximately 80 compared to the fine resolution everywhere simulation. It is worth noting that the speed-up in this scenario is relatively modest due to the smaller refinement ratio. As noted above, we fixed the particles per cell regardless of the cell size. Thus, a lot of the particles are clustered in a few MPI partitions and this can cause load imbalance. Further optimization of particle operation load balancing could improve computational efficiency in this context.

4 Conclusion

We describe a mesh refinement algorithm developed to accelerate full 3D QuickPIC simulations of two bunch PWFA simulations. The code applies high-resolution refined meshes in specific regions, typically surrounding the trailing beam in two bunch PWFA simulations, and the grid sizes of those meshes progressively change to coarser resolutions in the remaining parts of the simulation domain. Currently, the algorithm uses square cells in the two transverse directions. The cross section of the refined domains also needs to be rectangular but this is not a severe limitation. A fast multigrid Poisson solver has been implemented to solve the refined meshes, and the solver has been parallelized with both MPI and OpenMP. The coarsest mesh can be solved by both FFT and multigrid Poisson solvers. The code also enables inhomogeneous particle loading, where we can initialize more plasma particles inside the refined meshes. We resolve unbalanced computational load of the field solver by spreading fine grids that are usually clustered in one location into all processors, and gathering them back after solving the Poisson equation on refined meshes. The scalability of the code has also been improved significantly by using pipelining. We also developed a preliminary adaptive mesh refinement by choosing certain refined mesh domains and grid sizes during the simulation to save the computational time for simulations with an evolving beam size. Several methods have been used to benchmark the mesh refinement algorithm. The evolution of both symmetric and asymmetric witness beams have been simulated with ion motion. For the symmetric electron witness beam, the emittance growth simulated by mesh refinement is consistent with the quasi-3D QPAD simulations with fine resolution throughout the entire simulation domain. We have demonstrated that the use of multiple levels of refinement greatly reduces spurious fields near the boundaries between different levels of refinement. Additionally, we show that the mesh refinement code can be applied to simulate PWFA with high degrees of azimuthal asymmetry. For the symmetric witness positron beam, a single time step simulation with mesh refinement agrees with fully resolved 3D QuickPIC. An example of adaptive mesh refinement has also been presented and the results agree with QPAD. On problems of interests, speed-ups between 10100similar-to1010010\sim 10010 ∼ 100 has been found.

Acknowledgements

This worked was supported by the U.S. Department of Energy (DOE), Offices of Advanced Scientific Computing Research and of High Energy Physics (HEP) through the Scientific Discovery through Advanced Computing (SciDAC) project, ComPASS-4, under Contract Nos. DE-AC02-06CH11357 and DE-AC02-05CH11231, and a FNAL subcontract 644405, and by a DOE HEP grant DE SC0010064, and by the U.S. National Science Foundation through award # 2108970. We also acknowledge useful conversations with Dr. Carlo Benedetti.

Appendix A

Multigrid methods [45] have emerged as powerful techniques for efficiently solving differential equations within arbitrary spatial domains and for complex boundary conditions. Here we describe in detail the multigrid algorithm we use to solve for the fields on a refined mesh. This multigrid solver employs the V-cycle approach, which combines restriction, interpolation and smoothing operations. Recall that previously we defined Ωl,rsubscriptΩ𝑙𝑟\Omega_{l,r}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT as the domain for the refinement grid at level l𝑙litalic_l with refinement ratio 2rsuperscript2𝑟2^{r}2 start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT between the current level l𝑙litalic_l and the next coarser level, l1𝑙1l-1italic_l - 1. To solve the Poisson like equations on Ωl,rsubscriptΩ𝑙𝑟\Omega_{l,r}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT, a hierarchy of grids is established by iteratively reducing the grid points in both the x𝑥xitalic_x and y𝑦yitalic_y directions by factors of 2. This set of meshes is denoted as Ωl,msubscriptΩ𝑙𝑚\Omega_{l,m}roman_Ω start_POSTSUBSCRIPT italic_l , italic_m end_POSTSUBSCRIPT. For refinement level l𝑙litalic_l, where Mlsubscript𝑀𝑙M_{l}italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT meshes are created for the multigrid algorithm, we denote these meshes as Ωl,rsubscriptΩ𝑙𝑟\Omega_{l,r}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r end_POSTSUBSCRIPT, Ωl,r1subscriptΩ𝑙𝑟1\Omega_{l,r-1}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r - 1 end_POSTSUBSCRIPT, …, Ωl,rMl+1subscriptΩ𝑙𝑟subscript𝑀𝑙1\Omega_{l,r-M_{l}+1}roman_Ω start_POSTSUBSCRIPT italic_l , italic_r - italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT and the grid sizes of these meshes varies from hlsubscript𝑙h_{l}italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT to 2Ml1hlsuperscript2subscript𝑀𝑙1subscript𝑙2^{M_{l}-1}h_{l}2 start_POSTSUPERSCRIPT italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT italic_h start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT. We will establish such a hierarchy of grids for the field solution Fl,msubscript𝐹𝑙𝑚F_{l,m}italic_F start_POSTSUBSCRIPT italic_l , italic_m end_POSTSUBSCRIPT, correction El,msubscript𝐸𝑙𝑚E_{l,m}italic_E start_POSTSUBSCRIPT italic_l , italic_m end_POSTSUBSCRIPT, and residual Rl,msubscript𝑅𝑙𝑚R_{l,m}italic_R start_POSTSUBSCRIPT italic_l , italic_m end_POSTSUBSCRIPT, the definition of which will be explained when we discuss the multigrid algorithm. As an example, consider the l=2𝑙2l=2italic_l = 2 grid with r=1𝑟1r=1italic_r = 1, so the refinement ratio between level 2 and level 1 is 2. For simplicity, we assume this mesh is square, and the global indices ranging from 252 to 264 are created with resolution h2,1=h/2subscript212h_{2,1}=h/2italic_h start_POSTSUBSCRIPT 2 , 1 end_POSTSUBSCRIPT = italic_h / 2, denoted as Ω2,1subscriptΩ21\Omega_{2,1}roman_Ω start_POSTSUBSCRIPT 2 , 1 end_POSTSUBSCRIPT, and hhitalic_h is the resolution of l=1𝑙1l=1italic_l = 1. Subsequently, two additional meshes Ω2,0subscriptΩ20\Omega_{2,0}roman_Ω start_POSTSUBSCRIPT 2 , 0 end_POSTSUBSCRIPT and Ω2,1subscriptΩ21\Omega_{2,-1}roman_Ω start_POSTSUBSCRIPT 2 , - 1 end_POSTSUBSCRIPT, where the fields on these meshes are denoted as F2,0subscript𝐹20F_{2,0}italic_F start_POSTSUBSCRIPT 2 , 0 end_POSTSUBSCRIPT and F2,1subscript𝐹21F_{2,-1}italic_F start_POSTSUBSCRIPT 2 , - 1 end_POSTSUBSCRIPT, and lower resolutions, h2,0=2h2,1subscript202subscript21h_{2,0}=2h_{2,1}italic_h start_POSTSUBSCRIPT 2 , 0 end_POSTSUBSCRIPT = 2 italic_h start_POSTSUBSCRIPT 2 , 1 end_POSTSUBSCRIPT and h2,1=4h2,1subscript214subscript21h_{2,-1}=4h_{2,1}italic_h start_POSTSUBSCRIPT 2 , - 1 end_POSTSUBSCRIPT = 4 italic_h start_POSTSUBSCRIPT 2 , 1 end_POSTSUBSCRIPT, respectively are generated. The indices span from 126 to 132 for F2,0subscript𝐹20F_{2,0}italic_F start_POSTSUBSCRIPT 2 , 0 end_POSTSUBSCRIPT and 63 to 66 for F2,1subscript𝐹21F_{2,-1}italic_F start_POSTSUBSCRIPT 2 , - 1 end_POSTSUBSCRIPT. This recursive process leads to a pyramid of grids sharing the same boundary, each representing a progressively coarser level of resolution.

Algorithm 1 Multigrid cycle
1:function multigrid_solve(Fl,Slsubscript𝐹𝑙subscript𝑆𝑙F_{l},S_{l}italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT , italic_S start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT)
2:     Solve l=1𝑙1l=1italic_l = 1 field from 2F1=S1superscriptsubscriptperpendicular-to2subscript𝐹1subscript𝑆1\nabla_{\perp}^{2}F_{1}=S_{1}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT
3:     Initial value of F2=F2,r0subscript𝐹2subscriptsuperscript𝐹02𝑟F_{2}=F^{0}_{2,r}italic_F start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = italic_F start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT interpolated from F1subscript𝐹1F_{1}italic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT
4:     Calculate residual R2,r1=S22F2,r0subscriptsuperscript𝑅12𝑟subscript𝑆2superscriptsubscriptperpendicular-to2subscriptsuperscript𝐹02𝑟R^{1}_{2,r}=S_{2}-\nabla_{\perp}^{2}F^{0}_{2,r}italic_R start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT - ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT
5:     for Vcycle iteration n=1,2.𝑛12n=1,2....italic_n = 1 , 2 … . do \triangleright V-cycle
6:         for grids Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT on level 2 from Ω2,rsubscriptΩ2𝑟\Omega_{2,r}roman_Ω start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT, Ω2,r1subscriptΩ2𝑟1\Omega_{2,r-1}roman_Ω start_POSTSUBSCRIPT 2 , italic_r - 1 end_POSTSUBSCRIPT … to Ω2,rMl+1subscriptΩ2𝑟subscript𝑀𝑙1\Omega_{2,r-M_{l}+1}roman_Ω start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT do \triangleright Downward pass
7:              Restrict residual from finer mesh R2,mnsubscriptsuperscript𝑅𝑛2𝑚R^{n}_{2,m}italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT to coarse R2,m1nsubscriptsuperscript𝑅𝑛2𝑚1R^{n}_{2,m-1}italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m - 1 end_POSTSUBSCRIPT
8:         end for
9:         Solve 2E2,rMl+1n=R2,rMl+1nsuperscriptsubscriptperpendicular-to2subscriptsuperscript𝐸𝑛2𝑟subscript𝑀𝑙1subscriptsuperscript𝑅𝑛2𝑟subscript𝑀𝑙1\nabla_{\perp}^{2}E^{n}_{2,r-M_{l}+1}=R^{n}_{2,r-M_{l}+1}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT = italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT with the conjugate gradient solver
10:         for grids Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT from Ω2,rMl+2subscriptΩ2𝑟subscript𝑀𝑙2\Omega_{2,r-M_{l}+2}roman_Ω start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT + 2 end_POSTSUBSCRIPT, … to Ω2,rsubscriptΩ2𝑟\Omega_{2,r}roman_Ω start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT do \triangleright upward pass
11:              Interpolate correction E2,m1nsubscriptsuperscript𝐸𝑛2𝑚1E^{n}_{2,m-1}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m - 1 end_POSTSUBSCRIPT to E2,mnsubscriptsuperscript𝐸𝑛2𝑚E^{n}_{2,m}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT
12:              Smooth field E2,mnsubscriptsuperscript𝐸𝑛2𝑚E^{n}_{2,m}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT with the red-black GS algorithm
13:         end for
14:         Add correction to the solved field F2,rn=F2,rn1+E2,rnsubscriptsuperscript𝐹𝑛2𝑟subscriptsuperscript𝐹𝑛12𝑟subscriptsuperscript𝐸𝑛2𝑟F^{n}_{2,r}=F^{n-1}_{2,r}+E^{n}_{2,r}italic_F start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT = italic_F start_POSTSUPERSCRIPT italic_n - 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT + italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT
15:         Calculate residual R2,rn+1=S22F2,rnsubscriptsuperscript𝑅𝑛12𝑟subscript𝑆2superscriptsubscriptperpendicular-to2subscriptsuperscript𝐹𝑛2𝑟R^{n+1}_{2,r}=S_{2}-\nabla_{\perp}^{2}F^{n}_{2,r}italic_R start_POSTSUPERSCRIPT italic_n + 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT - ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT
16:         if R2,rn+1<δdelimited-∥∥subscriptsuperscript𝑅𝑛12𝑟𝛿\lVert R^{n+1}_{2,r}\rVert<\delta∥ italic_R start_POSTSUPERSCRIPT italic_n + 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT ∥ < italic_δ  then
17:              Break
18:         end if
19:     end for
20:end function

As an example, consider solving Poisson’s equation 2Fl=Slsuperscriptsubscriptperpendicular-to2subscript𝐹𝑙subscript𝑆𝑙\nabla_{\perp}^{2}F_{l}=S_{l}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT, and assume there are only two levels of refinement, l𝑙litalic_l = 1 and 2, where the second level has a refinement ratio of 2rsuperscript2𝑟2^{r}2 start_POSTSUPERSCRIPT italic_r end_POSTSUPERSCRIPT, and the mesh is denoted as Ω2,rsubscriptΩ2𝑟\Omega_{2,r}roman_Ω start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT. Recall that the source terms, S1subscript𝑆1S_{1}italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and S2subscript𝑆2S_{2}italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT have been obtained from the particle deposition. The workflow of the multigrid V cycle for the l=2𝑙2l=2italic_l = 2 mesh is shown as Algorithm 1. After solving for the coarsest, l=1𝑙1l=1italic_l = 1 mesh F1=F1,1subscript𝐹1subscript𝐹11F_{1}=F_{1,1}italic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_F start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT with an FFT solver, the initial field F2,rn=0subscriptsuperscript𝐹𝑛02𝑟F^{n=0}_{2,r}italic_F start_POSTSUPERSCRIPT italic_n = 0 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT, including the boundary values, is interpolated from F1,1subscript𝐹11F_{1,1}italic_F start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT by the bilinear interpolation scheme. We use subscript n𝑛nitalic_n to represent current V-cycle number. M2subscript𝑀2M_{2}italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT meshes are created for the multigrid algorithm for the correction E2,msubscript𝐸2𝑚E_{2,m}italic_E start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT, residual R2,msubscript𝑅2𝑚R_{2,m}italic_R start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT and fields F2,msubscript𝐹2𝑚F_{2,m}italic_F start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT separately. We next start the V-cycle multigrid algorithm to solve 2F2=S2superscriptsubscriptperpendicular-to2subscript𝐹2subscript𝑆2\nabla_{\perp}^{2}F_{2}=S_{2}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT using the initial value of F2,r0subscriptsuperscript𝐹02𝑟F^{0}_{2,r}italic_F start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT interpolated from the F1subscript𝐹1F_{1}italic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT solution. For the n=1𝑛1n=1italic_n = 1 part of the V-cycle, the residual on Ω2,rsubscriptΩ2𝑟\Omega_{2,r}roman_Ω start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT is calculated by R2,rn=1S22F2,r0subscriptsuperscript𝑅𝑛12𝑟subscript𝑆2superscriptsubscriptperpendicular-to2subscriptsuperscript𝐹02𝑟R^{n=1}_{2,r}\equiv S_{2}-\nabla_{\perp}^{2}F^{0}_{2,r}italic_R start_POSTSUPERSCRIPT italic_n = 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT ≡ italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT - ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT, and this is then recursively been passed down (restricted) to coarser levels Ω2,r1subscriptΩ2𝑟1\Omega_{2,r-1}roman_Ω start_POSTSUBSCRIPT 2 , italic_r - 1 end_POSTSUBSCRIPT,…,Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT, … Ω2,rM2+1subscriptΩ2𝑟subscript𝑀21\Omega_{2,r-M_{2}+1}roman_Ω start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT with resolution (2h2,r2subscript2𝑟2h_{2,r}2 italic_h start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT,… , 2rmh2,rsuperscript2𝑟𝑚subscript2𝑟2^{r-m}h_{2,r}2 start_POSTSUPERSCRIPT italic_r - italic_m end_POSTSUPERSCRIPT italic_h start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT…, 2M21h2,rsuperscript2subscript𝑀21subscript2𝑟2^{M_{2}-1}h_{2,r}2 start_POSTSUPERSCRIPT italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT italic_h start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT). A technique called full weighting [45] is used to restrict the residual R2,mnsubscriptsuperscript𝑅𝑛2𝑚R^{n}_{2,m}italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT from finer grid levels Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT to coarser grid levels Ω2,m1subscriptΩ2𝑚1\Omega_{2,m-1}roman_Ω start_POSTSUBSCRIPT 2 , italic_m - 1 end_POSTSUBSCRIPT. This full weighting scheme effectively transfers information from finer grids to coarser grids and can be represented by the following equation:

R2,m1n(i,j)=1/4[R2,mn(2i,2j)]+1/8[R2,mn(2i+1,2j)+R2,mn(2i1,2j)\displaystyle R^{n}_{2,m-1}(i,j)=1/4\left[R^{n}_{2,m}(2i,2j)\right]+1/8\left[R% ^{n}_{2,m}(2i+1,2j)+R^{n}_{2,m}(2i-1,2j)\right.italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m - 1 end_POSTSUBSCRIPT ( italic_i , italic_j ) = 1 / 4 [ italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i , 2 italic_j ) ] + 1 / 8 [ italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i + 1 , 2 italic_j ) + italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i - 1 , 2 italic_j )
+R2,mn(2i,2j+1)+R2,mn(2i,2j1)]\displaystyle\left.+R^{n}_{2,m}(2i,2j+1)+R^{n}_{2,m}(2i,2j-1)\right]+ italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i , 2 italic_j + 1 ) + italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i , 2 italic_j - 1 ) ]
+1/16[R2,mn(2i+1,2j+1)+R2,mn(2i1,2j+1)+\displaystyle+1/16\left[R^{n}_{2,m}(2i+1,2j+1)+R^{n}_{2,m}(2i-1,2j+1)+\right.+ 1 / 16 [ italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i + 1 , 2 italic_j + 1 ) + italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i - 1 , 2 italic_j + 1 ) +
R2,mn(2i+1,2j1)+R2,mn(2i1,2j1)].\displaystyle\left.R^{n}_{2,m}(2i+1,2j-1)+R^{n}_{2,m}(2i-1,2j-1)\right].italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i + 1 , 2 italic_j - 1 ) + italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i - 1 , 2 italic_j - 1 ) ] .

Here, the values of R2,m1n(i,j)subscriptsuperscript𝑅𝑛2𝑚1𝑖𝑗R^{n}_{2,m-1}(i,j)italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m - 1 end_POSTSUBSCRIPT ( italic_i , italic_j ) on grid indexes of (i,j)𝑖𝑗(i,j)( italic_i , italic_j ) are calculated based on the values of neighboring points on the finer grid (R2,mn(2i,2j)subscriptsuperscript𝑅𝑛2𝑚2𝑖2𝑗R^{n}_{2,m}(2i,2j)italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( 2 italic_i , 2 italic_j )). Note we are using global indices to label grid points so that (i,j)𝑖𝑗(i,j)( italic_i , italic_j ) on mesh Ω2,m1subscriptΩ2𝑚1\Omega_{2,m-1}roman_Ω start_POSTSUBSCRIPT 2 , italic_m - 1 end_POSTSUBSCRIPT is at the same position as (2i,2j)2𝑖2𝑗(2i,2j)( 2 italic_i , 2 italic_j ) on mesh Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT. The coefficients in the equation determine the weighting of these grid points during the restriction process.

After the restriction of residual to the mesh Ω2,rM2+1subscriptΩ2𝑟subscript𝑀21\Omega_{2,r-M_{2}+1}roman_Ω start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT with coarsest resolution 2M21h2,rsuperscript2subscript𝑀21subscript2𝑟2^{M_{2}-1}h_{2,r}2 start_POSTSUPERSCRIPT italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT italic_h start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT, a conjugate gradient solver is implemented to solve the correction E2,rM2+1nsubscriptsuperscript𝐸𝑛2𝑟subscript𝑀21E^{n}_{2,r-M_{2}+1}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT to the field F2,rM2+1nsubscriptsuperscript𝐹𝑛2𝑟subscript𝑀21F^{n}_{2,r-M_{2}+1}italic_F start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT from equation 2E2,rM2+1n=R2,rM2+1nsuperscriptsubscriptperpendicular-to2subscriptsuperscript𝐸𝑛2𝑟subscript𝑀21subscriptsuperscript𝑅𝑛2𝑟subscript𝑀21\nabla_{\perp}^{2}E^{n}_{2,r-M_{2}+1}=R^{n}_{2,r-M_{2}+1}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT = italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r - italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + 1 end_POSTSUBSCRIPT. Subsequently, in the upward pass of the V-cycle, the coarser correction E2,m1nsubscriptsuperscript𝐸𝑛2𝑚1E^{n}_{2,m-1}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m - 1 end_POSTSUBSCRIPT is passed to the finer grid E2,mnsubscriptsuperscript𝐸𝑛2𝑚E^{n}_{2,m}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT through interpolation. After each interpolation to a finer grid Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT, the red-black Gauss-Seidel (GS) algorithm is applied to smooth the correction E2,mnsubscriptsuperscript𝐸𝑛2𝑚E^{n}_{2,m}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT on each subgrid Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT. This smoothing operation involves iteratively updating E2,mnsubscriptsuperscript𝐸𝑛2𝑚E^{n}_{2,m}italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT at each grid point using its neighboring points. The equations for the red-black Gauss-Seidel algorithm [45] to smooth 2E2,mn=R2,msuperscriptsubscriptperpendicular-to2subscriptsuperscript𝐸𝑛2𝑚subscript𝑅2𝑚\nabla_{\perp}^{2}E^{n}_{2,m}=\prescript{}{}{R}_{2,m}∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT = italic_R start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT are expressed as follows:

E2,mnk+1(i,j)=14[E2,mnk(i1,j)+E2,mnk(i+1,j)+E2,mnk(i,j1)\displaystyle\prescript{k+1}{}{E}^{n}_{2,m}(i,j)=\frac{1}{4}\left[\prescript{k% }{}{E}^{n}_{2,m}(i-1,j)+\prescript{k}{}{E}^{n}_{2,m}(i+1,j)+\prescript{k}{}{E}% ^{n}_{2,m}(i,j-1)\right.start_FLOATSUPERSCRIPT italic_k + 1 end_FLOATSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i , italic_j ) = divide start_ARG 1 end_ARG start_ARG 4 end_ARG [ start_FLOATSUPERSCRIPT italic_k end_FLOATSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i - 1 , italic_j ) + start_FLOATSUPERSCRIPT italic_k end_FLOATSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i + 1 , italic_j ) + start_FLOATSUPERSCRIPT italic_k end_FLOATSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i , italic_j - 1 )
+E2,mnk(i,j+1)h2,m2R2,mn(i,j)].\displaystyle\left.+\prescript{k}{}{E}^{n}_{2,m}(i,j+1)-h_{2,m}^{2}R^{n}_{2,m}% (i,j)\right].+ start_FLOATSUPERSCRIPT italic_k end_FLOATSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i , italic_j + 1 ) - italic_h start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i , italic_j ) ] .

R2,mn(i,j)subscriptsuperscript𝑅𝑛2𝑚𝑖𝑗R^{n}_{2,m}(i,j)italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i , italic_j ) is the residual term at grid point (i,j)𝑖𝑗(i,j)( italic_i , italic_j ) that we obtained in the downward pass and E2,mnk+1(i,j)superscriptsubscriptsuperscript𝐸𝑛2𝑚𝑘1𝑖𝑗\prescript{k+1}{}{E}^{n}_{2,m}(i,j)start_FLOATSUPERSCRIPT italic_k + 1 end_FLOATSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT ( italic_i , italic_j ) represents the updated field values at grid point (i,j)𝑖𝑗(i,j)( italic_i , italic_j ) after the k𝑘kitalic_k-th iteration of the red-black Gauss-Seidel algorithm. For parallelization, we alternate between red points and black points to update E2,mnk+1superscriptsubscriptsuperscript𝐸𝑛2𝑚𝑘1\prescript{k+1}{}{E}^{n}_{2,m}start_FLOATSUPERSCRIPT italic_k + 1 end_FLOATSUPERSCRIPT italic_E start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT [45]. Typically, for each grid Ω2,msubscriptΩ2𝑚\Omega_{2,m}roman_Ω start_POSTSUBSCRIPT 2 , italic_m end_POSTSUBSCRIPT except Ω2,rM+1subscriptΩ2𝑟𝑀1\Omega_{2,r-M+1}roman_Ω start_POSTSUBSCRIPT 2 , italic_r - italic_M + 1 end_POSTSUBSCRIPT, which has been solved by the conjugate gradient algorithm, we choose iteration numbers k𝑘kitalic_k around 2. The correction E2,rn=1subscriptsuperscript𝐸𝑛12𝑟E^{n=1}_{2,r}italic_E start_POSTSUPERSCRIPT italic_n = 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT obtained at the end of the first V-cycle will be added to the field F2,rn=1=F2,rn=0+E2,rn=1subscriptsuperscript𝐹𝑛12𝑟subscriptsuperscript𝐹𝑛02𝑟subscriptsuperscript𝐸𝑛12𝑟F^{n=1}_{2,r}=F^{n=0}_{2,r}+E^{n=1}_{2,r}italic_F start_POSTSUPERSCRIPT italic_n = 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT = italic_F start_POSTSUPERSCRIPT italic_n = 0 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT + italic_E start_POSTSUPERSCRIPT italic_n = 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT . Then the new residual R2,rn=2subscriptsuperscript𝑅𝑛22𝑟R^{n=2}_{2,r}italic_R start_POSTSUPERSCRIPT italic_n = 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT of the next V-cycle will be calculated from the updated field by R2,rn=2S22F2,r1subscriptsuperscript𝑅𝑛22𝑟subscript𝑆2superscriptsubscriptperpendicular-to2subscriptsuperscript𝐹12𝑟R^{n=2}_{2,r}\equiv S_{2}-\nabla_{\perp}^{2}F^{1}_{2,r}italic_R start_POSTSUPERSCRIPT italic_n = 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT ≡ italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT - ∇ start_POSTSUBSCRIPT ⟂ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_F start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT. The V-cycle loop will be repeated until norm of the residual R2,rnnormsubscriptsuperscript𝑅𝑛2𝑟\|R^{n}_{2,r}\|∥ italic_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 2 , italic_r end_POSTSUBSCRIPT ∥ is less than a preset value δ𝛿\deltaitalic_δ (usually set close to the machine precision).

References

  • Joshi and Katsouleas [2003] C. Joshi, T. Katsouleas, Plasma Accelerators at the Energy Frontier and on Tabletops, Physics Today 56 (2003) 47–53. https://doi.org/10.1063/1.1595054.
  • Joshi et al. [2020] C. Joshi, S. Corde, W. B. Mori, Perspectives on the generation of electron beams from plasma-based accelerators and their near and long term applications, Physics of Plasmas 27 (2020) 070602. https://doi.org/10.1063/5.0004039.
  • Tajima and Dawson [1979] T. Tajima, J. M. Dawson, Laser electron accelerator, Phys. Rev. Lett. 43 (1979) 267–270. https://doi.org/10.1103/PhysRevLett.43.267.
  • Chen et al. [1985] P. Chen, J. M. Dawson, R. W. Huff, T. Katsouleas, Acceleration of electrons by the interaction of a bunched electron beam with a plasma, Physical Review Letters 54 (1985) 693–696. https://doi.org/10.1103/PhysRevLett.54.693.
  • Blumenfeld et al. [2007] I. Blumenfeld, C. E. Clayton, F.-J. Decker, M. J. Hogan, C. Huang, R. Ischebeck, R. Iverson, C. Joshi, T. Katsouleas, N. Kirby, et al., Energy doubling of 42 gev electrons in a metre-scale plasma wakefield accelerator, Nature 445 (2007) 741–744. https://doi.org/10.1038/nature05538.
  • Litos et al. [2014] M. Litos, E. Adli, W. An, C. Clarke, C. Clayton, S. Corde, J. Delahaye, R. England, A. Fisher, J. Frederico, et al., High-efficiency acceleration of an electron beam in a plasma wakefield accelerator, Nature 515 (2014) 92–95. https://doi.org/10.1038/nature13882.
  • Gonsalves et al. [2011] A. Gonsalves, K. Nakamura, C. Lin, D. Panasenko, S. Shiraishi, T. Sokollik, C. Benedetti, C. Schroeder, C. Geddes, J. Van Tilborg, et al., Tunable laser plasma accelerator based on longitudinal density tailoring, Nature Physics 7 (2011) 862–866. https://doi.org/10.1038/nphys2071.
  • Kneip et al. [2010] S. Kneip, C. McGuffey, J. L. Martins, S. Martins, C. Bellei, V. Chvykov, F. Dollar, R. Fonseca, C. Huntington, G. Kalintchenko, et al., Bright spatially coherent synchrotron x-rays from a table-top source, Nature Physics 6 (2010) 980–983. %****␣Mesh_refinement_in_QuickPIC.bbl␣Line␣100␣****https://doi.org/10.1038/nphys1789.
  • Adli et al. [2018] E. Adli, A. Ahuja, O. Apsimon, R. Apsimon, A.-M. Bachmann, D. Barrientos, F. Batsch, J. Bauche, V. Berglyd Olsen, M. Bernardini, et al., Acceleration of electrons in the plasma wakefield of a proton bunch, Nature 561 (2018) 363–367. https://doi.org/10.1038/s41586-018-0485-4.
  • Corde et al. [2015] S. Corde, E. Adli, J. Allen, W. An, C. Clarke, C. Clayton, J. Delahaye, J. Frederico, S. Gessner, S. Green, et al., Multi-gigaelectronvolt acceleration of positrons in a self-loaded plasma wakefield, Nature 524 (2015) 442–445. https://doi.org/10.1038/nature14890.
  • Nie et al. [2018] Z. Nie, C.-H. Pai, J. Hua, C. Zhang, Y. Wu, Y. Wan, F. Li, J. Zhang, Z. Cheng, Q. Su, et al., Relativistic single-cycle tunable infrared pulses generated from a tailored plasma density structure, Nature Photonics 12 (2018) 489–494. https://doi.org/10.1038/s41566-018-0190-8.
  • Birdsall and Langdon [2018] C. K. Birdsall, A. B. Langdon, Plasma physics via computer simulation, CRC press, 2018. https://doi.org/10.1201/9781315275048.
  • Courant et al. [1928] R. Courant, K. Friedrichs, H. Lewy, Über die partiellen differenzengleichungen der mathematischen physik, Mathematische annalen 100 (1928) 32–74. https://doi.org/10.1007/BF01448839.
  • Sprangle et al. [1990] P. Sprangle, E. Esarey, A. Ting, Nonlinear interaction of intense laser pulses in plasmas, Physical review A 41 (1990) 4463–4469. https://doi.org/10.1103/PhysRevA.41.4463.
  • Mora and Antonsen [1997] P. Mora, T. M. Antonsen, Jr., Kinetic modeling of intense, short laser pulses propagating in tenuous plasmas, Physics of Plasmas 4 (1997) 217–229. https://doi.org/10.1063/1.872134.
  • Lotov [2003] K. V. Lotov, Fine wakefield structure in the blowout regime of plasma wakefield accelerators, Physical Review Special Topics-Accelerators and Beams 6 (2003) 061301. https://doi.org/10.1103/PhysRevSTAB.6.061301.
  • Huang et al. [2006] C. Huang, V. Decyk, C. Ren, M. Zhou, W. Lu, W. Mori, J. Cooley, T. Antonsen, T. Katsouleas, Quickpic: A highly efficient particle-in-cell code for modeling wakefield acceleration in plasmas, Journal of Computational Physics 217 (2006) 658–679. https://doi.org/10.1016/j.jcp.2006.01.039.
  • An et al. [2013] W. An, V. K. Decyk, W. B. Mori, T. M. Antonsen, An improved iteration loop for the three dimensional quasi-static particle-in-cell algorithm: Quickpic, Journal of Computational Physics 250 (2013) 165–177. https://doi.org/10.1016/j.jcp.2013.05.020.
  • Mehrling et al. [2014] T. Mehrling, C. Benedetti, C. B. Schroeder, J. Osterhoff, Hipace: a quasi-static particle-in-cell code, Plasma Physics and Controlled Fusion 56 (2014) 084012. https://doi.org/10.1088/0741-3335/56/8/084012.
  • Diederichs et al. [2022] S. Diederichs, C. Benedetti, A. Huebl, R. Lehe, A. Myers, A. Sinn, J.-L. Vay, W. Zhang, M. Thévenet, Hipace++: A portable, 3d quasi-static particle-in-cell code, Computer Physics Communications 278 (2022) 108421. https://doi.org/10.1016/j.cpc.2022.108421.
  • Benedetti et al. [2012] C. Benedetti, C. B. Schroeder, E. Esarey, W. P. Leemans, Efficient modeling of laser-plasma accelerators using the ponderomotive-based code inf&rno, in: Proceedings of ICAP, 2012, p. THAAI2.
  • Wang et al. [2022] T. Wang, V. Khudik, J. Kim, G. Shvets, Wand-pic: an accelerated three-dimensional quasi-static particle-in-cell code, 2022. arXiv:2012.00881.
  • Li et al. [2021] F. Li, W. An, V. K. Decyk, X. Xu, M. J. Hogan, W. B. Mori, A quasi-static particle-in-cell algorithm based on an azimuthal fourier decomposition for highly efficient simulations of plasma-based acceleration: Qpad, Computer Physics Communications 261 (2021) 107784. %****␣Mesh_refinement_in_QuickPIC.bbl␣Line␣250␣****https://doi.org/10.1016/j.cpc.2020.107784.
  • Fonseca et al. [2002] R. A. Fonseca, L. O. Silva, F. S. Tsung, V. K. Decyk, W. Lu, C. Ren, W. B. Mori, S. Deng, S. Lee, T. Katsouleas, J. C. Adam, Osiris: A three-dimensional, fully relativistic particle in cell code for modeling plasma based accelerators, in: P. M. A. Sloot, A. G. Hoekstra, C. J. K. Tan, J. J. Dongarra (Eds.), Computational Science — ICCS 2002, Springer Berlin Heidelberg, Berlin, Heidelberg, 2002, pp. 342–351. https://doi.org/10.1007/3-540-47789-6_36.
  • Adli et al. [2013] E. Adli, J.-P. Delahaye, S. J. Gessner, M. J. Hogan, T. Raubenheimer, W. An, C. Joshi, W. Mori, A beam driven plasma-wakefield linear collider: From higgs factory to multi-tev, 2013. arXiv:1308.1145.
  • Lee and Katsouleas [1999] S. Lee, T. Katsouleas, Wakefield accelerators in the blowout regime with mobile ions, in: AIP Conference Proceedings, volume 472, American Institute of Physics, 1999, pp. 524–533. 10.1063/1.58913.
  • Rosenzweig et al. [2005] J. B. Rosenzweig, A. M. Cook, A. Scott, M. C. Thompson, R. B. Yoder, Effects of ion motion in intense beam-driven plasma wakefield accelerators, Physical Review Letters 95 (2005) 195002. https://doi.org/10.1103/PhysRevLett.95.195002.
  • An et al. [2017] W. An, W. Lu, C. Huang, X. Xu, M. J. Hogan, C. Joshi, W. B. Mori, Ion motion induced emittance growth of matched electron beams in plasma wakefields, Physical Review Letters 118 (2017) 244801. https://doi.org/10.1103/PhysRevLett.118.244801.
  • Lifschitz et al. [2009] A. Lifschitz, X. Davoine, E. Lefebvre, J. Faure, C. Rechatin, V. Malka, Particle-in-cell modelling of laser–plasma interaction using fourier decomposition, Journal of Computational Physics 228 (2009) 1803–1814. https://doi.org/10.1016/j.jcp.2008.11.017.
  • Davidson et al. [2015] A. Davidson, A. Tableman, W. An, F. Tsung, W. Lu, J. Vieira, R. Fonseca, L. Silva, W. Mori, Implementation of a hybrid particle code with a pic description in r–z and a gridless description in ϕitalic-ϕ\phiitalic_ϕ into osiris, Journal of Computational Physics 281 (2015) 1063–1077. https://doi.org/10.1016/j.jcp.2014.10.064.
  • Lehe et al. [2016] R. Lehe, M. Kirchen, I. A. Andriyash, B. B. Godfrey, J.-L. Vay, A spectral, quasi-cylindrical and dispersion-free particle-in-cell algorithm, Computer Physics Communications 203 (2016) 66–82. https://doi.org/10.1016/j.cpc.2016.02.007.
  • Vay et al. [2018] J.-L. Vay, A. Almgren, J. Bell, L. Ge, D. Grote, M. Hogan, O. Kononenko, R. Lehe, A. Myers, C. Ng, J. Park, R. Ryne, O. Shapoval, M. Thévenet, W. Zhang, Warp-x: A new exascale computing platform for beam–plasma simulations, Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 909 (2018) 476–479. https://doi.org/10.1016/j.nima.2018.01.035.
  • Benedetti et al. [2017] C. Benedetti, C. B. Schroeder, C. G. R. Geddes, E. Esarey, W. P. Leemans, Efficient modeling of laser-plasma accelerator staging experiments using INF&RNO, in: AIP Conference Proceedings, volume 1812, 2017, p. 050005. https://doi.org/10.1063/1.4975866.
  • Mehrling et al. [2018] T. Mehrling, C. Benedetti, C. Schroeder, E. Esarey, A subgrid algorithm for the efficient modeling of plasma-based accelerators with ion motion using quasi-static particle-in-cell codes, in: 2018 IEEE Advanced Accelerator Concepts Workshop (AAC), 2018, pp. 1–5. https://doi.org/10.1109/AAC.2018.8659404.
  • Feng et al. [2009] B. Feng, C. Huang, V. Decyk, W. Mori, P. Muggli, T. Katsouleas, Enhancing parallel quasi-static particle-in-cell simulations with a pipelining algorithm, Journal of Computational Physics 228 (2009) 5340–5348. https://doi.org/10.1016/j.jcp.2009.04.019.
  • Vay et al. [2002] J.-L. Vay, P. Colella, P. McCorquodale, B. Van Straalen, A. Friedman, D. Grote, Mesh refinement for particle-in-cell plasma simulations: Applications to and benefits for heavy ion fusion, Laser and Particle Beams 20 (2002) 569–575. %****␣Mesh_refinement_in_QuickPIC.bbl␣Line␣400␣****https://doi.org/10.1017/S0263034602204139.
  • Colella and Norgaard [2010] P. Colella, P. C. Norgaard, Controlling self-force errors at refinement boundaries for amr-pic, Journal of Computational Physics 229 (2010) 947–957. https://doi.org/10.1016/j.jcp.2009.07.004.
  • Chen et al. [1990] P. Chen, K. Oide, A. M. Sessler, S. S. Yu, Plasma-based adiabatic focuser, Physical Review Letters 64 (1990) 1231–1234. https://doi.org/10.1103/PhysRevLett.64.1231.
  • Zhao et al. [2023] Y. Zhao, L. Hildebrand, W. An, X. Xu, F. Li, T. N. Dalichaouch, Q. Su, C. Joshi, W. B. Mori, Emittance preservation in the presence of ion motion for low-to-high energy stages of a plasma based accelerator, Physical Review Special Topics-Accelerators and Beams 26 (2023) 121301. https://doi.org/10.1103/PhysRevAccelBeams.26.121301.
  • Diederichs et al. [2019] S. Diederichs, T. J. Mehrling, C. Benedetti, C. B. Schroeder, A. Knetsch, E. Esarey, J. Osterhoff, Positron transport and acceleration in beam-driven plasma wakefield accelerators using plasma columns, Physical Review Special Topics-Accelerators and Beams 22 (2019) 081301. https://doi.org/10.1103/PhysRevAccelBeams.22.081301.
  • Silva et al. [2021] T. Silva, L. D. Amorim, M. C. Downer, M. J. Hogan, V. Yakimenko, R. Zgadzaj, J. Vieira, Stable positron acceleration in thin, warm, hollow plasma channels, Physical Review Letters 127 (2021) 104801. https://doi.org/10.1103/PhysRevLett.127.104801.
  • Zhou et al. [2021] S. Zhou, J. Hua, W. An, W. B. Mori, C. Joshi, J. Gao, W. Lu, High efficiency uniform wakefield acceleration of a positron beam using stable asymmetric mode in a hollow channel plasma, Physical Review Letters 127 (2021) 174801. https://doi.org/10.1103/PhysRevLett.127.174801.
  • Zhou et al. [2022] S. Zhou, J. Hua, W. Lu, W. An, Q. Su, W. B. Mori, C. Joshi, High efficiency uniform positron beam loading in a hollow channel plasma wakefield accelerator, Physical Review Special Topics-Accelerators and Beams 25 (2022) 091303. https://doi.org/10.1103/PhysRevAccelBeams.25.091303.
  • Vieira and Mendonça [2014] J. Vieira, J. T. Mendonça, Nonlinear laser driven donut wakefields for positron and electron acceleration, Physical Review Letters 112 (2014) 215001. https://doi.org/10.1103/PhysRevLett.112.215001.
  • Briggs et al. [2000] W. L. Briggs, V. E. Henson, S. F. McCormick, A Multigrid Tutorial, Second Edition, second ed., Society for Industrial and Applied Mathematics, 2000. https://doi.org/10.1137/1.9780898719505.