# Optimized Computation of Tight Focusing of Short Pulses Using Mapping to Periodic Space
## 2 Materials and Methods  
### Spectral Solvers  
An essential part of the scheme we present is the use of a spectral (Fourier) method to advance the electromagnetic field in a region with periodic boundary conditions. In this subsection we briefly outline the main equations and practical aspects of this approach.  
The central idea of spectral methods for time-dependent problems is to make use of the fact that, for linear homogeneous equations with a well-determined nondegenerate spectrum, the state can be represented via eigenstates that can be independently advanced over an arbitrary large time interval without computational errors. When eigenstates correspond to plane waves, the transformation from the representation on a spatial grid to the eigenbasis representation (and vice versa) can be done with a FFT. Source terms (i.e., inhomogeneous part) and/or nonlinear terms can be accounted for by the step-splitting technique (see, for example, [47; 48]). Since the propagators for these terms do not necessarily commute with that for the homogeneous equation, this technique introduces errors that grow with, and thus restrict, the size of the time step. Nevertheless, since we consider the propagation of electromagnetic radiation in vacuum, the source term (governed by the current) is zero and we thus can do arbitrarily large time steps.  
The application of split-step spectral method to the Maxwell equations has been carried out and used in many numerical studies (see, for example, [49; 50; 51; 52; 53; 54] or chapter 15.9 (b) in [48]). We denote the electromagnetic field and current density in Fourier space by \(\hat{\mathbf{E}}\), \(\hat{\mathbf{B}}\) and \(\hat{\mathbf{j}}\) respectively. Furthermore, \(\hat{\mathbf{k}}\) is the normalized wave vector \(\mathbf{k}\), \(i\) is the imaginary unit, \(c\) is the speed of light, and \(C=\cos(ck\Delta t)\), and \(S=\sin(ck\Delta t)\). Using superscripts \(n\) and \(n+1\) to denote consecutive numerical states, we can express the Fourier method in the following form (see [53], CGS units are used):  
\[\hat{\mathbf{E}}^{n+1}=C\hat{\mathbf{E}}^{n}+iS\hat{\mathbf{k}} \times\hat{\mathbf{B}}^{n}-\frac{4\pi S}{kc}\hat{\mathbf{j}}^{n+1/2}+(1-C) \hat{\mathbf{k}}(\hat{\mathbf{k}}\cdot\hat{\mathbf{E}}^{n})+4\pi\hat{ \mathbf{k}}\Big{(}\hat{\mathbf{k}}\cdot\hat{\mathbf{j}}^{n+1/2}\Big{)}\Big{(} \frac{S}{kc}-\Delta t\Big{)}, \tag{1}\] \[\hat{\mathbf{B}}^{n+1}=C\hat{\mathbf{B}}^{n}-iS\hat{\mathbf{k}} \times\hat{\mathbf{E}}^{n}+4\pi i\frac{1-C}{kc}\hat{\mathbf{k}}\times\hat{ \mathbf{j}}^{n+1/2}. \tag{2}\]It is worth noting that [PERSON]'s equation \(\hat{\mathbf{k}}\cdot\hat{\mathbf{E}}=0\) is not satisfied here automatically but maintained approximately. This may lead to the appearance of static electric fields that arise from a spurious charge associated with either the initial field state or accumulated computational errors (in case of computations with nonzero current). To correct for this, we need to subtract the longitudinal component of electric field \(\hat{\mathbf{k}}(\hat{\mathbf{k}}\cdot\hat{\mathbf{E}})\) from the initial electric field \(\hat{\mathbf{E}}\) once, before the simulation starts (for more details see [53] or Section 6.2 in [54]). This will ensure that [PERSON]'s equation is satisfied throughout the simulation and that the corresponding term in Equation (1) vanishes. However, to make our solver capable of handling continuous sources, and to avoid the accumulation of numerical errors due to imperfect satisfaction of the continuity equation in nonvacuum simulations (beyond the scope of this article), we carry out this adjustment at each iteration:  
\[\hat{\mathbf{E}}^{n+1} =C(\hat{\mathbf{E}}^{n}-\hat{\mathbf{k}}(\hat{\mathbf{k}}\cdot \hat{\mathbf{E}}^{n}))+iS\hat{\mathbf{k}}\times\hat{\mathbf{B}}^{n} \tag{3}\] \[\hat{\mathbf{B}}^{n+1} =C\hat{\mathbf{B}}^{n}-iS\hat{\mathbf{k}}\times\hat{\mathbf{E}}^{ n}. \tag{4}\]  
As our implementation follows that referred to as PSATD in Ref. [53], we adopt the same terminology for our spectral solver.