Introduction

Classical numerical methods for simulating fluid dynamics and general nonlinear problems demand substantial computational resources. For instance, the direct numerical simulation (DNS) of turbulence faces significant challenges due to the cubic growth of computational cost with the Reynolds number (\({\rm{Re}}\)), which is necessary for resolving multiscale flow structures1,2. Quantum computation, leveraging the principles of superposition and entanglement inherent in quantum states, has shown an exponential advantage over classical computational methods in certain specific problems3,4,5. Consequently, quantum computing for fluid dynamics (QCFD)6,7,8,9,10,11,12 is anticipated to tackle turbulence, one of most challenging problems in classical physics13 and nonlinear dynamics.

Classical and quantum systems exhibit intrinsic differences: fluid dynamics is nonlinear and irreversible, whereas quantum computing relies on linear and unitary operations. This fundamental disparity presents a substantial challenge in simulating nonlinear dynamics using quantum computers14,15. Several approaches have been proposed to partially address this challenge. The Navier–Stokes (NS) equations governing fluid motion have been transformed into the Schrödinger equation and solved via Hamiltonian simulation8,10,16. They have also been discretized into a set of nonlinear ordinary differential equations and then linearized7,17. Variational quantum algorithms18 offer a feasible approach for addressing the nonlinearity in fluid dynamics simulations19,20. Quantum-classical hybrid methods have been employed to solve these equations6,21,22,23,24. Moreover, the general partial differential equations can be transformed into linear ones by increasing the dimensionality of the problem25,26,27,28.

In particular, the earliest attempt29 in QCFD used the lattice Boltzmann method (LBM)30,31, which provides a natural framework for addressing nonlinearity in fluid dynamics. By reformulating the NS equations into a higher-dimensional lattice gas representation, LBM inherently transforms the nonlinear convection term in physical space into a linear transport term in phase space. However, the collision term in LBM, usually treated by the Bhatnagar–Gross–Krook (BGK) model32, introduces additional nonlinearity, posing a significant challenge for its quantum implementation.

Therefore, developing a linear yet physically accurate collision model is crucial for the quantum lattice Boltzmann method (QLBM)9,11,33. In existing studies, the nonlinear part of the collision term has often been neglected to simulate simple convection-diffusion problems34,35,36,37,38,39,40,41. The nonlinearity in the collision term has been eliminated using the Carleman linearization, but this approach results in an exponential increase in the dimension of the linearized system with scale11,42,43,44. Another collision model in the lattice-gas cellular automata (LGCA)45,46,47 is linear and can be integrated into QLBM48,49, but its quantum algorithms suffer from excessively high dimensionality50. Consequently, an efficient QLBM algorithm for simulating nonlinear fluid dynamics has yet to be developed.

Here, we introduce a QLBM algorithm with a novel ensemble description of lattice gas to solve the NS equations. This ensemble assumes that each computational node contains multiple realizations, with all nodes being mutually independent. Our QLBM combines the strengths of both the LBM and LGCA, featuring medium dimensionality and linear collision treatment46. In the implementation, the probability distribution of the ensemble is encoded into amplitudes of quantum states. The evolution of the quantum states is driven by linear transport and collision steps. Additionally, an H-step is employed to keep the ensemble near thermodynamic equilibrium by reducing artificial correlations between qubits (measured by quantum entropy). The flow field is measured only at the end of simulation, thereby avoiding the need for frequent intermediate measurements and state preparations.

Notably, our QLBM is validated through simulations of vortex-pair merging and turbulence on up to 16.8 million computational grid points, representing the largest-scale case in QCFD to date. For comparison, the size of most existing QCFD simulations is limited to roughly 1000 grid points. This successful application demonstrates the capability of QCFD to address highly nonlinear flow prediction and provide insights into developing quantum algorithms for other nonlinear problems in various engineering applications.

Results

Method overview

Fluid dynamics is nonlinear, while quantum computing requires linearity. The key idea of our proposed QLBM is to “lift” a 2D/3D fluid system into a higher-dimensional (but still efficient) linear lattice gas model. This allows quantum hardware to handle nonlinearity via ensemble transformations, while an entropy-stabilizing step ensures physical equivalence between the quantum state and classical fluid dynamics.

The QLBM is used to solve the Boltzmann equation, which describes the evolution of the statistical distribution function of a particle system, and reduces to the NS equations at a small Knudsen number. Therefore, our QLBM holds the potential to simulate nonlinear problems across a wide range of transport phenomena in engineering.

In classical LBM or LGCA, the Boltzmann equation is solved using lattice gas models by discretizing the particle velocity into q discrete values through various DdQq models31 within a node in a d-dimensional space. As illustrated in Fig. 1, the lattice \({\mathcal{L}}\) comprises N discrete nodes (black dots). Each node represents a local flow state at a spatial location x = (x, y) and stores particle properties. The particles transport from one node to another along q predefined discrete directions (arrows), and they collide at the nodes. The collision of particles within a node drives the local lattice gas toward an equilibrium state47. Each node consists of q cells (red circles), and each cell can be either empty (open circles) or occupied (closed circles) by at most one particle with a specified velocity.

Fig. 1: Schematic of three-level ensemble descriptions for lattice gas.
figure 1

a Velocity-level ensemble, corresponding classical LBM; b node-level ensemble, corresponding to our QLBM; c lattice-level ensemble, corresponding to LGCA. The lattice \({\mathcal{L}}\) comprises N discrete nodes (black dots). Each node represents a local flow state, and it consists of q = 4 cells (red circles) for the D2Q4 model. Each card (containing nodes) represents a realization. The probability of each realization is depicted by the saturation level of circles in (a) and the saturation level of cards in (b, c). Our QLBM is featured by the medium dimensionality (computational cost) and linear collision treatment (quantum compatibility), suitable for an efficient quantum algorithm. The particle collision in LBM in (a) involves nonlinear calculations with probability values for different cells, whereas the collision in our QLBM in (b) or LGCA in (c) is characterized by a linear combination of different realizations.

As illustrated in Fig. 1a, c, neither classical LBM nor LGCA can simultaneously achieve manageable dimensionality and involve linear particle collisions. To address this, we propose a meso-level ensemble, situated between the LBM and LGCA, as shown in Fig. 1b. This ensemble forms the basis of our QLBM, resulting in medium dimensionality and linear collisions within the quantum algorithm.

The corresponding QLBM algorithm is sketched in Fig. 2. Initially, the flow field is encoded into the quantum state \(\left\vert \varPsi \right\rangle\). Then the quantum state evolves through transport and collision steps at the node level. When the state begins to deviate from equilibrium, an H-step is invoked to relax the state back to equilibrium. Upon reaching a specified time, the quantum state is measured to reconstruct the entire flow field.

Fig. 2: Flowchart for our QLBM.
figure 2

The velocity field u is embed into the amplitudes of the quantum state \(\left\vert \Psi \right\rangle\) via probability encoding. The preparation, measurement, and time evolution of the quantum state’s density matrix is preformed on a quantum computer. When the state deviates significantly from equilibrium (quantified by the H-function), the H-step relaxes the ensemble back to equilibrium. During the H-step, the state density matrix alternates between velocity-level and node-level ensembles. The state is measured to reconstruct the velocity field when the simulation is ended at a given time t = T.

Ensemble description for QLBM

The present QLBM employs the probability encoding method to embed the flow field into the amplitudes of quantum states within the lattice gas framework. As illustrated in Fig. 1, we use the concept of the Gibbs ensemble51 to re-describe LBM and LGCA from the perspective of statistical mechanics at the velocity, node, and lattice levels, which facilitates developing an efficient quantum algorithm for our proposed lattice gas system.

The velocity-level ensemble, named after the velocity distribution, corresponds to classical LBM. In this ensemble, each realization within a node is illustrated by a “card” (containing a node) in Fig. 1a. Each node is independent, and it involves q independent realizations or cells50 with different velocity directions. Consequently, the dimensionality of this ensemble is Nd = Nq. Each realization at x and time t occurs with the probability \({p}_{j}^{({n}_{j})}({\boldsymbol{x}},t)\), where the subscript j = 1, , q denotes for a quantity along the jth direction, and the Boolean variable nj(x, t) describes the occupation status of cells: nj = 1 indicates the presence of a particle with velocity ej, and nj = 0 indicates the absence of such a particle. The ensemble average of nj yields the velocity distribution function50

$${f}_{j}({\boldsymbol{x}},t)=\mathop{\sum }\limits_{{n}_{j}=0}^{1}{n}_{j}{p}_{j}^{({n}_{j})}={p}_{j}^{(1)}.$$
(1)

On each card, the cells are color-coded by \({p}_{j}^{(1)}({\boldsymbol{x}},t)\). Moreover, the fluid density ρ and velocity u are defined as \(\rho =\mathop{\sum }\nolimits_{j = 1}^{q}{f}_{j}\) and \(\rho {\boldsymbol{u}}=\mathop{\sum }\nolimits_{j = 1}^{q}{f}_{j}{{\boldsymbol{e}}}_{j}\).

The lattice-level ensemble, corresponding to LGCA, is a collection of all Nd = 2qN possible states of the entire lattice, and all N nodes in the lattice are fully correlated. Note that the excessively high Nd in LGCA causes its quantum algorithm to lose speedup advantage. In Fig. 1c, each realization for cellular automata is illustrated by a card with multiple nodes, and closed and open circles denote occupied and empty cells, respectively. At the lattice level, a realization is represented as \({\bigotimes }_{{\mathcal{H}}}{\boldsymbol{n}}({\boldsymbol{x}})\), where n = {n1, , nq} denotes the state for each node, and the Kronecker product of vectors over the Hilbert space \({\mathcal{H}}\) of node coordinates. Each card is color-coded by the probability \({p}_{{\bigotimes }_{{\mathcal{H}}}{\boldsymbol{n}}({\boldsymbol{x}})}\) of each realization.

The node-level ensemble, between the velocity- and lattice-level ones, combines the low-dimensional representation of LBM with the linear collision treatment of LGCA. In this ensemble, each node accommodates 2q realizations of n, and nodes are independent of each other, unlike the lattice-level one where nodes are fully correlated. This key property leads to medium Nd = 2qN. At the node level, we define the probability pn(x) of x, satisfying ∑n pn = 1 within a node, and the joint probability px,n of x and n, satisfying ∑x,n px,n = 1 over a lattice. Each card for realization {x, n} is color-coded by px,n in Fig. 1b. The independence of nodes leads to px,n = pnρ/∑xρ.

Algorithm of QLBM

The QLBM integrates certain components from both classical LBM and LGCA (see “Methods”). As illustrated in Fig. 2, all realizations {x, n} at the node level (blue panels) are encoded into a quantum state \(\left\vert \varPsi \right\rangle\), and \(\left\vert \varPsi \right\rangle\) is evolved in QLBM with ensemble transformation using a prediction-correction approach.

The prediction phase involves transport and collision steps, which are reformulated from those in LGCA to the node level. The transport step

$$\{{\boldsymbol{x}},{\boldsymbol{n}}\}\mapsto \mathop{\sum }\limits_{j=1}^{q}\frac{{n}_{j}}{{\rho }_{n}}\{{\boldsymbol{x}}+{{\boldsymbol{e}}}_{j},{\boldsymbol{n}}\}$$
(2)

is adapted from Eq. (9), where denotes a mapping and \({\rho }_{n}({\boldsymbol{x}},{\boldsymbol{n}})\equiv \mathop{\sum }\nolimits_{j = 1}^{q}{n}_{j}\) denotes the number of particles at a node. In Eq. (2), the realization {x, n} is divided into ρn components, and each component uniformly propagates into ρn neighboring nodes with the equal proportion nj/ρn.

In the collision step, each possible collision event is encoded among the realizations in the ensemble, as illustrated by a collection of cards for a node in Fig. 1b. This allows the LGCA collision model46,47, originally developed at the lattice level, to be effectively used at the node level. Incorporating the collision step in Eq. (10) into the node-level realization {x, n} yields the mapping \(\{{\boldsymbol{x}},{\boldsymbol{n}}\}\mapsto \{{\boldsymbol{x}},{{\boldsymbol{n}}}^{{\prime} }\}\) from the initial state n to the post-collision state \({{\boldsymbol{n}}}^{{\prime} }=\{{n}_{1}^{{\prime} },\cdots \,,{n}_{q}^{{\prime} }\}\). Incorporating the collision probability γ [0, 1] into this mapping leads to a linear operation

$$\{{\boldsymbol{x}},{\boldsymbol{n}}\}\mapsto \gamma \{{\boldsymbol{x}},{{\boldsymbol{n}}}^{{\prime} }\}+(1-\gamma )\{{\boldsymbol{x}},{\boldsymbol{n}}\},$$
(3)

where γ governs the fluid viscosity. Note that the transport and collision steps are linear, positive, L1-norm preserving, and numerically stable (see Sections 2 and 4 in Supplementary Information), and their complexities are discussed in Methods. The linear operations can be efficiently represented as unitary transformations in quantum algorithms, and the positivity and L1-norm preserving guarantee that the probability distribution remains physically realizable.

During these linear transport and collision steps, the cells within a node can become correlated. This contradicts to the cell independence constraint at the velocity level, and causes the deviation of fj from the equilibrium velocity distribution feq,j. This deviation, quantified by the H-function (an entropy measure), results in unphysical results of QLBM (see Section 3 in Supplementary Information). Thus, the correction phase in the QLBM algorithm introduces the H-step to keep fj near equilibrium, through inter-ensemble transformations between velocity and node levels across different Nd.

The node-to-velocity-level transformation is through a linear and surjective mapping

$${p}_{j}^{({n}_{j})}=\mathop{\sum }\limits_{\begin{array}{c}m=1\\ m\ne j\end{array}}^{q}\mathop{\sum }\limits_{{n}_{m}=0}^{1}{p}_{{\boldsymbol{n}}}$$
(4)

based on Eq. (1) and mass conservation. However, the inverse transformation is non-unique, because Nd = N2q at the node level is much higher than Nd = Nq at the velocity level. Consistent with the independent cells within a node, we establish the velocity-to-node-level transformation

$${p}_{{\boldsymbol{n}}}={p}_{{\rm{ind}},{\boldsymbol{n}}}\equiv \mathop{\prod }\limits_{j=1}^{q}{p}_{j}^{({n}_{j})},$$
(5)

where the subscript “ind” denotes the independence of individual \({p}_{j}^{({n}_{j})}\) components. This choice ensures that all possible pn satisfy Eq. (4). It is also consistent with the form of the local equilibrium probability52 at a node, facilitating relaxing the ensemble back to equilibrium.

As illustrated in Fig. 3, the H-step applies Eqs. (4) and (5), relaxing distribution of pn toward the local equilibrium one of pind,n, along with the growth of quantum entropy (see Section 3 in Supplementary Information). In the quantum representation, each cell at the node level is encoded by a single qubit. Entangled states correspond to cells that are not independent of each other53, while separable states correspond to independent cells. The H-step is equivalent to disentangling the qubits without changing the measurement outcomes. This challenging quantum separability problem can hinder the overall speedup of the QLBM algorithm (see Eq. (16) and relevant discussion in Methods), and is expected to be resolved54,55 in the future work.

Fig. 3: Physical interpretation of H-step.
figure 3

a Schematic for inter-ensemble transformations in the H-step relaxing the ensemble toward equilibrium. The color code and symbol meaning are the same as in Fig. 1. A node-level ensemble (left panel), consisting of two cells and four realizations, can be transformed into a velocity-level ensemble (middle panel) with two realizations under mass conservation, where \({p}_{1}^{(1)}={p}_{0,1}+{p}_{1,1}\) and \({p}_{2}^{(1)}={p}_{1,0}+{p}_{1,1}\) are calculated by Eq. (4). Assuming independence among cells, the velocity-level ensemble can be transformed back to node-level one (right panel), where \({p}_{0,0}={p}_{1}^{(0)}{p}_{2}^{(0)}\), \({p}_{0,1}={p}_{1}^{(1)}{p}_{2}^{(0)}\), \({p}_{1,0}={p}_{1}^{(0)}{p}_{2}^{(1)}\), and \({p}_{1,1}={p}_{1}^{(1)}{p}_{2}^{(1)}\) are calculated by Eq. (5). Through these two transformations, the effective dimensionality is reduced from four to two, leading to smoothing of the probability distribution (right panel). b Schematic for the quantum representation of the H-step. The histogram plots the probability distribution. The two entangled qubits Q1 and Q2 (left panel), with density matrix ϱ2,1 encoding \({p}_{{n}_{2},{n}_{1}}\), can be reduced to a single qubit (middle panel) via the partial trace Tr1 or Tr2. Performing this operation on two identical ϱ2,1 yields two independent qubits, with density matrices ϱ1 and ϱ2. These two qubits form a separable state ϱ2 ϱ1 (right panel). In the H-step, the entangled qubits are disentangled, while the measurement outcomes of each qubit remain unchanged.

In the implementation of the QLBM algorithm, the probabilities are encoded into quantum states, and the states are evolved using quantum circuits (see Methods and Section 2 in Supplementary Information). The sensitivity of the quantum circuit to noise is analyzed in Section 7 in Supplementary Information.

Validation of QLBM

We assess the proposed QLBM algorithm50 using three typical 2D incompressible flows, the Taylor–Green (TG) vortex, vortex-pair merging, and decaying turbulence. In post-processing of simulation data, fluid density and velocity are calculated from fj, and fj is calculated from Eqs. (1) and (4) where the probability is measured from the quantum state (see Section 2E in Supplementary Information).

The QLBM simulations were conducted with the D2Q9 model (see “Methods”). Note that the NS equation

$$\frac{\partial }{\partial t}(\rho {\boldsymbol{u}})+{\boldsymbol{\nabla }}\cdot (\rho {\boldsymbol{u}}{\boldsymbol{u}})=-{\boldsymbol{\nabla }}P+{\boldsymbol{\nabla }}\cdot (\mu {\boldsymbol{\nabla }}{\boldsymbol{u}})$$
(6)

can be derived from the D2Q9 model with the LGCA collision step in Eq. (3)56, where \(P=\mathop{\sum }\nolimits_{j = 1}^{q}({{\boldsymbol{e}}}_{j}-{\boldsymbol{u}})\cdot ({{\boldsymbol{e}}}_{j}-{\boldsymbol{u}}){f}_{j}/3\) denotes the pressure and μ the viscosity. It is straightforward to extend the QLBM to simulating 3D flows with more sophisticated DdQq models and more computational resources.

The QLBM of the TG vortex was conducted at \({\rm{Re}}=13\) and 27 on 1282 and 2562 nodes, respectively, where the viscosity is calculated from Eq. (15) with γ = 0.5. This benchmark problem has the initial velocity \({{\boldsymbol{u}}}_{0}=(\sin x\cos y,-\cos x\sin y)/8\) and the exact solution of vorticity \(\omega ={{\rm{e}}}^{-2\nu t}\sin x\sin y/4\), showing the exponential decay of vortex intensity. The excellent agreement of the QLBM results and the exact solutions at different \({\rm{Re}}\) in Fig. S1 indicates that the QLBM accurately captures viscous dissipation.

QLBM simulation of vortex-pair merging

Merging of a pair of vortices involves nonlinear vortex interactions, which are crucial for many practical applications in vortical flows and turbulence. The initial vorticity is the superposition of the two Burgers vortices separated by a distance l. Each vortex is characterized by a Gaussian vorticity distribution \(\omega =(\varGamma /2\pi {\sigma }^{2})\exp (-{r}_{v}^{2}/2{\sigma }^{2})\), with the radial distance rv from the vortex center. The QLBM of the vortex-pair merging was conducted at \({\rm{Re}}=350\) on 20482 nodes, with σ = 0.1π, Γ = 0.2π, and l = 0.59. Figure 4a illustrates the mutual rotation of two vortices driven by their induced velocities. The vortices first undergo persistent stretching and deformation, and then nonlinear vortex interaction and viscous diffusion initiate the merging process. Finally, the two vortices are merged into one with two spiral-like arms.

The QLBM result is assessed using the result of the DNS for incompressible flow with the pseudo-spectral method57,58. Figure 4b demonstrates quantitative agreement between the vorticity distributions from QLBM and DNS, along the y = π cross-section of the 2D vorticity field, where the migration of peaks in these distributions characterizes the vortex-pair merging process. The deviation of the velocity u in QLBM simulation from that uDNS in DNS is quantified by the normalized L2-norm error \({\mathcal{R}}\equiv\Vert{{\boldsymbol{u}}-{{\boldsymbol{u}}}_{{\rm{DNS}}}}\Vert_{2}/\Vert{\boldsymbol{u}_{{\rm{DNS}}}}\Vert_{2}\). In general, our QLBM can accurately simulate nonlinear dynamics of vortex interactions.

Fig. 4: Comparison between the results of QLBM and DNS for the 2D vortex-pair merging at t = 0, 2π, 4π, and 6π with \({\rm{Re}}=350\) on 20482 nodes.
figure 4

a Vorticity contours illustrate the nonlinear interaction of two merging vortices, with the normalized L2-norm error \({\mathcal{R}}\). b Cross-sectional vorticity profiles along y = π from QLBM and DNS results. c Scatter plots of normalized vorticities \({\hat{\omega }}_{q}\) for QLBM and \({\hat{\omega }}_{c}\) for DNS, with correlation coefficients shown in the upper left. Data points are color-coded by the KDE.

Furthermore, the discrete vorticity from QLBM is transformed into a continuous probability distribution using the kernel density estimation (KDE). The correlation coefficient r of normalized vorticities from QLBM and DNS decreases with time in Fig. 4c. The KDE analysis reveals that slight discrepancies between QLBM and DNS in the low vorticity region. This discrepancy may stem from the deviation from equilibrium in the lattice gas system32, which is attributed to the lack of growth of the H-function during the collision step. Here we selected γ = 1 to achieve the largest \({\rm{Re}}\) (see Eq. (15)) to clearly show the nonlinear vortex interaction, but this choice also causes a milder growth of the H-function during the collision step (see Section 3 in Supplementary Information).

QLBM simulation of decaying turbulence

The quantum computing of turbulence is considered to be extremely challenging8,15,59, because turbulence is highly nonlinear whereas quantum computing is based on linear operations. The present QLBM of turbulence showcases the capability of quantum computing for simulating one of the most challenging problems in classical physics13.

The velocity of 2D decaying homogeneous isotropic turbulence is initialized using a Gaussian random field on 40962 nodes with the spatially averaged initial velocity magnitude \(\overline{| {{\boldsymbol{u}}}_{0}| }=0.03\) and a specified energy spectrum60, Ek(k) ~ k−5/3fL(k) at \(k < \sqrt{N}/3\), where k is the wavenumber in Fourier space, and \({f}_{L}={(k/{({k}^{2}+4)}^{1/2})}^{5/3+2}\) characterizes the shape of Ek in the energy-containing range. The maximum velocity magnitude 0.12 1 satisfies the low-Mach-number condition31. Here \({\rm{Re}}=102\) is small, due to the small \(\overline{| {{\boldsymbol{u}}}_{0}| }\) and the medium viscosity, which is proportional to \(1/\sqrt{N}\) with modest N and D2Q9 model61. To increase \({\rm{Re}}\), a larger N and a more sophisticated DdQq model can be employed.

The vorticity evolution in Fig. 5a exhibits consistent decaying rates and morphological characteristics between DNS and QLBM results, including the dissipation of small-scale flow structures and the generation of large-scale ones. In Fig. 5b, the decay of the average kinetic energy \(\overline{| {\boldsymbol{u}}{| }^{2}}/2\) in QLBM is slightly slower than that in DNS, perhaps due to the insufficient dissipation mechanisms at high wavenumbers in QLBM. The multiscale features and energy cascade are characterized using the energy spectrum in Fig. 5c. Consistent with the vorticity contour in Fig. 5a, the low-wavenumber region of Ek remains nearly constant over time, while the high-wavenumber region dissipates gradually, representing the viscous dissipation and inverse energy cascade at small scales62. The slightly larger Ek in QLBM than DNS at high wavenumbers indicates that QLBM has a slower energy transfer rate than DNS.

Fig. 5: Comparison between the results of QLBM and DNS for 2D decaying homogeneous isotropic turbulence with \({\rm{Re}}=102\) on 40962 nodes.
figure 5

a Vorticity contours at t = 0.2π, 0.4π, and 0.8π. The normalized L2-norm error \({\mathcal{R}}\) is labeled for the QLBM results. b Evolution of the average energy. c Energy spectra at t = 0.2π and 0.8π.

Discussion

We propose the QLBM algorithm with ensemble transformations for simulating nonlinear fluid dynamics problems, including turbulence. The significant challenge in quantum computing for solving such highly nonlinear problems is addressed by two conceptual steps. First, we transform a low-dimensional, nonlinear fluid system to a medium-dimensional, linear lattice gas system. The resultant node-level ensemble permits linear operations for particle transport and collision in a quantum algorithm. Second, the transformation between ensembles at different dimensions can cause inconsistent physical constraints, leading to the deviation of the velocity distribution from its equilibrium state. Thus we introduce the H-step to maintain the velocity distribution near equilibrium, which is equivalent to disentangling qubits without altering the measurement outcomes of each qubit.

Our QLBM algorithm is linear, positive, and L1-norm preserving. It can be implemented on a quantum computer without the need for classical computation, frequent intermediate measurements, or repetitive state preparation processes. Furthermore, it shows potential for speedup in large-scale flow simulations (see Section 6 in Supplementary Information).

The QLBM has been validated by three typical 2D incompressible flows. The QLBM results show an excellent agreement with the exact solution for the linear TG vortex, and good agreements with the DNS results for the highly nonlinear vortex-pair merging and decaying turbulence on up to 40962 nodes. These successful applications of the QLBM showcase the capability of quantum computing to simulate highly nonlinear dynamics.

The QLBM incorporating ensemble transformation provides insights into quantum computing for nonlinear problems broadly and QCFD specifically. Integrating the understandings from both nonlinear classical systems and their quantum counterparts is essential for the development of an efficient quantum algorithm.

On the other hand, there are some issues to be addressed in the future work. First, the execution of the H-step demands significant qubit resources and may limit the potential speedup, and thus enhancing the efficiency of the H-step is essential. Second, the QLBM algorithm needs to be further improved for running on quantum devices, e.g., the current QLBM case for 2D turbulence requires nQ = 24 + 9 = 33 qubits to encode the flow field and the quantum circuit depth can reach \({n}_{Q}^{2}\) for each time step, which poses a significant challenge for the current hardware63. Potential challenges on efficient state preparation/measurement and effects of noises are discussed in Section 7 in Supplementary Information. Furthermore, error correction/mitigation methods should be applied in the future work. Third, the QLBM is restricted to low Mach numbers and has not incorporated no-slip boundary conditions. These issues will be addressed to enhance its applicability to more complex problems, such as multiphase and porous media flows, as well as more general nonlinear dynamics problems beyond fluid dynamics.

Methods

Classical LBM and LGCA

The Boltzmann equation can be discretized into the lattice Boltzmann equation \({f}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t+\delta t)-{f}_{j}({\boldsymbol{x}},t)={\Omega }_{j}\) at the velocity level and the LGCA equation \({n}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t+\delta t)-{n}_{j}({\boldsymbol{x}},t)={\Omega }_{j}\) at the lattice level, with the time step δt. The collision term Ωj ensures the conservation of particles and momentum.

Each time step in LBM can be decomposed into the transport step

$${f}_{j}({\boldsymbol{x}},t)\,\mapsto\, {f}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t)$$
(7)

and the collision step

$$\begin{array}{rcl}{f}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t)&\mapsto &\,{f}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t)+{\Omega }_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,{f}_{j})\\ &&={f}_{j}\left({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t+\delta t\right).\end{array}$$
(8)

Each time step in LGCA can also be divided into the transport step

$${n}_{j}({\boldsymbol{x}})\,\mapsto\, {n}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t)$$
(9)

and the collision step

$$\begin{array}{rcl}{n}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t)&\mapsto &\,{n}_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t)+{\Omega }_{j}({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,{n}_{j})\\ &&={n}_{j}\left({\boldsymbol{x}}+{{\boldsymbol{e}}}_{j}\delta t,t+\delta t\right).\end{array}$$
(10)

The collision in LBM is widely treated by the BGK model Ωj = −κ(fjfeq,j) with the relaxation time coefficient κ32. Particularly, the local equilibrium velocity distribution feq,j is a nonlinear function of u and ej, prompting our attempt to adopt the linear collision model in LGCA. Under the collision rules in Fig. S2 in Supplementary Information, the collision event occurs with probability γ. We characterize the collision using the collision term in LGCA, which can be expressed as a linear combination of products of nj in the lattice-level ensemble46. This property makes it well-suited for implementation in quantum algorithms.

Probability encoding for QLBM

We encode the ensemble description of lattice gas at the node level into a quantum state \(\left\vert \varPsi \right\rangle\) from a single qubit, through q qubits, to \(q+{\log }_{2}N\) qubits, corresponding to encoding probabilities \({p}_{j}^{({n}_{j})}\), pn(x), and px,n, respectively. First, we encode \({p}_{j}^{({n}_{j})}\) at the velocity level using a single-qubit state

$$\vert {f}_{j}\rangle \equiv \sqrt{{p}_{j}^{(0)}}\left\vert 0\right\rangle +\sqrt{{p}_{j}^{(1)}}\left\vert 1\right\rangle$$
(11)

in a superposition of quantum basis states \(\left\vert 0\right\rangle\) and \(\left\vert 1\right\rangle\), where \(\left\vert 0\right\rangle\) and \(\left\vert 1\right\rangle\) encode nj = 0 and 1, respectively, and \({p}_{j}^{(0)}\) and \({p}_{j}^{(1)}\) are probabilities for measuring the qubit in states \(\left\vert 0\right\rangle\) and \(\left\vert 1\right\rangle\), respectively.

Second, we encode the node-level probability pn in Eq. (5) using q qubits for each node. To encode all possible (up to 2q) states of a node, we employ a q-qubit pure state

$$\vert {f}_{q}\cdots {f}_{1}\rangle \equiv \mathop{\sum }\limits_{{n}_{1},\cdots \,,{n}_{q}=0}^{1}\sqrt{{p}_{{\boldsymbol{n}}}}\vert {n}_{q}\cdots {n}_{1}\rangle ,$$
(12)

where \(\vert {n}_{q}\cdots {n}_{1}\rangle { = \bigotimes }_{j = 1}^{q}\vert {n}_{j}\rangle\) denotes basis states, and n1 and nq are the lowest and highest indices of the qubit sequence, respectively. As illustrated in Fig. S3(a) in Supplementary Information, we establish an encoding bijection \({\boldsymbol{n}}\leftrightarrow \vert {n}_{q}\cdots {n}_{1}\rangle\) between the node-level n and basis states \(\vert {n}_{q}\cdots {n}_{1}\rangle\). The measurement of \(\vert {n}_{q}\cdots {n}_{1}\rangle\) yields pn in Eq. (12), transforming the quantum state into the classical probability. Note that Eq. (12) can be decomposed into a product of q separable qubits

$$\vert {f}_{q}\cdots {f}_{1}\rangle =\mathop{\bigotimes }\limits_{j = 1}^{q}\vert {f}_{j}\rangle$$
(13)

at the velocity level, when q cells for a node are independent. Consistent with Eq. (5), this encoding method can be transformed between the velocity and node levels when each \(\vert {f}_{j}\rangle\) is independent.

Third, we encode the joint probability px,n for lattice \({\mathcal{L}}\). Besides encoding the node state using q qubits, all coordinates \({\boldsymbol{x}}\in {\mathcal{L}}\) are encoded into the basis states by the binary representation \({\boldsymbol{x}}\leftrightarrow \left\vert {\boldsymbol{x}}\right\rangle\) using \({\log }_{2}N\) qubits. As illustrated in Fig. S3(b) in Supplementary Information, each realization is encoded as \(\{{\boldsymbol{x}},{\boldsymbol{n}}\}\leftrightarrow \vert {n}_{q}\cdots {n}_{1}\rangle \left\vert {\boldsymbol{x}}\right\rangle\). Finally, we encode all realizations {x, n} at the node level into a \((q+{\log }_{2}N)\)-qubit quantum state

$$\vert \varPsi \rangle \equiv \sum _{{\boldsymbol{n}}}\sum _{{\boldsymbol{x}}}\sqrt{{p}_{{\boldsymbol{x}},{\boldsymbol{n}}}}\left\vert {n}_{q}\cdots {n}_{1}\right\rangle \vert {\boldsymbol{x}}\rangle .$$
(14)

Quantum implementation of QLBM

The QLBM algorithm is implemented using quantum circuits. As sketched in Fig. 2, the flow field is firstly transformed into the equilibrium velocity distribution feq,j based on macroscopic state, and then feq,j is encoded into the quantum state \(\left\vert \varPsi \right\rangle\) at the node level using Eqs. (1), (5), and (14). Then, \(\left\vert \varPsi \right\rangle\) sequentially undergoes the transport step, collision step, and H-step.

In the quantum state preparation, the velocity and density fields are sequentially transformed into feq,j, px,n, and \(\left\vert \varPsi \right\rangle\). During the transport step, qubits encoding coordinates undergo phase shifts in different directions, controlled by \(\vert {f}_{j}\rangle\). Each basis is split into ρn parts according to Eq. (2). In the collision step, all \(\vert {f}_{j}\rangle\) exchange states according to predefined collision rules. Collision occurs at a given probability γ, controlled by an ancilla qubit. In the H-step, fj is obtained by tracing off all qubits except the one encoding \(\vert {f}_{j}\rangle\). The circuit is then repeated q times to obtain all fj, and all fj are combined by exchanging cross terms of different coordinates (see Section 5 in Supplementary Information). Finally, qubits are measured one by one to obtain fj. The quantum circuit and implementation detail for each step are provided in Section 2 in Supplementary Information.

Note that the complexity of the H-step (see Section 6 in Supplementary Information) could be a weakness of this algorithm. It causes linear growth in the number of qubits required for every H-step, and exponential growth in the initialization, transport, and collision steps. A possible improvement to the H-step lies in developing a more efficient and effective disentanglement algorithm (see Section 3 in Supplementary Information) that does not require repeating the circuit to prepare all fj.

Simulation setup of QLBM

All QLBM simulations were performed in a periodic square domain with side 2π, \(N={N}_{x}^{2}\) uniformly distributed nodes, and periodic boundary conditions. The time step is δt = 2π/Nx. The kinematic viscosity ν = μ/ρ with ρ = 1 is determined by the viscosity

$$\mu =\frac{e}{{\gamma }_{2D}{e}^{2}+{\gamma }_{2B}{(1-e)}^{2}}\delta t$$
(15)

with the internal energy e and the subscript of γ denoting the particle collision type (see Fig. S2 in Supplementary Information). We set γ2D = γ2B = γ and e = 1/356 in all simulations. The Reynolds number is defined by \({\rm{Re}}=2\pi \overline{| {{\boldsymbol{u}}}_{0}| }/\nu\), where \(\overline{(\cdot )}\) denotes the spatial average.

The QLBM was implemented using our in-house code64, which employs the quantum algorithm on a classical desktop computer. Only the diagonal elements of the density matrix for \(\left\vert \varPsi \right\rangle\) were allocated, requiring the memory of \({\mathcal{O}}({2}^{{n}_{Q}})\) bytes to realize the QLBM with up to NxNy = 40962 nodes. Note that although the initial and final states can be feasibly accessed on a classical computer, corresponding state preparation and measurement can be costly on a quantum computer, which is discussed in Section 7 in Supplementary Information.

Complexity analysis

The computational complexity of the QLBM is analyzed in terms of the number of two-qubit gates (detailed in Section 6 in Supplementary Information). The algorithm requires \({n}_{Q}={\log }_{2}N+q\) qubits to encode the flow field. The initialization cost depends on the preparation of the NM dominant modes, yielding a gate complexity of \({\mathcal{O}}({\log }^{c}(q{N}_{M}))\) with c < 4. The complexities of each transport step, collision step, and H-step are \({\mathcal{O}}({q}^{2}\,{\log }_{2}^{2}\,N)\), \({\mathcal{O}}(q)\), and \({\mathcal{O}}(q\,{\log }_{2}\,N)\), respectively. The total QLBM cost with Nt time steps and NH H-steps is \({{\mathcal{C}}}_{qc} \sim {q}^{{N}_{H}}{q}^{2}\,{\log }_{2}^{2}\,N\), with NH Nt. Compared to the classical LBM cost \({{\mathcal{C}}}_{{\rm{classic}}}=Nq{N}_{t}\), the ratio is

$$\frac{{{\mathcal{C}}}_{qc}}{{{\mathcal{C}}}_{{\rm{classic}}}} \sim \frac{{q}^{1+{N}_{H}}{\log }_{2}^{2}\,N}{N{N}_{t}}.$$
(16)

In principle, quantum speedup for the present QLBM can only be achieved under a very strict condition \(N\,\gg {q}^{{N}_{H}}\). Since the H-step dominates the cost, improving its efficiency is essential for practical speedup on a quantum computer. Compared to other QCFD methods, our QLBM more accurately models Newtonian viscous flow, avoids post-selection, and reduces the measurement cost relative to Carleman-based and hybrid methods, though it requires additional qubits for implementing the H-step (see Section 6 and Table S1in Supplementary Information).