The present application claims the priority to a Chinese patent application No. 202010771592.2 filed with the China National Intellectual Property Administration on Aug. 4, 2020 and entitled “Computational Fluid Dynamics Simulation Method, Apparatus based on quantum algorithm, and Device”, which is incorporated herein by reference in its entirety.
The present application relates to the technical field of quantum computing, in particular to a computational fluid dynamics simulation method and apparatus based on a quantum algorithm and a device.
CFD (Computational Fluid Dynamics) is a product of the combination of modern fluid mechanics, computational mathematics and computer science, and is an interdiscipline with strong vitality. It uses an electronic computer as a tool and applies various discrete mathematical methods to carry out numerical experiments, computer simulations and analytical studies on various problems in fluid mechanics in order to solve various practical problems. CFD simulation is a basic tool for simulating the aerodynamic design of an aircraft, from which the flow characteristics around the aircraft and the aerodynamic forces acting on the aircraft surface can be obtained. These calculations are computationally expensive, which makes it an urgent issue to seek for efficient CFD simulation algorithms.
In the prior art, in the process of simulating fluid movement by computational fluid dynamics, because the implicit scheme is unconditionally stable, it is necessary to solve the linear system x=R, where
is a coefficient matrix that must be inverted during the calculation. The calculation of the inverse of the matrix is very complex, and an iterative approach is needed. The dimension of the coefficient matrix is linearly related to the grid nodes. When the grid nodes are large in scale, classical algorithms such as Jacobi method, LU method or GMRES (Generalized Minimum Residual Method) are used to solve it. However, the calculation amount when classical calculation is performed to solve the coefficient matrix is very large, and CFD simulation would be very difficult to implement.
The inherent characteristic of quantum computing is quantum parallelism. In a Hilbert space (a complex linear space), the quantum state of N quantum bits is a vector, and every quantum operation is a transformation in this linear space. If a description of a practical problem is encoded as a quantum state vector of a set of quantum bits, the problem can be solved by executing an operation in parallel to process the vector without iterating the state of each quantum bit in the set of quantum bits. For example, if a matrix and a vector are multiplied, a for loop is no longer needed, and only a few quantum gates are required to operate on the input quantum states. Therefore, the parallelism of quantum computing can greatly increase the computational speed of CFD simulation. Therefore, it is hoped that CFD simulations are implemented using quantum computing.
The embodiment of the present application aims to provide a computational fluid dynamics simulation method and apparatus based on a quantum algorithm and a device, so as to achieve CFD simulations using quantum computing. The specific technical solutions are as follows.
In a first aspect, embodiments of the present application provide a computational fluid dynamics simulation method based on a quantum algorithm, which includes:
In a second aspect, embodiments of the present application provide a computational fluid dynamics simulation apparatus based on a quantum algorithm, which includes:
In a third aspect, embodiments of the present application provide a quantum computer device, which includes a quantum circuit, a device based on a quantum effect, and a quantum random access memory, and implements any computational fluid dynamics simulation method based on a quantum algorithm while running.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored therein a computer program that, when executed by a processor, causes the processor to perform any of the computational fluid dynamics simulation methods based on a quantum algorithm.
Embodiments of the present application provide a computational fluid dynamics simulation method and apparatus based on a quantum algorithm and a device, which involves, in a computational fluid dynamics analysis process using a finite volume method, constructing, for each grid cell in a discretized numerical grid for fluid movement, a first quantum circuit representing coordinate information of the grid cell, a second quantum circuit representing state parameters of the grid cell, wherein the state parameters of the grid cell are stored in a quantum random access memory, and the quantum random access memory can operate addresses and data in a quantum superposition state; constructing a third quantum circuit representing parameters of a linear system equation that represents a change of a fluid state of the grid cell based on the first quantum circuit, the second quantum circuit and the quantum random access memory; solving, for all grid cells, the linear system equations of the grid cells based on the third quantum circuit, to obtain fluid states represented by the state parameters of the linear system equations of the grid cells as target states of the grid cells when the fluid states of the grid cells tend to be stable, which implements CFD simulations using quantum computing. The inherent characteristic of quantum computing is quantum parallelism, by means of which exponential acceleration can be achieved compared with the classical algorithm, which reduces the complexity of CFD simulations and increase the practicability thereof. Of course, it is not necessary for any product or method implementing the present application to achieve all the advantages mentioned above at the same time.
In order to more clearly illustrate the embodiments of the present application and the technical solutions of the prior art, the drawings needed in the embodiments and the prior art are briefly described below. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained from these drawings without any creative effort.
In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further explained in detail with reference to the attached drawings and embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, but not all of them. Based on the embodiments in the present application, all other embodiments obtained by those ordinary skilled in the art without creative effort fall within the protection scope of the present application.
CFD simulation is a basic tool for aircraft aerodynamic design, from which the flow characteristics around the aircraft and the aerodynamic forces acting on the aircraft surface can be obtained. CFD problems are usually associated with solving a series of equations by numerical methods. Among them, the CFD solver needs to perform time integration of the partial derivative equation, so it needs to use time increment to iterate to calculate the change of the system, and stop when the system becomes stable. In this problem setting, SU2 (The Stanford University Unstructured Suite, a high-precision partial differential equation solver developed by Stanford University) is generally used in classical algorithms. In CFD simulation, starting from the mathematical model, the following elements need to be defined, including: numerical grid, discretization method, numerical scheme and solution.
An effective method to solve the conservation equation of formula (1) is FVM. Based on the discretization numerical scheme and solution introduced above, it is necessary to solve the spatial numerical grid. In two-dimensional space, each spatial point is a node, identified by a set of indexes. The set of nodes connected by the nearest neighboring nodes forms a grid, for example, as shown in
Un is the fluid state of all grid cells at the nth moment (the nth integration), Un={Ui}, i=0,1,2, . . . , N−1, and Ui=(ρ, ρu, ρv, ρE)i represents the fluid state of the ith grid cell, ρ represents the fluid density, u and v represent two components of the fluid velocity in two-dimensional coordinates, E represents the total energy per unit mass of fluid, and bn (Un) represents the residual quantity at the nth moment, and it is a function related to Un.
Let ΔUn=Un+1−Un, then:
Substitute formula (3) into formula (2) to get:
Where δi,i′δj,j′ is the parameter related to the coordinate information of the grid cell.
In addition,
formula (4) is equivalent to:
A(Un)ΔUn=−bn(Un) (5)
Wherein, A(Un) represents the coefficient matrix at the nth moment, and it is a function related to Un.
A(Un) is abbreviated as An, and −b(Un) is abbreviated as bn, thus obtaining an iterative problem that needs to solve a linear system: AnΔUn=bn.
When the number of grid cells is N, then the dimension of Un is 4N, when solving, get the initial fluid state of these N grid cells to U0, perform calculations based on U0 to get A0, b0, solve A0 (U1−U0)=b0 to get U1, then calculate A1, b1 to get U2, and keep iterating. The iteration stops under the condition that bn converges to 0. In this case, it is necessary to use the method of solving the linear system in the form of AnΔUn=bn, in which ΔUn=Un+1−Un.
In the classical scheme, the implicit Euler solver has linear complexity and An is a sparse matrix, which must be inverted in the calculation process. The calculation of the inversion for this matrix is very complex, and requires an iterative method. The classical solving method uses a multiple grid method, and the dimension of the sparse matrix is linearly related to the grid nodes with a complexity of O(N), where N is the number of grid cells. In classical schemes, there is a good linear relationship between the running time and the number of grid cells, as in
In view of this, in order to reduce the complexity of CFD simulation and increase the practicability of CFD simulation, the embodiment of the present application provides a computational fluid dynamics simulation method based on a quantum algorithm, which includes: in a computational fluid dynamics analysis process using a finite volume method, constructing, for each grid cell in a discretized numerical grid for fluid movement, a first quantum circuit representing the coordinate information of the grid cell, a second quantum circuit representing the state parameters of the grid cell, wherein the state parameters of the grid cell are stored in a quantum random access memory, and the quantum random access memory can operate addresses and data in a quantum superposition state; constructing a third quantum circuit representing the parameters of a linear system equation that represents the change of the fluid state of the grid cell based on the first quantum circuit, the second quantum circuit and the quantum random access memory; solving, for all grid cells, the linear system equations of the grid cells based on the third quantum circuit, to obtain the fluid states represented by the state parameters of the linear system equations of the grid cells as the target states of the grid cells when the fluid states of the grid cells tend to be stable.
The inherent characteristic of quantum computing is quantum parallelism. In a Hilbert space (a complex linear space), the quantum state of N quantum bits is a vector, and each quantum operation is a transformation in this linear space. If the description of a real problem is encoded as a quantum state vector of a set of quantum bits, the vector can be processed by executing an operation in parallel to achieve the solution of the problem without iterating the state of each quantum bit in the set of quantum bits. For example, if the matrix and vector are multiplied, the for loop is no longer needed, but only a few quantum gates are required to operate on the input quantum state. In the embodiment of the present application, the CFD simulation is realized by using quantum computing, using which exponential acceleration can be achieved compared with the classical algorithm, so as to reduce the complexity of CFD and the computational time of CFD, and increase practicability of CFD.
Detailed description is made below.
First, the symbols in the embodiment of the present application are explained.
When the residual bn of a linear system equation AnΔUn=bntends to 0, a stable solution may be obtained. Quantum algorithm is an effective method to solve such linear system. Quantum circuits can be built to complete the calculations. Referring to
S11, in a computational fluid dynamics analysis process using a finite volume method, constructing, for each grid cell in a discretized numerical grid for fluid movement, a first quantum circuit representing the coordinate information of the above-mentioned grid cell and a second quantum circuit representing the state parameters of the above-mentioned grid cell, wherein the state parameters of the above-mentioned grid cell are stored in a quantum random access memory, and the above-mentioned quantum random access memory can operate addresses and data in a quantum superposition state.
The computational fluid dynamics simulation method based on a quantum algorithm according to the embodiment of the present application can be implemented by electronic devices with quantum computing capability, such as quantum computers, or by classical computers simulating quantum computing, or by classical computers combined with quantum computers.
The first quantum circuit is configured to represent the coordinate information of the grid cell, and the second quantum circuit is configured to represent the state parameters of the grid cell. For example, for the ith grid cell (or called grid cell i), Ui=(ρ, ρu, ρv, ρE)i, the first quantum circuit is configured to represent the coordinate information associated with i, and the second quantum circuit is configured to represent (ρ, ρu, ρv, ρE).
The state parameters of grid cells are stored in the QRAM (Quantum Random Access Memory), which is a quantum simulation of classical random access memory and a structure that can effectively store and load quantum information. Quantum random access memory can operate addresses and data in a quantum superposition state, and the QRAM operates addresses in superposition state. When the addresses are in the superposition state, the data in the QRAM can be effectively acquired. In a possible implementation, a preset mapping relationship between addresses and data is stored in the above quantum random access memory, wherein the above addresses are encoded to be in a first superposition state, each eigenstate in the above first superposition state corresponds to one piece of address information, the above data is encoded to be in a second superposition state, and each eigenstate in the above second superposition state corresponds to one piece of data information. The QRAM in the embodiment of the present application can be realized in a quantum way or a classical computer simulation. The implementation of QRAM using classical computer simulation is known in the prior art, and will not be described here. In addition, it can also be realized by hardware circuit, etc., all of which are within the scope of protection of the present application.
S12, constructing a third quantum circuit representing the parameters of a linear system equation that represents the change of the fluid state of the above grid cell based on the above first quantum circuit, the above second quantum circuit and the above quantum random access memory.
The coordinate information of each grid cell can be obtained using the first quantum circuit, and the initial state parameters of each grid cell can be obtained using the second quantum circuit. Since the fluid state of the grid cell is represented by the state parameters, the initial fluid state of each grid cell can be obtained. The quantum random access memory can store the state parameters (including the initial state parameters and the state parameters after iteration) of each grid cell, therefore based on the first quantum circuit, the second quantum circuit and the quantum random access memory, a third quantum circuit representing the parameters of the linear system equation that represents the change of the fluid state of the grid cell can be constructed.
S13, solving, for all grid cells, the linear system equations of the above grid cells based on the above third quantum circuit, to obtain the fluid states represented by the state parameters of the linear system equations of the grid cells as the target states of the above grid cells when the fluid states of the above grid cells tend to be stable.
The fluid states of all grid cells can be iterated through the third quantum circuit. When the fluid states of the grid cells tend to be stable, that is, the residual bn tends to 0, the fluid state of the linear system equation of each grid cell at this time can be obtained, which is the target state of each grid cell.
Optionally, after obtaining the target state of each grid cell, the target state of the grid cell can be converted into an analog encoded state, and the above analog encoded state can be measured, so as to complete the computational fluid dynamics analysis of fluid movement.
The target state of the grid cell read from the quantum random access memory is a digital state (called quantum digital state), which needs to be converted into an analog encoded state (called quantum analog state). By measuring the analog encoded state, the classical data used to describe the fluid movement can be obtained, thus completing the computational fluid dynamics analysis of the subsequent fluid movement.
The digital encoded state of the quantum form of the target state of the grid cell is expressed as |{right arrow over (U)} and stored in the QRAM. The classic information extraction process is as follows: firstly, read the digital encoded state |{right arrow over (U)}
from the QRAM, and then convert the digital encoded state into the analog encoded state |φ
=CΣk=1NUk|k
by a QDAC (Quantum Digital-to-Analog Converter), where, C=√{square root over (1/(Σj=1NUj2))}. It can be understood that the analog encoded state refers to the state in which the digital information is encoded on the amplitude of the quantum state, while the digital encoded state refers to the state where the digital information is encoded on the quantum state itself (equivalent to a register). Finally, the classical information is extracted by measuring the analog encoded state |φ
.
In the calculation process, N grid cells are needed. When the number N of the grid cells is very large, the fluid states of the grid cells may be optionally collected multiple times. In one sampling process, the fluid states of only N1 grid cells in N grid cells can be sampled, so that the final output classical information can be obtained through multiple sampling processes. Assuming that the jth grid after dimensionality reduction contains aj original grids, which are sampled M times in total, and the jth grid appears bj times, the solution of the obtained N1 grids can be expressed as: {right arrow over (u)}out=(bj/aj), j=0,1, . . . , N1−1. The sampling is finally done M times, since QDAC is a probabilistic operation, there is a probability p=Σj=1NUj2/N that the digital information will be successfully converted into analog information, thus requiring M/p times of information extraction from the QRAM and M/p times of QDAC conversion.
The inherent characteristic of quantum computing is quantum parallelism. In the embodiment of the present application, the quantum parallelism of quantum computing is utilized, so that exponential acceleration can be achieved compared with the classical algorithm, so as to reduce the complexity of CFD simulation, reduce the computation time of CFD simulation, and increase the practicability of CFD simulation. When the fluid state of the grid cell tends to be stable, the target state of the grid cell, that is, the state of the fluid state in the grid cell, can be obtained, from which the flow characteristics around a device, such as an aircraft, a fan, a compressor or a hydraulic turbine, and the aerodynamic force acting on the surface of the device can be obtained, which is important for the design and operation simulation of the device.
In order to facilitate the design of quantum circuits and to clarify the functions of each quantum circuit, in a possible implementation, the above first quantum circuit includes a first Oracle and a second Oracle. The above first Oracle is configured to extract the number of adjacent grids of a specified grid cell, and the second Oracle is configured to extract the coordinate information of the grid cell.
The parameters related to the coordinates of grid cells are encoded into the first quantum circuit using a grid scheme. Two Oracles can be defined here, i.e., the first Oracle (hereinafter referred to as Oadjacent) and the second Oracle (hereinafter referred to as Ocoor). Wherein, Oadjacent is configured to extract the number of adjacent grids of a specified grid cell and can be expressed as:
O
adjacent
|i
|j
=|i
|g(i,j) (6)
Where: g(i,j) is the jth adjacent grid cell of the grid cell i.
Ocoor is configured to extract the coordinates of grid cells, which can be expressed as:
O
coor
|i
|0=|i
|{right arrow over (xI)}
(7)
where {right arrow over (xi)} represents coordinate information related to the grid cell i, such as the coordinates of each vertex of the grid cell i. Ocoor can also be used to obtain other position information, such as the coordinates of the center of the grid cell i and the normal of each side of the grid cell i.
The numbers of quantum bits required to construct Oadjacent and Ocoor are 2(m−2), m−2+C0qf respectively, here C0qf is a quantum bit sequence, which represents the coordinate information and other position information obtained from the coordinates of the grid cell, and C0 is a constant. The complexity of constructing Oadjacent and Ocoor depends on the complexity of the grid scheme. Where the complexity can be expressed as O(poly(log(N))), that is, the complexity of Oadjacent and Ocoor is expressed as O(poly(log(N))).
In the embodiment of the present application, the first quantum circuit includes a first Oracle and a second Oracle. The first Oracle is configured to extract the number of adjacent grids of a specified grid cell, and the second Oracle is configured to extract the coordinate information of the grid cell. The functions of the first quantum circuit are assigned to the first Oracle and the second Oracle for implementation, so that the functions of each part are clarified, which facilitates the design and application of the quantum circuit.
In the process of data conversion, two forms of state parameters are required, i.e., a quantum digital state and an analog encoded state. In a possible implementation, the above second quantum circuit includes a second analog state quantum circuit that extracts the state parameters of the above grid cell through the amplitudes of the quantum states, and a second digital state quantum circuit that extracts the state parameters of the above grid cell through the eigenstates of the quantum states.
The second quantum circuit includes a second analog state quantum circuit and a second digital state quantum circuit. The second analog state quantum circuit is configured to extract, through the amplitudes of the quantum states, the state parameters of the above grid cell, that is, the state parameters used for representing the analog encoded state. The second digital state quantum circuit is configured to extract, through the eigenstates of the quantum states, the state parameters of the above grid cell, that is, the state parameters used for representing the digital states.
In the process of solving using FVM, the initial values of the state parameters Ui of each grid cell can be considered the same, and can be expressed as Ui=(x0,x1,x2,x3), where x0,x1,x2,x3 are the specific values of ρ,ρu,ρv,ρE respectively, the initial states U0 of all grid cells can be expressed as:
|{right arrow over (U)}0=C0Σi=04N−1xj|i
(8)
where: j=i mod 4, that is, take a remainder when i is divided by 4. And finally xj is one of x0, x1, x2 and x3.
|{right arrow over (U)}0 is a representation of the analog encoded state of U0, and can be prepared by quantum circuits as shown in
Similarly, it is possible to construct {right arrow over (U)}0 in a digital version, i.e.,
|{right arrow over (d)}U0=Σi|i
|Ui
(9)
Where |{right arrow over (d)}U0 is the representation of U0 in a digital state, and the corresponding quantum circuit can be shown in
|{right arrow over (d)}U0 can be stored in a QRAM, which is defined as follows:
MU in the above equation, as a data memory that stores the state variables of the grid cell parameters, is a quantum random access memory QRAM with the function of a quantum logic gate, and MU can operate on a superposition state. It should be noted that the above QRAM is a structure that can effectively store and load quantum information. QRAM encodes both addresses and data on quantum bits, and can represent the addresses through the superposition state of quantum bits, so it can operate addresses in the superposition state. QRAM enables parallel loading and storage of quantum data in a digital form with time complexity O(log N). Where time complexity O(log N) indicates that when the data increases by N times, the time consumption increases by log N times, where the log can be in the base of 2.
From the above description, it can be seen that the linear system equation can be: AnΔUn=bn, whose parameters are the coefficient matrix An and the residual quantity bn at the current moment, so the function of the third quantum circuit can be further divided.
In a possible implementation, the above linear system equation is: AnΔUn=bn where: ΔUn=Un+1−Un; Where: n represents the nth moment of recording the fluid state; Un represents the fluid states of the grid cells at the nth moment, Un={Ui}, i=0,1,2, . . . , N−1, and Ui represents the fluid state of the grid cell i; An represents the coefficient matrix at the nth moment, and An={A(Un, {circumflex over (M)})}, representing that An is a function associated with Un, {circumflex over (M)}, bn represents the residual quantity at the nth moment, and bn={b(Un, {circumflex over (M)})}, representing that bn is a function associated with Un, {circumflex over (M)}, N is the number of grid cells in total and {circumflex over (M)} is the coordinate information of the above grid cells.
The parameters of the above linear system equation include the coefficient matrix An at the current moment and the residual quantity bn at the current moment; the above third quantum circuit includes Oracle OA corresponding to the above coefficient matrix An and Oracle Ob corresponding to the above residual quantity bn; The coefficient matrix is a sparse matrix, and when i and j are adjacent, the element Ai′j′ is non-zero; the above Oracle OA is configured to extract the element Ai′j′ of the coefficient matrix An at the current nth moment, wherein, Ai′j′ represents the j′th element in the i′th row of the coefficient matrix; An={Ai′j′}, i′=4i+i1; j′=4j+j1, i,j=0,1,2, . . . , N−1; i1,j1∈[0,3] and are integers; for the jth adjacent grid cell of the grid cell i, the above Oracle OA has an effect of OA|i|j
=|i
|j
|Ai′j′
; the above Oracle Ob is configured to extract the element bi of the residual quantity bn at the current nth moment, wherein, bi represents the residual quantity of the grid cell i; bn={bi}, i=0,1,2, . . . , N−1, for the grid cell i, the above Oracle Ob has an effect of Ob|0
=Σibi|i
.
The effect of Oracle Ob on the initial fluid state, i.e. |0 state, of a grid cell is Ob|0
=Σibi|i
, bi represents the residual quantity of the grid cell i, which is a function of the state parameters and coordinates of the └i/4┘th grid cell and its neighboring grid cells, and the expressions of these functions are regular, specifically, the expression of bi is only related to i mod 4, so bi can be effectively constructed, where mod represents the remainder operation. A possible quantum circuit diagram for Oracle Ob can be shown in
Firstly, the related state parameters and coordinates are obtained: |i|Urelated
|Xrelated
, Xrelated represents the coordinate information of the related grid cells and Urelated represents the state parameter information corresponding to the related grid cells.
Then, bi is calculated to get: |i|Urelated
|Xrelated
|bi
.
Here, it is not necessary to calculate |Urelated and |Xrelated
, |i
|bi
, because it is an auxiliary state constructed to calculate the target state, and QDAC can be used to operate and complete the process of Σibi|i
.
In this process, the number of quantum bits required is m+Cbqf, m is a constant, which indicates the number of spare quantum bits, and Cbqf is an auxiliary quantum bit sequence used to calculate bi; it can also be used for QDAC quantum circuits. Assuming that the success rate of QDAC is pQDAC, the number of times when MU, Oadjacent and Ocoor are used is O(1/pQDAC). The complexity of quantum logic gates is O(poly(m)/pQDAC+poly(1/ϵpQDAC)), where ϵ represents the accuracy of the QDAC.
A possible way of constructing Oracle Ob is described below. In a possible implementation, constructing the third quantum circuit representing the parameters of a linear system equation that represents the change of the fluid state of the above grid cell based on the above first quantum circuit, the above second quantum circuit and the above quantum random access memory, includes:
|i|0
|0
→|i
|Urelated
|Xrelated
It should be noted that it is only a possible way to construct Oracle Ob with the help of the above first sub-quantum circuit Oracle Ob1, the above second sub-quantum circuit Oracle Ob2, the above third sub-quantum circuit Oracle Ob3 and the above fourth sub-quantum circuit Oracle Ob4. On the one hand, there is no strict restriction on the sequential steps of the above first sub-quantum circuit Oracle Ob1, the above second sub-quantum circuit Oracle Ob2, the above third sub-quantum circuit Oracle Ob3 and the above fourth sub-quantum circuit Oracle Ob4; on the other hand, each sub-quantum circuit is essentially a quantum state evolution operation to achieve a certain function, that is, equivalent to a quantum logic gate. In specific application scenarios, quantum logic gates may operate on different quantum states used to describe specific application scenarios and/or the preset quantum states of auxiliary quantum bits. It is more intuitively understood that the selection and setting of the initial quantum state is not unique, which conforms to the superposition characteristics of quantum states and is also based on the convenience of occupying and releasing quantum bit resources, which can be set on demand by those skilled in the art. Exemplarily, during the implementation of |i|Urelated
|Xrelated
|0
→|i
|Urelated
|Xrelated
|bi
, the initial state may be set to be other states before |i
|Urelated
|Xrelated
|0
, for example, the initial state is |i
|Urelated
|Xrelated
|1
. At this time, in order to implement the reversible operation of the quantum state evolution operation, it is necessary to release quantum bit resources through additional quantum circuits.
In this embodiment, it is preferable to set the initial state as |i|Urelated
|Xrelated
|0
, which, on the one hand, can reduce the complexity of the preparation of the initial state of the quantum state, and on the other hand, can reduce the encoding complexity of a quantum circuit in the process of realizing the reversible operation of the functional quantum state evolution operation, and can simplify the quantum circuit arrangement on the whole.
Similarly, the settings of the above other function Oracle also satisfy the requirements of simple and convenient optimization settings of the above quantum circuits. Therefore, it can be understood that the steps A to I provided above are only one possible way to construct Oracle Ob. The effect of Oracle OA on the fluid state of the grid cell may be:
O
A
|i
|j
|z
=|i
|j
|z⊕A
i′j′
(11)
Ai′j′ is an element of the coefficient matrix, ⊕ is the XOR symbol, and Z is a user-defined binary number, which may be 0. At this time, the formula (11) may be expressed as: OA|i|j
=|i
|j
|Ai′j′
.
The coefficient matrix Ai′j′ is expressed as:
A
4i
+i
,4j
+j
=f
i
,i
,j
,j
(Ui
i0, j0 , respectively represent the serial numbers of grid cells i, j, that is, the specific values of i, j, and each grid cell has four state parameters, i1, j1 are integers ranging from 0 to 3 (including 0 and 3), and respectively represent the four state parameters of grid cells i0, j0 . Ui
Here, the forms of function fi
To calculate A4i
|4i0+i1,4j0+j1|Ui
(13)
Then fi
|4i0+i1,4j0+j1|Ui
|fi
Since Ui|0,0,0,0
fi
are auxiliary states constructed to calculate the target state, it is unnecessary to calculate them.
Thereby Oracle OA is realized, and the corresponding quantum circuit thereof is shown in (poly(m)), and the expression of Aij is more complex than bi, so CA≥Cb.
A possible way of constructing Oracle OA is described below. In a possible implementation, constructing a third quantum circuit representing the parameters of a linear system equation that represents the change of the fluid movement state of the above grid cell based on the above first quantum circuit, the above second quantum circuit and the above quantum random access memory, includes:
where: f(i,j) is a function of the state parameters and coordinate information of the grid cell, % represents a remainder operation, and └┘ represents a RoundDown symbol.
Here, there is a trick to construct the quantum circuits, as shown in and |j
, where the effect of Ol on the grid cell state can be written as: Ol|i
|j
=|i
|f(i,j)
, the number of quantum bits required in this process is 2m.
A
i′j′
=A
4i
+i
,4j
+j
=f
i
,i
,j
,j
(Ui
i0, j0, respectively represent the serial numbers of grid cells i, j, each grid cell has four state parameters, i1, j1 range from 0 to 3, and respectively represent the four state parameters of the grid cells i0, j0; Ui
|i,j|0
→|4i0+i1,4j0+j1
|Ui
.
|4i0+i1,4j0+j1|Ui
|0
→|4i0+i1,4j0+j1
|Ui
|fi
.
|4i0+i1,4j0+j1|Ui
|fi
→|4i0+i1,4j0+j1
|0
|fi
Similar to the above discussion that it is only a possible way to construct Oracle Ob with the help of the above first sub-quantum circuit Oracle Ob1, the above second sub-quantum circuit Oracle Ob2, the above third sub-quantum circuit Oracle Ob3 and the above fourth sub-quantum circuit Oracle Ob4, the process of constructing Oracle OA based on the above first sub-quantum circuit Oracle OA1, the above second sub-quantum circuit Oracle OA2 and the above third sub-quantum circuit Oracle OA3 is also only a possible way, which will not be repeated here.
In a possible implementation, solving, for all grid cells, the linear system equations of the grid cells based on the third quantum circuit, to obtain the fluid states represented by the state parameters of the linear system equations of the above grid cells as the target states of the above grid cells when the fluid states of the above grid cells tend to be stable, including:
After being linearized, the problem is transformed into solving a linear equation. The goal of this process is to output a target state:
In this way, ∥|{tilde over (x)}−|x
∥≤ϵ, |{tilde over (x)}
is the calculated target state, |x
is the true value of the target state, and the amplitude of |x
satisfies {right arrow over (x)}=A−1{right arrow over (b)}, where ϵ is the preset accuracy.
The quantum linear solver using Chebyshev method by Andrew Childs can be used here as an accelerator for the calculation, and the overall quantum circuit of the quantum linear solver can be shown in
and α is the normalization constant of Σi√{square root over (αi)}|i. The number of quantum bits in total is 2(m+1)+t+CAqf. Δ{right arrow over (U)}n is obtained by a quantum linear solver.
Δ{right arrow over (U)}n is converted into a numerical form: dΔUn=Σi|i|ΔUin
.
The following states are generated according to MU: Σi|i|ΔUin
|Uin
, wherein MU is the fluid states of all grid cells stored in the quantum random memory.
Then the quantum adder is executed on |ΔUin and |Uin
, to obtain: Σi|i
|ΔUin+1
|Uin
.
MU† is configured to disentangle the |Uin to obtain Σi|i
|ΔUin+1
|0
, the quantum circuit of which can be shown in
Thereby dUn+1 is obtained and MU is updated by using dUn+1. In this process, m+2qf quantum bits are needed. MU is used twice, once by the QADC and once by the quantum adder.
The evolved state obtained from quantum random access memory is the digital encoded state |{right arrow over (U)}, that is, the target state of the grid cell.
In a possible implementation, the above ΔUn is data in an analog encoded state with information encoded on the amplitude of the quantum state; updating Un stored in the quantum random access memory according to the acquired ΔUn to obtain Un+1 as the target states of the above grid cells, specifically comprises:
ΔUn|i|0
→|i
|ΔUn
.
|i|Un
|ΔU
→|i
|Un
|Un+1
.
|i|Un
|Un+1
→|i
|0
|Un+1
.
It should be noted that, Similar to the above discussion that it is only a possible way to construct Oracle Ob with the help of the above first sub-quantum circuit Oracle Ob1, the above second sub-quantum circuit Oracle Ob2, the above third sub-quantum circuit Oracle Ob3 and the above fourth sub-quantum circuit Oracle Ob4, the process of obtaining quantum circuit with the help of the above first data conversion quantum circuit Oracle Oconvert1, the above quantum random access memory, the above quantum adder circuit Oracle Oadd and the above second data conversion quantum circuit Oracle Oconvert2 is also only a possible way, which will not be repeated here. In a possible implementation, obtaining the target states of the above grid cells according to the above target values of the state parameters, specifically includes:
Step a, constructing a third data conversion quantum circuit Oracle Oconvert3, wherein Oracle Oconvert3 is configured to implement |i|0
|Un+1
→Un+1|i
.
It should be noted that, Oracle Oconvert3 is configured to implement the transformation from the digital encoded state to the analog encoded state, but the transformed quantum state is not unique. Exemplary, Oracle Oconvert is configured to implement: |i|1
|Un+1
→Un+1|i
|1
, at this time, the quantum circuit correspondingly implementing Oracle Oconvert3 will require one more bit of auxiliary quantum bits to encode the |1
≢state, which does not satisfy the need of simplifying quantum circuit settings as much as possible.
Step b, obtaining the target state of each grid cell by converting the above target values of the state parameters into Un+1 encoded by amplitudes of the quantum states using the above third data conversion quantum circuit Oracle Oconvert3.
Linear system AnΔUn=bn can be solved by quantum algorithms. However, the output results are related states. not in the vector form of real solutions. Unlike vector Δ{right arrow over (U)}, quantum state |ΔU has been normalized:
There are different normalization constants for different A and b; usually, the constant cn of the nth iteration is different from the constant cn+1 of the (n+1)th iteration, Ui,j,kn+1 is equal to Ui,j,kn+ΔUi,j,kn=Ui,j,k1+Σl=1nΔUi,j,kl, that is, it is necessary to perform the operation Δ{right arrow over (U)}i+Δ{right arrow over (U)}j. Further, there is still a need to implement |ΔUi plus |ΔUj
. Assuming that there is a sufficiently large constant L, a new state |ΔU′
is constructed:
Then a new set of equations is obtained:
When Δt is sufficiently small, the second equation in equation (19) is linearized, and Δui′2 is replaced with Δuj′n−1Δui′n, thereby obtaining a new linear system A′Δ{right arrow over (U)}′={right arrow over (b)}′, where
For the state |ΔU′, the normalization constant is always 1. Then, the mathematical operation may be freely completed (use the first N parts of |ΔU′
). When N is large enough, A′ is also a sparse matrix, so it can be successfully constructed.
Optionally, the computational fluid dynamics simulation method based on a quantum algorithm in the embodiment of the present application may be applied to SU2, and some modules are replaced by quantum subroutines to seek acceleration through quantum in the execution process. The module replaced in SU2 is the data structure and method used in CfluidIteration class. In data structures, they are replaced by quantum memories or sets of quantum states, which include information about all vectors involved in grid settings and linear equations. For time integration, the linear solver is replaced by the quantum solver. In the pre-processing and post-processing stages, they are completely replaced by quantum algorithm modules, forming the Oracle necessary for quantum linear solvers. In addition, the problem model, grid setting and finite volume method, including the iterative process of time integration, are not changed.
The time complexity of the quantum algorithm is proportional to log N, where N represents the number of grids or cells in the grids. The number of quantum bits is also proportional to log N. In addition, the number of grids, the complexity and the number of quantum bits are all affected by the precision ϵ. The number of conditions κ and sparseness s will also affect the time complexity. Optional, since the precision ϵ, the number of conditions κ and sparseness s have little change, they can be regarded as constant in the calculation.
SU2 is an open source fluid dynamics solution. In the embodiment of the present application, quantum sub-processes are used to replace some modules in classical solvers to form a quantum-classical hybrid model. Finally, acceleration through quantum is demonstrated, where the classical model is shown in
For SU2_CFD module, the program starts with the main function (main) that reads the configuration file. Then, the whole calculation process is controlled by the instance of computational CfluidDriver, that is, the computational fluid iteration is performed. Time integration is performed in a for loop controlled by CfluidIteration. In each iteration step, the MultiGrid_Cycle method and the preprocessing method are called. The MultiGrid_Cycle contains MultiGrid algorithm for calculating FVM problems. Preprocessing connects the result of the previous iteration with the input of the next iteration. In MultiGrid_Cycle, the preprocessing subprocess reads the data of the grid and generates Jacobi matrix, then sends it to CeulerSolver (Fluid Control Equation Processor) and solves the linear equation by the classical linear solver.
The preprocessing module of CmultiGridlntegration includes the linear problems generated by preprocessing. This part is replaced by a corresponding quantum algorithm, and Oracle containing grid information data is called. Similar to the classical process, the final goal is to generate the quantum data needed for the next step: a quantum linear solver.
The module MultiGrid_Cycle calls the TimeIntegration module in CMultiGridIntegration, and it is replaced by a quantum linear solver, which performs tasks much faster than the classical solver.
Pre-processing in CFluidIteration processes the results after MultiGrid_Cycle, then generates data for the next iteration and displays the results. This module is replaced by one quantum post-process, the purpose of which is to add changes to the vector and prepare for the next iteration.
The quantum computing process can be shown in
A
i+1
=A({right arrow over (U)}i,{circumflex over (M)})
b
i+1
=b({right arrow over (U)}i,{circumflex over (M)}).
Therefore, the quantum Oracles required by the quantum linear solver can be obtained. Here, in the (i+1)th iteration, An+1 represents the coefficient matrix, bi+1 represents the residual quantity, and {circumflex over (M)} represents the quantum Oracles of the coordinate information of grid cells. Then the following equation is solved by using a quantum computer:
A
i+1
Δ{right arrow over (U)}
i+1
={right arrow over (b)}
i+1.
Then, by adding the variation in the last step {right arrow over (U)}i, this iterative step is over:
{right arrow over (U)}
i
={right arrow over (U)}
i
+{right arrow over (U)}
i.
For the specific implementation process thereof, please refer to the related contents in the above embodiments. QRAM is a necessary condition for demonstrating acceleration through quantum in the model. QRAM is used in three processes: first, storing the information about grid cells, second, storing interval results of solvers, and third, it helps to recover from probability errors in performing non-unitary transformations. In the whole process of the algorithm, for quantum bits, queries and the complexity of quantum logic gates, the number of quantum bits required is:
The relationship between the number of grid cells and the number of quantum bits is shown in
The complexity of quantum logic gates is:
Combining SU2 with quantum programming framework, a quantum-classical hybrid solution program for solving CFD problems is compiled. QPanda quantum programming framework may be used, and QPanda and its OriginIR (Quantum Intermediate Representation) support the definition and simulation of any quantum Qracle.
The quantum linear solver part of the present application is implemented by programming, which adopts the generated linear equation, takes SU2 as input, and outputs the quantum circuit encoding equation. This program combines the SU2 module with the quantum programming framework QPanda. Quantum Oracles are used for processing, and QPanda supports the definition and simulation of quantum Oracles. Quantum Oracle is a black box that represents the transformation of a quantum state. A typical example of quantum Oracles is a quantum function: O|x|0
=|x
|f(x)
, the calculation of f(x) uses the first quantum register as input and the second quantum register as output. In another example, QRAM may be regarded as an Oracle. Many quantum algorithms use Oracle, but they don't care about the implementation of Oracle—it can be decomposed into quantum gates or implemented as QRAM. In QPanda, it can be defined by using the “Oracle” function. Oracle is considered to have a name provided by the user.
Grid generation module can be integrated into a quantum computer in addition to accelerate the time integration process. In the above algorithm, the grid information is regarded as Oracle. A direct method is to pre-generate grid files and encode classical data into quantum computers. Instead of reading the pre-generated grid files, quantum algorithms can also be used instead of grid generation programs. The solver needs an effective quantum representation of matrix A and constant {right arrow over (b)}. In this problem, the system of partial differential equations need to be linearized to obtain the expressions of A and {right arrow over (b)}.
In order to improve the acceleration effect in the embodiment of the present application, the quantum computers need to meet the following requirements: fault tolerance, the method of the embodiment of the present application speeds up the calculation of each iteration step. However, with the increase of the number of grids, the number of iterations will greatly increase. In the process, quantum measurement is not performed to extract the results of each step. The quantum features (entanglement and superposition) are retained in the whole calculation process. This feature of this method means that the storage of quantum states is not affected by decoherence and noise, and quantum computers with fault tolerance can increase the accuracy of calculation results.
The quantum-classical hybrid algorithm faces the problem of data conversion between classical and quantum. The question is what is the time complexity of performing this conversion between Σ|addr|data
and classic memory. A simple method from quantum to classical is repeated measurement, or “quantum chromatography”, which is often mentioned. Generally, the way from classical to quantum is to encode the state preparation stage in the quantum circuit through a set of controlled rotation operations. These methods are simple, but they will take time of
(2n). If quantum classical transformation cannot be effectively realized, many quantum algorithms will never achieve sublinear time complexity, because input and output will consume at least linear time. To solve this problem, quantum random access memory is needed. QRAM is a structure that can effectively store and load quantum information. QRAM operates addresses in superposition. It enables quantum data in digital forms to be loaded and stored in parallel with time complexity O(log N). QRAM is a quantum simulation of classical random access memory. When the addresses are in the superposition state, QRAM enables users to effectively acquire the data in QRAM.
QRAM is configured to implement.: Σi|i|0
=Σi|i
|Ui
where, Ui represents the classical data encoded in the quantum state of the ith grid cell.
QRAM model can be realized by using a set of optical devices, which requires O(log N) operation (N represents the length of memory). QRAM model is also realized by decomposing quantum circuits.
In the embodiment of the present application, the quantum module constructed by the hybrid quantum-classical method replaces some modules in an SU2 CFD solver, which can realize the simulation of fluid movement by computational fluid dynamics. The original classical solver used FVM and iterative time integration to obtain the solution of fluid equation. Through the multi-grid method, the classical solver has a complexity of O(n) between each iteration step; here, n represents the number of grids. In this embodiment of the present application, the quantum linear solver is configured to accelerate the solution of the linear equation system, instead of the core process in the CFluidIteration processes. One is MultiGrid_Cycle, which includes preprocessing and equation solving, which has been completely replaced by quantum processes. The other is preprocessing, which links data between two iterative steps and is also replaced by quantum process. Classical data is naturally replaced by quantum data. The input grid information should be put into the QRAM which is often used in the preprocessor. Most of the internal data in the calculation process is no longer needed since they are saved in quantum registers. The configuration data of the whole problem is considered as a constant and used to directly generate quantum programs. The time complexity in the scheme of the embodiment of the present application is O(log(N)), N is the number of grids, and the calculation speed is much faster than the classical logarithm.
In the embodiment of the present application, an exponential acceleration is achieved through quantum for the problem without changing the problem model. Secondly, the SU2 program is fully demonstrated, and the appropriate replacement that must be made is found. Then, our algorithm is implemented with the help of QPanda quantum programming framework, and finally the numerical results are obtained. And the quantum-classical interface problem for data conversion is not ignored.
The quantum circuit module used in the quantum circuit construction in the embodiment of the present application is described below.
1. Firstly, QDAC (Quantum Digital-to-Analog Converter) and QADC (Quantum Analog-to-Digital Converter) are introduced.
The purpose of the QDAC is to change the quantum state encoded by a number between 0 and 1 to the amplitude corresponding to the quantum state. Therefore, the QDAC operation is defined by:
The main idea of the QDAC algorithm is to transform coefficients in front of each ground state by rotating the auxiliary bits, which is explained in three aspects below.
First, the possibility of success is explained. QDAC algorithm has only a certain probability of success and a certain probability of failure of the operation. If it fails, please run the algorithm from the beginning. After calculation, the probability of one-time success is Σj=1Ndj2/N.
Secondly, the quantum circuit of the QDAC algorithm is shown in state during measurement, continue; If it is |1
state, do it again from the beginning. n represents the number of quantum bits required to encode the data, and m represents the number of bits of required precision, where only the high bits need to be calculated. The UD gate is represented as: UD({dj})|j
|0
=|j
|dj
. UAC Gate represents arc cos function, and controlled Ry gate represents the controlled rotation of one bit. If n H gates are not considered, a total of O(m) gates are required.
Then, the normalization problem is explained. The final coefficient needs to be normalized. After calculation, the normalization coefficient C is √{square root over (1/τj=1Ndj2))}.
The QADC algorithm includes absolute QADC, real QADC and imaginary QADC. The main ideas of these algorithms involve Hadamard test and phase estimation. The real QADC is mainly used in the present application. An m-bit real QADC operation is defined as:
In which, {tilde over (x)}k represents the m-bit string {tilde over (x)}k(1) . . . {tilde over (x)}k(m) such that the Σl=1m{tilde over (x)}k(l)2−1 is closest to the real portion of ck. The quantum circuit of real QADC algorithm is shown in =Σjcj|j
, here {cj}j=1N is classical data, and it satisfies the normalization condition Σj=1N|cj|2=1.
Gate G is given by the following formula: G=QS0Q†ZB, where Q is the gate shown in 0|)data,B is a conditional phase flip gate, and ZB is a Pauli Z gate only acting on the quantum bit B. PE represents a phase estimation, IQFT refers to inverse quantum Fourier transform.
After the phase estimation, the phase θk of Q can be encoded on register0 quantum bits, and then the quantum arithmetic operation Uf(θ) is configured to calculate xk=f(θk)=2 sin2 πθk−1. Finally, the uncalculated data, B, register0 quantum bits, and digital encoded state
are obtained. In the real QADC quantum circuit, 2(m+n)+1 quantum bits are needed. Since the gates S0 can be divided into O[(log2N)2](N=2n) single gates and double gates. Therefore, the number of single and double quantum bit gates is O[(log2N)2/ε], O(1/ϵ) controlled UA gates are used.
2. Realize matrix inversion by operating linear combination.
Any simple function can be linearly approximated as a linear combination of other functions, and the inverse function of the matrix can be approximated by Chebyshev polynomials, specifically as follows:
An inverse matrix function f(x)=1/x is required in the present application, which satisfies O(∥A−1−F∥)=ϵ. The linear combination is:
Here, j0=√{square root over (blog(4b/ϵ))}, b=κ2 log(κ/ϵ), g(x) is 2ϵ.
Dκ:=(−1, −1/78 )∪(1/κ, 1). 2j+1(x) is the first class of Chebyshev polynomials.
Quantum walk: in order to implement the Chebyshev polynomial, it needs to be carried out in the framework of quantum walk.
Because the quantum walk is performed on some states |φj in space
2N⊗
2N, defining a mapping T:=Σj∈[N]|φj
(j|, from
N to
2N⊗
2N.
And a walk operator is as follows:
W=S(2TT†−1)
The operator S performs the flip operation on the product state |φj, and thus:
T
†
W
n
T|b
=|0mn(H)|b
+|⊥b
n(λ) is the first class of Chebyshev polynomials.
Implementation of the Quantum circuit: two Oracles are used to extract the information of matrix A: Ol and OA, written as:
O
l
|j,l
=|j,f(j,l),OA|j,k,z=|j,k,z⊕Ajk
The first goal is to decode the state
which can prepare the quantum circuit with a length of O(j0).
Next, a T operator is constructed, which can be synthesized as follows. For the vector |j, the whole circuit needs log22N quantum bits, similarly, log22N indicates its product state and a bunch of auxiliary quantum bits are used for rotation control.
Consider Ajl as a series of control bits, define a control rotation operator:
Operator M is synthesized by an Oracle Oamp as:
The purpose is to prepare an approximation to the target state.
The key contribution is M as the control rotation operator.
|α|0
:=|α
(sin(θ)|0
+cos(θ)|1
)
Use OH again to change |Hjl back to |0
.
Next, for example, as shown in
Therefore TT†=|jj|⊗|ϕj
ϕj|. Operator T is a unitary operator in a quantum circuit, which changes |j
|0
to |ψj
. It is different from T:=Σj∈N|ψj
j| with a dimension of 4N2×2N. For distinguishing, Tqc is configured to define this quantum circuit:
T
qc(Σj|jj|⊗(2|0
0|−I2N))Tqc†=Σj|j
j|⊗(2|ϕj
ϕj|−I2N)=2TT†−I4N
0|−I2N=diag(1,−1,−1, . . . −1)=−diag(−1,1,1, . . . , 1)
In quantum circuit, H represents H-gate, OH and M represents Oracles with different functions, † represents transposed conjugation, and T represents the whole functional module T of H-gate and Oracle combination, the function of T module is to transform |j into |Ψj
. In addition, the matrix obtained for the input of the T module is an N-order matrix, with N in the ┌log2 N┐ above |j
representing the number of matrix rows, N in the lower ┌log2 N┐ representing the number of matrix columns, and the rest expressions are the same as above. The constructed T module can be equivalent to a quantum logic gate in the quantum circuit, and its matrix form is: Σj∈[N]|Ψj
j
, where |j
is the left vector of quantum state.
Specifically, using the H-gate, the superposition state is constructed:
Where j is the target value, representing the jth row of the matrix; ⊗ represents a tensor product or multiplication; d is the number of non-zero elements in the jth row in total; 1 is the sequence number of a non-zero element in all the non-zero elements in the jth row, indicating the lth non-zero element, and the quantum bit corresponding to |l is the first quantum bit.
Implementation of OH transformation:
where, Hjl′ is the non-zero element value in the jth row and the l′th column of the matrix, and the quantum bit corresponding to |Hjl′ is the second quantum bit. It should be noted that if Hjl′ is a complex, the real part and the imaginary part can be encoded on the second bit, that is |Hjl′
=|real
|imag
, real represents the real part and image represents the imaginary part; If Hjl′ is written in Euler form reiθ, the information of r and θ can be encoded on the second bit, that is |Hjl′
=|r
|θ
.
Implementation of M transformation:
finally, the transposition conjugation operation is performed by calling OH again, the quantum bit of encoded Hjl′ is recovered, and then |Ψj is outputted. Hjl′* is the conjugate of the non-zero element values in the jth row and the l′th column of matrix H, and Hmax is the element value with the largest absolute value in matrix H.
An embodiment of the present application also provides a computational fluid dynamics simulation apparatus based on a quantum algorithm, as shown in
In a possible implementation, the first quantum circuit comprises a first Oracle and a second Oracle; the first Oracle is configured to extract the number of adjacent grids of a specified grid cell, and the second Oracle is configured to extract coordinate information of the grid cell.
In a possible implementation, the second quantum circuit comprises: a second analog state quantum circuit that extracts the state parameters of the grid cell through amplitudes of quantum states, and a second digital state quantum circuit that extracts the state parameters of the grid cell through eigenstates of quantum states.
In a possible implementation, a preset mapping relationship between addresses and data is stored in the quantum random access memory, wherein the addresses are encoded in a first superposition state, each eigenstate in the first superposition state corresponds to one piece of address information, the data is encoded in a second superposition state, and each eigenstate in the second superposition state corresponds to one piece of data information.
In a possible implementation, the linear system equation is: AnΔUn=bn, wherein ΔUn=Un+1−Un; wherein, n represents a nth moment of recording a fluid state; Un represents fluid states of the arid cells at the nth moment, Un={Ui}, i=0,1,2, . . . , N−1, and Ui represents a fluid state of a grid cell i; An represents a coefficient matrix at the nth moment, and An={A(Un, {circumflex over (M)})}, representing that An is a function associated with Un, {circumflex over (M)}, bn represents a residual quantity at the nth moment, and bn={b(Un, {circumflex over (M)})}, representing that bn is a function associated with Un, {circumflex over (M)}, N is the number of grid cells in total and {circumflex over (M)} is coordinate information of the grid cells.
The parameters of the linear system equation comprise the coefficient matrix An at a current moment and the residual quantity bn at the current moment; the third quantum circuit comprises Oracle OA corresponding to the coefficient matrix An and Oracle Ob corresponding to the residual quantity bn; the Oracle OA is configured to extract an element Ai′j′ of the coefficient matrix An at the current nth moment, An={Ai′j′}, i′=4i+i1; j′=4j+j1, i,j=0,1,2, . . . , N−1; l1 and j1 are integers from 0 to 3; for a jth adjacent grid cell of the grid cell i, Oracle OA has an effect of OA|i|j
=|i
|j
|Ai′j′
; the Oracle Ob is configured to extract an element bi of the residual quantity bn at the current nth moment, wherein, bi represents a residual quantity of the grid cell i; bn={bi}, i=0,1,2, . . . , N−1, for the grid cell i, the Oracle Ob has an effect of Ob|0
=Σibi|i
.
In a possible implementation, the parameter quantum circuit construction module 202 is specifically configured for:
|i|0
|0
→|i
|Urelated
|Xrelated
;
In a possible implementation, the parameter quantum circuit construction module 202 is specifically configured for:
wherein f(i,j) is a function of the state parameters and the coordinate information of the grid cell, % represents a remainder operation, and └ ┘ represents a RoundDown symbol;
A
i′j′
=A
4i
+i
,4j
+j
=f
i
,i
,j
,j
(Ui
|i,j0
→|4i0+i1,4j0+j1
|Ui
;
|4i0+i1,4j0+j1|Ui
|0
→|4i0+i1,4j0+j1
|Ui
|fi
;
|4i0+i1,4j0+j1|Ui
|fi
→|4i0+i1,4j0+j1
|0
|fi
;
In a possible implementation, the target state obtaining module 203 includes:
In a possible implementation, the ΔUn is data in an analog encoded state with information encoded on an amplitude of a quantum state; the target state calculation submodule comprises:
ΔUn|i|0
→|i
|ΔUn
;
|i|Un
|ΔU
→|i
|Un
|Un+1
;
|i|Un
|Un+1
→|i
|0
|Un+1
In a possible implementation, wherein the target state determining unit is specifically configured for: constructing a third data conversion quantum circuit Oracle Oconvert3, wherein Oracle Oconvert3 is configured to implement |i|0
|Un+1
→Un+1|i
; obtaining the target state of each grid cell by converting the target values of the state parameters into Un+1 encoded by amplitudes of the quantum states using the third data conversion quantum circuit Oracle Oconvert3.
The embodiment of the present application also provides a quantum computer device, which comprises a quantum circuit, a device based on a quantum effect, and a quantum random access memory, and the quantum computer device may realize any computational fluid dynamics simulation method based on a quantum algorithm mentioned above at runtime.
The embodiment of the present application also provides a computer-readable storage medium having stored therein a computer program that, when executed by a processor, causes the processor to perform the computational fluid dynamics simulation method based on a quantum algorithm described above.
It should be noted that, in this document, the technical features of various alternative solutions may be combined to form a solution as long as they do not contradict each other, and these solutions are all within the scope of the present application. Relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or sequence between these entities or operations. Moreover, the terms “include”, “comprise” or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. Without further limitation, the elements defined by the statement “including one . . . ” do not preclude the existence of another identical elements in the process, method, article or device that includes the elements.
Each embodiment in this specification is described in a relevant manner, and the same and similar parts between each embodiment can be referred to each other, and each embodiment focuses on the difference from the other embodiments. In particular, for the embodiments of the device, quantum computer device and storage medium, the description is relatively simple since they are basically similar to the method embodiments, and the relevant parts can be found in the partial descriptions of the method embodiments.
The above is only a preferred embodiment of the present application, and is not intended to limit the scope of protection of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the scope of protection of the present application.
| Number | Date | Country | Kind |
|---|---|---|---|
| 202010771592.2 | Aug 2020 | CN | national |
| Filing Document | Filing Date | Country | Kind |
|---|---|---|---|
| PCT/CN2020/140833 | 12/29/2020 | WO |