juliaTDGL: the four dots of the Julia logo as vortices over the j and the iv2.0.0 GitHub

The numerics

How release 2.0 discretises the model, and why each choice is there.

The lattice

A staggered Cartesian mesh carries Ψμ on the nodes, the vector potential on the links and the field on the plaquettes. The links hold link variables \( U = e^{-i\mathbf A\cdot d\mathbf l} \), so lattice gauge invariance is exact. The condensation mask f sits on the nodes. The six faces of the sample have covariant Neumann conditions, written as ghost nodes \( \Psi_{\mathrm{face}} = U\,\Psi_{\mathrm{interior}} \). Every loop over nodes or links is free of reductions, so a run gives the same bits with any number of threads.

The voltage is gauge-invariant by construction: the time derivative of the phase difference \( \arg(\Psi_i^* U \Psi_j) \) summed along measuring lines between two planes inside the contacts. Each 2π slip of a line is one vortex crossing.

The band update

Without KWT a band takes an explicit step of its right-hand side Rμ, a Jacobi sweep over the interior nodes, \( \Psi_\mu^{n+1} = \Psi_\mu^n + (dt/\Gamma_\mu)R_\mu \). With KWT the left-hand side is a symmetric positive operator on Ψ seen as a vector of ℝ², inverted per node without dividing by Ψ:

\[ \partial_t\Psi = R' - \frac{\tilde\gamma^2\,\Psi\,\mathrm{Re}(\Psi^* R')}{1+\tilde\gamma^2|\Psi|^2}, \qquad R' = \frac{\sqrt{1+\tilde\gamma^2|\Psi|^2}}{\Gamma}\,R . \]

With materials the coefficients are read per node, through one index per node into small tables; with one material the kernel is the one of before, at the same speed and with the same bits.

The field update

The curl-curl term is implicit, one solve per step; the supercurrent is explicit:

\[ \Big(I + \frac{dt}{\sigma_n}\kappa^2 K\Big)\mathbf A^{n+1} = \mathbf A^n + \frac{dt}{\sigma_n}\mathbf J_s^n - \frac{dt}{\sigma_n}\kappa^2\mathbf c , \]

with K the Yee curl-curl and c the boundary fields. With dx = dy = dz, K is diagonalised by per-axis bases, and per wavevector \( (I+aK)^{-1} = P_L + P_T/(1+a|k|^2) \): an exact, direct solve by dense products along each axis. Only the transverse part is implicit; the longitudinal part (the conversion layers) moves with Js.

With an insulating buffer or a sample carved in vacuum the conductivity changes from link to link and the system is no longer separable. It is solved by conjugate gradients with the separable solve as preconditioner. The iterations are set by the smooth solenoidal fields of the vacuum: they sit in the middle of the preconditioned spectrum, nearly independent of the conductivity contrast. That is why no cheap separable preconditioner removes them, and a full auxiliary-space (multigrid) correction would cost more per iteration than it saves. What pays is the tolerance (10−8 of the step's right-hand side) and a first guess extrapolated from the last two steps, with the preconditioner in single precision inside a flexible conjugate gradient. On the nanowire box that takes 14 iterations to 6.5 and the step from 10.1 to 4.5 ms; the state stays within 2 × 10−9, and a CPU ladder resumes to the bit with matched arithmetic.

The time step

The step is the smallest of the stability bounds, times 0.99 and dt_scale (0.5 by default). For band μ,

\[ dt_\mu = \frac{2\Gamma_\mu}{4g_\mu\sum_i dx_i^{-2} + h_\mu}\cdot\frac{1}{\sqrt{1+\tilde\gamma_\mu^2 P_\mu^2}}, \qquad h_\mu = 3\beta_\mu P_\mu^2 - \varepsilon_\mu , \]

with Pμ the amplitude of the coupled homogeneous equilibrium. The explicit supercurrent adds \( 2\sigma_n/\sum_\mu g_\mu n_\mu \), with nμ = aμ/βμ for a band that condenses alone and Pμ² for a passive one (a ≤ 0, condensed by the coupling); the heat model adds 0.15 dx²/DT. The summary of a run names the bound that set the step. KWT makes the phase mode √(1 + γ̃²P²) times faster: with γ̃ = 10 the explicit step would be ten times shorter.

Stabilised stages

Instead of shortening the step, a band made stiff by KWT advances by first-order stabilised Runge–Kutta stages over the step of the same model without KWT:

\[ Y_0 = \Psi^n,\quad Y_1 = E(Y_0),\quad Y_j = \mu_j E(Y_{j-1}) + \nu_j Y_{j-2},\quad \Psi^{n+1} = Y_s , \]

with E an Euler step of dt/q. Two families are in the code:

  • Runge–Kutta–Chebyshev (the default). Damped RKC (Verwer, Hundsdorfer and Sommeijer): \( \omega_0 = 1 + \epsilon/s^2 \), \( \omega_1 = T_s(\omega_0)/T_s'(\omega_0) \), \( \mu_j = 2\omega_0 T_{j-1}/T_j \), \( \nu_j = -T_{j-2}/T_j \), q = ω0/ω1. Its stability polynomial is \( T_s(\omega_0+\omega_1 z)/T_s(\omega_0) \), so s stages bridge 0.762 s² explicit steps with the damping ε = 0.5. The textbook damping, 0.05, lets the splitting with the field and the other band grow a mode, and the notched KWT box diverged within 100 steps.
  • Runge–Kutta–Legendre (Meyer, Balsara and Aslam), rkl = true: μj = (2j−1)/j, νj = (1−j)/j, q = s(s+1)/2.

A band takes RKC only where it saves a stage, so a run without KWT keeps the bits of RKL. On the notched KWT box of the examples RKC is 6 % faster per step at γ̃ = 10 and 10 % at γ̃ = 30, with the same brackets, the same delay of the first slip (0.05 %) and the same energy balance.

The rotating frame

In the gauge Φ = 0 a stationary state with charge imbalance is not a fixed point of an explicit step. Where its phase turns at rate ω, the step of that rotation, |1 + iωh| > 1, leaves a radial error ∝ ω²dt, and KWT multiplies it by √(1 + γ̃²|Ψ|²). With rotframe (on with KWT) each band is stepped in the gauge that turns with it, \( \Psi = e^{i\hat\omega\tau}\tilde\Psi \). The band equation gains −iω̂Ψ̃, the links gain the difference of the rates, and the state is turned back exactly at the end of the step. A stationary state is then a fixed point of every stage for any dt: the KWT state is the same to six digits at dt, dt/2, dt/4 and with explicit substeps, for γ̃ = 0, 10 and 30. Any bounded ω̂ is an exact change of gauge.

Noise in a stiff band

With KWT the phase modes of the lattice are s ≈ 8–23 times faster, and thermal noise excites them at the scale of the mesh. A kick added after the stages over-heats them, by a factor 2|z|/(1 − R²) for a mode with z = λdt and stability function R. Even when the run stayed finite, the equilibrium came out wrong. So with noise a KWT band steps in log-polar form: its increments, the frame term and the combination of its stages act on the phase as rotations, and the frame rate is smoothed. Its phase kick enters the first RKC stage (SK-ROCK: Abdulle, Almuslimani and Vilmart, 2018), and its amplitude kick is polar, with the drift \( \tilde T/(2\Gamma dV\rho s^3) \). The equilibrium ⟨|Ψ|²⟩ with KWT then matches the one without KWT, which it must, because the Gibbs measure does not depend on the mobility:

  • within 1.2 % at T̃ = 10−3;
  • at T̃ = 10−2, the stiff π band comes out 5–10 % high at the production step. That is the integrator on its stiffest modes, and it goes away when the step resolves them.

RKL stages with noise and KWT are refused, because their equilibrium is biased.

Reproducibility

  • To the bit. With the new terms off, release 2.0 reproduces release 1.2 state by state, to the bit with the Haswell kernels of OpenBLAS (any x86 machine with AVX2), and to 10−10 on other kernels. Verdicts and counts are exact either way.
  • Stop and resume. A checkpoint per closed point carries the state and the whole ladder: the solver's last solutions, the noise stream, the temperature, the open-boundary ramp. CPU continuation is bitwise with matched arithmetic; GPU continuation is checked within tolerance because loading reconstructs links on the host. Older replay-ring entries have a separate PCG/RNG-history limitation.
  • The scheme defaults travel with the run. A run folder keeps the defaults it started with (scheme_defaults.toml), so resuming, refining or filming an old run never switches its integrator in the middle of a ladder. A key given in the run file always wins.
  • Threads give the same bits, but no speed on a laptop: the step is limited by memory bandwidth, so a campaign runs one single-threaded process per physical core.