**4.1 Quantum circuit implementation of specular-reflection boundary conditions**

A key aspect of the flows simulated by the quantum algorithm described here are gas-solid interactions. In this work, specular-reflection boundary conditions are assumed. This means that upon hitting a solid surface, a gas particle will bounce off this surface with the wall-normal velocity component effectively getting reversed and the tangential-flow component being preserved. In **Figure 7**, the time evolution of a Mach 2 free-molecular flow is shown, starting from an initial flow at uniform velocity everywhere.

As can be seen in **Figure 7**, the specular-reflection boundary conditions gradually make the velocity vectors align with the solid wall such that there is no longer a flow into the solid body. This is the physically correct behavior. In the quantum register,

**41**

**Figure 7.**

*mesh with 64 × 64 discrete velocities.*

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

the indexing for the velocity-mesh data is designed such that a change of the sign of the discrete velocity implies a bit negation of qubits representing the index of the considered discrete velocity. As an example, **Figure 8** shows the quantum circuit implementation of the specular reflection for a rectangular body. In this case, only 16 × 16 discrete velocities are used for clarity. It can be seen that control qubits are used to "select" cells in space for which to apply the boundary condition. A further control qubit involves the "BC" qubit representing the solid/fluid flag. The negation operation ("X") is applied to the qubits representing the velocity-mesh index to create the "change of sign" of the considered discrete-velocity data. This circuit is shown as an illustration of the quantum algorithm design approach used here.

*Discrete-velocity simulation of Mach 2 flow around rectangular body. 64 × 64 Cartesian mesh, velocity-space* 

Although the circuits shown in **Figure 6** perform the correct convection operations, an important practical constraint needs to be considered. For the quantum computer implementations achieved so far and those foreseen for the near future, the kind of multi-qubit-controlled NOT operations used here cannot be implemented. A small set of native gates will be available which most likely includes NOT, CNOT, and the Toffoli gate.

**4.2 Circuit implementations using ancilla qubits**

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

*Advances in Quantum Communication and Information*

**4.1 Quantum circuit implementation of specular-reflection boundary conditions**

*Quantum circuit implementation of streaming operations for discrete-velocity method (with 16 × 16 velocity* 

*mesh). Two-dimensional domain with 64 × 64 Cartesian mesh.*

A key aspect of the flows simulated by the quantum algorithm described here are gas-solid interactions. In this work, specular-reflection boundary conditions are assumed. This means that upon hitting a solid surface, a gas particle will bounce off this surface with the wall-normal velocity component effectively getting reversed and the tangential-flow component being preserved. In **Figure 7**, the time evolution of a Mach 2 free-molecular flow is shown, starting from an initial flow at uniform

As can be seen in **Figure 7**, the specular-reflection boundary conditions gradually make the velocity vectors align with the solid wall such that there is no longer a flow into the solid body. This is the physically correct behavior. In the quantum register,

**40**

**Figure 6.**

velocity everywhere.

**Figure 7.**

*Discrete-velocity simulation of Mach 2 flow around rectangular body. 64 × 64 Cartesian mesh, velocity-space mesh with 64 × 64 discrete velocities.*

the indexing for the velocity-mesh data is designed such that a change of the sign of the discrete velocity implies a bit negation of qubits representing the index of the considered discrete velocity. As an example, **Figure 8** shows the quantum circuit implementation of the specular reflection for a rectangular body. In this case, only 16 × 16 discrete velocities are used for clarity. It can be seen that control qubits are used to "select" cells in space for which to apply the boundary condition. A further control qubit involves the "BC" qubit representing the solid/fluid flag. The negation operation ("X") is applied to the qubits representing the velocity-mesh index to create the "change of sign" of the considered discrete-velocity data. This circuit is shown as an illustration of the quantum algorithm design approach used here.

### **4.2 Circuit implementations using ancilla qubits**

Although the circuits shown in **Figure 6** perform the correct convection operations, an important practical constraint needs to be considered. For the quantum computer implementations achieved so far and those foreseen for the near future, the kind of multi-qubit-controlled NOT operations used here cannot be implemented. A small set of native gates will be available which most likely includes NOT, CNOT, and the Toffoli gate.

**Figure 8.**

*Quantum circuit implementation of specular-reflection boundary conditions for rectangular body. 64 × 64 Cartesian mesh, 16 × 16 discrete-velocity mesh.*

The solution around this limitation is the introduction of ancilla qubits, which can be regarded as the quantum equivalence of additional workspace in the memory of a classical computer. Then circuits involving multi-qubit operations involving a large number of control gates can be transformed into circuits with more qubits and a larger number of gate operations, however now with a smaller number of control qubits. As is typical in this context, we assume that the ancilla qubits are initially in |0>, and since these are to be reused multiple times, the transformed circuits need to reset the ancilla qubits of this state at the end of the operations. For the quantum circuits implementing streaming in positive *x*-direction considered previously, **Figure 9** shows the required circuit transformations for the cases of 1, 2, or 3 ancilla qubits. Increasing the number of qubits will make the circuits more demanding to implement, so in the actual implementation there is an important trade-off between gate complexity (i.e., within the set of native gates available) and total number of qubits. For the 64 × 64 two-dimensional mesh and 16 × 16 discrete velocities considered in **Figure 6**, the transformed circuits show that with three ancilla qubits, the maximum number of control gates is reduced to four in a five-qubit-controlled negation gate. However, for most practical hardware implementations, further transformations would be required.

**43**

**5. Conclusions**

*2, and 3 ancilla qubits.*

**Figure 9.**

end of the simulation.

This chapter presented two different quantum algorithms with possible applications in computational fluid dynamics. Beyond their very different areas of application, the key differences are the computational model with regard the quantum coprocessor model of quantum computing. The hybrid quantum/classical algorithm for the vortex-in-cell method involves repeated exchanges of information between classical and quantum hardware, i.e., at each time step in the time integration. In contrast, the quantum algorithm implementing a discrete-velocity method for kinetic flow modeling can be performed on the quantum processor for the duration of the simulation, with classical information exchange only required at the start and

*Quantum circuit implementation of streaming operation. Circuit transformations are shown for addition of 1,* 

This work addressed a number of key challenges that remain to be investigated further. Firstly, the need for further efficient quantum algorithms as well as a further understanding of how to apply the quantum coprocessor model for this type of flow simulations was investigated. Secondly, the measurement-based extraction of

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

*Advances in Quantum Communication and Information*

The solution around this limitation is the introduction of ancilla qubits, which can be regarded as the quantum equivalence of additional workspace in the memory of a classical computer. Then circuits involving multi-qubit operations involving a large number of control gates can be transformed into circuits with more qubits and a larger number of gate operations, however now with a smaller number of control qubits. As is typical in this context, we assume that the ancilla qubits are initially in |0>, and since these are to be reused multiple times, the transformed circuits need to reset the ancilla qubits of this state at the end of the operations. For the quantum circuits implementing streaming in positive *x*-direction considered previously, **Figure 9** shows the required circuit transformations for the cases of 1, 2, or 3 ancilla qubits. Increasing the number of qubits will make the circuits more demanding to implement, so in the actual implementation there is an important trade-off between gate complexity (i.e., within the set of native gates available) and total number of qubits. For the 64 × 64 two-dimensional mesh and 16 × 16 discrete velocities considered in **Figure 6**, the transformed circuits show that with three ancilla qubits, the maximum number of control gates is reduced to four in a five-qubit-controlled negation gate. However, for most practical hardware

*Quantum circuit implementation of specular-reflection boundary conditions for rectangular body. 64 × 64* 

implementations, further transformations would be required.

**42**

**Figure 8.**

*Cartesian mesh, 16 × 16 discrete-velocity mesh.*

**Figure 9.**

*Quantum circuit implementation of streaming operation. Circuit transformations are shown for addition of 1, 2, and 3 ancilla qubits.*
