Physics Quantum Mechanics Superfluid BEC WebGL GLSL

Superfluid Vortices in Your Browser: Solving the Gross–Pitaevskii BEC Equation in WebGL


ξ (Healing Length): 0.60 Δx | c_s (Bogoliubov Sound): 1.18 | Click/Drag to stir quantized 2π vortices
Live 2D Gross–Pitaevskii Superfluid BEC Solver. Click or drag across the condensate to stir quantized $2\pi$ phase vortices ($\oint \nabla\varphi \cdot d\vec\ell = 2\pi n$), or switch between Abrikosov Vortex Lattice, Vortex–Antivortex Dipole, Supersonic Obstacle Shedding, and Dark Soliton Snake Instability.

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:

Madelung Continuity & Quantum Euler Momentum Equations ($\hbar = m = 1$)
$$\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \vec v_s) = 0, \qquad \frac{\partial \vec v_s}{\partial t} + (\vec v_s \cdot \nabla)\vec v_s = -\frac{1}{\rho}\nabla P_{\text{int}} - \nabla V_{\text{trap}} + \nabla\!\left(\frac{\nabla^2\sqrt{\rho}}{2\sqrt{\rho}}\right)$$ $$\vec v_s = \nabla \varphi = \frac{\psi_R \nabla \psi_I - \psi_I \nabla \psi_R}{\psi_R^2 + \psi_I^2}, \qquad P_{\text{int}} = \frac{1}{2}g\rho^2, \qquad c_s = \sqrt{\frac{\partial P_{\text{int}}}{\partial \rho}} = \sqrt{g\rho_0}$$

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);
}
Why You Must Subtract the Chemical Potential $\mu = gn_0$ in Explicit Leapfrog Schemes: Without subtracting $\mu = gn_0$ from the diagonal potential, the uniform ground state $\psi_0 = \sqrt{n_0}e^{-i\mu t}$ rotates in complex phase at angular frequency $\omega_0 = gn_0$, eating up your symplectic stability budget $\Delta t \le 2 / (E_{\max} + gn_0)$ and causing high-$g$ condensates to blow up! Working in the co-rotating chemical potential frame ($\hat{H}_{\text{GP}} - \mu$) keeps the uniform background stationary in phase.

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