Introduction

Partial differential equations (PDEs) are fundamental to solving important problems in disciplines ranging from heat and mass transfer, fluid dynamics and electromagnetics to quantitative finance and human behavior. Finding new methods to solve PDEs more efficiently—including making use of new algorithms or new types of hardware—has been an active area of research.

Recently, the advent of quantum computers and the invention of new quantum algorithms have provided a novel paradigm for solving PDEs. A cornerstone of many of these quantum algorithms is the seminal Harrow-Hassidim-Lloyd (HHL) algorithm1 for solving linear systems, which can be utilized to solve PDEs by discretizing the PDE and mapping it to a system of linear equations. Compared to classical algorithms, the HHL algorithm can be shown to exhibit an exponential speedup. Unfortunately, attractive as it may sound, the HHL algorithm works only in an idealized setting, and a list of caveats must be addressed before it can be used to realize a quantum advantage2. Moreover, implementing HHL and many other quantum algorithms would require the use of a fault-tolerant quantum computer, which may not be available in the near future3. Instead, the machines we have today are imperfect, noisy intermediate-scale quantum (NISQ) devices4 with both coherent and incoherent errors limiting practical circuit depths.

Over the last few years, variational quantum algorithms (VQAs) have emerged as a leading strategy to realize a quantum advantage on NISQ devices. Specifically, VQAs employ shallow circuit depths to optimize a cost function, expressed in terms of an Ansatz with tunable parameters, through iterative evaluations of expectation values5. Applications of VQAs include the variational quantum eigensolver (VQE) for finding the ground or excited states of a system Hamiltonian6,7,8, the quantum approximate optimization algorithm (QAOA) for solving combinatorial optimization problems9, and solvers for linear10,11,12 and non-linear13 systems of equations.

Here, we are interested in variational quantum algorithms for solving differential equations14, such as the Black–Scholes equation15,16, the Poisson equation17,18, and the Helmholtz equation19. Specifically, the Poisson equation can be solved efficiently through explicit decomposition of the coefficient matrix derived from finite difference discretization17 using minimal cost function evaluations18 and shallower circuit depth compared to other non-variational quantum algorithms14,20,21,22. A natural question to ask, then, is whether such variational algorithms for Poisson equations can be extended to solving evolution equations, i.e. partial differential equations including a time domain. McArdle et al.23 proposed a variational quantum algorithm which simulates the real (imaginary) time evolution of parametrized trial states via forward Euler time-stepping of the Wick rotated Schrödinger equation, thereby solving the Black–Scholes equation, and by extension, the heat equation15,16. Besides issues of Ansatz selection and quantum complexity, time-stepping based on an explicit Euler method may be unstable, a limiting condition exacerbated by noise. With existing variational quantum algorithms10, an implicit scheme for evolution equations is expected to preserve any quantum advantage1 over classical algorithms, with reduced time complexity18.

This paper is organized as follows. In section “Theory”, we outline general implicit time-stepping schemes for solving evolution partial differential equations and propose the use of a variational quantum solver to resolve the Laplacian operator iteratively. In section “Applications to the heat/diffusion equation”, we apply the variational quantum algorithm to solving a heat or diffusion equation without source terms as a proof of concept. With that, we explore potential applications to more general evolution problems with non-linear source terms, including the reaction–diffusion (section “Applications to the reaction–diffusion equations”) and the Navier–Stokes equations (section “Applications to the Navier–Stokes equations”), where variables can be coupled through semi-implicit schemes.

Theory

Consider the second-order homogeneous evolution equation defined on the set \(\Omega \times J\), where \(\Omega \subset \mathbb R^d\) denotes a d-dimensional bounded spatial domain and \(J = [0,T]\), where \(T>0\) denotes a bounded temporal domain, as

$$\begin{aligned} \frac{\partial u(\vec{x},t)}{\partial t}&= D \nabla ^{2} u(\vec{x},t) + f(\vec{x},t), \qquad&\text{ in } \Omega \times J \end{aligned}$$
(1)
$$\begin{aligned} u(\vec{x},0)&=u_{0}(\vec{x}),&\text{ in } \Omega \times \{t=0\}, \end{aligned}$$
(2)

where \(u(\vec{x},t)\) is a function of spatial vector \(\vec{x}\) and time t, \(D>0\) is the diffusion coefficient and f is an unspecified source term. For now, Dirichlet and Neumann boundary conditions are applicable on the boundary \(\Gamma := \partial \Omega = \Gamma _D\cup \Gamma _N\), respectively,

$$\begin{aligned} u&=g, \quad \text{ in } \Gamma _{D}&\times J, \end{aligned}$$
(3)
$$\begin{aligned} \frac{\partial u}{\partial n}&=0, \quad \text{ in } \Gamma _{N}&\times J, \end{aligned}$$
(4)

where \(\partial /\partial n\) is the outward normal derivative on boundary \(\Gamma\).

For a two-dimensional rectangular domain \(\Omega = (x_L,x_R )\times (y_L,y_R) \subset \mathbb R^2\), partitioning the space-time domain \(\Omega \times J\) yields the space-time grid points

$$\begin{aligned} \left( x_{i j}, t^{k}\right) :=\left( x_{i}, y_{j}, t^{k}\right) , \quad i=0,1, \ldots , n_{x}; j=0, 1, \ldots , n_{y}; k=0, 1, \ldots , n_{t}, \end{aligned}$$
(5)

where \(n_x\), \(n_y\) and \(n_t\) are prescribed positive integers, such that \(x_i=x_L+i\cdot \Delta x\), \(y_j=y_L+j \cdot \Delta y\), \(t^k=k\cdot \Delta t\), \(\Delta x=L_x/n_x\) , \(\Delta y=L_y/n_y\) and \(\Delta t=T/n_t\) , where \(L_x=x_R-x_L\) and \(L_y=y_R-y_L\). The discrete domain grid is denoted by \(\Omega _d=\{(x_i,y_j ): n_x \in \{0,1,\ldots ,n_x\}, n_y \in \{0,1,\ldots ,n_y\} \}\) and boundary grid by \(\Gamma _d\).

The finite difference (FD) approximation for the second-order spatial derivative (5-point) of the Laplacian operator taken at \(t=t^k\) is

$$\begin{aligned} \mathcal {A}u_{i, j}=-\delta _{x}(u_{i-1, j}-2 u_{i, j}+u_{i+1, j})-\delta _{y}(u_{i, j-1}-2 u_{i, j}+u_{i, j+1}), \end{aligned}$$
(6)

where \(\delta _x :=D \Delta t/\Delta x^{2}\) and \(\delta _y:=D \Delta t/\Delta y^{2}\) are diffusion parameters.

Using first-order FD for temporal derivative \((u_{ij}^{k+1}-u_{ij}^k)/\Delta t\) weighted by \(\vartheta \in [0,1]\), the evolution Eq. (1) can be expressed in vector shorthand as

$$\begin{aligned} (\mathcal {I}+\vartheta \mathcal {A}) u^{k+1}=[\mathcal {I}-(1-\vartheta ) \mathcal {A}] u^{k}+\Delta t f^{k+\vartheta }, \end{aligned}$$
(7)

where \(\mathcal {I}\) is the identity matrix of the same size, \(u^{k}=\left[ u_{i j}^{k}\right] _{0 \le i \le n_{x}, 0 \le j \le n_{y}}\) and \(f^{k}=\left[ f_{i j}^{k}\right] _{0 \le i \le n_{x}, 0 \le j \le n_{y}}\).

Depending on the choice of parameter \(\vartheta\), actual time-stepping may follow an explicit (forward Euler) method (\(\vartheta =0\)), an implicit (backward Euler) method (\(\vartheta =1\)), a semi-implicit (Crank–Nicolson) method (\(\vartheta =1/2\)) or a variable-\(\vartheta\) method24. The explicit method (\(\vartheta =0\)) is efficient for each time-step but is only stable if it satisfies the stability condition \(v\le 1/2\). The implicit (backward Euler) method (\(\vartheta =1\)) is unconditionally stable and first-order accurate in time (\(\varepsilon \sim \Delta t\)), which reads

$$\begin{aligned} (\mathcal {I}+\mathcal {A}) u^{k+1}=u^{k}+\Delta t f^{k+1}. \end{aligned}$$
(8)

The semi-implicit Crank–Nicolson (CN) method (\(\vartheta =1/2\)) is popular as it is not only stable, but also second-order accurate in both space and time (\(\varepsilon \sim \Delta t^2\)), which reads

$$\begin{aligned} \left( \mathcal {I}+\frac{\mathcal {A}}{2}\right) u^{k+1}=\left( \mathcal {I}-\frac{\mathcal {A}}{2}\right) u^{k}+\Delta t f^{k+1 / 2} \end{aligned}$$
(9)

where \(f^{k+1/2}=(f^{k+1}+f^k )/2\). However, the CN method may introduce spurious oscillations to the numerical solution for non-smooth data unless the algorithm parameters satisfy the maximum principle25.

Variational quantum solver

Here, we explore a variational quantum approach towards the solution of the evolution equation (1). In addition to potential quantum speedup, a variational quantum algorithm could also benefit from data compression, where a matrix of dimension N can be expressed by a quantum system with only \(\log _2 N\) qubits, where N is the size of the problem. Consider the Poisson equation, which is a time-independent form of Eq. (1), expressed as

$$\begin{aligned} -\nabla ^2 u=f,\qquad \text{ in } \Omega \subset \mathbb R. \end{aligned}$$
(10)

The Laplacian operator \(\nabla ^2\) in one dimension can be discretized using the finite difference method in the x direction into an N N coefficient matrix \(A_{x,\beta }\) as

$$\begin{aligned} A_{x,\beta } = \begin{bmatrix} 1+\alpha _\beta & -1 & 0 & & & \cdots & & 0 \\ -1 & 2 & -1 & 0 & & \cdots & & 0 \\ 0 & -1 & 2 & -1 & & \cdots & & 0 \\ \vdots & & & \ddots & & & & \vdots \\ 0 & & \cdots & & 0 & -1 & 2 & -1 \\ 0 & & \cdots & & & 0 & -1 & 1+\alpha _\beta \end{bmatrix}. \end{aligned}$$
(11)

where \(\beta \in \{D,N\}\) refers to either the Dirichlet (D) or Neumann (N) boundary condition, and \(\alpha _D=1\) and \(\alpha _N=0\). This extends naturally to higher dimensions, for instance \(A_{y,\beta }\) in the y direction.

A variational quantum solution is to prepare a state \(| u \rangle\) such that \(A | u \rangle\) is proportional to a state \(| b \rangle\) in a way that satisfies Eq. (10). To do that, a canonical approach10,11,12 is to first decompose the matrix A over the Pauli basis \(\mathcal P_n = \{P_1\otimes \cdots \otimes P_n: \forall i,P_i \in \{I,X,Y,Z\} \}\) (where \(X=|1\rangle \!\langle 0| +|0\rangle \!\langle 1|\), \(Y = i|1\rangle \!\langle 0| -i |0\rangle \!\langle 1|\), and \(Z=|0\rangle \!\langle 0| -|1\rangle \!\langle 1|\) are the Pauli matrices and \(I=|0\rangle \!\langle 0| +|1\rangle \!\langle 1|\) is the identity matrix) as

$$\begin{aligned} A=\sum _{P \in \mathcal {P}_{n}} c_{P} P, \end{aligned}$$
(12)

where \(c_P={{\,\mathrm{tr}\,}}(PA)/2^n\) are the coefficients of A in the Pauli basis. Using simple operators \(\sigma _+ = |0\rangle \!\langle 1|\), \(\sigma _- = |1\rangle \!\langle 0|\), the number of terms in the decomposition can be reduced to \(2 \log N+1\)17. A more efficient approach, however, is to express A as a linear combination of unitary transformations of simple Hamiltonians18. Accordingly, the decomposition of A in one dimension can be written as19

$$\begin{aligned} A_{x, \beta }=I^{\otimes n-1} \otimes (I-X)+S^{\dagger }\left[ I^{\otimes n-1} \otimes (I-X)+I_{0}^{\otimes n-1} \otimes \left( X-a_{\beta } I\right) \right] S, \end{aligned}$$
(13)

where \(I_0 = |0\rangle \!\langle 0|\) and \(\beta \in \{D,N\}\), as before except here, \(a_D=0\) and \(a_N=1\). Here, S is the n-qubit cyclic shift operator defined as

$$\begin{aligned} S = \sum _{i=0}^{2^n-1} |(i+1)\ {\text {mod}}\ 2^n\rangle \!\langle i|. \end{aligned}$$
(14)

The expectation values of a Hamiltonian H including the shift operator S are evaluated by applying the unitary shift operator to the quantum state18,

$$\begin{aligned} \langle \phi |S^\dag H S | \phi \rangle = \langle \phi ' | H | \phi ' \rangle , \end{aligned}$$
(15)

where \(| \phi \rangle\) is an arbitrary n-qubit state and \(| \phi ' \rangle = S | \phi \rangle\). Note that Eq. (13) can be re-written as

$$\begin{aligned} A_{x, \beta }=2 I^{\otimes n}-\underbrace{I^{\otimes n-1} \otimes X}_{H_{1}}+S^{\dagger }\big [-\underbrace{I^{\otimes n-1} \otimes X}_{H_{2}}+\underbrace{I_{0}^{\otimes n-1} \otimes X}_{H_{3}}-\underbrace{b_{\beta } I_{0}^{\otimes n-1} \otimes I}_{H_{4}}\big ] S. \end{aligned}$$
(16)

Since expectation values of the identity operator are equal to 1, i.e. \(\langle \phi |I^{\otimes n} | \phi \rangle = \langle \phi ' | I^{\otimes n} | \phi ' \rangle = 1\), evaluating the expectation value of the operator \(A_{x, \beta }\) requires only the evaluation of expectation values of the simple Hamiltonians \(H_{1-4}\) (\(H_{1-3}\) for Dirichlet boundary condition). The required number of quantum circuits is therefore limited to a constant \(O(n^0)\)18. Similar decomposition expressions apply to problems of higher dimensions, including \(A_{y,\beta }\) in the y direction19.

Once the matrix A is decomposed, a parameterized quantum state \(| \psi (\theta ) \rangle\) is prepared using an Ansatz represented by a sequence of quantum gates \(U(\theta )\) parameterized by \(\theta\) applied to a basis state \(| 0 \rangle ^{\otimes n}\), such that \(| \psi (\theta ) \rangle = U(\theta ) | 0 \rangle ^{\otimes n}\). Here, we use a hardware-efficient Ansatz consisting of multiple layers of \(R_Y\) gates across n qubits entangled by controlled-X gates (see Fig. 1). For the source term f in (10), a quantum state \(| b \rangle\) is prepared by encoding a real vector with the unitary \(U_b\), such that \(| b \rangle = U_b | 0 \rangle ^{\otimes n}\). Depending on the actual input, conventional amplitude encoding methods26,27 may introduce a global phase that must be corrected by its complex argument for computing in the real space.

Figure 1
figure 1

Schematic of the quantum circuit hardware-efficient Ansatz used in this study.

With \(| \psi (\theta ) \rangle\) and \(| b \rangle\), the cost function E can be optimized in terms of A as18

$$\begin{aligned} E(r(\theta ), \theta )=-\frac{1}{2} \frac{\left| \langle \psi (\theta )|b\rangle \right| ^{2}}{\langle \psi (\theta )|A| \psi (\theta )\rangle }, \end{aligned}$$
(17)

where \(| \psi (\theta ),b \rangle := (| 0 \rangle | \psi (\theta ) \rangle + | 1 \rangle | b \rangle )/\sqrt{2}\). The norm of the state vector \(| \psi (\theta ) \rangle\) is represented by \(r\in \mathbb R\), where

$$\begin{aligned} r(\theta )&:=\frac{\left| \langle \psi (\theta )|b\rangle \right| }{\langle \psi (\theta ) |A| \psi (\theta ) \rangle } \nonumber \\&=\frac{\left| \langle \psi (\theta ),b |X \otimes I^{\otimes n}| \psi (\theta ),b \rangle -i\langle \psi (\theta ),ib | X \otimes I^{\otimes n}| \psi (\theta ),ib \rangle \right| }{\langle \psi (\theta ) |A| \psi (\theta ) \rangle }. \end{aligned}$$
(18)

The quantum circuit required for the numerators of (17) and (18) consists of an encoding unitary \(U_b\) and a parameterized Ansatz \(U(\theta )\) (Fig. 1), both oppositely controlled by an ancilla qubit placed in superposition17. As for the denominators, the number of quantum circuits required corresponds to the number of decomposed terms of the Hamiltonian (13), each paired with the Ansatz \(U(\theta )\). Finally, the resulting states of these circuits are measured in the computational basis.

Using classical optimization tools, the cost function (17) is minimized with \(\theta\) updated iteratively until convergence is reached. The optimization process follows either a gradient-based or gradient-free approach, depending on how the gradient of the cost function is evaluated. A gradient-free optimizer is guided by an estimate of the inverse Hessian matrix, whereas a gradient-based optimizer by the partial derivative of the cost function E with respect to parameters \(\theta\), i.e. \(\partial E /\partial \theta\), which can be evaluated by a quantum computer (for details, see18,19). Regardless of the choice of gradient optimizer used, the optimization routine halts when the cost error falls under a convergence threshold (\(\epsilon < \epsilon _{\mathrm {tol}}\)) whence the parameters are at optimum \(\theta =\theta _\mathrm {opt}\). The converged solution vector \(| u \rangle = r_{\mathrm {opt}} | \psi (\theta _{\mathrm {opt}} \rangle\) satisfies10

$$\begin{aligned} r_{\mathrm {opt}}A\left| \psi \left( \theta _{\mathrm {opt}}\right) \right\rangle =|b\rangle \end{aligned}$$
(19)

where \(r_{\mathrm {opt}}=r(\theta _{\mathrm {opt}} )\) is the norm of the solution to the Poisson equation (10).

In this study, we propose to solve the evolution equation (1) through successive time-stepping of the quasi-steady Poisson equation using a variational quantum algorithm. Using a parameter set \(\theta ^k\) obtained at time-step k, we encode a normalized source state \(| \hat{b}^k \rangle := | b \rangle /\sqrt{\langle b|b\rangle }\) from \(| b(\theta ^k) \rangle\) and seek an implicit solution to

$$\begin{aligned} r^{k+1}A\left| \psi \left( \theta ^{k+1}\right) \right\rangle =\left| \hat{b}^{k}\right\rangle , \end{aligned}$$
(20)

where \(\theta ^{k+1}=\theta _\mathrm {opt}(t^{k+1} )\) is the parameter set and \(r^{k+1}=r_\mathrm {opt}(\theta ^{k+1})\) is the norm at next time-step \(k+1\). This process is then iterated in time up to \(n_t\) number of time-steps as desired (see Algorithm 1).

figure a

The cost function \(E(\theta ^k)\) may be evaluated on a quantum computer by computing each of the inner products in the expression in Eq. (17) separately. Using the decomposition provided in Eq. (16), these inner products may be expressed in terms of expectation values \(\langle \varphi | O_i | \varphi \rangle\) for preparable states \(| \varphi \rangle\) and simple Hermitian operators \(O_i\). Each expectation value \(\langle \varphi | O_i | \varphi \rangle\) is evaluated on a quantum computer by preparing the state \(| \varphi \rangle\) using the quantum circuits described above and then measuring the operator \(O_i\) in the state \(| \varphi \rangle\)18.

In this study, the variational quantum algorithm is implemented in Pennylane (Xanadu)28 using a statevector simulator with the Qulacs29 plugin as a backend for quantum simulations, and the L-BFGS-B optimizer for parametric updates. Amplitude encoding is carried out via the standard Mortonnen state preparation template30 with custom global phase correction. For hardware emulation via the QASM simulator (Qiskit), we refer the reader to the excellent cost-sampling analysis of Sato et al. 18.

Applications to the heat/diffusion equation

Consider the following one-dimensional heat or diffusion equation without a source term

$$\begin{aligned} \frac{\partial u}{\partial t}&=D \frac{\partial ^{2} u}{\partial x^{2}}, \qquad&\text{ in } \Omega \times J \end{aligned}$$
(21)
$$\begin{aligned} u&=u_{0}(x),&\text{ in } \Omega \times \{t=0\}. \end{aligned}$$
(22)

Dirichlet conditions are applied on the boundaries of a 1D domain \(\Omega =(x_L,x_R)\subset \mathbb R\), where \(u(x_L,t)=g_L (t)\) and \(u(x_R,t)=g_R (t)\), such that the boundary vector \(u_D=(g_L, 0,\ldots , 0,g_R )\) is known for all t.

To solve Eq. (22), the variational quantum evolution algorithm (Algorithm 1) can be employed with a suitable time-stepping scheme (7). For the implicit Euler (IE) method (8), the matrix A and source state \(| b(\theta ^k) \rangle\) can be decomposed into

$$\begin{aligned} \begin{aligned} &A = I^{\otimes n}+\delta _{x}A_{x, D}, \\&| b^k \rangle = | u^k \rangle + \delta _{x}| u_{D}^{k+1} \rangle , \end{aligned} \end{aligned}$$
(23)

where \(| u^k \rangle = r^k| \psi \left( \theta ^{k}\right) \rangle\).

For the Crank-Nicolson (CN) method (9), it follows that the \(\mathcal Au^k\) term, which carries a small but non-trivial evaluation cost, can be eliminated using the source state of the previous time-step \(k-1\), leading to

$$\begin{aligned} \begin{aligned} &A = 2I^{\otimes n} + \delta _{x}A_{x, D}, \\&| b^k \rangle = 4| u^k \rangle - 2\delta _{x}\left( | b^{k-1} \rangle + | \bar{u}_{D}^{k+1/2} \rangle \right) . \end{aligned} \end{aligned}$$
(24)

where \(2\left| \bar{u}_{D}^{k+1/2}\right\rangle :=\left( \left| u_{D}^{k+1}\right\rangle +\left| u_{D}^{k}\right\rangle \right)\). Here, the presence of a \(k-1\) term in \(\left| b^{k-1}\right\rangle\) is not unexpected due to temporal finite differencing at second-order accuracy.

For a space-time domain \(\Omega \times J\in [0,1] \times [0,1]\), let the number of time-steps be \(n_t=20\) and the spatial intervals be \(n_x=2^n+1\), where n is the number of qubits, and \(\delta _x=1\) is the diffusion parameter. We employ the Dirichlet boundary condition with boundary values \((g_L,g_R )=(1,0)\) and initial values \(u_0= \mathbf {0}\). With initial random parameters \(\theta ^0 \in [0,2 \pi ]\), we run a limited-memory Broyden-Fletcher-Goldfarb-Shanno boxed (L-BFGS-B) optimizer31,32,33,34 to optimize \(\theta\) with absolute and gradient tolerances set at \(10^{-8}\).

Figure 2a compares solutions obtained from the variational quantum solver (23) and classical methods to a 1D heat or diffusion problem in time-increments of 0.1, where the number of qubits and Ansatz layers expressed as a set n- l, are 3- 3 and 4- 4. Here we define the time-averaged trace error \(\bar{\epsilon }_{\mathrm {tr}}\) as

$$\begin{aligned} \bar{\varepsilon }_{\mathrm {t r}}:=\frac{1}{n_{t}} \sum _{k=0}^{n_{t}-1} \sqrt{\left. 1-\left| \langle \psi \left( \theta ^{k}\right) \right| \hat{u}^{k}\right\rangle \left. \right| ^{2}}, \end{aligned}$$
(25)

where \(\left| \hat{u}^{k}\right\rangle :=\left| u^{k}\right\rangle / \sqrt{\left\langle u^{k} \mid u^{k}\right\rangle }\) is the normalized classical solution vector at time k. The trace errors of solutions shown in Fig. 2a are 0.0008 and 0.0025 for n- l sets of 3-3 and 4-4 respectively.

Figure 2
figure 2

(a) Implicit variational quantum solutions to a 1D heat conduction or diffusion problem in time-increments of 0.1, with boundary values \(\{g_L,g_R \}=\{1,0\}\), initial values \(u_0=\bar{0}\) and diffusion parameter \(\delta _x=1\). (Left) Qubit–layer count n-\(l=3\)-3 and time-averaged trace error \(\bar{\varepsilon }_{{{\,\mathrm{tr}\,}}}=0.0008\); (Right) n-\(l=4\)-4, \(\bar{\varepsilon }_{{{\,\mathrm{tr}\,}}}=0.0025\). Both classical and quantum solutions overlap with vanishingly small trace errors. (b) Cost function vs. number of optimization steps for 10 runs. Inset: Input parameters are re-initialized randomly, \(\theta \in [0,2 \pi ]\), before each time-step for 5 runs.

Figure 2b shows how the cost function E depends on the number of optimization steps for n-l of 3-3 and 4-4 (10 sampled runs each). Each distinct step in E represents sequential optimization from solution \(| \psi (\theta ^k) \rangle\) at time-step k towards the solution \(| \psi (\theta ^{k+1}) \rangle\) at \(k+1\). For small time-step \(\Delta t\), \(\theta ^k\) provides a good initial parameter set for solving optimization step \(k+1\). If the Ansatz parameters were re-initialized randomly \(\theta ^k\in [0,2\pi ]\) before each time-step, significantly more optimization steps would be required on average for convergence for each run (see Fig. 2b, inset).

Time complexity

Here we briefly examine the time complexity of the quantum algorithm excluding the classical computing components. Following the analysis of the variational Poisson solver18, the time complexity of the proposed variational evolution equation solver per time-step reads

$$\begin{aligned} T \sim \mathcal {O}\left( \bar{T}_{\mathrm {eval}}\left( \frac{l+e+n^{2}}{\varepsilon ^{2}}\right) \right) , \end{aligned}$$
(26)

where the terms within the inner parentheses indicate the time complexity of the state preparation scaling as \(\mathcal {O}(l+e+n^2 )\), which consists of the Ansatz depth l, the encoding depth \(e = \mathcal {O}(n^2)\)35, the depth of the circuit needed to implement the n-qubit cyclic shift operator \(O(n^2)\), and that of the number of shots \(\mathcal {O}(\varepsilon ^{-2})\) required for estimation of expectation values up to a mean squared error of \(\varepsilon ^2\). The required number of quantum circuits depends on the boundary conditions applied (3 for periodic, 4 for Dirichlet and 5 for Neumann conditions), scaling only as \(\mathcal {O}(n^0 )\). \(\bar{T}_{\mathrm {eval}}\) is the time-averaged number of function evaluations,

$$\begin{aligned} \bar{T}_{\mathrm {eval}}:=\frac{1}{n_{t}} \sum _{k=0}^{n_{t}-1} T_{\mathrm {eval}}, \end{aligned}$$
(27)

where \(T_{\mathrm {eval}}\) is the sum of function evaluations required for a run with \(n_t\) time-steps. Using a gradient-based optimizer, the time complexity for gradient estimation via quantum computing would scale as the Ansatz volume \(\mathcal {O}(nl)\) representing the number of quantum circuits required for parameter shifting. Otherwise, with a gradient-free optimizer, the time complexity simply contributes towards \(\bar{T}_{\mathrm {eval}}\) as additional function evaluations required to evaluate the Hessian for gradient descent.

To see if the time complexity for gradient-free optimization scales as \(\mathcal {O}(nl)\), we plot the time-averaged number of function evaluations \(\bar{T}_{\mathrm {eval}}\) against the number of parameters nl (Fig. 3a). Indeed, we found that \(\bar{T}_{\mathrm {eval}}\) scales reasonably with nl (see trendline of slope 1), despite apparent tapering at higher l. Figure 3b shows that the time-averaged trace error \(\bar{\varepsilon }_{{{\,\mathrm{tr}\,}}}\) decreases with circuit depth l, even for over-parameterized quantum circuits where the number of layers exceeds the minimum required for convergence, \(l_{\mathrm {min}} := 2^n/n\)36. For low grid resolution \(n = 3\), the trace error is limited to a minimum of \(\sim 10^{-4}.\) Since the time complexity for solving the Poisson equation classically is \(\mathcal {O}(N\log _2N)\), where \(N=2^n\), quantum advantage could be realized with the proposed algorithm with linear time scaling by \(n_t\) at sub-exponential time complexity18.

Figure 3
figure 3

Logarithmic plots of time-averaged (a) number of function evaluations \(\bar{T}_{\mathrm {eval}}\) vs. number of parameters nl, (b) trace error \(\bar{\varepsilon }_{{{\,\mathrm{tr}\,}}}\) vs. number of layers l, (c) number of iterations \(\bar{T}_{ }\) and (d) trace error \(\bar{\varepsilon }_{{{\,\mathrm{tr}\,}}}\) vs. diffusion parameter \(\delta\) for \(l=n\) up to \(T=1\). Each data point and error bar represents, respectively, the mean and standard deviation out of 25 runs.

For deep and wide quantum circuits, the increase in optimization time is exacerbated by the presence of barren plateaus, or vanishingly small gradients in the energy landscape, where re-initialization can leave one trapped at a position far removed from the minimum37,38,39. Conversely, short time-steps lead to efficient solution trajectories that remain close to the local cost minima, leading to significant reduction in optimization times. To verify this, we conduct numerical simulations varying the diffusion parameter \(\delta\) with \(l=n\) up to time \(T=1\). Figure 3c shows that the number of iterations, or required optimization steps, per time-step increases linearly with \(\delta\). Close inspection of the time-averaged trace distance shows bimodal distributions at higher \(\delta\), which separates success and failure during convergence towards the global minimum (see Fig. 3d, dotted lines), resembling local minima traps due to poor optimization or expressivity of Ansätze19,40.

Discretization error

Time evolution can be at a higher order, specifically for the Crank-Nicolson method. The problem statement is identical to the previous one, except with Dirichlet boundary values \((g_L, g_R) = (0,0)\) and the initial condition \(u_0 = \sin (\pi x/L_x\)), where we use \(L_x=1\) as the spatial length of the domain. This admits an exact analytical solution,

$$\begin{aligned} u(x, t)=\sin \left( \frac{\pi x}{L_{x}}\right) \exp \left[ -D t\left( \frac{\pi }{L_{x}}\right) ^{2}\right] . \end{aligned}$$
(28)

Figure 4 compares variational quantum and exact solutions using implicit Euler and Crank-Nicolson (CN) schemes. The discretization error for the higher-order CN scheme is reduced significantly, especially at lower grid resolution (\(n=3\)). Although the complexity costs for both methods (23) and (24) are similar, note however that the CN method may introduce spurious oscillations for non-smooth data24, an issue which may be exacerbated by quantum noise41.

Figure 4
figure 4

Variational quantum solutions to a 1D heat conduction or diffusion problem for qubit-layers (a) n-\(l=3\)-3 and (b) n-\(l=4\)-4 in time-increments of 0.1 using implicit Euler and Crank–Nicolson schemes, with Dirichlet boundary values \((g_L,g_R )=(0,0)\), initial values \(u_0=\sin {(\pi x)}\) and diffusion parameter \(\delta _x=1\). Dashed lines denote exact solutions.

Higher dimensions

The preceding analysis can be extended to higher dimensions. Consider the following two-dimensional heat or diffusion equation in \(\Omega \times J\), where \(\Omega =(x_L,x_R )\times (y_L,y_R) \subset \mathbb R^2\):

$$\begin{aligned} \frac{\partial u}{\partial t}&=D \left( \frac{\partial ^{2} u}{\partial x^{2}} + \frac{\partial ^{2} u}{\partial y^{2}}\right) , \qquad&\text{ in } \Omega \times J, \end{aligned}$$
(29)
$$\begin{aligned} u&=u_{0},&\text{ in } \Omega \times \{t=0\}. \end{aligned}$$
(30)

Under the implicit Euler scheme (8), the matrix A and source state \(| b^k \rangle\) can be decomposed into

$$\begin{aligned} \begin{aligned} A = I^{\otimes n} + \delta _{x}A_{x, D} + \delta _{y}A_{y, D}, \\ \left| b^k\right\rangle =\left| u^k\right\rangle +\delta _{x}\left| u_{x,D}^{k+1}\right\rangle +\delta _{y}\left| u_{y,D}^{k+1}\right\rangle . \end{aligned} \end{aligned}$$
(31)

Dirichlet conditions are applied on the boundaries, where \(u(x_{L,R},y,t) = g_{x_{L,R}}(y,t)\) and \(u(x,y_{L,R},t) = g_{y_{L,R}}(x,t)\). Let the number of spatial grid intervals be \(n_x = 2^{m_x} + 1\) and \(n_y = 2^{m_y} + 1\), where \(m_x\) is the number of qubits allocated to the x grid, \(m_y\) to the y grid, and \(n=m_x+m_y\) is the total number of qubits. Accordingly, A is decomposed in terms of simple Hamiltonians in x and y as

$$\begin{aligned} A_{x, \beta } &=2 I^{\otimes n}-\underbrace{I^{\otimes n-1}\otimes X}_{H_{1}} \nonumber \\& \quad + S^{\dagger }_{[0,m_x)}\big [-\underbrace{I^{\otimes n-1}\otimes X}_{H_{2}} +\underbrace{I^{\otimes m_y}I_{0}^{\otimes m_x-1}\otimes X}_{H_{3}}-\underbrace{b_{\beta }I^{\otimes m_y} I_{0}^{\otimes m_x-1} \otimes I}_{H_{4}}\big ] S_{[0,m_x)}, \end{aligned}$$
(32)
$$\begin{aligned} A_{y, \beta } & =2 I^{\otimes n}-\underbrace{I^{\otimes m_y-1}\otimes X\otimes I^{\otimes m_x}}_{H_{1}}\nonumber \\&\quad + S^{\dagger }_{[m_x,n)}\big [-\underbrace{I^{\otimes m_y-1}\otimes X\otimes I^{\otimes m_x}}_{H_{2}}+\underbrace{I_{0}^{\otimes m_y-1}\otimes X\otimes I^{\otimes m_x}}_{H_{3}}-\underbrace{b_{\beta }I_{0}^{\otimes m_y-1} \otimes I^{\otimes m_x+1}}_{H_{4}}\big ] S_{[m_x,n)}, \end{aligned}$$
(33)

where \(H_{1-4}\) are simple Hamiltonians to be evaluated (\(H_{1-3}\) for Dirichlet boundary condition).

Figure 5 shows solution snapshots to a 2D heat conduction or diffusion problem taken at time \(T = 1\) with Dirichlet boundary values \((g_{x_L},g_{x_R}) = (0,0)\) and \((g_{y_L},g_{y_R})=(1,0)\), initial values \(u_0=\mathbf {0}\), \(n_t = 20\) and diffusion parameters \(\delta _x=\delta _y=1\). Results obtained from variational quantum solver agree with classical solutions with time-averaged trace errors of up to \(10^{-2}\).

Figure 5
figure 5

(a) Contour solution plot of 2D heat conduction or diffusion problem at time \(T = 1\) on a \(8 \times 8\) x-y square grid (qubit-layer \(m_x\)-\(m_y\)-\(l=3\)-3-6) with Dirichlet boundary values \((g_{x_L},g_{x_R}) = (0,0)\) and \((g_{y_L},g_{y_R})=(1,0)\), initial values \(u_0=\mathbf {0}\), \(n_t = 20\) and diffusion parameters \(\delta _x=\delta _y=1\). (b) Solution vectors in time-increments of 0.1.

Applications to the reaction–diffusion equations

Here, we extend applications of our variational quantum solver to evolution equations with non-trivial source terms. Consider a two-component homogeneous reaction-diffusion system of equations

$$\begin{aligned} \frac{\partial \mathbf {u}(\vec{x},t)}{\partial t}&= \mathbf {D} \nabla ^{2} \mathbf {u}(\vec{x},t) + \mathbf {f} (\vec{x},t), \qquad&\text{ in } \Omega \times J, \end{aligned}$$
(34)
$$\begin{aligned} \mathbf {u}(\vec{x},0)&=\mathbf {u_0}(\vec{x}),&\text{ in } \Omega \times \{t=0\}, \end{aligned}$$
(35)

where \(\mathbf {u}=[u_1,u_2]^T\) is a concentration tensor, \(\mathbf {D}={\text {diag}}[D_1,D_2]^T\) is a diffusion tensor and \(\mathbf {f} = [f_1(u_1,u_2), f_2(u_1,u_2)]^T\) is a coupled reaction source term. First proposed by Turing42, the reaction-diffusion equations are useful for understanding pattern formation and self-organization in biological and chemical systems43,44, such as morphogenesis45 and autocatalysis46.

Here, we propose a semi-implicit time-stepping scheme, whereby the coupled, non-linear source term is solved at the current time-step k. With explicit source term \(f^k\), the implicit Euler scheme (8) reads

$$\begin{aligned} (I+\mathcal {A}) u^{k+1}=u^{k}+\Delta t f^{k}. \end{aligned}$$
(36)

The two-component tensor \(\mathbf {A}=[A_1,A_2]^T\) and source state \(\mathbf {b}=[b_1,b_2]^T\) can then be decomposed into

$$\begin{aligned} \begin{aligned} \mathbf {A}&=I^{\otimes n}+\mathbf {\delta _{x}A_{x, D}}, \\ \left| \mathbf {b^k}\right\rangle&=\left| \mathbf {u^k}\right\rangle +\mathbf {\delta _{x}}\left| \mathbf {u_{D}^{k+1}}\right\rangle +\Delta t\left| \mathbf {f^k}\right\rangle , \end{aligned} \end{aligned}$$
(37)

where \(\mathbf {\delta _x} = 2^{2n}\Delta t\mathbf {D}\) is the two-component diffusion parameter vector. With a linear Hermitian source matrix f, a fully implicit time-stepping scheme becomes available (Appendix A).

Implementation

The semi-implicit variational quantum solver solves for the Laplacian for each component using a quantum computer and the solution vectors are explicitly coupled through source terms prior to re-encoding in preparation for the next time-step (see Algorithm 2).

figure b

1D Gray–Scott model

The Gray-Scott model46 was originally conceived to model chemical reactions of the type \(U + 2V \rightarrow 3V\), \(V \rightarrow P\), where U, V and P are chemical species with reaction term

$$\begin{aligned} \mathbf {f(u)}=\begin{bmatrix} k_1(1-u_1)-u_1u_2^2 \\ -(k_1+k_2)u_2+u_1u_2^2 \end{bmatrix}, \end{aligned}$$
(38)

where \(k_1\) and \(k_2\) are kinetic rate constants.

An interesting class of Gray-Scott solutions involves periodic splitting of chemical wave pulses24,47. Here, we conduct a pulse splitting numerical experiment under limited spatial and temporal resolutions, using input parameters \(\mathbf {D}=[10^{-4},10^{-6}]^T\), \(k_1 = 0.04\) and \(k_2 = 0.02\), with a mid-pulse initial condition and Dirichlet boundary conditions as

$$\begin{aligned} u_1(x,0) = 1 - \frac{1}{2}\sin ^{100}(\pi x), \qquad&u_2(x,0) = \frac{1}{4}\sin ^{100}(\pi x), \qquad&x \in (0,1), \end{aligned}$$
(39)
$$\begin{aligned} u_1(0,t) = u_1(1,t) = 1, \qquad&u_2(0,t) = u_2(1,t) = 0, \qquad&t \in [0,T], \end{aligned}$$
(40)

where time t extends up to \(T=600\) on \(dt = 0.5\).

Figure 6a shows how an initial mid-pulse can spontaneously and periodically split in space and time, a phenomenon captured using variational quantum diffusion reaction solver (see Algorithm 2) even on relatively low spatial resolutions.

Figure 6
figure 6

Space-time solutions of (a) mid-pulse wave-splitting in 1D two-component Gray-Scott model obtained using semi-implicit variational quantum reaction-diffusion solver on \(2^{6}=64\) grid points up to \(T=600\), for chemical species \(u_1\) (left) and \(u_2\) (right). Parameters include \(\mathbf {D}=[10^{-4},10^{-6}]^T\), \(k_1 = 0.04\), \(k_2 = 0.02\) and \(dt=0.5\). (b) Traveling wave solutions for 1D Brusselator model on \(2^{4}=16\) grid points up to \(T=400\) on Neumann boundary conditions. Parameters include \(\mathbf {D}=[10^{-4},10^{-4}]^T\), \(k_1 = 3\), \(k_2 = 1\) and \(dt=0.5\).

1D Brusselator model

So far, we have been looking at only Dirichlet boundary conditions. Here, we demonstrate a test example for Neumann boundary conditions in a diffusion-reaction model, namely, the Brusselator model48, which was developed by the Brussels school of Prigogine to model the behavior of non-linear oscillators in a chemical reaction system. The model reaction term reads

$$\begin{aligned} \mathbf {f(u)} = \begin{bmatrix} -(k_1+1)u_1 + u_1^2u_2 + k_2 \\ k_1u_1 - u_1^2u_2 \end{bmatrix}. \end{aligned}$$
(41)

Using \(\mathbf {D}=[10^{-4},10^{-4}]^T\), \(k_1 = 3\) and \(k_2 = 1\), with initial conditions

$$\begin{aligned} u_1(x,0) = \frac{1}{2}, \qquad&u_2(x,0) = 1+5x, \qquad&x \in (0,1), \end{aligned}$$
(42)
$$\begin{aligned} \frac{\partial u_1}{\partial x}(0,t) = \frac{\partial u_1}{\partial x}(1,t) = 0, \qquad&\frac{\partial u_2}{\partial x}(0,t) = \frac{\partial u_2}{\partial x}(1,t) = 0, \qquad&t \in [0,T], \end{aligned}$$
(43)

where time t extends up to \(T=400\) on \(dt = 0.5\).

Figure 6b shows how a chemical pulse can be spontaneously created, which continually travels leftwards in time, creating traveling waves that appear as striped patterns in time despite low spatial resolutions.

Applications to the Navier–Stokes equations

The Navier-Stokes equations are a set of non-linear partial differential equations that describes the motion of fluids across continuum length scales. There are several studies aimed at applying quantum algorithms to computational fluid dynamics (see review49), ranging from reduction of partial differential equations to ordinary differential equations50 and quantum solutions of sub-steps of the classical algorithm51,52 to the quantum Lattice Boltzmann scheme53.

Here, we look into the potential use of variational quantum algorithms to evolve the fluid momentum equations in time. Consider the incompressible Navier-Stokes equations in non-dimensional form

$$\begin{aligned} \frac{\partial \mathbf {u}}{\partial t} + \mathbf {u}\cdot \nabla \mathbf {u}&= - \nabla p + \frac{1}{\mathrm {Re}}\nabla ^{2}\mathbf {u}, \end{aligned}$$
(44)
$$\begin{aligned} \nabla \cdot \mathbf {u}&=0, \end{aligned}$$
(45)

where \(\mathbf {u}\) is the velocity vector and p is the fluid pressure. The ratio \(\mathrm {Re}=U_cL_c/\nu\) is the Reynolds number, where \(U_c\) is the characteristic flow velocity across a characteristic length-scale \(L_c\) and \(\nu\) is the fluid kinematic viscosity.

Unlike other temporal evolution equations, the incompressible Navier-Stokes equations cannot be time-marched directly as the resultant velocities do not satisfy the continuity constraint (45), and hence are not divergence-free. To resolve this, the projection method54, also known as the predictor-corrector or fractional step method, separates the solution time-step into velocity and pressure sub-steps, also known as the predictor and corrector steps.

Projection method

Predictor step

The predictor step first approximates an intermediate velocity \(\mathbf {u^{*}}\) by solving the fluid momentum equation (44) in the absence of pressure, i.e. the Burgers’ equations55, of the form

$$\begin{aligned} \left( 1-\frac{\Delta t}{\mathrm {Re}}\nabla ^2\right) \mathbf {u^*}=\left( 1-\Delta t\mathbf {u^k}\nabla \cdot \ \right) \mathbf {u^k}. \end{aligned}$$
(46)

Through a semi-implicit scheme, the viscous terms are handled implicitly using the variational quantum evolution equation solver and the non-linear inertial terms explicitly as source terms using classical computation. For quantum algorithms for non-linear problems, the reader is referred to separate works on quantum ordinary differential equation solvers50,55, Carleman linearization56 and a variational quantum nonlinear processing unit (QNPU)13.

On a two-dimensional domain with Dirichlet boundary conditions, the tensor \(\mathbf {A_u}=[A_u,A_v]^T\) and source state \(\mathbf {b_u}=[b_u,b_v]^T\) can be decomposed as

$$\begin{aligned} \begin{aligned} &{\mathbf {A_u}} = I^{\otimes n} + \delta _{x} \mathbf {A_{x, D}} + \delta _{y} \mathbf {A_{y, D}}, \\&\mathbf {| b^k_u \rangle } = (1 - \Delta t \mathbf {F^k}) \mathbf {| u^k \rangle } + \delta _{x}\mathbf {| u_{x,D}^{k+1} \rangle } + \delta _{y}\mathbf {| u_{y,D}^{k+1} \rangle }, \end{aligned} \end{aligned}$$
(47)

where \(\delta _x := \Delta t/(\mathrm {Re}\Delta x^{2})\) and \(\delta _y:= \Delta t/(\mathrm {Re}\Delta y^{2})\). \(F^k = D^k_u B_{x,D} + D^k_v B_{y,D}\) is an operator which approximates the non-linear inertial term, where \(\mathbf {D^k_{u}}\) are diagonal matrices with velocity vectors \(\mathbf {| u^k \rangle }\) along the diagonals and B is a divergence matrix discretized through center differencing, for instance in the x direction, as

$$\begin{aligned} B_{x,\beta } = \frac{1}{2\Delta x} \begin{bmatrix} \alpha _\beta & 1 & 0 & & & \cdots & & 0 \\ -1 & 0 & 1 & 0 & & \cdots & & 0 \\ 0 & -1 & 0 & 1 & & \cdots & & 0 \\ \vdots & & & \ddots & & & & \vdots \\ 0 & & \cdots & & 0 & -1 & 0 & 1 \\ 0 & & \cdots & & & 0 & -1 & \alpha _\beta \end{bmatrix}. \end{aligned}$$
(48)

where \(\beta \in \{D,N\}\) refers to either Dirichlet (D) or Neumann (N) boundary condition. Here, \(\alpha _D=0\) and \(\alpha _N=-1\).

Corrector step

The second corrector step solves for the velocity \(\mathbf {u^{k+1}}\) by correcting the intermediate velocities \(\mathbf {u^*}\) using the pressure gradient as a Lagrange multiplier to enforce continuity. Applying divergence to the correction equations yields the pressure Poisson equation for the pressure field at half-step

$$\begin{aligned} -\nabla ^2 p^{k+1} = -\frac{1}{\Delta t}\nabla \cdot {\mathbf {u^*}}, \end{aligned}$$
(49)

which can be solved implicitly in two dimensions (xy) via the following decomposition:

$$\begin{aligned} \begin{aligned}{}&A_{p} = \frac{\Delta t}{\Delta x^2}\left( A_{x,N} + \frac{1}{2}I_0^{\otimes n}\right) + \frac{\Delta t}{\Delta y^2}\left( A_{y,N} + \frac{1}{2}I_0^{\otimes n}\right) , \\&| b^k_p \rangle = -(B_{x,D}| u^* \rangle + B_{y,D}| v^* \rangle ). \end{aligned} \end{aligned}$$
(50)

Note the addition of a simple Hermitian \(I_0 = |0\rangle \!\langle 0|\) to the pressure matrix \(A_p\), which would otherwise be singular (corank 1) under Neumann boundary conditions for the pressure field.

With the new pressure \(p^{k+1}\), the velocities are updated at the \(k+1\) time-step as

$$\begin{aligned} \mathbf {u^{k+1}} = \mathbf {u^*} - \Delta t \mathbf {B_N} | p^{k+1} \rangle , \end{aligned}$$
(51)

where \(\mathbf {B_N} = [B_{x,N}, B_{y,N}]^T\) are the gradient operators.

Implementation

Overall, the variational quantum solver for Navier-Stokes equations using the projection method (see Algorithm 3) involves two sequential steps, the first requiring a number of Algorithm 1 iterations equal to the number of velocity components, and the second for the pressure Poisson step. For two-dimensional flows, the number of velocity components to be solved can be effectively reduced by one through the vorticity stream-function formulation (Appendix B). In computational fluid dynamics, these implicit systems of linear equations are often the most computationally expensive parts to solve in classical algorithms, providing incentives for potential speedup via quantum computing49,52.

figure c

2D cavity flow

The lid-driven cavity flow is a standard benchmark for testing incompressible Navier–Stokes equations57. Consider a two-dimensional square domain \(\Omega =(0,L)\times (0, L) \subset \mathbb R^2\) with only one wall sliding tangentially at a constant velocity. For simplicity, we employ a fixed collocated grid, instead of a staggered grid which helps avoid spurious pressure oscillations but at the cost of increased mesh and discretization complexity. No-slip boundary conditions apply on all walls, so that zero velocity applies on all wall boundaries except one moving at \(u(x,0)=1\).

Figure 7a shows a snapshot of a test case conducted on a \(2^n=8\times 8\) grid at \(\Delta t=0.5\) up to \(T = 5\), with the central vortex shown by normalized velocity quivers in white. In terms of time complexity, we note that the pressure correction step requires a greater number of function evaluations for convergence compared to an implicit velocity step (Fig. 7b). This is due to the additional quantum circuits for evaluating the \(H_4\) Hamiltonians (32, 33) for Neumann boundary conditions and one for specifying the reference pressure (50), leading to a total of 9 evaluation terms compared to 6, a ratio which corroborates with the apparent \(\sim 50\%\) increase in function evaluations shown in Fig. 7b.

Figure 7
figure 7

(a) 2D lid-driven cavity flow (\(\mathrm {Re}= 100\)) on a \(2^n=8\times 8\) grid at \(\Delta t=0.5\) up to \(T = 5\) and upper boundary sliding in the x direction at \(u(x,0)=1\). Color map indicates velocity magnitude with normalized velocity quivers in white indicating direction of flow. (b) Plots of cumulative number of function evaluations (Nfeval) vs. time for intermediate velocities (u,v) and pressure (p).

While not directly comparable to classical computational fluid dynamics in numerical accuracy, this exercise, nevertheless, roadmaps potential applications of the variational quantum method towards more complicated flow problems52.

Conclusion

In this study, we proposed a variational quantum solver for evolution equations which include a Laplacian operator to be solved implicitly. For short time-steps \(\Delta t\), the use of initial parameter sets encoded from prior solution vectors results in faster convergence compared to random re-initialization. The overall time complexity scales with the Ansatz volume \(\mathcal {O}(nl)\) for gradient estimation and with the number of time-steps \(\mathcal {O}(n_t)\) for temporal discretization. Our proposed algorithm extends naturally to higher-order time-stepping and higher dimensions. For evolution equations with non-trivial source terms, the semi-implicit scheme can be applied, where non-linear source terms are handled explicitly. Using statevector simulations, we demonstrated that variational quantum algorithms can be useful in solving popular partial differential equations, including the reaction-diffusion and the incompressible Navier-Stokes equations. Together, our proposed algorithm extends the use of quantum Poisson solvers to solve time-dependent problems with reduced time complexity from variational quantum algorithms over classical computation.

The present work aims at bridging the gap between variational quantum algorithms and practical applications. Our work has assumed that the state preparations, unitary transformations and measurements are implemented perfectly, and does not consider the effects of quantum noise from actual hardware or any potential amplification from iterative time-stepping. In our implementation, we only considered the hardware-efficient Ansatz with \(R_y\) rotation gates and controlled-NOT entanglers, and thus leave open the question about the performance of other Ansätze. Future work can include noise mitigation58,59,60, quantum random access memory61,62,63, tensor networks64, Ansatz architecture, non-linear algorithms and cost-efficient encoding.