# Three-Dimensional, Time-Dependent Analysis of High- and Low-\(Q\) Free-Electron Laser Oscillators
## 2 Numerical Formulation
### The Optical Propagation Code OPC  
When modeling FEL oscillators, the electron-light interaction within the undulator segments needs to be modeled, as well as the propagation of the light through the remainder of the oscillator. The light propagators internal to FEL gain codes, including that in MINERVA, are typically not very efficient when considering free-space propagation over large distances and interaction with various optical elements. The wavefront propagator [185; 199] is based upon the scalar paraxial Helmholtz equation [200]  
\[\frac{\partial^{2}u}{\partial x^{2}}+\frac{\partial^{2}u}{\partial y^{2}}-2 ik_ {0}\frac{\partial u}{\partial z}=0, \tag{25}\]  
where \(u\) is the complex scalar wave amplitude that describes the transverse profile of a time-harmonic optical beam, \(k_{0}=2\pi/\lambda_{0}\), and \(\lambda_{0}\) is the free-space wavelength. By applying a two-dimensional spatial Fourier transform, Equation (25) transforms into  
\[(k_{x}^{2}+k_{y}^{2})\bar{u}-2 ik_{0}\frac{\partial\bar{u}}{\partial z}=0, \tag{26}\]  
Figure 4: Simulated (blue line) and measured (red circles) optical pulse energy as a function of the propagation distance \(z\) for the LCLS experiment. The simulation result is on average over 25 noise realizations. where  
\[\tilde{u}(k_{x},k_{y},z)\equiv\int\limits_{-\infty}^{\infty}\int\limits_{-\infty}^ {\infty}dxdy\,u(x,y,z)e^{-i(k_{x}x+k_{y}y)} \tag{27}\]  
is the two-dimensional Fourier transform of \(u(x,y,z)\). Given a known profile \(u_{0}(x,y)=u(x,y,0)\) at \(z=0\), e.g., at the exit of the undulator line, the analytical solution in reciprocal space to Equation (26) is given by  
\[\tilde{u}(k_{x},k_{y},z)=\tilde{u}_{0}(k_{x},k_{y})e^{i\lambda_{0}(k_{x}^{2}+k _{y}^{2})/\pi}. \tag{28}\]  
The solution in normal space at location \(z\) is found by the inverse spatial Fourier transform of Equation (28),  
\[u(x,y,z)\equiv\frac{1}{4\pi^{2}}\int\limits_{-\infty}^{\infty}\int\limits_{- \infty}^{\infty}dk_{x}dk_{y}\,\tilde{u}(k_{x},k_{y},z)e^{i(k_{x}x+k_{y}y)}). \tag{29}\]  
This wavefront propagation is known as spectral propagation and is very suitable for propagation over short and large distances. However, when propagating over long distances, care has to be taken that the complete optical field remains contained within the transverse domain of the two-dimensional spatial Fourier transform (Equation (27)), e.g., as a result of a fast Fourier transformation, to avoid artificial reflections from the edges of this domain. By substituting Equation (28) into Equation (29), using the initial profile \(u_{0}(x,y)\) and Equation (27), changing the order of integration and performing the integration over \(k_{x}\) and \(k_{y}\), we obtain the Fresnel diffraction integral [201]  
\[u(x,y,z)=-\frac{i}{\lambda_{0}z}\int\limits_{-\infty}^{\infty}\int\limits_{- \infty}^{\infty}d\xi d\eta\,u_{0}(\xi,\eta)e^{i\pi[(x-\xi)^{2}+(y-\eta)^{2}]/ \lambda_{0}z}. \tag{30}\]  
Note that the Fresnel diffraction integral can be derived using various methods, including the free-space Green's function [202], or by applying the paraxial approximation to the spherical wavelets in Huygens' integral [200]. It can also be shown that propagation through a cascaded set of paraxial optical components described by an overall ray-optical ABCD matrix can be described by a single Huygens' integral, given by [200]  
\[u(x,y,z)=e^{-ik_{0}z}\int\limits_{-\infty}^{\infty}\int\limits_{-\infty}^{ \infty}d\xi d\eta\,K(x,y,\xi,\eta)u_{0}(\xi,\eta), \tag{31}\]  
where Huygens' kernel \(K\) is given by  
\[K(x,y,\xi,\eta)\equiv\frac{i}{\lambda_{0}\sqrt{B_{x}B_{y}}}e^{-i\frac{\pi}{B _{x}\lambda_{0}}(A_{x}\xi^{2}-2\xi x+D_{x}x^{2})}e^{-i\frac{\pi}{B_{y}\lambda_ {0}}(A_{y}\eta^{2}-2\eta y+D_{y}y^{2})}, \tag{32}\]  
and \(A_{i}\), \(B_{i}\), \(C_{i}\) and \(D_{i}\) are the components of the system ABCD matrix for \(i=x,y\). The ABCD matrix can describe real or complex orthogonal paraxial optical systems that may contain astigmatism [200].