**4. Quantum algorithm for discrete-velocity method**

In computational fluid dynamics, the most widely used methods involve solving the Navier-Stokes equations for a continuum fluid, i.e., where fluid density, velocity components, and energy in each location in the computational domain are to be found from conservation equations. The vortex-in-cell method used in the previous section employs the Navier-Stokes equations in a transformed form involving vorticity rather than velocity, but importantly it still uses the continuum flow assumption.

An alternative approach to the Navier-Stokes-based modeling is a description of the flow at a more detailed level, i.e., at the kinetic level [11]. Instead of governing equations for mass, momentum, and energy conservation, the flow is now described by the Boltzmann equation governing a particle distribution function in state space (or 3D velocity space for a 3D monatomic gas flow) for each location in the considered domain [10].

For a monatomic gas, the distribution function *f*(*x,* <sup>→</sup> *c* <sup>→</sup>;*t*) with *x* <sup>→</sup> defining the coordinates in (physical) space and *c* <sup>→</sup> the molecular velocity (defined in "velocity space") is governed by the Boltzmann equation:

$$
\frac{\partial \mathbf{f}}{\partial \mathbf{t}} + \vec{\mathbf{c}} \frac{\partial \mathbf{f}}{\partial \vec{\mathbf{x}}} = \mathbf{Q} \{ \mathbf{f}, \mathbf{f} \} \tag{3}
$$

The distribution function defines for each point *x* <sup>→</sup> the likelihood that molecules have velocity *c* <sup>→</sup>. On the right-hand side of the equation, the collision term *Q* (*f*,*f*) represents the effect of collisions between particles [12]. For each point in space, we can take moments of the distribution function to obtain the local fluid density, velocity components, and energy.

The key advantage of this approach is that non-continuum flows, i.e., flows for which the density is so low that we cannot assume it to act as a continuum, can also be modeled. However, the main problem is the large computational cost when using a direct discretization approach due to the high dimensionality, i.e., for a 3D flow problem, we have a six-dimensional solution space (or seven when including time).

A further main challenge is the cost of evaluating the collision term. For the free-molecular flows considered here, the collision term can be discarded, and we will use the **collisionless Boltzmann equation** instead.

In the discrete-velocity method used here, the velocity space is discretized using a uniformly spaced Cartesian mesh. A maximum molecular velocity magnitude is defined, *cmax*, so that the left and right domain boundaries in velocity space are at −*cmax* and +*cmax*, respectively, with a uniform spacing Δc separating each point in velocity space. These limits are problem dependent.

The discrete-velocity approach used here has a number of characteristics facilitating a quantum implementation:


In the examples shown, problems are restricted to two-dimensional flows. For this case, the collisionless Boltzmann equation originally defined for 3D can be reduced to two kinetic equations for two reduced distribution functions:

$$\frac{\partial \mathbf{f}}{\partial \mathbf{t}} + \vec{\mathbf{c}} \frac{\partial \mathbf{f}}{\partial \vec{\mathbf{x}}} = \mathbf{O}; \frac{\partial \mathbf{g}}{\partial \mathbf{t}} + \vec{\mathbf{c}} \frac{\partial \mathbf{g}}{\partial \vec{\mathbf{x}}} = \mathbf{O} \tag{4}$$

**39**

**Figure 5.**

*Cartesian mesh.*

*Quantum Algorithms for Fluid Simulations DOI: http://dx.doi.org/10.5772/intechopen.86685*

negated when each control qubit is in state |0>.

time-integration method.

where the velocity and coordinate vectors are now defined in 2D.

circuit implementation of the streaming operations in x- and y-direction on a Cartesian 2D mesh can be created as shown in **Figure 5**. The example shows how a 12-qubit register is used for a discretized function with 6 qubits defining the indices of 64 grid points in x- and y-coordinate directions. The circuits with the filled circles define streaming to "right" neighbors, i.e., when each control qubits has the |1> state, the target qubit gets negated ("X" symbol used here). Similarly, the left streaming operation employs multiple-control NOT gates with target qubits being

For the streaming operations in quantum discrete-velocity method, further extensions are needed. First, the quantum register needs to be extended relative to that shown in **Figure 5** to account for the storage of two discretized reduced distributions defined in the discretized velocity space. The additional distribution function is accounted for using an additional qubit termed "g" in the following quantum circuit diagrams. The number of additional qubits needed for the discrete-velocity mesh clearly depends on the number of discrete velocities used. For example, for a 16 × 16 discrete-velocity mesh, we add 8 qubits (four for each direction in state space). The qubits are denoted by the "u0,"…, "v0,"… qubits in the quantum circuits. Finally, to account for solid objects, we use an additional qubit ("BC" in the diagrams) set to |1> to denote a cell within fluid and |0> for a cell within a solid. For a 64 × 64 Cartesian mesh and a 16 × 16 discrete-velocity mesh, **Figure 6** shows the quantum circuit used to simulate the free-molecular flow around a rectangular body, for which the evolution of the flow field starting from an initial uniform flow is shown in **Figure 7**. The key feature in the quantum circuits shown in **Figure 6** is the extended number of control qubits, i.e., beyond the checks on the qubits corresponding to spatial coordinates, control qubits also involve the "BC" qubit (fluid/solid flag) as well as the qubits related to the discrete-velocity indices. This least feature originates from the need to stream only data associated with selected discrete velocities in the used

*Quantum circuit implementation of "left streaming" and "right streaming" in x- and y-direction on a 64 × 64* 

Inspired by the previous work on the Dirac equation [14], an efficient quantum

#### *Quantum Algorithms for Fluid Simulations DOI: http://dx.doi.org/10.5772/intechopen.86685*

*Advances in Quantum Communication and Information*

The distribution function defines for each point *x*

will use the **collisionless Boltzmann equation** instead.

velocity space. These limits are problem dependent.

as for the discretization of the velocity space.

velocities are identical in each cell.

interparticle collisions.

"streaming" of data.

\_\_

∂f ∂t <sup>+</sup> <sup>c</sup> → \_\_\_ ∂f ∂x <sup>→</sup> = 0; ∂g\_\_\_ ∂t <sup>+</sup> <sup>c</sup> <sup>→</sup> ∂g\_\_\_ ∂x

∂f ∂t <sup>+</sup> <sup>c</sup> → \_\_\_ ∂f ∂x

<sup>→</sup>. On the right-hand side of the equation, the collision term *Q* (*f*,*f*)

represents the effect of collisions between particles [12]. For each point in space, we can take moments of the distribution function to obtain the local fluid density,

The key advantage of this approach is that non-continuum flows, i.e., flows for which the density is so low that we cannot assume it to act as a continuum, can also be modeled. However, the main problem is the large computational cost when using a direct discretization approach due to the high dimensionality, i.e., for a 3D flow problem, we have a six-dimensional solution space (or seven when including time). A further main challenge is the cost of evaluating the collision term. For the free-molecular flows considered here, the collision term can be discarded, and we

In the discrete-velocity method used here, the velocity space is discretized using a uniformly spaced Cartesian mesh. A maximum molecular velocity magnitude is defined, *cmax*, so that the left and right domain boundaries in velocity space are at −*cmax* and +*cmax*, respectively, with a uniform spacing Δc separating each point in

The discrete-velocity approach used here has a number of characteristics facili-

1.A uniformly spaced Cartesian mesh is used for the spatial discretization as well

2.In case solid objects are present in the computational domain, these are rectangular, and its edges align with the mesh lines in the mesh. Specifically, solid

bodies can be defined by "tagging" selected groups of cells in the mesh.

4.The convection part of the Boltzmann equation (i.e., the second term on the left-hand side in the shown equation) along with gas-solid interactions determines the time evolution of the distribution function in the absence of

5.The time-integration method used here is based on the reservoir technique [13], such that during the time integration the convection step always exactly involves the distribution function defined in a cell of computational mesh to move to a cell that is a nearest neighbor. This is commonly referred to as

In the examples shown, problems are restricted to two-dimensional flows. For this case, the collisionless Boltzmann equation originally defined for 3D can be reduced to two kinetic equations for two reduced distribution functions:

<sup>→</sup> = 0 (4)

3.A constant velocity-space discretization is used in each point in space, i.e., the velocity-space boundaries defined earlier as well as the number of discrete

<sup>→</sup> = Q(f,f) (3)

<sup>→</sup> the likelihood that molecules

\_\_

velocity components, and energy.

tating a quantum implementation:

have velocity *c*

**38**

where the velocity and coordinate vectors are now defined in 2D.

Inspired by the previous work on the Dirac equation [14], an efficient quantum circuit implementation of the streaming operations in x- and y-direction on a Cartesian 2D mesh can be created as shown in **Figure 5**. The example shows how a 12-qubit register is used for a discretized function with 6 qubits defining the indices of 64 grid points in x- and y-coordinate directions. The circuits with the filled circles define streaming to "right" neighbors, i.e., when each control qubits has the |1> state, the target qubit gets negated ("X" symbol used here). Similarly, the left streaming operation employs multiple-control NOT gates with target qubits being negated when each control qubit is in state |0>.

For the streaming operations in quantum discrete-velocity method, further extensions are needed. First, the quantum register needs to be extended relative to that shown in **Figure 5** to account for the storage of two discretized reduced distributions defined in the discretized velocity space. The additional distribution function is accounted for using an additional qubit termed "g" in the following quantum circuit diagrams. The number of additional qubits needed for the discrete-velocity mesh clearly depends on the number of discrete velocities used. For example, for a 16 × 16 discrete-velocity mesh, we add 8 qubits (four for each direction in state space). The qubits are denoted by the "u0,"…, "v0,"… qubits in the quantum circuits. Finally, to account for solid objects, we use an additional qubit ("BC" in the diagrams) set to |1> to denote a cell within fluid and |0> for a cell within a solid. For a 64 × 64 Cartesian mesh and a 16 × 16 discrete-velocity mesh, **Figure 6** shows the quantum circuit used to simulate the free-molecular flow around a rectangular body, for which the evolution of the flow field starting from an initial uniform flow is shown in **Figure 7**. The key feature in the quantum circuits shown in **Figure 6** is the extended number of control qubits, i.e., beyond the checks on the qubits corresponding to spatial coordinates, control qubits also involve the "BC" qubit (fluid/solid flag) as well as the qubits related to the discrete-velocity indices. This least feature originates from the need to stream only data associated with selected discrete velocities in the used time-integration method.

#### **Figure 5.**

*Quantum circuit implementation of "left streaming" and "right streaming" in x- and y-direction on a 64 × 64 Cartesian mesh.*

**Figure 6.**

*Quantum circuit implementation of streaming operations for discrete-velocity method (with 16 × 16 velocity mesh). Two-dimensional domain with 64 × 64 Cartesian mesh.*
