💡

Laser Cavity Simulator

Coupled rate equations for inversion and intracavity photons in a two-mirror cavity, solved in physical time. Measure the threshold, the slope efficiency and the relaxation oscillations and compare them with the analytic results.

Pick a preset, press Start (or Step), then read the L–I curve and the relaxation readouts
⚡ – Pump / Threshold
🪞 – Output Mirror R₂
🔦 – Steady-state Pout
🔥 – Laser Status
📊 Cavity, time traces and measurements

Cavity schematic

Mirrors and gain medium are drawn to scale along the axis. The dots are illustrative only: the photon-dot count grows with log₁₀ q, and the dots move far slower than c. The output beam brightness follows Pout.

Four-level scheme illustrative

The red fraction of the drawn atoms is N/(2Nth), so half of them are red at threshold. Pump band E3 and lower level E1 empty instantly, so the inversion equals the upper-level population N.

Time traces since the pump was switched on

Inversion N / Nth

Intracavity photons q peak per time bin

Output power Pout peak per time bin

Gain g(t) versus loss gth

All four panels share one physical time axis (µs). Move the pointer over any panel to read all four quantities at the same instant. q and Pout show the largest value in each of the 480 time bins so that short spikes are not lost. N and g are sampled at the end of each bin. The intracavity (one-way circulating) power is Pcirc = q hν/Trt.

Time t
–
N / Nth
–
Gain g(t)
–
Round-trip multiplier M
–
Photons q
–
Pcirc
–
Pout
–
Latest spike spacing
–

Steady state and small-signal dynamics

L–I curve: pump sweep steady state

Dots are the automated sweep: at each pump step the rate equations are integrated from the previous settled state until dN/dt and dq/dt vanish. Solid line: exact algebraic steady state, including spontaneous emission β. Dashed line: the analytic above-threshold solution ηs(Pp − Pp,th). The white cursor is the current pump.

Relaxation oscillations small signal

The steady state at the current pump is kicked by Δq/q = 10⁻³, and the full nonlinear rate equations are integrated (solid). Dashed: the analytic linearised response e−γt[cos ωRt + (γ/ωR) sin ωRt]. Dotted: the envelope ±e−γt.

Threshold Pp,th: analytic / sweep fit
–
Slope efficiency ηs: analytic / sweep fit
–
Steady Pout at current pump
–
fR: analytic / simulated
–
Damping γ: analytic / simulated
–
Loss shares (output / back mirror / internal)
–

Which modes lase? passive cavity

Free spectral range c/2L
–
Cold-cavity linewidth 1/(2πτp)
–
Finesse 2π/δ
–
Longitudinal modes under the gain curve
–

The rate equations above describe one lasing mode, and they say nothing about which one it is. The mode structure is fixed by the passive resonator. Longitudinal modes sit at νm = m c/(2nL), spaced by one free spectral range, and each has the cold-cavity linewidth set by the same photon lifetime τp used here. A homogeneously broadened gain medium clamps at the loss of the mode closest to the gain peak. Spatial hole burning and inhomogeneous broadening let several modes lase. Transverse (TEMpq) modes exist only with curved mirrors in a stable resonator, 0 ≤ g1g2 ≤ 1, and their size is the Gaussian-beam waist. Explore these in the Fabry–Pérot and passive-resonator tool (transmission comb, finesse, g1–g2 stability) and the Gaussian-beam tool (waist, Rayleigh range, q-parameter). The moving dots do not create coherence. Coherence comes from stimulated emission into a resonator mode.

💡 How to Use

Learn with this tool

Learning objectives

  • Derive the threshold condition R1R2e2glg−2αL = 1 and show that the rate equations reproduce it through τp.
  • Predict the threshold pump and slope efficiency of a laser from its cavity losses and measure both from an L–I sweep.
  • Explain gain clamping and relaxation oscillations, and estimate ωR and γR from linearised rate equations.

Prerequisites

  • Exponential gain and loss, logarithms, and first-order ODEs
  • Linearisation of a 2×2 system and damped harmonic oscillators
  • Standing waves between two mirrors (cavity modes)
  • Fabry–Pérot resonators: FSR, finesse, photon lifetime

Model

An ideal four-level medium of length lg sits in a linear cavity of length L between mirrors R1, R2. One cavity mode of area A holds q photons, and N atoms are inverted. In the uniform-field (mean-field) approximation:

Laser rate equations

dNdt=Rp−Nτ−GNq\frac{dN}{dt}=R_p-\frac{N}{\tau}-GNq
dqdt=GNq−qτp+βNτ\frac{dq}{dt}=GNq-\frac{q}{\tau_p}+\frac{\beta N}{\tau}

Gain and photon lifetime

G=cσAL,τp=TrtδG=\frac{c\sigma}{AL},\qquad\tau_p=\frac{T_{\mathrm{rt}}}{\delta}
δ=ln⁡ ⁣(1R1R2)+2αL,Trt=2Lc\delta=\ln\!\left(\frac1{R_1R_2}\right)+2\alpha L,\qquad T_{\mathrm{rt}}=\frac{2L}{c}

Lasing threshold

Nth=1Gτp,gth=δ2lg,Pp,th=hνpNthτN_{\mathrm{th}}=\frac1{G\tau_p},\qquad g_{\mathrm{th}}=\frac{\delta}{2l_g},\qquad P_{p,\mathrm{th}}=\frac{h\nu_p N_{\mathrm{th}}}{\tau}

Above threshold

Pout=ηs(Pp−Pp,th),ηs=λpλT2δP_{\mathrm{out}}=\eta_s(P_p-P_{p,\mathrm{th}}),\qquad\eta_s=\frac{\lambda_p}{\lambda}\frac{T_2}{\delta}

Relaxation oscillations

s2+rτs+r−1ττp=0s^2+\frac r\tau s+\frac{r-1}{\tau\tau_p}=0
γR=r2τ,ωR=r−1ττp−γR2\gamma_R=\frac r{2\tau},\qquad\omega_R=\sqrt{\frac{r-1}{\tau\tau_p}-\gamma_R^2}
N
number of inverted atoms in the mode volume (four-level: N = N2)
q
photons in the lasing mode, both directions together
Rp
pump rate into the upper level, Rp = Pp/hνp (s⁻¹)
τ, τp
upper-state lifetime and photon (cavity) lifetime
σ, A, β
emission cross-section, mode area, spontaneous-emission fraction into the mode
g, α
single-pass intensity gain coefficient σN/(Alg) and internal loss (m⁻¹)
δ
logarithmic round-trip loss, so photons decay as e−δ per round trip
r
pump ratio Rp/Rp,th
T2
output-coupler transmission 1 − R2 (lossless mirror)

Assumptions and validity: ideal four-level medium with instant pump-band and lower-level decay, a single mode, the uniform-field limit (small loss per pass, δ ≲ 0.3), unit pump quantum efficiency, group index 1, and no spatial hole burning, thermal lensing or reabsorption. Numerics: fixed-step RK4 with Δt = min(τp/10, τ/1000). Halving Δt changes the transient by less than 10⁻⁴. The pump sweep uses Δt = τp/2, which is allowed because RK4's fixed points are the exact equilibria of the ODE.

Derivation: threshold, photon lifetime and the L–I line

Over one round trip the intensity is multiplied by M = R1R2e2glge−2αL. Spreading that change evenly over Trt gives a photon growth rate ln M/Trt = 2glg/Trt − δ/Trt. With g = σN/(Alg), the first term is 2σN/(A Trt) = cσN/(AL) = GN, and the second is 1/τp. So the photon equation is exactly dq/dt = (GN − 1/τp)q, and threshold GN = 1/τp is the same as M = 1.

In steady state above threshold, dq/dt = 0 with q ≫ 1 forces GN = 1/τp. The inversion, and hence the gain, is clamped at Nth. Then dN/dt = 0 gives Rp − Nth/τ = GNthq = q/τp, so q = τp(Rp − Rp,th). Every photon hits the output coupler once per round trip, so Pcirc = q hν/Trt and Pout = T2Pcirc = (T2/δ)(hν/hνp)(Pp − Pp,th). The slope ηs is the output-coupling efficiency T2/δ times the quantum defect λp/λ.

Exact bookkeeping. The photon loss rate q/τp = qδ/Trt splits between the output mirror, the back mirror and internal loss in the ratio ln(1/R2) : ln(1/R1) : 2αL. With the "exact photon budget" option, Pout = ln(1/R2) q hν/Trt, and absorbed pump photons = spontaneous decays + output + back mirror + internal loss holds exactly. Since ln(1/R2) = T2 + T2²/2 + …, the two options differ by about T2/2 (2.5 % at R2 = 95 %).

Relaxation oscillations. Write N = Nth + n and q = q0 + m, drop the products nm, and set β → 0. This gives dn/dt = −(r/τ)n − m/τp and dm/dt = Gq0n = ((r−1)/τ)n. Eliminating n gives m̈ + (r/τ)ṁ + (r−1)/(ττp) m = 0, a damped oscillator with ω0² = (r−1)/(ττp) and γR = r/(2τ). Because τp ≪ τ, the oscillation is strongly underdamped for any r that is not extremely close to 1.

Exercise 1: Threshold and slope from an L–I sweep

  1. With R2 = 95 % (preset "2 × threshold"), Pp,th = 1.40 W and ηs = 0.407. Predict both values after changing R2 to 90 %.
  2. Set R2 = 90 % in the number box. The sweep re-runs automatically.
  3. Read the fitted threshold and slope under the L–I plot.
  4. Why do both the threshold and the slope rise?
Show answer

δ rises from 0.0933 to ln(1/(0.998·0.9)) + 0.04 = 0.1474, and Pp,th ∝ δ gives 1.40 × 0.1474/0.0933 ≈ 2.21 W. The slope is ηs = 0.759 × 0.10/0.1474 ≈ 0.515. A larger share of the loss now leaves through the useful mirror, which raises the slope, but more gain is needed to reach threshold. The optimum output coupling balances the two at a given pump.

Exercise 2: Relaxation frequency versus pump

  1. Going from the "1.2 × threshold" preset to "2 × threshold", by what factor should fR change?
  2. Load each preset in turn.
  3. Read the simulated fR and γ in both cases, and the period of the kicked response.
  4. Why does γ grow only linearly with r while fR grows as √(r−1)?
Show answer

Since γR² ≪ ω0², fR ≈ √((r−1)/(ττp))/2π, and the ratio is √(1/0.2) ≈ 2.24: 55.5 kHz → 124 kHz. γ = r/(2τ) goes from 2.6×10³ to 4.3×10³ s⁻¹. The restoring force comes from the extra stimulated emission G q0 ∝ r − 1 acting through the short photon lifetime. The damping comes from the inversion recovery rate 1/τ + Gq0 = r/τ.

Exercise 3 (limiting case): a perfect output mirror

  1. Load "R₂ = 100 %". Does the laser reach threshold? What are Pout and Pcirc?
  2. Press Start and wait for the oscillations to decay.
  3. Read Pcirc, Pout and the slope efficiency.
  4. Where does the pump power go?
Show answer

δ drops to 0.042 (back mirror plus internal loss only), so the threshold falls to 0.63 W and the preset pumps at 1.26 W. The cavity lases with Pcirc ≈ 11 W, yet Pout = 0 exactly and ηs = 0. All of the extracted power is lost to scattering (2αL) and to the 0.2 % back mirror. fR also drops to 83 kHz, because τp grew from 7.2 ns to 15.9 ns.

Exercise 4 (limiting case): large versus small signal

  1. In the "2 × threshold" turn-on, will the spacing between the first two spikes equal the small-signal period 1/fR ≈ 8.06 µs?
  2. Press Reset, then Start, and watch the "Latest spike spacing" readout.
  3. Note the spacing after the first few spikes and again after about 1 ms (500 µs/s speed).
  4. Explain the difference.
Show answer

The first spikes are about 15 µs apart, roughly twice 1/fR, because each spike drives N far below Nth. The inversion then has to be rebuilt by the pump, which is a nonlinear, relaxation-type cycle. Only once Δq/q ≪ 1 does the spacing approach 8.06 µs, which it does to within 0.5 % after 2.5 ms (see the unit tests). The linearised formula is a small-signal result.

Worked example: a diode-pumped Nd:YAG laser

Take L = 10 cm, lg = 5 cm, R1 = 99.8 %, R2 = 95 %, α = 0.2 m⁻¹, σ = 2.8×10⁻²³ m², τ = 230 µs, w = 0.5 mm and Pp = 2.80 W at 808 nm. Find the threshold, output power and relaxation frequency.

  1. Round-trip loss: δ = ln(1/0.998) + ln(1/0.95) + 2(0.2)(0.1) = 0.0020 + 0.0513 + 0.0400 = 0.0933. Trt = 2L/c = 0.667 ns, so τp = Trt/δ = 7.15 ns.
  2. Threshold gain: gth = δ/(2lg) = 0.933 m⁻¹. With A = πw² = 7.85×10⁻⁷ m², G = cσ/(AL) = 1.07×10⁻⁷ s⁻¹ and Nth = 1/(Gτp) = 1.31×10¹⁵ atoms.
  3. Threshold pump: Rp,th = Nth/τ = 5.69×10¹⁸ s⁻¹, and hνp = 2.46×10⁻¹⁹ J gives Pp,th = 1.40 W. The pump ratio is r = 2.00.
  4. Slope and output: ηs = (808/1064)(0.05/0.0933) = 0.407, so Pout = 0.407 × (2.80 − 1.40) = 0.569 W and Pcirc = Pout/T2 = 11.4 W.
  5. Relaxation: γR = r/(2τ) = 4.35×10³ s⁻¹ (1/e time 230 µs), and ωR ≈ √((r−1)/(ττp)) = 7.80×10⁵ s⁻¹, so fR = 124 kHz. The simulator's kicked response gives the same value to better than 10⁻⁴.

Load "2 × threshold" and check each number against the readouts.

When the model fails

  • High output coupling or high gain per pass (δ ≳ 0.3): the intracavity intensity is no longer uniform along the axis. Use the Rigrod analysis with separate forward and backward waves. The two bookkeeping options then disagree noticeably.
  • Several modes: spatial hole burning in a standing-wave cavity, inhomogeneous broadening and mode competition need a multimode model. Mode beating and relative-intensity noise are not captured.
  • Quasi-three-level media (Yb:YAG, 946 nm Nd, Er fibre): the lower level is populated and reabsorbs, so N ≠ N2 and threshold depends on the total ion density.
  • Thermal effects: thermal lensing changes the mode area A and the resonator stability at high pump power. The pump–mode overlap efficiency is taken as 1 here.
  • Q-switching, mode locking, noise and linewidth: phase, spontaneous-emission noise (Schawlow–Townes linewidth) and pulse formation are outside a mean-photon-number model.

References

  • A. E. Siegman, Lasers (University Science Books, 1986), ch. 11 (threshold, output coupling), ch. 25 (relaxation oscillations).
  • O. Svelto, Principles of Lasers, 5th ed. (Springer, 2010), ch. 7 (continuous-wave behaviour, slope efficiency, optimum coupling) and ch. 8.
  • B. E. A. Saleh and M. C. Teich, Fundamentals of Photonics, 3rd ed. (Wiley, 2019), chapters on resonator optics and lasers.
  • W. Koechner, Solid-State Laser Engineering, 6th ed. (Springer, 2006), ch. 3: Nd:YAG parameters and L–I measurements.
  • MIT OCW 6.974, Fundamentals of Photonics: Quantum Electronics, lecture notes on laser dynamics.

📚 Physics Background

💡 How a Laser Works

LASER stands for Light Amplification by Stimulated Emission of Radiation. A laser combines an amplifier, a gain medium with population inversion, with optical feedback from two mirrors. Oscillation starts when one round trip amplifies the light by at least as much as the mirrors and internal losses remove.

What this simulator computes: the number of inverted atoms N(t) and the number of photons q(t) in one cavity mode, from coupled rate equations. It does not model the optical phase, the transverse beam profile, or which longitudinal modes lase. Coherence and mode selection come from the resonator's field modes (see "Which modes lase?"), not from the dots in the animation.

⚛️ Why a Four-Level System

In a two-level system, pumping can at best equalise the populations, so optical pumping alone cannot produce inversion. The model uses an ideal four-level scheme:

  • The pump lifts atoms from E0 to a pump band E3, which relaxes quickly to the upper laser level E2.
  • E2 has a long lifetime τ (230 µs here).
  • The lower laser level E1 empties to E0 almost instantly, so it stays empty.

So any pump rate produces some inversion. Threshold is the inversion at which the gain balances the cavity loss.

🎯 Below, At and Above Threshold

⬇️ Below threshold (r < 1)

The inversion rises to Rpτ < Nth, so the gain stays below the loss line. The mode holds only tens of photons, fed by spontaneous emission, and the output is at the nanowatt level.

⚡ At threshold (within ±1 %)

The gain approaches the loss line (M → 1) and the photon number grows slowly. Its final value is set only by spontaneous emission, many orders of magnitude below the above-threshold output. This is the knee of the L–I curve on a log scale.

🔥 Above threshold (r > 1)

After a delay τ ln(r/(r−1)), the inversion overshoots Nth and the photon number explodes into a spike. Damped relaxation oscillations follow. In steady state the gain is clamped at gth, and every extra pumped atom becomes a photon: q = τp(Rp − Rp,th).

⚠️ What Is Computed and What Is Illustrative

  • Computed: N(t), q(t), g(t), M(t), Pcirc, Pout, the threshold, the L–I sweep, the relaxation response and the passive-cavity mode numbers.
  • Illustrative only: the atom dots (the red fraction is N/2Nth) and the photon dots (their count grows with log₁₀ q, with none below 10⁴ photons). New dots copy the direction of an existing mode photon, which stands for stimulated emission into the mode. Faint sparks show spontaneous emission going in random directions.
  • Mentioned but not simulated: coherence, linewidth, mode competition and transverse modes.

🔬 Applications of Lasers

  • Communications: fibre-optic links. Relaxation oscillations limit how fast a directly modulated diode laser can be switched.
  • Materials processing: cutting, welding and marking, often with Nd:YAG or fibre lasers like the one modelled here.
  • Medicine: surgery, ophthalmology and dermatology.
  • Science: spectroscopy, interferometry and atomic cooling.