A quantum computational fluid dynamics simulation method based on the lattice Boltzmann method
By combining quantum computing and lattice Boltzmann method, using the collision operator in the non-equilibrium correction term linearized lattice Boltzmann equation, the problem that the quantum computing lattice Boltzmann method is difficult to effectively deal with nonlinear collision terms is solved, and efficient simulation of complex flow phenomena is achieved.
Patent Information
- Application Number
- CN202510039358.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-10
AI Technical Summary
The existing quantum computing lattice Boltzmann method is difficult to effectively solve the nonlinear collision term problem, and is limited to simple one-dimensional and two-dimensional low Reynolds number flow simulation analysis.
By combining the parallelism of quantum computing and the advantages of the lattice Boltzmann method, an efficient fluid dynamics solution framework is constructed using the collision operator in the non-equilibrium correction term linearized lattice Boltzmann equation with tunable relaxation parameters derived by the Chapman-Enskog theory and the Maxwell equilibrium state function.
The efficient simulation of complex flow phenomena is achieved, and the limitations of traditional quantum computing in dealing with nonlinear collision terms and low Reynolds number flow simulation are overcome, which significantly reduces the computational complexity of complex fluid behavior.
Smart Images

Figure CN119476128B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a fluid dynamics simulation method, and in particular to a quantum computational fluid dynamics simulation method based on a lattice Boltzmann method. Background Art
[0002] The application of quantum computing in fluid simulation is a cutting-edge technology that combines quantum mechanics and computational fluid dynamics (CFD). It has important application value and scientific significance in aerospace, chemical engineering, biomedicine, wind energy, ocean energy and other new energy fields. Traditional CFD methods rely on numerical solutions to partial differential equations (such as the Navier-Stokes equations), usually using finite element method, finite volume method or lattice Boltzmann method (LBM). These methods have extremely high computational costs in high-dimensional complex scenarios (such as turbulence or multiphase flow) and require a large amount of computing resources. However, quantum computing has great potential in exponential computing. The method in this paper combines LBM with quantum computing methods, which has acceleration potential and application prospects.
[0003] Quantum computing has the characteristics of linearity, parallelism, and non-locality. Quantum computing uses quantum superposition and entanglement to process a large number of states in exponential parallelism. In simulation, most calculations involve matrix operations. Quantum algorithms (such as the HHL algorithm) have the potential to accelerate the solution of matrix equations. The subsystem's ability to process global related information matches the modeling of long-range correlations in fluid systems (such as turbulence models). There are already some studies that combine quantum computing with fluid simulation, such as the HHL algorithm (Harrow-Hassidim-Lloyd), which has been used to solve linear equations (such as Poisson's equation) to provide potential solutions to fluid problems, or to apply the Schrödinger equation to describe fluid motion, develop algorithms for implementing classical fluid mechanics equations on QPUs, and derive the Navier-Stokes equations using the Madelung transform.
[0004] In the above-mentioned prior art, quantum computing circuits are only applicable to linear operations, and the nonlinear collision terms in the lattice Boltzmann method must be linearized to meet the unitary requirements of matrix operations in quantum computing. The current "dual circuit method for reducing quantum resources using the quantum lattice Boltzmann method" simply omits the nonlinear collision terms, thereby reducing the requirements for discrete velocity models and not solving the problem of nonlinear collision terms, so it is limited to the simulation of low Reynolds number flow problems. Summary of the invention
[0005] The technical problem to be solved by the embodiments of the present invention is to provide a quantum computational fluid dynamics simulation method based on the lattice Boltzmann method, which can solve the shortcomings of the current quantum computational lattice Boltzmann method numerical simulation technology, which is difficult to solve the problem of nonlinear collision terms and is limited to simple one-dimensional and two-dimensional low Reynolds number flow simulation analysis.
[0006] In order to solve the above technical problems, an embodiment of the present invention provides a quantum computational fluid dynamics simulation method based on the lattice Boltzmann method, including the following method:
[0007] S1: Initialize the lattice model DmQn and parameters, construct the first quantum circuit of stream function-external force, the second quantum circuit of vortex function calculation and the modular third quantum circuit for each grid unit in the discretized numerical grid of fluid motion, and construct a non-unitary matrix; wherein the state parameters of the grid unit are stored in a quantum state vector simulator, and the quantum state vector simulator can operate the address and data in the quantum superposition state, and finally extract the macroscopic quantity from the quantum state vector simulator;
[0008] S2: Construct a migration gate, simulate the migration process of the lattice Boltzmann method through a controlled NOT gate, and set the left and right sliding gates;
[0009] S3: Initialize the required quantum registers and auxiliary quantum registers, the stream function and the lattice Boltzmann equation of the external force term, build the first quantum circuit, and combine the left-shift gate and the right-shift gate to obtain the stream function-external force term circuit;
[0010] S4: define the vortex function, and define the distribution function as the Adiag diagonal matrix, and define the quantum circuit of the vortex, decompose the Adiag diagonal matrix into two non-unitary matrices through the amplitude encoding method, define them as new diagonal matrix gates, and assemble them into the quantum circuit of the vortex, add left-shift gates and right-shift gates, and implement corresponding control bits, and finally add barriers to build the second quantum circuit and the third quantum circuit with the same structure;
[0011] S5: setting the boundary conditions of the vortex function;
[0012] S6: Use the vortex function circuit to evolve the quantum state, extract the evolved quantum state, take the result as a real number, calculate the stream function, vortex function, and source term through the Stimestep and Vtimestep functions, and continuously iterate and update until a stable fluid state is reached, perform visual drawing, and output the calculated values of the stream function and vortex function.
[0013] Wherein, S1 also includes a method: constructing a non-unitary matrix and decomposing it into a linear combination of two unitary matrices.
[0014] The left sliding door and the right sliding door in S2 are defined as:
[0015] and
[0016] in, : Right sliding door; : Left sliding door.
[0017] The lattice Boltzmann equations for the stream function and external force terms in S3 are defined as:
[0018] , ;
[0019] in, is the stream function, represents the stream function balance function, It is an external force term.
[0020] Wherein, the S3 also includes constructing a phase gate in the quantum circuit to simulate the collision process of the LBM method, the steps including:
[0021] Assumptions represents the phase gate, X represents the bit flip gate, lambda is the angle value, and the steps of each quantum operation are as follows:
[0022] S31: Applying phase gates on qubits: , For the lambda angle, is the current bit;
[0023] S32: Apply X-gate to flip the quantum state , and applying the phase gate;
[0024] S33: Apply the X gate to restore the quantum state. The final quantum state can be expressed as:
[0025] .
[0026] Wherein, the S3 further comprises the steps of:
[0027] According to the definitions of the left shift gate and the right shift gate, the rshift function and the lshift function are constructed, and the four directions of the D2Q5 model in the lattice Boltzmann method are defined using multiple control gates. The control state is a specific 4-bit binary string, 1: 0001; 2: 0010; 3: 0011; 4: 0100. These shift operations are then applied to the quantum bits. Finally, the barrier in the quantum computing library qiskit is added, and then 4 Hadamard gates are added.
[0028] The quantum circuit of the vortex of S4 is defined by the following formula:
[0029] First, define the equilibrium distribution function of the lattice Boltzmann method:
[0030] ,
[0031] is the equilibrium distribution function of the vortex function, is the position vortex function, where is the weight coefficient, is the lattice velocity, is the flow velocity, is the lattice speed of sound, Representative position time ,
[0032] Probability distribution function It is expressed as the sum of equilibrium distribution function and non-equilibrium distribution function:
[0033] ;
[0034] ;
[0035] in, is a non-equilibrium distribution function, are the partial derivatives corresponding to the x and y directions, is the lattice speed of sound, is the relaxation parameter, is the flow velocity, is the identity matrix;
[0036] The lattice Boltzmann equation can be reformulated as:
[0037] ; ;
[0038] in, is the latest state of the probability distribution function, is the time step and B is the balance term.
[0039] Wherein, the S4 also includes the steps of: inputting the distribution function as a parameter into the Diagonalgate diagonal matrix based on the qiskit library, obtaining the diagonal matrix quantum gate through the amplitude coding technology, and decomposing the diagonal matrix quantum gate into a series of realizable quantum logic gates;
[0040] The decomposition of the diagonal matrix is achieved by extracting the phase difference layer by layer: For each pair of diagonal elements Can be gate to extract the phase, The angle is obtained by the wts weight:
[0041] ;
[0042] Perform layer-by-layer reduction on the diagonal matrix quantum gates, passing the next layer of the matrix to the higher layer operation after each operation;
[0043] For the phase difference between any two adjacent diagonal elements, the phase difference and the residual phase are extracted, and the distribution function is converted into a diagonal matrix quantum gate to simulate the collision step of the LBM method. is the phase value of the revolving door:
[0044] ,
[0045] The remaining global phase is then applied in the final layer.
[0046] Wherein, the mathematical model of the diagonal matrix is:
[0047]
[0048] C is a diagonal matrix, is the initial phase, is the resulting rotation angle. U and Represents the before and after states of a quantum operation.
[0049] Wherein, the boundary condition formula of the vortex function in S5 is:
[0050] ,
[0051] is the value of the vortex function at this time;
[0052] When the boundary is a solid wall, U=0, .
[0053] is the stream function value, is the vertical grid spacing.
[0054] The implementation of the embodiment of the present invention has the following beneficial effects: the present invention combines the parallelism of quantum computing with the advantages of the lattice Boltzmann method, and linearizes the collision operator in the lattice Boltzmann equation by using the non-equilibrium correction term with adjustable relaxation parameters derived from the Chapman-Enskog theory and the Maxwell equilibrium state function, thereby constructing an efficient fluid dynamics solution framework. The characteristics of quantum computing enable it to transform the quantum state in the Hilbert space through quantum logic gates, thereby efficiently solving complex computational problems in fluid mechanics. By encoding the actual problem into the quantum state vector of the quantum bit, the vector is directly changed by quantum operation to solve the problem without iterating the quantum bit state one by one. For example, in the process of matrix and vector multiplication, the operation can be completed by only using quantum logic gates to act on the input quantum state, thereby significantly improving the computational efficiency. The present invention overcomes the limitations of traditional quantum computing in dealing with nonlinear collision terms and low Reynolds number flow simulations in the lattice Boltzmann equation, uses nonequilibrium correction terms containing adjustable relaxation parameters to linearize the collision operator in the lattice Boltzmann equation, uses specific quantum logic gates and circuit designs to achieve the solution of nonlinear terms, and combines relaxation parameter adjustment strategies to flexibly adapt to different flow conditions and accurately simulate a wider range of complex flow phenomena. The method is efficient, widely applicable and practical, not only significantly reduces the computational complexity of complex fluid behavior, but also provides efficient and flexible solutions for complex fluid engineering problems in the fields of aerospace, chemical industry, biomedicine, wind energy, ocean energy and other new energy utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 is a schematic diagram of a flow function and an external force term circuit of the present invention;
[0056] Figure 2 is a schematic diagram of a migration circuit of the present invention;
[0057] Figure 3 is the schematic diagram of the vortex function circuit;
[0058] Figure 4 It is a diagonal migration roadmap;
[0059] Figure 5 It is a schematic diagram of the complete calculation iteration logic flow of the present invention. DETAILED DESCRIPTION
[0060] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.
[0061] Reference Figures 1 to 5 Schematic diagram shown.
[0062] In the process of analyzing fluid dynamics using the lattice Boltzmann method (LBM), a quantum computational fluid dynamics simulation method based on the lattice Boltzmann method of the embodiment of the present invention needs to go through several stages of collision, migration, boundary conditions, and macroscopic quantity calculation. Based on this process, this method constructs a first quantum circuit, a second quantum circuit, and a third quantum circuit that can be added as a modular circuit. The first quantum circuit is a stream function-external force circuit, the second quantum circuit is a vortex function circuit, and the third quantum circuit is a module circuit. The circuit can choose to calculate other physical fields such as temperature or phase field. The construction of these three quantum circuits follows the calculation steps of LBM: collision, migration, boundary conditions, and macroscopic quantity calculation. The main implementation steps are as follows.
[0063] Step 1: Initialization
[0064] This step is to prepare for fluid simulation, and various parameters are required to initially define the fluid phenomena.
[0065] Define the required parameters, define the grid model DmQn used, including the weight value wts, grid sound velocity , Reynolds number , number of quantum bits n, relaxation parameter And the grid number M, etc.
[0066] In the process of analyzing computational fluid dynamics using the lattice Boltzmann method, a first quantum circuit of stream function-external force, a second quantum circuit of calculating vortex function and a modular third quantum circuit are constructed for each grid cell in the discretized numerical grid of fluid motion, wherein the state parameters of the grid cell are stored in a quantum state vector simulator, which can operate addresses and data in quantum superposition states, and finally what is extracted from the quantum state vector simulator is the macroscopic quantity.
[0067] Since the calculation based on the LBM method constructs a non-unitary matrix, in order to support quantum computing, the non-unitary matrix needs to be converted into a unitary matrix (the unitary matrix satisfies that the result of multiplying itself by its transposed matrix is the unit matrix). The linear combination unit (LCU) algorithm is used to decompose the non-unitary matrix into a linear combination of two unitary matrices, and a function is defined to implement matrix decomposition to ensure that the quantum computing framework can handle non-unitary matrices. The specific process is as follows, and this process is implemented in Python:
[0068]
[0069] Through the above formula, the matrix A is divided into two unitary matrices, namely top half(A) and bottom half(A), where i is the imaginary number symbol.
[0070] In quantum computing, amplitude is a core concept of quantum state, which reflects the complex value of the "probability" of a quantum system being measured in a specific state. Amplitude is closely related to the probability of quantum state, but it is essentially a complex value, and the measurement probability can only be obtained by squaring (modulo squaring), so top half (A) and bottom half (A) meet the amplitude requirement. This condition ensures that the sum of the measurement probability of the quantum state is 1, which satisfies the normalization condition of the amplitude.
[0071] Normalizing the amplitude of matrix A is the core theoretical basis for ensuring that the sum of measurement probabilities is 1 in quantum computing. In this problem, by dividing matrix A into two unitary matrices, top half(A) and bottom half(A), the properties of unitary matrices are implicitly satisfied. All diagonal matrices in the following text must undergo this decomposition to meet the amplitude coding requirements in quantum computing. Traditional non-unitary matrix inputs cannot be used for quantum computing.
[0072] Step 2: Migrate Gate Build
[0073] Before constructing the quantum circuit, we first construct the migration quantum gate. Using the principle of quantum walk, we simulate the migration process of the lattice Boltzmann method through a series of controlled NOT gates (CNOT gates). First, we set a left-shift gate and a right-shift gate:
[0074] and
[0075] in, : Right sliding door; : Left sliding door.
[0076] The above matrix is used to simulate the left-right migration of the lattice model, and the transpose of the left and right matrices is used to simulate the up-down migration. When the D2Q5 lattice model in the LBM method is used, only two left-sliding gates and two right-sliding gates are needed.
[0077] Alternatively, you can also simulate diagonal migration, for example, migration at D2Q9 can be simulated like this:
[0078] st: migration, st[1]: Rn, st[2]: Ln, st[3]: Rn.T, st[4]: Ln.T, st[5]: Rn* Rn.T, st[6]: Ln* Ln.T, st[7]: Ln* Rn.T, st[8]: Rn* Ln.T, (.T here represents the transposed matrix) When performing diagonal migration, two migration gates need to be applied to the same control bit. Quantum circuits are constructed based on this principle.) When the D2Q9 model is used for simulation, a linear combination of left-shift gates and right-shift gates is required to achieve diagonal migration.
[0079] The left shift operation is expressed in the quantum circuit as an operation to control the conditions of each quantum bit, as follows:
[0080] , x is the input state at this time, the input state is transferred to an output state that is shifted left by one bit, the rightmost quantum bit is set to 0 (initial state), and the state transfer is achieved using a controlled CNOT gate. The mathematical description is: , x is the input state at this time, i represents the index of a quantum bit, indicating the number of the quantum bit on which the operation is performed, and the rightmost quantum bit is set by the Pauli-X gate to The circuit for the right shift operation is similar, but the execution direction is opposite. , the mathematical operation of the gate is described as , the leftmost qubit is set by the Pauli-X gate to .
[0081] Step 3: Construction of the first quantum circuit of stream function-external force term
[0082] First, we need to define the phase value lambda according to the weight value wts, lambda=arcos(wts). According to the following stream function and the lattice Boltzmann equation of the external force term, we construct a phase gate in the quantum circuit according to this theory to simulate the collision process of the LBM method:
[0083] , ;
[0084] in, is the stream function, represents the stream function balance function, It is an external force term.
[0085] Assumptions represents the phase gate, X represents the bit flip gate, lambda is the angle value, and the steps of each quantum operation are as follows:
[0086] 1. First apply the phase gate on the qubit: , For the lambda angle, is the current bit.
[0087] 2. Then apply the X gate to flip the quantum state , and apply the phase gate in 1 again.
[0088] 3. Finally, apply the X gate again to restore the quantum state. The final quantum state can be expressed as:
[0089] .
[0090] Initialize the required quantum registers and auxiliary quantum registers, the lattice Boltzmann equations of the stream function and the external force term, build the circuit, and combine the left-shift gate and right-shift gate built in step 2 to obtain the stream function-external force term circuit, such as Figure 1 The shown figure is the flow function-external force term circuit. The D2Q5 model built in this embodiment requires 2 left-shift gates and 2 right-shift gates. According to the definition of the left-shift gate and the right-shift gate in step 2, the rshift function and the lshift function are constructed, and the four directions of the D2Q5 model are defined by using multiple control gates. The control state is a specific 4-bit binary string, 1: 0001; 2: 0010; 3: 0011; 4: 0100. Then apply these shift operations to specific quantum bits. Finally, add the barrier barrier in the quantum computing library qiskit to prevent the merging of gate operations, which is also convenient for debugging and visualization. Then add 4 Hadamard gates to put it in a uniform superposition state. This step is equivalent to macroscopic superposition, which prepares for subsequent measurement and interference operations.
[0091] This step forms the first quantum circuit for calculating the stream function-external force term by assembling phase gates and migration gates, simulating the collision and migration of the stream function-external force term and the macroscopic superposition process.
[0092] Step 4: Construction of the second quantum circuit of vortex function
[0093] Before performing vortex function circuit operations, it is necessary to first define the coefficients of the vortex function diagonal matrix, which conforms to mathematical logic on the one hand and quantum computing logic on the other.
[0094] By defining the stream function , the velocity field can be expressed as:
[0095] ;
[0096] : speed in x direction, : Velocity in the y direction. Here we get the partial derivatives of the stream function.
[0097] The quantum circuit of the vortex is defined by the following formula, first adopting the equilibrium distribution function of the lattice Boltzmann method:
[0098]
[0099] is the equilibrium distribution function of the vortex function, is the position vortex function, where is the weight coefficient, is the lattice velocity, is the flow velocity, is the lattice speed of sound, Representative position time , then define the non-equilibrium term according to the formula: According to the Chapman-Enskog (CE) theory, the equilibrium distribution function (PDF) of the lattice Boltzmann equation (LBE) corresponds to the Navier-Stokes equation (NSE) at a second-order small scale (molecular mean free path). Probability distribution function It can be expressed as the sum of equilibrium distribution function and non-equilibrium distribution function:
[0100] ;
[0101] ;
[0102] in, is a non-equilibrium distribution function, are the partial derivatives corresponding to the x and y directions, is the lattice speed of sound, is the relaxation parameter, is the flow velocity, is the identity matrix. Therefore, the lattice Boltzmann equation (LBE) is reformulated as:
[0103] ; ;
[0104] in, is the latest state of the probability distribution function, is the time step and B is the balance term.
[0105] Define the distribution function as the Adiag diagonal matrix, and use the Diagonalgate diagonal matrix in the qiskit library as a parameter input to get a diagonal matrix quantum gate. Diagonal matrices are usually used to implement quantum gates because unitary matrices need to be operated in quantum computing, and diagonal matrices are a special type of unitary matrix with a simple structure and good computing characteristics. In order to match the quantum state dimension, it is necessary to fill the matrix with all zeros to match the quantum dimension 2 n .
[0106] The circuit uses the Qiskit-based diagonal matrix class (Diagonal gate). In quantum computing, a diagonal matrix is a special unitary matrix whose non-zero elements are only located on the main diagonal. The function of this class is to build a quantum gate based on a diagonal matrix and provide methods to support its decomposition and verification.
[0107] The diagonal matrix quantum gate is decomposed into a series of realizable quantum logic gates (such as Rz gate and controlled rotation gate). The decomposition of the diagonal matrix is achieved by extracting the phase difference layer by layer. The phase difference is extracted: For each pair of diagonal elements Can be gate to extract the phase, The angle is obtained by the wts weight:
[0108] ;
[0109] Since there are multiple such gates in the diagonal matrix class, the diagonal matrix quantum gates are then reduced layer by layer, and the next layer of the matrix is passed to the higher layer operation after each operation. For the phase difference between any two adjacent diagonal elements, the phase difference and the residual phase are extracted, and the distribution function can be converted into a diagonal matrix quantum gate. This step can simulate the collision step of the LBM method. is the phase value of the revolving door:
[0110] , ;
[0111] The remaining global phase is then applied in the last layer. The mathematical model of the diagonal matrix is:
[0112]
[0113] C is a diagonal matrix, is the initial phase, is the resulting rotation angle. U and Represents the before and after states of a quantum operation.
[0114] Define the distribution function constructed in the previous step as the Adiag diagonal matrix and input the Diagonalgate diagonal matrix as a parameter. In order to match the quantum state dimension, it is necessary to fill the matrix with all zeros to match the quantum dimension 2n.
[0115] According to the non-unitary matrix conversion in step 1, the current diagonal matrix Adiag is split into B1, B2 to ensure its unitary property. In the algorithm, the Hadamard gate acting on the auxiliary bit is used as a preparation gate, and the equation is realized by implementing a second Hadamard gate on the auxiliary bit.
[0116] According to step 1, convert the current diagonal matrix A into two diagonal matrix quantum gates B1 and B2 to ensure its unitary nature. After assembling the diagonal matrix gates to the circuit, perform operations similar to the stream function, add left-shift gates and right-shift gates, and assemble the diagonal matrix gates to the circuit. Perform operations similar to the stream function, add the displacement matrix, and implement the corresponding control bits in the same way. Since there are no quantum bits storing source terms in this part, only three binary control bits are required: 001; 2: 010; 3: 011; 4: 100. Finally, add a barrier to prevent merging gate operations, which is also convenient for debugging and visualization. Add three Hadamard gates to the quantum bit control bits to put them in a uniform superposition state. This step is equivalent to macroscopic superposition, preparing for subsequent measurement and interference operations. Figure 2 Shown is the second quantum circuit diagram of the vortex function.
[0117] Step 5: Third quantum circuit definition
[0118] This method can be extended to the calculation of multi-physics field coupling based on the circuit structure of the vortex function. Here, the same circuit structure as the vortex function circuit can be used to build other physical field circuits such as the temperature field circuit. The temperature balance function and distribution function here also use the same calculation method as the distribution function in step 4. The temperature circuit is added as a module to the main function iteration. The circuit structure is as follows Figure 2 As shown, the circuit structure is the same as the second quantum circuit.
[0119] Step 6: Boundary Condition Correction
[0120] According to the fluid phenomenon to be simulated, specific boundary conditions should be set. The boundary conditions of the stream function are all 0, and the boundary condition formula of the vortex function is as follows:
[0121] ,
[0122] is the value of the vortex function at this time;
[0123] When the boundary is a solid wall, U=0, .
[0124] is the stream function value, is the vertical grid spacing.
[0125] Step 7: Main function iteration
[0126] Define the Stimestep function and Vtimestep function to prepare for the evolution of the circuit. Expand the stream function and source term to the format and dimension required by the quantum state vector, initialize the stream function as the quantum state vector, and use the stream function-external force term circuit to perform evolution to extract the evolved quantum state. Take the result as a real number and set the stream function boundary to a specific value; in order to avoid matching the dimensionality requirements of quantum bits in quantum computing (must be 2 n ) Expand the vorticity field to a larger dimension that matches the required dimension (by repeating and padding the zero matrix), and initialize the vorticity field to the quantum state vector. Use the expand method to expand the quantum state to match the required dimension of the circuit 2 n . Use the vortex function circuit to evolve the quantum state, extract the evolved quantum state, and take the result as a real number.
[0127] What we get here are the stream function external force terms and the vortex function recording the quantum state after collision and migration, and we perform boundary value operations.
[0128] The boundary value calculated in step 6 is applied to the boundary of the vortex field. At this step, the process of collision, migration, macroscopic quantity processing and boundary value application of the external force term of the stream function and the vortex function is completely constructed.
[0129] The stream function, vortex function, and source term are calculated through the Stimestep and Vtimestep functions and updated iteratively until a stable fluid state is reached. When a stable fluid state is reached, the Matplotlib library in Python is used to visualize the plot and output the calculated values of the stream function and vortex function to analyze the fluid state.
[0130] The above disclosure is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A quantum computational fluid dynamics simulation method based on the lattice Boltzmann method, characterized in that: The following methods are included: S1: Initialize the lattice model DmQn and parameters, construct the first quantum circuit of stream function-external force, the second quantum circuit of vortex function calculation and the modular third quantum circuit for each grid unit in the discretized numerical grid of fluid motion, and construct a non-unitary matrix; wherein the state parameters of the grid unit are stored in a quantum state vector simulator, and the quantum state vector simulator can operate the address and data in the quantum superposition state, and finally extract the macroscopic quantity from the quantum state vector simulator; S2: Construct a migration gate, simulate the migration process of the lattice Boltzmann method through a controlled NOT gate, and set the left and right sliding gates; S3: Initialize the required quantum registers and auxiliary quantum registers, the stream function and the lattice Boltzmann equation of the external force term, build the first quantum circuit, and combine the left-shift gate and the right-shift gate to obtain the stream function-external force term circuit; S4: define the vortex function, and define the distribution function as the Adiag diagonal matrix, and define the quantum circuit of the vortex, decompose the Adiag diagonal matrix into two non-unitary matrices through the amplitude encoding method, define them as new diagonal matrix gates, and assemble them into the quantum circuit of the vortex, add left-shift gates and right-shift gates, and implement corresponding control bits, and finally add barriers to build the second quantum circuit and the third quantum circuit of the same structure; S5: setting the boundary conditions of the vortex function; S6: Use the vortex function circuit to evolve the quantum state, extract the evolved quantum state, take the result as a real number, calculate the stream function, vortex function, and source term through the Stimestep and Vtimestep functions, and continuously iterate and update until a stable fluid state is reached, perform visual drawing, and output the calculated values of the stream function and vortex function.
2. The method according to claim 1, characterized in that: The S1 also includes a method: constructing a non-unitary matrix and decomposing it into a linear combination of two unitary matrices.
3. The method according to claim 1, characterized in that The left sliding door and the right sliding door in S2 are defined as: and ; in, : Right sliding door; : Left sliding door.
4. The method according to claim 1, characterized in that The lattice Boltzmann equations for the stream function and external force terms in S3 are defined as: , ; in, is the stream function, represents the stream function balance function, It is an external force term.
5. The method according to claim 4, characterized in that The S3 also includes constructing a phase gate in the quantum circuit to simulate the collision process of the LBM method, the steps comprising: Assumptions represents the phase gate, X represents the bit flip gate, lambda is the angle value, and the steps of each quantum operation are as follows: S31: Applying phase gates on qubits: , For the lambda angle, is the current bit; S32: Apply X-gate to flip the quantum state , and applying the phase gate; S33: Apply the X gate to restore the quantum state. The final quantum state can be expressed as: 。 6. The method according to claim 5, characterized in that The S3 further comprises the steps of: According to the definitions of the left shift gate and the right shift gate, the rshift function and the lshift function are constructed, and the four directions of the D2Q5 model in the lattice Boltzmann method are defined using multiple control gates. The control state is a specific 4-bit binary string, 1: 0001; 2: 0010; 3: 0011; 4: 0100. These shift operations are then applied to the quantum bits. Finally, the barrier in the quantum computing library qiskit is added, and then 4 Hadamard gates are added.
7. The method according to claim 1, characterized in that The quantum circuit of the S4 vortex is defined by the following formula: First, define the equilibrium distribution function of the lattice Boltzmann method: , is the equilibrium distribution function of the vortex function, is the position vortex function, where is the weight coefficient, is the lattice velocity, is the flow velocity, is the lattice speed of sound, Representative position time , Probability distribution function It is expressed as the sum of equilibrium distribution function and non-equilibrium distribution function: ; ; in, is a non-equilibrium distribution function, are the partial derivatives corresponding to the x and y directions, is the lattice speed of sound, is the relaxation parameter, is the flow velocity, is the identity matrix; The lattice Boltzmann equation can be reformulated as: ; ; in, is the latest state of the probability distribution function, is the time step and B is the balance term.
8. The method according to claim 7, characterized in that The S4 also includes the steps of: inputting the distribution function as a parameter into the Diagonalgate diagonal matrix based on the qiskit library to obtain a diagonal matrix quantum gate, and decomposing the diagonal matrix quantum gate into a series of realizable quantum logic gates; The decomposition of the diagonal matrix is achieved by extracting the phase difference layer by layer: For each pair of diagonal elements Can be gate to extract the phase, The angle is obtained by the wts weight: ; Perform layer-by-layer reduction on the diagonal matrix quantum gates, passing the next layer of the matrix to the higher layer operation after each operation; For the phase difference between any two adjacent diagonal elements, the phase difference and the residual phase are extracted, and the distribution function is converted into a diagonal matrix quantum gate to simulate the collision step of the LBM method. is the phase value of the revolving door: , ; The remaining global phase is then applied in the final layer.
9. The method according to claim 8, characterized in that The mathematical model of the diagonal matrix is: ; C is a diagonal matrix, is the initial phase, To obtain the rotation angle, U and Represents the before and after states of a quantum operation.
10. The method according to claim 9, characterized in that The boundary condition formula of the vortex function in S5 is: , is the value of the vortex function at this time; When the boundary is a solid wall, U=0, , is the stream function value, is the vertical grid spacing.
Citation Information
Patent Citations
Computational fluid dynamics simulation method and device based on quantum algorithm, and equipment
CN114091363A
Computational fluid dynamics simulation method and apparatus based on quantum algorithm, and device
WO2022027916A1