# Three-Dimensional, Time-Dependent Analysis of High- and Low-\(Q\) Free-Electron Laser Oscillators
## 2 Numerical Formulation
### The Optical Propagation Code OPC
#### 2.4.2 Modeling Mirrors  
The default optical components used by OPC are ideal thin lenses and spherical mirrors. However, by using amplitude and phase masks, additional optical components can be added, in particular more realistic lenses and mirrors. Here, we limit ourselves to phase masks that are generated using the circle polynomials \(R_{n}^{[m]}\)of [PERSON] [194]. These polynomials are used to generate a phase difference \(d\theta\) defined on a transverse plane that is applied to the optical field as  
\[d\theta=D_{mn}R_{n}^{[m]}(\rho)\times\begin{cases}\cos{(m\phi)}&m\leq 0\\ \sin{(m\phi)}&m<0^{\prime}\end{cases} \tag{38}\]  
where \(\rho\) is a scaled radial distance, \(\rho=\sqrt{x^{2}+y^{2}}/\rho_{c}\) with \(\rho_{c}\) some characteristic length scale, \(\phi\) is the angle \(\tan^{-1}(y/x)\) and \(D_{mn}\) is the amplitude of the polynomial. The indices \(m,n\) describe the type of aberration, for example, \(m=0\) and \(n=4\) correspond to spherical aberration and \(m=1\) and \(n=3\) to coma [194]. Therefore, adding a phase mask and applying it at the location of a lens of mirror adds the associated aberrations to create a more realistic model of the component.  
It is also possible to use these Zernike polynomials to generate new optical components. For example, adding the polynomials \(m,n=2,2\) with \(m,n=0,2\) with appropriate amplitudes generates a cylindrical lens of a certain focal strength. This can be used to correctly model the performance of a spherical mirror with a non-zero angle of incidence, e.g., when used in a ring resonator, to model for the different foci in tangential and sagittal direction.  
Another application is to use the Zernike polynomials to model mirror surface distortions, in particular, due to thermal loading of the mirror. Here, we assume that round mirror is uniformly cooled at its circumference and that the heat loading is axi-symmetric. A finite element program can be used to calculate the steady state deviation \(\delta z(r/r_{0})\), where \(r_{0}\) is some characteristic length, that results from the heat generation in the mirror due to some absorbed power \(P_{\text{abs}}\). A fit using \(R_{n}^{0}(r/r_{0})\) Zernike polynomials with \(n\) taken even is then used to determine the amplitudes to be used in generating the phase mask. To convert the mirror distortion \(\delta z\) into a localized change in phase for the optical field, we set  
\[d\theta(r/r_{0})=-\frac{4\pi\delta z(r/r_{0})}{\lambda}, \tag{39}\]where the minus sign is required to comply with the phase advance used in OPC and the phase change is proportional to twice the mirror displacement. It is reasonable to assume that a stable transverse field distribution is established after starting from noise when the intracavity optical starts to heat the mirror. Therefore, the phase distortion due to mirror heating can be obtained by scaling Equation (39) with a factor \(P_{i}(t)\tau/(P_{\text{abs}}T_{\text{rep}})\) with \(P_{\text{abs}}\) the absorbed power used to calculate \(\delta z\), \(P_{i}\) the instantaneous absorbed power, \(\tau\) the duration of the optical pulse and \(T_{\text{rep}}\) the repetition time for the optical pulses.