Introduction
projects / tesla-elec.mdx

Tesla Coil Pt.2, Simulation

Multi-physics simulation of my Tesla Coil. The inductance and coupling of coils are calculated, and used with a time-domain electronic solver.

Introduction

For my previous Tesla Coil project, I wanted to better understand the physical principles behind the machine, and to experiment with the effect of geometry and component choices on its behaviour.

In this article, concise and technical, I study the inductive coupling between coil geometries, then use this data to build a real-time electronic simulation of the full Tesla Coil cycle.

The Inductance and Magnetic coupling

Parametrization

A general coil geometry can be described by the following parametrization, where t∈[0,1]t \in [0, 1]:

r(t)=(((1−t)r+tR)cos⁡(2πNturnt)((1−t)r+tR)sin⁡(2πNturnt)L(t−0.5))+rotation+translation\bm{r}(t) = \left( \begin{align*} ((1-t)r +& tR) \cos(2\pi N_\text{turn} t) \\ ((1-t)r +& tR) \sin(2\pi N_\text{turn} t) \\ &L(t - 0.5) \end{align*}\right) + \text{rotation} + \text{translation}

This allows for a conical coil (when r≠Rr \neq R) that reduces to a standard cylindrical coil when r=Rr = R. The parameter NturnN_\text{turn} controls the number of turns and LL the total length of the coil.

In the case of my DIY Tesla Coil, the system is modelled with the following parameters, where coil 1 is the primary and coil 2 is the secondary:

python
r1 = 0.1            r2 = 0.05
R1 = 0.25           R2 = 0.05
n1 = 9              n2 = 1200
L1 = 0              L2 = 2*w2*n2 = 0.4
w1 = 0.01           w2 = 0.000165
z01 = 0.02          z02 = 0.
The two coils under study (blue: primary, orange: secondary).
The two coils under study (blue: primary, orange: secondary).

It is useful to reparametrize the curve with an arc-length parametrization, one where the "speed" ∣dr/dt∣|d\bm{r}/dt| is constant. This ensures that when the curve is discretized numerically, all segments have the same length, which may be important for the accuracy of finite element methods.

The arc length as a function of tt is:

s(t)=∫0t∣drdt′(t′)∣dt′s(t) = \int_0^t \left| \frac{d\bm{r}}{dt'}(t') \right| dt'

If we can express t(s)t(s), then r(t(s))\bm{r}(t(s)) is arc-length parametrized. While s(t)s(t) can in principle be computed analytically for our coil, the expression is complicated and cannot be inverted in closed form. We therefore compute the reparametrization numerically:

python
def equinorm_integral(f):
    """Compute cumulative arc length along a discretized curve f of shape (N, 3)."""
    d_dist = np.sqrt(np.diff(f[..., 0])**2 +
                     np.diff(f[..., 1])**2 +
                     np.diff(f[..., 2])**2)
    return np.concatenate(([0.], np.cumsum(d_dist)))
 
def equinorm_param(t, f):
    """Return values of t that produce uniformly spaced arc-length samples."""
    s_of_t = equinorm_integral(f)
    s_of_t /= s_of_t[-1]
 
    t_of_s = interp1d(s_of_t, t, axis=0)
    s_uniform = np.linspace(0, 1, len(t))
    return t_of_s(s_uniform)

Physical model

A coil is electrically described by its self-inductance LiL_i and its coupling kijk_{ij} to other coils. This coupling arises from the variation of magnetic fields generated by other coils. Concretely, the voltage across coil ii is:

Vi=LidIidt+∑jMijdIjdtV_i = L_i\frac{dI_i}{dt} + \sum_j M_{ij}\frac{dI_j}{dt}

where the coupling depends on the mutual inductance through:

kij=MijLiLjk_{ij} = \frac{ M_{ij} }{ \sqrt{L_i L_j} }

The mutual inductance between two coils ii and jj can be calculated using the Neumann formula:

Mij=μ04π∫Ci∫Cjdl1⋅dl2∣r1−r2∣M_{ij} =\frac{\mu_0}{4\pi} \int_{C_i}\int_{C_j} \frac{ d\bm{l}_1 \cdot d\bm{l}_2 }{|\bm{r}_1 - \bm{r}_2|}

The magnetic field generated by a coil is given by the Biot–Savart law:

B(r)=μ0I4π∫Cdr′×r−r′∣r−r′∣3\bm{B}(\bm{r}) = \frac{\mu_0 I}{4\pi} \int_{C} d\bm{r'} \times \frac{ \bm{r} - \bm{r'}}{|\bm{r} - \bm{r'}|^3}

Magnetic field

We model each coil as a series of straight segments, where each segment is located at r0\bm{r_0}, oriented along unit vector u0\bm{u_0}, and has length ℓ0\ell_0. The exact magnetic field generated by a single such segment is:

B(r)=μ0I4πγ(ℓ0+β(ℓ0+β)2+γ−ββ2+γ)u0×(r−r0) with β=u0⋅(r−r0) and γ=∣r−r0∣2−β2\begin{align*} \bm{B}(\bm{r}) & = \frac{\mu_0 I}{4\pi \gamma} \left( \frac{\ell_0 + \beta }{ \sqrt{(\ell_0 + \beta)^2 + \gamma}} - \frac{ \beta }{ \sqrt{\beta^2 + \gamma}} \right) \bm{u_0} \times (\bm{r} - \bm{r_0}) \\ \text{ with } & \beta = \bm{u_0} \cdot (\bm{r} - \bm{r_0})\\ \text{ and } & \gamma = |\bm{r} - \bm{r_0}|^2 - \beta^2 \end{align*}

The total field of the coil is then obtained by summing the contributions of all segments; this is essentially a finite element approach.

Coupling

Deriving an exact closed-form solution for the mutual inductance integral between two arbitrary coils is generally intractable. We therefore approximate the Neumann double integral as a double sum over segment midpoints xi\bm{x}_i, where Δxi\bm{\Delta x}_i is the vector representing each segment (encoding both direction and length):

Mij=μ04π∑xi∑xjΔxi⋅Δxj∣xi−xj∣M_{ij} = \frac{\mu_0}{4\pi}\sum_{\bm{x}_i} \sum_{\bm{x}_j} \frac{ \bm{\Delta x}_i \cdot \bm{\Delta x}_j }{|\bm{x}_i - \bm{x}_j|}

Analytical inductance and coupling

For validation, we can also use a theoretical result for the mutual inductance of two coaxial loops of radii RiR_i, RjR_j separated by a distance dd:

mij=μ0RiRj2k((1−k22)K(k2)−E(k2)) with k2=4RiRj(Ri+Rj)2+dij2\begin{align*} m_{ij} &= \mu_0\sqrt{R_i R_j} \frac{2}{k} \left( \left(1-\frac{k^2}{2}\right)K(k^2) - E(k^2) \right)\\ \text{ with }& k^2 = \frac{4 R_i R_j }{ (R_i + R_j)^2 + d_{ij}^2} \end{align*}

where KK and EE are the complete elliptic integrals of the first and second kind, respectively.

The self-inductance of a single loop of radius RR with wire radius ρ\rho is:

ℓi=μ0R(log⁡(8Rρ)−2)\ell_{i} = \mu_0 R \left( \log \left( \frac{8R}{\rho} \right) - 2 \right)

From these two results, the total self-inductance of a coil (summing each loop's self-inductance and all mutual interactions between loops) and the total mutual inductance between two coils can be reconstructed by summing the appropriate ℓi\ell_i and mijm_{ij} terms.

When the winding density is high (many turns per unit length), the coil can be modelled as a continuous cylindrical sheet of conductor. In this limit, the self-inductance becomes:

L≈μ0πN2R2Lc⋅LcLc+0.9RL \approx \frac{\mu_0 \pi N^2 R^2}{L_c} \cdot \frac{L_c}{L_c+0.9R}

where NN is the number of turns, RR is the coil radius, and LcL_c is the physical length of the coil. The factor LcLc+0.9R\frac{L_c}{L_c+0.9R} is the Nagaoka correction, which accounts for the finite length of the coil (this is itself an approximation of the exact Nagaoka function).

Results

For the studied coil configuration, we obtain the magnetic field and the self and mutual inductance.

Magnetic field generated by coil 1.
Magnetic field generated by coil 1.
Magnetic field generated by coil 2.
Magnetic field generated by coil 2.
plots
How much each part of a coil contributes to its self inductance (top) and to the mutual inductance with the other coil (bottom).
python
    === COIL 1 ===
Length = 9.8972 m
R = 0.0005 Ohms
L (analytic)     = 28.1104 μH
L (simulation)   = 28.4587 μH
 
    === COIL 2 ===
Length = 376.9913 m
R = 74.0496 Ohms
L (analytic)            = 31950.6411 μH
L (analytic continuous) = 31937.5963 μH
L (simulation).         = 32840.9457 μH
 
    === COUPLING ===
M (analytic)    = 139.8130 μH -> k = 0.1475
M (simulation)  = 136.9115 μH -> k = 0.1416

These numerical results are the parameters of the circuit model below.

Electronic part

A spark-gap Tesla coil is two coupled resonant circuits. A neon-sign transformer (NST) slowly charges a capacitor; when its voltage reaches the breakdown voltage of the spark gap, the gap fires and the capacitor rings through the primary coil. Over a few cycles the energy moves into the secondary and its top-load, where the voltage is stepped up by two orders of magnitude until a streamer (the lightning) breaks out.

Circuit schematic: NST supply, primary circuit with spark gap, coupled secondary, streamer on the top-load
The simulated circuit. I1I_1 and I2I_2 are the currents flowing into C1C_1 and C2C_2.

Small notes. The model is physically consistent, but it is not fitted to measurements. The secondary losses and the streamer use typical values from the Tesla-coil literature. But it is fine, it is able to reproduce the typical Tesla Coil cycle !

The circuit

symbolvalue
NSTpeak voltage, RsupR_\text{sup}, LsupL_\text{sup}10 kV, 50 kΩ, 300 H
PrimaryL1L_1, C1C_128.5 µH, 19.6 nF
SecondaryL2L_2, R2R_2 (AC), C2C_232.84 mH, 222 Ω, 17 pF
Couplingkk, MM0.142, 136.9 µH
Resonancef1=f2f_1 = f_2213 kHz
Spark gapstatic breakdown VbV_b6.5 kV

C1C_1 is chosen so that f1=f2f_1 = f_2. Kirchhoff's voltage law around the two loops gives the coupled coils, the core of the model:

L1I˙1+MI˙2=−(RsI1+V1),C1V˙1=Isup+I1MI˙1+L2I˙2=−(R2I2+V2),C2V˙2=I2−Istr\begin{align*} L_1\dot I_1 + M\dot I_2 &= -(R_s I_1 + V_1), & C_1\dot V_1 &= I_\text{sup} + I_1 \\ M\dot I_1 + L_2\dot I_2 &= -(R_2 I_2 + V_2), & C_2\dot V_2 &= I_2 - I_\text{str} \end{align*}

with M=kL1L2M = k\sqrt{L_1L_2}, RsR_s the spark-gap resistance and IstrI_\text{str} the current into the streamer. The supply is LsupI˙sup=Vsup(t)−RsupIsup−V1L_\text{sup}\dot I_\text{sup} = V_\text{sup}(t) - R_\text{sup}I_\text{sup} - V_1.

For a tuned ideal circuit, the energy moves from the primary to the secondary in about 1/(2kf)≈171/(2kf) \approx 17 µs (about 3.5 primary cycles), and energy conservation bounds the secondary voltage:

V2,max⁡=V1C1/C2⇒221 kV for V1=6.5 kVV_{2,\max} = V_1\sqrt{C_1/C_2} \quad\Rightarrow\quad 221\ \text{kV for } V_1 = 6.5\ \text{kV}

The spark gap

The gap is the only discrete part of the model. It is modelled as a Cassie arc in series with a Mayr arc, so it conducts for several cycles and then extinguishes by itself instead of by an imposed rule.

  • Open: no current, I1=0I_1 = 0.
  • Fires when an ignition state SS reaches 1. SS is a 0 → 1 counter that fills while the gap voltage vgapv_\text{gap} exceeds the breakdown voltage VbV_b and leaks otherwise, so the gap needs some overvoltage and some time:
S˙=1τf[(∣vgap∣Vb)n−1]+−Sτleak\dot S = \frac{1}{\tau_f}\left[\left(\frac{|v_\text{gap}|}{V_b}\right)^{n} - 1\right]_+ - \frac{S}{\tau_\text{leak}}
  • Arc: Rs=Rc+RmR_s = R_c + R_m, a Cassie (constant arc voltage) and a Mayr (constant cooling power) resistance in series. Near a current zero both grow exponentially and the arc dies, so the gap quenches at a notch that the dynamics decides, not a rule.

The streamer

The streamer is a series branch RstrR_\text{str}–Cstr(l)C_\text{str}(l) on the top-load, whose capacitance grows with its length ll:

Cstr=c′(l+l0),Istr=V2−q/CstrRstr,l˙=(leq−l)(gτg+1−gτd),leq=[A−Vbo]+EdC_\text{str} = c'(l + l_0), \qquad I_\text{str} = \frac{V_2 - q/C_\text{str}}{R_\text{str}}, \qquad \dot l = (l_\text{eq} - l)\left(\frac{g}{\tau_g} + \frac{1-g}{\tau_d}\right), \qquad l_\text{eq} = \frac{[A - V_{bo}]_+}{E_d}

with AA the amplitude of the top-load voltage.

  • The streamer grows until the tip voltage falls to the breakout voltage Vbo=80V_{bo} = 80 kV (Ed=500E_d = 500 V/cm of voltage drop along it, growth time τg=30\tau_g = 30 µs).
  • It loads the secondary more and more, then fades slowly (τd=300\tau_d = 300 µs) because the hot channel cools slowly.
  • Rstr=220R_\text{str} = 220 kΩ and c′=4.5c' = 4.5 pF/m are typical literature values.

The 14 states variables are normalised and integrated together (Radau while the gap conducts, LSODA while it is open); two mains cycles take about 9 s.

Simulation results

Several mains cycles

With the NST connected, the capacitor charges slowly, the gap fires, and the cycle repeats: 13 discharges in 40 ms, nearly identical because the supply recharges the capacitor to the same voltage each time. Each discharge produces a burst of top-load voltage and a streamer.

plots
Two mains cycles. Each 18 µs discharge is a vertical line at this scale.

Zoom on one discharge

The first discharge, from 40 µs before the gap fires (t=0t = 0) to 100 µs after.

plots
One discharge. The gap fires at t=0t = 0 and quenches at 17.6 µs (red line). Energy is in % of the 0.43 J stored in C1C_1 at t=0t = 0.
  • The primary rings for 3.7 cycles and the gap quenches at 17.6 µs, close to the 16.6 µs predicted for a tuned pair.
  • The spark gap is an open circuit (109 Ω10^9\ \Omega) until it fires, then drops to about 1 Ω1\ \Omega and climbs back as the arc dies. The streamer is RstrR_\text{str} in series with a capacitance that grows with its length, so its impedance ∣Z∣=Rstr2+1/(ωCstr)2|Z| = \sqrt{R_\text{str}^2 + 1/(\omega C_\text{str})^2} (at 213 kHz) falls from about 15 MΩ15\ \text{M}\Omega to 350 kΩ350\ \text{k}\Omega as it grows.
  • The secondary reaches 161 kV (ideal lossless: 221 kV).
  • The streamer grows to 54 cm in about 25 µs and drains the secondary.
  • At most 57 % of the energy sits in the secondary (at 12 µs). Final split: 58 % streamer, 35 % spark gap, 7 % winding.

Tuning

plot
Peak energy reaching the secondary when the primary is detuned (only C1C_1 changes). The vertical line is the tuned case.

The optimal tuning is very close to the analytic value with a maximum efficiency of 57 % for f1/f2=1.01f_1/f_2 = 1.01.