LBM-based quantum flow simulation method, device, medium and equipment
By quantizing the collision and migration steps of flow field information and utilizing qubit encoding and quantum gate operations, the problem of high computational cost in classical LBM is solved, and fast simulation of high Reynolds number flows is achieved.
Patent Information
- Application Number
- CN202210807673.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-06
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-07-06
AI Technical Summary
The classic LBM method is computationally intensive when simulating high Reynolds number flows, making it difficult to solve flow problems within a finite time.
A quantum flow simulation method based on the D2Q9 model is adopted, using four qubits to encode the equilibrium distribution function and the distribution function. Collisions and migrations are performed through quantum gate operations to update the flow field information until the convergence condition is met.
It enables rapid solutions to flow problems, improves the Reynolds number in simulations, broadens the application scope of simulation methods, and reduces the dependence of computation time on the number of grid cells.
Smart Images

Figure CN117408344B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of circuit design, and in particular to a quantum flow simulation method, apparatus, medium, and device based on LBM. Background Technology
[0002] LBM (Lattice Boltzmann Method) is a mesoscopic simulation method whose core is the Boltzmann equation, the fundamental equation of gas kinetic theory. Its specific form is as follows:
[0003]
[0004] Where f is the particle distribution function, which is related to the particle's spatial position r, velocity ξ, and time t. The first term of the equation characterizes the evolution of the particle distribution function over time, the second term characterizes the contribution of the particle's own motion, the third term characterizes the contribution of external forces, and the fourth term characterizes the contribution of particle collisions. The specific form of the collision term depends on the chosen collision model and is generally called the collision integral term. The collision integral term is usually very complex, posing a great challenge to solving the Boltzmann equation.
[0005] To numerically solve the Boltzmann equations, the Bhatnagar-Gross-Krook single-relaxation collision model is used to simplify the collision terms. The D2Q9 model is used for velocity space discretization. After integrating the Boltzmann equations along the characteristic line, the first-order rectangular method is used for time-space discretization. External force terms are ignored, and the discrete governing equations of the LBM are obtained as follows:
[0006] Collision process:
[0007]
[0008] Migration process:
[0009] f i (x+e i δ t ,t+δ t )=f i (x,t+δ t )
[0010] Where x is the spatially discretized node position, τ is the collision relaxation time, and e i For discrete velocities, δ t f is the time step size after discretization. eq Let i be the local equilibrium distribution function, and let i be the direction of the discrete velocity.
[0011] Please refer to Figure 4 , Figure 4This is a schematic diagram of a two-dimensional nine-velocity discrete model provided for an exemplary embodiment of this application. Figure 4 As shown, the D2Q9 model has 9 discrete velocity directions, namely: e0=(0,0) c , e2=(0,1)c, e3=(-1,0)c, e4=(0,-1)c, e5=(1,1)c, e6=(-1,1)c, e7=(-1,-1)c, e8=(1,-1)c.
[0012] The parameters of the model can be derived from the equations of each order of moments:
[0013]
[0014] Where, ω i δ is the weighting factor for each discrete velocity direction. x The grid step size is c = δ. x / δ t For lattice velocity, numerical simulations typically take c = 1. s Let the dimensionless speed of sound of the fluid be used to determine the characteristic velocity of the LBM. The equilibrium distribution function in the LBM is taken as a Maxwell distribution, with the following form:
[0015]
[0016] The relationship between macroscopic quantities of flow and the distribution function can be derived from conservation conditions, in the following form:
[0017] ρ=f0+f1+f2+f3+f4+f5+f6+f7+f8
[0018] ρu=f1-f3+f5-f7+f8-f6
[0019] ρv=f2-f4+f5-f7+f6-f8
[0020] Where ρ is the fluid density, v is the velocity in the Y direction, u is the velocity in the X direction, ρu represents the component of fluid momentum in the X direction, and ρv represents the component of fluid momentum in the Y direction.
[0021] The Chapman-Enskog multi-scale analysis technique can reduce the discrete governing equations of the LBM to the incompressible Navier-Stokes equations, thus proving the effectiveness of the LBM method. During the multi-scale analysis, the relationship between the relaxation time τ and flow characteristic quantities in the LBM can be obtained as follows:
[0022]
[0023] Where, N xMa, Re, and Ma' represent the number of grid nodes in the characteristic direction, the flow Mach number, and the flow Reynolds number, respectively. The numerical stability of LBM requires the relaxation time τ to not approach 0.5. Clearly, when the flow Reynolds number Re is large, a larger number of grid nodes are needed to ensure the stability of the method.
[0024] In summary, since the computational time complexity of the classical LBM method is linearly related to the number of grid nodes, the computational burden of the classical LBM method is unbearable when simulating high Reynolds number flows. Summary of the Invention
[0025] The purpose of this application is to provide a quantum flow simulation method, apparatus, medium, and device based on LBM, in order to solve the problem of the huge computational cost of classical LBM in the prior art, reduce the dependence of LBM solution time on the number of grids, thereby realizing the rapid solution of flow problems, or greatly increasing the number of simulation grids under the constraint of the same computational time.
[0026] To address the aforementioned technical problems, in a first aspect, this application provides a quantum flow simulation method based on LBM, comprising:
[0027] Initialize the flow field information; wherein, the flow field information includes fluid density and fluid momentum;
[0028] Calculate the equilibrium distribution function based on the flow field information;
[0029] The D2Q9 model uses four types of qubits to encode the equilibrium state distribution function and the distribution function; the four types of qubits are auxiliary bits, discrete velocity direction control bits, Y-axis coordinate control bits, and X-axis coordinate control bits; among them, the number of discrete velocity direction control bits is four and the number of auxiliary bits is two.
[0030] Based on the encoded equilibrium distribution function and distribution function, perform collision operations;
[0031] After the collision operation, the migration operation is performed;
[0032] The flow field information is updated after the migration operation;
[0033] Determine whether the updated flow field information satisfies the convergence condition;
[0034] If not, perform boundary condition processing on the updated flow field information, and return to the step of calculating the equilibrium distribution function based on the processed flow field information, until the updated flow field information satisfies the convergence condition, and output the updated flow field information.
[0035] Optionally, the D2Q9-based model uses four types of qubit-encoded equilibrium state distribution functions and distribution functions, including:
[0036] The encoding format using four qubits is: |F1F0X3X2X1X0YZ>
[0037] Among them, bits X3, X2, X1, and X0 represent discrete velocity direction control bits, bit Y represents Y-direction coordinate control bits, bit Z represents X-direction coordinate control bits, and bits F1 and F0 represent auxiliary bits; the number of bits Y and Z is related to the number of grids when simulating fluid.
[0038] The encoding format of the equilibrium distribution function and the distribution function based on auxiliary bits is as follows:
[0039]
[0040] Where f represents the distribution function, f eq Characterizes the equilibrium distribution function.
[0041] Optionally, the collision operation based on the encoded equilibrium distribution function and the distribution function includes:
[0042] Apply an R(θ) gate to bit F0 to perform a collision operation.
[0043] Optionally, the step of performing a migration operation after the collision operation includes:
[0044] Quantum gate operations are performed sequentially on bits Z and Y in their respective discrete velocity directions to transfer the distribution function after the collision operation.
[0045] Optionally, the sequential quantum gate operation on bits Z and Y in their respective discrete velocity directions includes:
[0046] Quantum gate operations are performed on bits Z and Y in the following order to shift the distribution function after the collision operation according to their respective discrete velocity directions:
[0047] Perform the first quantum gate operation on bit Z, which is in the quantum state of |1000> for discrete velocity direction control bit;
[0048] Perform the first quantum gate operation on bit Y with the discrete velocity direction control bit quantum state |1001>;
[0049] Perform a second quantum gate operation on bit Z in the discrete velocity direction control bit quantum state |1100>;
[0050] Perform a second quantum gate operation on bit Y with the discrete velocity direction control bit quantum state |1101>;
[0051] Perform the first quantum gate operation on bit Z, which is in the quantum state of |1010> for discrete velocity direction control bit;
[0052] Perform the first quantum gate operation on bit Y with the discrete velocity direction control bit quantum state |1010>;
[0053] Perform a second quantum gate operation on bit Z, which is in the quantum state of |1111> for discrete velocity direction control bit;
[0054] Perform the first quantum gate operation on bit Y with the discrete velocity direction control bit quantum state |1111>;
[0055] Perform a second quantum gate operation on bit Z, which is in the quantum state of |1110> for discrete velocity direction control bit;
[0056] Perform a second quantum gate operation on bit Y with the discrete velocity direction control bit quantum state |1110>;
[0057] Perform a second quantum gate operation on bit Z, which is in the quantum state of |1011> for discrete velocity direction control bit;
[0058] Perform a second quantum gate operation on bit Y with the discrete velocity direction control bit quantum state |1011>.
[0059] Optionally, when bit Y or bit Z includes j+1 qubits, the encoding format of bit Y or bit Z is: Where j is an integer greater than or equal to 0, and n is an integer where 0 ≤ n ≤ j;
[0060] The first quantum gate operation includes:
[0061] By bit to bit The order is such that each bit is the target bit, and when the bit... For target bit and bit To Bit When all quantum states are |0>, the X gate is executed; where, the bit When the target bit is used, directly in the bit The upper action X gate;
[0062] The second quantum gate operation includes:
[0063] By bit to bit The order is such that each bit is the target bit, and when the bit... For target bit and bit To Bit When all quantum states are |1>, the X gate is executed; where, qubit When the target bit is used, directly in the bit The X-gate is used for action.
[0064] Optionally, updating the flow field information after the migration operation includes:
[0065] Apply an H gate to bit F1 after the transfer operation to obtain data when the auxiliary bit quantum state is |10>.
[0066] A quantum gate operation is performed on the discrete velocity direction control bit with the auxiliary bit quantum state |10> to update the flow field information.
[0067] Optionally, the quantum gate operation on the discrete velocity direction control bit with the auxiliary bit quantum state |10> includes:
[0068] The flow field information is updated by performing quantum gate operations on the discrete velocity direction control bits with auxiliary bit quantum state |10> in the following order:
[0069] Using bit X3 as the control bit and bit X2 as the target bit, the H gate is executed when the quantum state of bit X3 is |1>.
[0070] Using bits X3, X2, and X1 as control bits and bit X0 as the target bit, the H gate is executed when the quantum states of bits X3, X2, and X1 are all |1>.
[0071] Using bits X3 and X2 as control bits and bit X1 as target bit, when the quantum states of bits X3 and X2 are both |1>, the R(d) gate is executed;
[0072] Using bits X3 and X2 as control bits and bit X1 as the target bit, the H gate is executed when the quantum state of bit X3 is |1> and the quantum state of bit X2 is |0>.
[0073] Using bits X3, X2, and X1 as control bits and bit X0 as the target bit, the H gate is executed when the quantum state of bit X3 is |1> and the quantum states of bits X2 and X1 are |0>.
[0074] Apply an R(e) gate to bit X3.
[0075] Secondly, a quantum flow simulation device based on LBM is provided, comprising:
[0076] An initialization module is used to initialize flow field information; wherein, the flow field information includes fluid density and fluid momentum;
[0077] The acquisition module is used to calculate the equilibrium distribution function based on the flow field information;
[0078] The encoding module is used to encode the equilibrium state distribution function and the distribution function using four types of qubits based on the D2Q9 model. The four types of qubits are auxiliary bits, discrete velocity direction control bits, Y-axis coordinate control bits, and X-axis coordinate control bits. Among them, the number of discrete velocity direction control bits is four, and the number of auxiliary bits is two.
[0079] The collision module is used to perform collision operations based on the encoded equilibrium distribution function and the distribution function.
[0080] The migration module is used to perform migration operations based on collision operations.
[0081] An update module is used to update the flow field information based on the migration operation.
[0082] The judgment module is used to determine whether the updated flow field information meets the convergence condition.
[0083] The processing module is used to perform boundary condition processing on the updated flow field information if no, and return to the step of calculating the equilibrium distribution function based on the processed flow field information, until the updated flow field information satisfies the convergence condition, and output the updated flow field information.
[0084] Thirdly, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the method described in any of the first aspects above.
[0085] Fourthly, a storage medium is provided, wherein a computer program is stored therein, wherein the computer program is configured to execute the method described in any of the first aspects above when it is run.
[0086] Fifthly, a quantum computer operating system is provided, wherein the quantum computer operating system implements LBM-based quantum flow simulation according to the method described in any one of the first aspects above.
[0087] In a sixth aspect, a quantum computer is provided, the quantum computer comprising the quantum computer operating system described in the fifth aspect above.
[0088] Based on the aforementioned LBM-based quantum flow simulation method, the collision step, migration step, and flow field information calculation steps in the fluid simulation process are quantized, resulting in an exponential speedup effect. This enables partial exponential acceleration of the overall solution, allowing for the use of more grid nodes compared to the classical LBM algorithm under the same computation time constraint. This solves the problem of the large computational load of the classical LBM in existing technologies, improves the Reynolds number simulated by the simulation method, and broadens the practical application range of the simulation method.
[0089] The LBM-based quantum flow simulation device, storage medium, and electronic device provided in this application belong to the same inventive concept as the LBM-based quantum flow simulation method, and therefore have the same beneficial effects, which will not be repeated here. Attached Figure Description
[0090] Figure 1 This is a hardware structure block diagram of a computer terminal for a quantum flow simulation method based on LBM provided in an exemplary embodiment of this application;
[0091] Figure 2 A schematic diagram illustrating a quantum circuit as provided in an exemplary embodiment of this application;
[0092] Figure 3 A schematic flowchart of an LBM-based quantum flow simulation method provided for an exemplary embodiment of this application;
[0093] Figure 4 This is a schematic diagram of a two-dimensional nine-velocity discrete model;
[0094] Figure 5 for Figure 3 A schematic diagram of the quantum circuit for the mid-transfer operation;
[0095] Figure 6 for Figure 5 A schematic diagram of the S1 quantum circuit, the first quantum gate for the mid-transfer operation;
[0096] Figure 7 for Figure 5 A schematic diagram of the S2 quantum circuit, the second quantum gate for the mid-transfer operation;
[0097] Figure 8 for Figure 3 A schematic diagram of a quantum circuit for updating flow field information.
[0098] Figure 9 This is a schematic block diagram of an LBM-based quantum flow simulation device provided for an exemplary embodiment of this application. Detailed Implementation
[0099] The specific embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. The advantages and features of the present invention will become clearer from the following description and claims. It should be noted that the drawings are all in a very simplified form and use non-precise proportions, and are only used to facilitate and clarify the illustration of the embodiments of the present invention.
[0100] This application first provides a quantum flow simulation method based on LBM, which can be applied to electronic devices, such as computer terminals, specifically ordinary computers, quantum computers, etc.
[0101] The following detailed explanation uses a computer terminal as an example. Figure 1 This is a hardware structure block diagram of a computer terminal for a quantum flow simulation method based on LBM, provided as an embodiment of this application. Figure 1 As shown, computer terminal 10 may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. Optionally, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0102] The memory 104 can be used to store software programs and modules for application software, such as the program instructions / modules corresponding to the LBM-based quantum flow simulation method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0103] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0104] It's important to note that a true quantum computer has a hybrid structure, comprising two main parts: a classical computer responsible for performing classical computations and control, and a quantum device responsible for running quantum programs to achieve quantum computation. A quantum program is a sequence of instructions written in a quantum language such as QRunes that can run on a quantum computer, supporting operations on quantum logic gates and ultimately enabling quantum computing. Specifically, a quantum program is a sequence of instructions that operates on quantum logic gates according to a specific timing order.
[0105] In practical applications, due to limitations in the development of quantum device hardware, quantum computing simulations are often required to verify quantum algorithms, quantum applications, and so on. Quantum computing simulation is the process of simulating the execution of a quantum program corresponding to a specific problem using a virtual architecture (i.e., a quantum virtual machine) built with the resources of a regular computer. Typically, it is necessary to construct a quantum program corresponding to a specific problem. The quantum program referred to in this embodiment of the invention is a program written in a classical language that represents qubits and their evolution, wherein qubits, quantum logic gates, etc., related to quantum computing all have corresponding classical code representations.
[0106] Quantum circuits, also known as quantum logic circuits, are a common manifestation of quantum programming and are the most widely used general-purpose quantum computing model. They represent circuits that operate on qubits under an abstract concept. They consist of qubits, circuits (timelines), and various quantum logic gates. Finally, the results are often read out through quantum measurement operations.
[0107] Quantum circuits can be represented as a sequence of quantum logic gates arranged in a specific time order. For example:
[0108] q0:RX(q0),H(q0),CNOT(q0,q2),X(q0)
[0109] q1:X(q1), RY(q1), H(q1), CNOT(q2,q1)
[0110] q2:H(q2),X(q2),CNOT(q0,q2),CNOT(q2,q1),RZ(q2)
[0111] A more intuitive representation of the quantum circuits corresponding to the aforementioned quantum logic gate sequence is shown below. Figure 2 As shown.
[0112] Unlike traditional circuits that use metal wires to transmit voltage or current signals, in quantum circuits, the circuits can be seen as being connected by time. That is, the state of a quantum bit evolves naturally over time, following the instructions of the Hamiltonian operator, until it encounters a quantum logic gate and is manipulated.
[0113] A quantum program corresponds to a single quantum circuit. The quantum program described in this application refers to this single quantum circuit, where the total number of qubits in the single quantum circuit is the same as the total number of qubits in the quantum program. This can be understood as follows: a quantum program can consist of a quantum circuit, measurement operations on the qubits within the quantum circuit, registers storing the measurement results, and control flow nodes (jump instructions). A single quantum circuit can contain dozens, hundreds, or even thousands of quantum logic gate operations. The execution of a quantum program is the process of executing all the quantum logic gates in a specific timing order. It should be noted that the timing order refers to the chronological sequence in which individual quantum logic gates are executed.
[0114] It's important to note that in classical computing, the most basic unit is the bit, and the most fundamental control mode is the logic gate. Circuit control can be achieved through combinations of logic gates. Similarly, the way to process qubits is through quantum logic gates. Quantum logic gates enable the evolution of quantum states and are the foundation of quantum circuits. Quantum logic gates include single-qubit gates, such as Hadamard gates (H-gates), Pauli-X gates (X-gates), Pauli-Y gates (Y-gates), Pauli-Z gates (Z-gates), RX gates, RY gates, RZ gates, etc.; and multi-qubit quantum logic gates, such as CNOT gates, CR gates, iSWAP gates, Tofoli gates, etc. Quantum logic gates are generally represented using unitary matrices, which are not only matrix forms but also operations and transformations. The effect of a quantum logic gate on a quantum state is generally calculated by left-multiplying the unitary matrix by the matrix corresponding to the right vector of the quantum state.
[0115] A quantum state, or the logical state of a qubit, is represented in binary in quantum algorithms (or quantum programs). For example, a set of qubits q0, q1, and q2 represents the 0th, 1st, and 2nd qubits, ordered from most significant bit to least significant bit as q2q1q0. This set of qubits corresponds to a total of 2^(1 / 2) qubits, which refers to 8 eigenstates (determined states): |000>, |001>, |010>, |011>, |100>, |101>, |110>, and |111>. Each bit in a quantum state corresponds to a qubit. For example, in the state |000>, 000 corresponds to q2q1q0 from most significant bit to least significant bit. |> is the Dirac notation.
[0116] Taking a single qubit as an example, the logical state ψ of a single qubit may be in a superposition of the states |0>, |1>, and |0> and |1> (an uncertain state), specifically expressed as ψ = a|0> + b|1>, where a and b are complex numbers representing the amplitude (probability amplitude) of the quantum state, and the square of the amplitude represents the probability. 2 b 2Let a represent the probabilities that the logical state is |0> and |1>, respectively. 2 +b 2 =1. In short, a quantum state is a superposition of eigenstates. When the probability of other states is 0, it is in a uniquely determined eigenstate.
[0117] The following is a further description of a quantum flow simulation method based on LBM provided by an embodiment of the present invention.
[0118] See Figure 3 , Figure 3 This is a schematic flowchart of a quantum flow simulation method based on LBM provided in an exemplary embodiment of this application, including steps S310 to S380, wherein:
[0119] S310, initialize flow field information.
[0120] The flow field information includes fluid density and fluid momentum. The initialization information for fluid density and fluid momentum is manually set according to requirements.
[0121] After obtaining the initial flow field information, proceed to step S320.
[0122] S320, Calculate the equilibrium distribution function based on the flow field information.
[0123] Based on the D2Q9 model, the equilibrium distribution function scheme in this application adopts the Maxwell distribution, as shown below:
[0124]
[0125] Where u is the velocity vector.
[0126] The calculation process of the equilibrium distribution function in this application is similar to that of the classical LBM. In other words, the calculation process of the equilibrium distribution function is a technique well-known to those skilled in the art; therefore, for the sake of brevity, this application will not elaborate on it further.
[0127] After calculating the equilibrium distribution function using the Maxwell distribution function, proceed to step S330.
[0128] The S330, based on the D2Q9 model, uses four types of qubit encodings for the equilibrium state distribution function and the distribution function.
[0129] The four types of qubits are auxiliary bits, discrete velocity direction control bits, Y-axis coordinate control bits, and X-axis coordinate control bits. The discrete velocity direction control bits consist of four bits, and the auxiliary bits consist of two bits.
[0130] Specifically, the encoding format using four qubits is: |F1F0X3X2X1X0YZ>
[0131] Among them, bit X3, bit X2, bit X1, and bit X0 represent discrete velocity direction control bits, bit Y represents the Y-direction coordinate control bit, bit Z represents the X-direction coordinate control bit, and bits F1 and bit F0 represent auxiliary bits; the number of bits Y and bit Z is related to the number of grids when simulating fluids.
[0132] The encoding format for the equilibrium distribution function and the distribution function based on the auxiliary bit positions is:
[0133]
[0134] Among them, f represents the distribution function, and f eq represents the equilibrium distribution function.
[0135] The specific encoding format of the discrete velocity control bits is
[0136]
[0137] The specific encoding form of the subsequent row and column position bits is related to the number of row and column bits. For example, for a 16*16 grid, the number of row bits and column bits is 4. Then the quantum state position of the equilibrium distribution function in the 6th discrete velocity direction at the grid node in the 1st row and 3rd column is |0111110 c . Thus, we have encoded all classical information into the quantum state amplitudes.
[0138] After encoding the equilibrium distribution function using four qubits, step S340 is executed.
[0139] S340, based on the encoded equilibrium distribution function and the distribution function, perform a collision operation.
[0140] After completing the encoding, the collision operation is performed first. The collision process can be described as:
[0141]
[0142] Obviously, a rotation gate is introduced here:
[0143]
[0144] As the generator of the collision unitary matrix, apply the rotation gate R(θ) to bit F0. Specifically, in this application, performing the collision operation includes: applying the R(θ) gate to bit F0 to perform the collision operation. The data operation performed by this rotation gate R(θ) is as follows:
[0145]
[0146] Here, k represents the amplitude. It should be noted that the specific value of the rotation angle θ can be reasonably deduced by those skilled in the art from the operational data.
[0147] After performing the collision operation, proceed to step S350.
[0148] S350 performs a migration operation after a collision operation.
[0149] The classic process of a migration operation can be represented as follows:
[0150] f i (x+e i δ t ,t+δ t )=f i (x,t+δ t )
[0151] That is, the distribution function is migrated according to the direction of its discrete velocity.
[0152] In this application, to perform the transfer operation, the designed quantum circuit can sequentially perform quantum gate operations on bits Z and Y in their respective discrete velocity directions to transfer the distribution function after the collision operation. This application uses a specific quantum circuit diagram as an example to illustrate the transfer process of the distribution function. It should be noted that in other embodiments, the transfer of the distribution function can also be performed using other quantum circuit diagrams, and this application does not make specific limitations.
[0153] Please refer to Figure 5 and Figure 6 , Figure 5 for Figure 3 A schematic diagram of the quantum circuit for the mid-transfer operation. Figure 6 for Figure 5 A schematic diagram of the first quantum gate S1 quantum circuit for the transfer operation. Here, we take the direction e1 = (1,0) as an example. The transfer in this direction can be described in classical code as follows:
[0154] f[y][x] = f[y][x-1]
[0155] Here, y represents the row number (Y-direction coordinate) and x represents the column number (X-direction coordinate), and the two-dimensional flow field mesh is described in the form of a two-dimensional array.
[0156] Taking a three-qubit quantum system as an example, the process involves the following quantum state operations:
[0157]
[0158] Here, an additional first-order loop operation is added, meaning that the data in position 0 should be missing after the transfer, but it is filled with the data in position 5. Now, let's explain in detail how this quantum state transition is achieved.
[0159] First, it is stated that the data contains only one qubit. How to achieve this operation? For example... Figure 6 As shown, when there is only one bit At that time, the data operation is as follows:
[0160]
[0161] This operation corresponds to: on this single bit Functions of the X-gate.
[0162] Next, it explains how this operation is achieved when the data contains two qubits. For example... Figure 5 and Figure 6 As shown, when there are bits and bit Data operations can be divided into the following two processes:
[0163]
[0164] like Figure 6 As shown, firstly, in bits Apply an X gate; then, in bits To control bits, bits For the target bit, when bit When the quantum state is |0>, the X gate is executed.
[0165] Next, it explains how this operation is achieved when the data contains three qubits. For example... Figure 5 and Figure 6 As shown, when there are bits Bit and Data operations can be divided into the following three processes:
[0166]
[0167] like Figure 6 As shown, firstly, in bits Apply an X gate; then, in bits To control bits, bits For the target bit, when bit When the quantum state is |0>, the X gate is executed; then, bits are used... Bit To control bits, bits For the target bit, when bit Bit When all quantum states are |0>, the X gate is executed.
[0168] As described above, the core migration path in step S350 is as follows: Figure 5 As shown. Figure 5 As shown, the migration operation performed after the collision operation includes the following steps: performing a first quantum gate S1 operation on bit Z with a discrete velocity direction control quantum state of |1000>; performing a first quantum gate S1 operation on bit Y with a discrete velocity direction control quantum state of |1001>; performing a second quantum gate S2 operation on bit Z with a discrete velocity direction control quantum state of |1100>; performing a second quantum gate S2 operation on bit Y with a discrete velocity direction control quantum state of |1101>; performing a first quantum gate S1 operation on bit Z with a discrete velocity direction control quantum state of |1010>; and performing a second quantum gate S2 operation on bit Y with a discrete velocity direction control quantum state of |1010>. Bit Y undergoes a first quantum gate S1 operation; bit Z, whose discrete velocity direction control bit quantum state is |1111>, undergoes a second quantum gate S2 operation; bit Y, whose discrete velocity direction control bit quantum state is |1111>, undergoes a first quantum gate S1 operation; bit Z, whose discrete velocity direction control bit quantum state is |1110>, undergoes a second quantum gate S2 operation; bit Y, whose discrete velocity direction control bit quantum state is |1110>, undergoes a second quantum gate S2 operation; bit Z, whose discrete velocity direction control bit quantum state is |1011>, undergoes a first quantum gate S1 operation; bit Y, whose discrete velocity direction control bit quantum state is |1011>, undergoes a second quantum gate S2 operation.
[0169] When bit Y or bit Z comprises j+1 qubits, the encoding format of bit Y or bit Z is as follows: Where j is an integer greater than or equal to 0, and n is an integer where 0 ≤ n ≤ j.
[0170] like Figure 6 As shown, the first quantum gate operation includes: bit-wise operations. to bit The order is such that each bit is the target bit, and when the bit... For target bit and bit To Bit When all quantum states are |0>, the X gate is executed; where, the bit When the target bit is used, directly in the bit The X-gate is used for action.
[0171] In other words, the transfer operation is performed on the j+1 qubits of bit Y or bit Z in the following order:
[0172] In bits The upper action X gate;
[0173] In bits To control bits, bits For the target bit, when bit When the quantum state is |0>, execute the X gate;
[0174] In bits Bit To control bits, bits For the target bit, when bit Bit When all quantum states are |0>, the X gate is executed;
[0175] …
[0176] In bits Bit …
[0177] Bit To control bits, bits For the target bit, when bit Bit … bits When all quantum states are |0>, the X gate is executed; where n is an integer greater than 1 and less than j;
[0178] …
[0179] In bits Bit … bits To control bits, bits For the target bit, when bit Bit …
[0180] Bit When all quantum states are |0>, the X gate is executed.
[0181] like Figure 7 As shown, the second quantum gate operation includes: bit-wise operations. to bit The order is such that each bit is the target bit, and when the bit... For target bit and bit To Bit When all quantum states are |1>, the X gate is executed; where, qubit When the target bit is used, directly in the bit The X-gate is used for action.
[0182] In other words, the transfer operation is performed on the j+1 qubits of bit Y or bit Z in the following order:
[0183] In bits The upper action X gate;
[0184] In bits To control bits, bits For the target bit, when bit When the quantum state is |1>, execute the X gate;
[0185] In bits Bit To control bits, bits For the target bit, when bit Bit When all quantum states are |1>, execute the X gate;
[0186] …
[0187] In bits Bit … bits To control bits, bits For the target bit, when bit Bit … bits When all quantum states are |1>, the X gate is executed; where n is an integer greater than 1 and less than j;
[0188] …
[0189] In bits Bit … bits To control bits, bits For the target bit, when bit Bit … bits When all quantum states are |1>, the X gate is executed.
[0190] After the migration operation is completed, proceed to step S360.
[0191] S360, Update the flow field information based on the migration operation.
[0192] It should be noted that the classic flow field information calculation process performs the following operations:
[0193] ρ=f0+f1+f2+f3+f4+f5+f6+f7+f8
[0194] ρu=f1-f3+f5-f7+f8-f6
[0195] ρv=f2-f4+f5-f7+f6-f8
[0196] Step S360 uses quantum circuitry to calculate and update the flow field information. The quantum state after the quantum transfer is as follows:
[0197]
[0198] The discrete velocity direction control bit X includes bit X3, bit X2, bit X1, and bit X0, and their specific distribution in each discrete velocity direction is as follows:
[0199]
[0200] To update the flow field information, the designed quantum circuit, during execution, can perform quantum gate operations on the discrete velocity direction control bits sequentially, thereby updating the flow field information. This application uses a specific quantum circuit diagram as an example to illustrate the process of updating the flow field information. It should be noted that in other embodiments, other quantum circuit diagrams can also be used to update the flow field information, and this application does not make specific limitations.
[0201] This application provides a quantum circuit diagram for updating the flow field information, such as... Figure 8 As shown.
[0202] Figure 8 The quantum circuit diagram shown omits two auxiliary bits, as well as row and column bits, because fluid information computation only involves data calculations along different discrete velocity directions, not calculations between information at different positions. Clearly, there will be no quantum gate operations on the row and column bits. To ensure that the computation of flow field information does not destroy the original distribution function information, an H-gate is applied to bit F1 after the migration operation before the flow field information computation operation, obtaining the data when the auxiliary bit quantum state is |10>, achieving the following operation:
[0203]
[0204] This step is to "backup" the transferred distribution function, which is the significance of the second auxiliary bit. In this embodiment, the flow field information is calculated on the quantum state on |10XYZ>. Obviously, the specific form of the quantum state here is still...
[0205]
[0206] In this embodiment, only the data at the auxiliary bit quantum state |10> is considered, thus avoiding the destruction of the distribution function information stored at the auxiliary bit quantum state |00>. Therefore, step S360 only applies to the data at the auxiliary bit quantum state |10>. Here, each quantum gate in the circuit diagram is interpreted, and quantum gate operations are performed on the discrete velocity direction control bits at the auxiliary bit |01> after the migration operation to update the flow field information in the following order:
[0207] First, using bit X3 as the control bit and bit X2 as the target bit, the H gate is executed when the quantum state of bit X3 is |1>. The data operations performed by this quantum gate are as follows:
[0208]
[0209] Next, using bits X3, X2, and X1 as control bits and bit X0 as the target bit, the H gate is executed when the quantum states of bits X3, X2, and X1 are all |1>. The data operations performed by this quantum gate are as follows:
[0210]
[0211] Next, using bits X3 and X2 as control bits and bit X1 as the target bit, an R(d) gate is executed when the quantum states of bits X3 and X2 are both |1>. It should be noted that the value of sin d can be reasonably inferred by those skilled in the art from the data manipulated. The data operations performed by this quantum gate are as follows:
[0212]
[0213] It is evident that the fluid momentum in the X and Y directions has been stored in |101100YZ> and |101101YZ>.
[0214] Next, using bits X3 and X2 as control bits and bit X1 as the target bit, the H gate is executed when the quantum state of bit X3 is |1> and the quantum state of bit X2 is |0>. The data operations performed by this quantum gate are as follows:
[0215]
[0216] Next, using bits X3, X2, and X1 as control bits and bit X0 as the target bit, the H gate is executed when the quantum state of bit X3 is |1> and the quantum states of bits X2 and X1 are |0>. The data operations performed by this quantum gate are as follows:
[0217]
[0218] Finally, an R(e) gate is applied to bit X3; the value of sin e can be reasonably inferred by those skilled in the art from the manipulated data. The data operations performed by this quantum gate are as follows:
[0219]
[0220] It can be seen that the fluid density information is stored in the amplitude in the direction of |100000YZ>.
[0221] In summary, after the flow field information is updated through the calculation circuit, the flow field information (fluid density, fluid momentum in the X direction, and fluid momentum in the Y direction) is stored in the quantum state amplitudes in the directions of |100000YZ>, |101100YZ>, and |101101YZ>.
[0222] After obtaining the updated flow field information, proceed to step S370.
[0223] S370, determine whether the updated flow field information meets the convergence condition.
[0224] The convergence conditions in this application are similar to those in the classical LBM calculation, and the judgment process is also similar. In other words, judging whether the flow field information meets the convergence conditions is a technical means known to those skilled in the art. Therefore, for the sake of brevity, this application will not elaborate on it in detail.
[0225] If the updated flow field information meets the convergence condition, proceed to step S380.
[0226] If the updated flow field information does not meet the convergence condition, perform boundary condition processing, and return to step S320 based on the processed flow field information until the updated flow field information meets the convergence condition, and then proceed to step S380.
[0227] The boundary condition processing procedure in this application is similar to that in the classical LBM calculation. In other words, performing boundary condition processing is a technique well-known to those skilled in the art; therefore, for the sake of brevity, this application will not elaborate on it further.
[0228] S380 outputs the updated flow field information.
[0229] Compared with existing technologies, based on Figure 3The LBM-based quantum flow simulation method shown quantizes the calculation steps of collision steps, migration steps, and flow field information in the fluid simulation process, resulting in an exponential speedup. This leads to an exponential acceleration of some processes in the overall solution, allowing for the use of more grid nodes compared to the classical LBM algorithm under the same computation time constraint. This solves the problem of the huge computational load of the classical LBM in the existing technology, improves the Reynolds number of the simulation, and broadens the practical application range of the method.
[0230] The above combination Figure 3 This application provides a detailed description of the LBM-based quantum flow simulation method provided in its embodiments. The following is in conjunction with... Figure 9 This document describes in detail the apparatus for performing the LBM-based quantum flow simulation method provided in the embodiments of this application.
[0231] For example, see Figure 9 , Figure 9 A schematic block diagram of an LBM-based quantum flow simulation device provided as an exemplary embodiment of this application, and... Figure 3 Corresponding to the process shown, the LBM-based quantum flow simulation device 700 includes:
[0232] An initialization module 710 is used to initialize flow field information; wherein, the flow field information includes fluid density and fluid momentum;
[0233] The acquisition module 720 is used to calculate the equilibrium distribution function based on the flow field information;
[0234] The encoding module 730 is used to encode the equilibrium state distribution function and the distribution function using four types of qubits based on the D2Q9 model; the four types of qubits are auxiliary bits, discrete velocity direction control bits, Y-direction coordinate control bits, and X-direction coordinate control bits; wherein, the number of discrete velocity direction control bits is four bits, and the number of auxiliary bits is two bits;
[0235] Collision module 740 is used to perform collision operations based on the encoded equilibrium distribution function and distribution function;
[0236] The migration module 750 is used to perform migration operations based on collision operations.
[0237] Update module 760 is used to update flow field information based on the migration operation;
[0238] The judgment module 770 is used to determine whether the updated flow field information meets the convergence condition.
[0239] The processing module 780 is used to perform boundary condition processing on the updated flow field information if no, and return to the step of calculating the equilibrium distribution function based on the processed flow field information, until the updated flow field information satisfies the convergence condition, and output the updated flow field information.
[0240] The LBM-based quantum flow simulation device provided in this application belongs to the same inventive concept as the LBM-based quantum flow simulation method, and therefore has the same beneficial effects, which will not be repeated here.
[0241] This application also provides a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0242] Specifically, in this embodiment, the storage medium can be configured to store a computer program for performing the following steps:
[0243] S310, Initialize flow field information; wherein, the flow field information includes fluid density and fluid momentum.
[0244] S320, Calculate the equilibrium distribution function based on the flow field information.
[0245] S330 uses four types of qubits to encode the equilibrium state distribution function and the distribution function based on the D2Q9 model; the four types of qubits are auxiliary bits, discrete velocity direction control bits, Y-direction coordinate control bits and X-direction coordinate control bits; among them, the number of discrete velocity direction control bits is four and the number of auxiliary bits is two.
[0246] S340 performs a collision operation based on the encoded equilibrium distribution function and the distribution function.
[0247] S350 performs a migration operation after a collision operation.
[0248] S360 updates the flow field information based on the migration operation.
[0249] S370, determine whether the updated flow field information meets the convergence condition.
[0250] S380, if not, perform boundary condition processing on the updated flow field information, and return to the step of calculating the equilibrium distribution function based on the processed flow field information, until the updated flow field information satisfies the convergence condition, and output the updated flow field information.
[0251] Specifically, in this embodiment, the storage medium may include, but is not limited to, USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks, and other media capable of storing computer programs.
[0252] This application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0253] Specifically, the aforementioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the aforementioned processor, and the input / output device is connected to the aforementioned processor.
[0254] Specifically, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0255] S310, Initialize flow field information; wherein, the flow field information includes fluid density and fluid momentum.
[0256] S320, Calculate the equilibrium distribution function based on the flow field information.
[0257] S330 uses four types of qubits to encode the equilibrium state distribution function and the distribution function based on the D2Q9 model; the four types of qubits are auxiliary bits, discrete velocity direction control bits, Y-direction coordinate control bits and X-direction coordinate control bits; among them, the number of discrete velocity direction control bits is four and the number of auxiliary bits is two.
[0258] S340 performs a collision operation based on the encoded equilibrium distribution function and the distribution function.
[0259] S350 performs a migration operation after a collision operation.
[0260] S360 updates the flow field information based on the migration operation.
[0261] S370, determine whether the updated flow field information meets the convergence condition.
[0262] S380, if not, perform boundary condition processing on the updated flow field information, and return to the step of calculating the equilibrium distribution function based on the processed flow field information, until the updated flow field information satisfies the convergence condition, and output the updated flow field information.
[0263] This application also provides a quantum computer operating system, which implements LBM-based quantum flow simulation according to any of the above-described method embodiments provided in this application.
[0264] Embodiments of this application also provide a quantum computer, which includes the quantum computer operating system described above.
[0265] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A quantum flow simulation method based on LBM, characterized by, The method comprises: initializing flow field information; wherein the flow field information comprises fluid density and fluid momentum; calculating equilibrium distribution function according to the flow field information; Based on The model uses four quantum bits to encode the equilibrium state distribution function and the distribution function; the four quantum bits are auxiliary bits, discrete velocity direction control bits, Y direction coordinate control bits and X direction coordinate control bits, and the encoding format of the four quantum bits is: ; wherein the number of discrete velocity direction control bits is four bits, the number of auxiliary bits is two bits, bit X3, bit X2, bit X1 and bit X0 represent the discrete velocity direction control bits, bit represents the Y direction coordinate control bits, bit Z represents the X direction coordinate control bits, and bit represents the auxiliary bits; the number of bits Y and bits Z is related to the number of grids when simulating the fluid; the encoding format of the equilibrium distribution function and the distribution function based on the auxiliary bits is: wherein characterizing the distribution function, characterizing the equilibrium distribution function; Based on the encoded equilibrium distribution function and the distribution function, collision operations are performed, including in bits The above acts The door to perform collision operations; performing a migration operation after the collision operation; updating the flow field information after the migration operation; determining whether the updated flow field information meets a convergence condition; if not, performing boundary condition processing on the updated flow field information, and returning to the step of calculating the equilibrium distribution function based on the processed flow field information until the updated flow field information meets the convergence condition, and outputting the updated flow field information.
2. The method of claim 1, wherein, The performing of the migration operation after the collision operation comprises: sequentially performing quantum gate operations on the bits Z and Y in the respective discrete velocity directions to migrate the distribution function after the collision operation.
3. The method of claim 2, wherein, The sequentially performing quantum gate operations on the bits Z and Y in the respective discrete velocity directions comprises: sequentially performing quantum gate operations on the bits Z and Y to migrate the distribution function after the collision operation in the respective discrete velocity directions: controlling a bit quantum state of a discrete velocity direction as a first quantum gate operation on a bit Z at controlling a bit quantum state in a discrete velocity direction for a bit Y on performing a first quantum gate operation; controlling a bit quantum state of the discrete velocity direction as bit Z on the second quantum gate operation; controlling a bit quantum state of a discrete velocity direction as a second quantum gate operation on a bit Y at controlling a bit quantum state of a discrete velocity direction as bit Z on the first quantum gate operation; controlling a bit quantum state of a discrete velocity direction as performing a first quantum gate operation; controlling a bit quantum state of the discrete velocity direction as bit Z on the second quantum gate operation; controlling a bit quantum state in a discrete velocity direction for a bit Y on performing a first quantum gate operation; controlling a bit quantum state of the discrete velocity direction as bit Z on the second quantum gate operation; controlling a bit quantum state in a discrete velocity direction for a bit Y on performing a second quantum gate operation; controlling a bit quantum state of a discrete velocity direction as a first quantum gate operation on a bit Z at The discrete velocity direction control bit quantum state is bit Y on the second quantum gate operation.
4. The method of claim 3, wherein, When the bit Y or the bit Z includes j+1 quantum bits, the encoding format of the bit Y or the bit Z is: ; wherein j is an integer greater than or equal to 0, and n is an integer and 0≤n≤j. The first quantum gate operation comprises: bit to bit targeted bit by bit in order, when the quantum state of bit targeted bit and bit to bit are all , an X gate is executed; wherein when bit is targeted, an X gate is directly applied on bit ; The second quantum gate operation comprises: bit to bit targeting each bit in turn, when bit is the target bit and the quantum states of bits to bit are all , an X gate is performed; wherein when bit is the target bit, the X gate is directly applied on bit .
5. The method of claim 2, wherein, The updating of the flow field information after the migration operation comprises: The bit F1 after performing the migration operation is subjected to the H gate, and the auxiliary bit quantum state is obtained as the data at the time Quantum states of ancilla bits are Quantum gate operations are performed on discrete velocity direction control bits in the state of to update the flow field information.
6. The method of claim 5, wherein, The pair of ancillary bits quantum states are performing quantum gate operations on the discrete velocity direction control bits on the The ancilla bit quantum states are updated in the following order performing quantum gate operations on the discrete velocity direction control bits on to update the flow field information: Taking bit X3 as a control bit and bit X2 as a target bit, when the quantum state of bit X3 is , an H gate is executed. Taking bits X3, X2, X1 as control bits and bit X0 as target bit, when the quantum states of bits X3, X2, X1 are all H gate is executed. When the quantum states of the bit X3 and the bit X2 are both , the gate is executed. Taking bit X3 and bit X2 as control bits, and taking bit X1 as a target bit, when the quantum state of bit X3 is and the quantum state of bit X2 is , an H gate is executed. Taking bits X3, X2 and X1 as control bits and bit X0 as a target bit, when the quantum state of bit X3 is , the quantum states of bits X2 and X1 are , an H gate is executed. Action on bit X3 Gate.
7. An LBM-based quantum flow simulation device, characterized by, The device comprises: an initialization module configured to initialize flow field information; wherein the flow field information comprises fluid density and fluid momentum; an acquisition module configured to calculate equilibrium distribution function according to the flow field information; The encoding module is configured to encode the state distribution function and the distribution function based on The model uses four quantum bits to encode the state distribution function and the distribution function; the four quantum bits are an auxiliary bit, a discrete velocity direction control bit, a Y direction coordinate control bit and an X direction coordinate control bit, and the encoding format of the four quantum bits is: ; wherein the number of discrete velocity direction control bits is four, the number of auxiliary bits is two, bit X3, bit X2, bit X1 and bit X0 represent the discrete velocity direction control bits, bit Y represents the Y direction coordinate control bits, and bit Z represents the X direction coordinate control bits. ; wherein the number of discrete velocity direction control bits is four, the number of auxiliary bits is two, bit X3, bit X2, bit X1 and bit X0 represent the discrete velocity direction control bits, bit Y represents the Y direction coordinate control bits, and bit Z represents the X direction coordinate control bits. ; wherein the number of discrete velocity direction control bits is four, the number of auxiliary bits is two, bit X3, bit X2, bit X1 and bit X0 represent the discrete velocity direction control bits, bit Y represents the Y direction coordinate control bits, and bit Z represents the X direction coordinate control bits. the encoding format of the equilibrium distribution function and the distribution function based on the auxiliary bits is: wherein characterizing the distribution function, characterizing the equilibrium distribution function; a collision module for performing a collision operation based on the encoded equilibrium distribution function and the distribution function, including flipping bits the above actions the door to perform the collision operation; a migration module configured to perform a migration operation after the collision operation; an updating module configured to update the flow field information after the migration operation; a determination module configured to determine whether the updated flow field information meets a convergence condition; a processing module configured to, if not, perform boundary condition processing on the updated flow field information, and return to the step of calculating the equilibrium distribution function based on the processed flow field information until the updated flow field information meets the convergence condition, and output the updated flow field information.
8. A storage medium, characterized by The storage medium has stored therein a computer program, which is configured to execute the LBM-based quantum flow simulation method according to any one of claims 1 to 6 when running.
9. An electronic device, comprising: The device comprises a memory and a processor, wherein the memory has stored therein a computer program, and the processor is configured to execute the LBM-based quantum flow simulation method according to any one of claims 1 to 6 when running the computer program.
Citation Information
Patent Citations
Fluid mechanics simulation method and device and storage medium
CN111680456A
Computational fluid dynamics simulation method and device based on quantum algorithm, and equipment
CN114091363A