Superfluid Vortices in Your Browser: Solving the Gross–Pitaevskii BEC Equation in WebGL
In Solving Navier–Stokes at 60 FPS, we simulated classical viscous fluids where vorticity $\omega = \nabla \times \vec u$ takes arbitrary continuous values and decays via viscosity. In Quantum Tunneling in Your Browser, we evolved a linear single-particle Schrödinger wavefunction $\psi(\vec x, t) \in \mathbb{C}$. What happens when millions of bosons condense into the exact same macroscopic quantum ground state and repel one another via s-wave contact interactions?
The result is a Bose–Einstein Condensate (BEC) superfluid governed by the Gross–Pitaevskii Equation (GPE) (Tsubota et al., arXiv:cond-mat/0104255; Villois et al., arXiv:1604.03595). Adding a single cubic self-interaction term $g|\psi|^2\psi$ to our staggered symplectic leapfrog shader transforms the linear dispersion relation into a Bogoliubov superfluid with zero viscosity, a finite speed of sound $c_s = \sqrt{gn_0/m}$, and topologically quantized vortices whose circulation is locked to integer multiples of $h/m$.
0. Anatomy of a Quantum Superfluid Solver
- Governing PDE
- $i\hbar \partial_t \psi = \big(-\tfrac{\hbar^2}{2m}\nabla^2 + V_{\text{trap}}(\vec x) + g|\psi|^2 - \mu\big)\psi$, where $g \gt 0$ models repulsive s-wave boson scattering and $\mu = gn_0$ is the chemical potential.
- Madelung Fluid Map
- Writing $\psi = \sqrt{\rho}\,e^{i\varphi}$ maps the GPE onto inviscid compressible Euler hydrodynamics with superfluid velocity $\vec v_s = \frac{\hbar}{m}\nabla\varphi$ and Bohm quantum pressure $Q = -\frac{\hbar^2}{2m}\frac{\nabla^2\sqrt{\rho}}{\sqrt{\rho}}$.
- Quantized Circulation
- Because $\psi$ is single-valued, the phase $\varphi$ must wind by $2\pi n$ around any closed loop: $\oint_{\mathcal{C}} \vec v_s \cdot d\vec\ell = \frac{h}{m}n$ ($n \in \mathbb{Z}$). Vorticity vanishes everywhere except at point singularities where $\rho \to 0$.
- Healing Length $\xi$
- The vortex core radius $\xi = \hbar / \sqrt{2mgn_0}$ where kinetic quantum pressure balances nonlinear interaction energy $gn_0$.
1. Madelung Hydrodynamics & Why Superfluid Vortices Are Quantized
Substituting the polar decomposition $\psi(\vec x, t) = \sqrt{\rho(\vec x, t)}\,e^{i\varphi(\vec x, t)}$ (with natural units $\hbar = m = 1$) into the Gross–Pitaevskii equation and separating real and imaginary parts yields the exact Madelung quantum fluid equations:
Notice two remarkable consequences: (1) the repulsive nonlinearity $g|\psi|^2$ acts as a polytropic gas pressure $P = \frac{1}{2}g\rho^2$ with sound speed $c_s = \sqrt{g\rho_0}$, and (2) the Bohm quantum potential $\frac{\nabla^2\sqrt{\rho}}{2\sqrt{\rho}}$ regularizes vortex cores at scale $\xi = 1/\sqrt{2g\rho_0}$ without requiring artificial viscosity!
💻 GLSL: Staggered Symplectic Gross–Pitaevskii Shader & Topological Vortex StampingGLSL
// Isotropic 9-point Laplacian on RGBA16F wavefunction texture C = (psi_R, psi_I)
vec2 lap = (10.0 / 3.0) * (0.20 * (N + S + E + W) + 0.05 * (NE + NW + SE + SW) - C);
float rho = dot(C, C); // Condensate density |psi|^2 = psi_R^2 + psi_I^2
// Effective nonlinear Hamiltonian potential: V_eff = V_trap(x) + g * |psi|^2 - mu
float V_eff = evalTrapAndObstacle(vUv, uTime) + uCouplingG * (rho - 1.0);
if (uPassType == 0) {
// Pass A: advance Real part psi_R^(n+1) using H_GP * psi_I^(n+1/2)
float hPsiI = -0.5 * lap.g + V_eff * C.g;
gl_FragColor = vec4(C.r + uDt * hPsiI, C.g, 0.0, 1.0);
} else {
// Pass B: advance Imag part psi_I^(n+3/2) using H_GP * psi_R^(n+1)
float hPsiR = -0.5 * lap.r + V_eff * C.r;
gl_FragColor = vec4(C.r, C.g - uDt * hPsiR, 0.0, 1.0);
}
2. Four Superfluid Regimes in the Interactive Simulator
| Preset Mode | Initial Field $\psi(\vec x, 0)$ | Macroscopic Quantum Phenomenon |
|---|---|---|
| Abrikosov Vortex Lattice | Array of same-sign $n = +1$ phase singularities | Same-sign vortices co-rotate in a triangular Abrikosov crystal lattice rather than merging |
| Vortex–Antivortex Dipole | Opposite-circulation pairs ($n = \pm 1$) | Kelvin–Helmholtz self-induced translation at speed $v_{\text{pair}} = \frac{\hbar}{m d}$ followed by BKT acoustic annihilation |
| Supersonic Obstacle Shedding | Moving Gaussian laser barrier ($v_{\text{obs}} \gt c_s$) | Breakdown of Landau superfluidity above the critical Mach number, shedding quantized von Kármán vortex pairs (Liu et al., arXiv:2311.06664) |
| Dark Soliton Snake Instability | Planar $\tanh(x/\xi)$ density notch with $\pi$ phase jump | 2D transverse "snake" modulational instability decaying a planar dark soliton into a chain of vortex–antivortex pairs |