# Kerr-Lens Mode-Locking: Numerical Simulation of the Spatio-Temporal Dynamics on All Time Scales
## 3 Materials and Methods
The total matrix of the Kerr medium then becomes:  
\[M_{kl}^{thick}(t)=M_{z}(l/2)M_{kl}^{(1)}(t)M_{z}(l)M_{kl}^{(2)}(t)\cdots M_{z} (l)M_{kl}^{(N_{kl})}(t)M_{z}(l/2), \tag{8}\]  
where \(M_{z}(l)\) is the free space matrix and \(M_{kl}^{(i)}(t)\) are the thin Kerr-lenses of Equation (5), each calculated according to the beam parameter at its location \(q^{i}(t)\). The thick-lens is factorized this way so that multiplying several thick-lens matrices would give, yet again, a thick-lens. In our simulation, the Kerr medium of thickness \(L_{c}=3\) mm was divided into \(N_{kl}=5\) thin lenses. The nonlinear diffraction loss due to the Kerr-lensing effect is at the heart of KLM. In the single-mode regime, the Kerr-lensing effect couples the beam size and the (on-axis) instantaneous intensity at the crystal. Thus, by inserting a mechanism that penalizes the laser for large beams [15; 19; 24], we can create an effective saturable absorber. Here, we note two competing loss/saturation mechanisms--small beams suffer from insufficient overlap with the pump mode, which reduces their gain, whereas larger beams suffer increased loss due to the effective Kerr lens aperture. This competition is summarized in Figure 7. In general, the nonlinear losses can be divided into two categories: hard apertures, where any power beyond a certain beam size is completely cut off; and soft apertures, where beams beyond a certain size incur a certain amount of loss that depends on the beam's size [3,10,11]. Both can be easily incorporated into our simulation. In our simulation, we opt for a soft-aperture mechanism, corresponding to a situation where the most important loss mechanism is the spatial overlap between the laser and the pump mode at the gain medium, where the KLM operates slightly beyond the stability limit. Different mechanisms simply amount to different loss functions, and can be easily accommodated by our software. For numerical reasons, in order to assure convergence of the cavity evolution (power and beam parameter) to the steady state, we need to prevent the beam size from diverging during the initial stage of cavity amplification, when the intra-cavity power is too low to support a significant Kerr lens. For this purpose, we introduce an artificial hard aperture in the round trip that limits the size of large beams effectively without incurring loss on smaller beams. For a narrow beam, only the (exponentially small) wings of the beam would be affected by the aperture and the incurred loss would be minute. This does not affect the dynamics of the cavity or the steady-state value, but only the convergence time of the simulation, as illustrated in Figure 8.  
The simulation is performed partially in the time domain, where the instantaneous nonlinear effects are calculated, and partially in the frequency domain where the linear transfer function of the cavity is calculated, as detailed in the pseudo-code given in Algorithm A1. To propagate the field in both time and space, the simulation is divided into a spatial procedure and a temporal procedure. The spatial procedure, detailed in the pseudo-code in Algorithm A2, handles the spatial ABCD propagation under the Gaussian single-mode assumption (including the spatial Kerr and the diffraction losses). The temporal procedure, detailed in the pseudo-code in Algorithm A3, handles the temporal evolution of SPM, gain, loss, and dispersion. The two components are coupled through the Kerr-lens interaction, where the temporal profile of the beam determines the optical power of the Kerr-lens, which, in turn, affects the temporal evolution via the diffraction losses. The variables and function names are given in Table 2.  
Figure 7: Modeling the diffraction losses. **Left axis**: gain as function of the beam waist for three pulse energies, \(U_{sat}/100\) (red), \(U_{sat}/10\) (yellow), \(U_{sat}\) (purple). The saturated gain value depends on the beam waist because for narrow beams, the spatial overlap with the pump mode is only partial (see algorithm for exact dependence).