A multi-core computing method and device for lattice boltzmann D2Q9 model
By dividing the computing cores of a multi-core SoC chip into a D2Q9 logic structure and alternately reading and transmitting grid data in the core memory unit, the problem of wasted computing resources in multi-core SoC chips is solved, and more efficient utilization of computing performance is achieved.
Patent Information
- Application Number
- CN202411990052.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-12-31
AI Technical Summary
When using the D2Q9 model for fluid flow calculations, the computing resources of multi-core SoC chips are wasted significantly, and the chip performance cannot be fully utilized. This is mainly due to the small cache space, which prevents computation and data transmission from being performed simultaneously.
The multi-core SoC chip's processing core is divided into a D2Q9 logic structure, and the internal storage unit is divided into Ping and Pang storage sub-units. Grid data is read and transmitted alternately from the external storage unit. The computing unit processes the data alternately according to the reading order, realizing the alternating operation of computing and data transmission.
It improves the utilization rate of chip computing resources, reduces resource waste, can handle computing tasks of more grids, and fully utilizes the computing performance of the chip.
Smart Images

Figure CN119761261B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of multi-core computing, and particularly relates to a multi-core computing method and device for a lattice Boltzmann D2Q9 model. BACKGROUND
[0002] The lattice Boltzmann method (LBM) is a computational fluid dynamics method based on the principles of statistical physics, used to simulate and study the behavior of fluids. The basic idea of LBM is to regard the fluid as being composed of a large number of randomly moving small particles, and the exchange of momentum and energy between particles is achieved through particle migration and particle collision. The D2Q9 model is a two-dimensional model of LBM, which includes 9 discrete velocity directions of particles, and is used for fluid flow simulation in two-dimensional space.
[0003] When calculating fluid flow using the D2Q9 model, the two-dimensional space is divided into a plurality of lattices, and particle migration and particle collision between lattices are calculated. However, when a large number of lattices are calculated, due to the small cache space inside the chip, after one calculation is completed, a large amount of data generated by the calculation needs to be transmitted to the external storage space first, and the cache space inside the chip is released at the same time to read the data required for the next calculation, and then the next calculation is performed. The calculation and data transmission of the chip cannot be performed at the same time, resulting in resource waste. SUMMARY
[0004] The embodiments of the present application provide a multi-core computing method and device for a lattice Boltzmann D2Q9 model, to solve the technical problem of waste of computing resources of a multi-core SoC chip and inability of the chip to fully exert its performance.
[0005] In a first aspect, the embodiments of the present application provide a multi-core computing method for a lattice Boltzmann D2Q9 model, comprising:
[0006] The operation cores of a multi-core SoC chip are logically divided to form a D2Q9 logical structure, the D2Q9 logical structure including a two-dimensional logical structure of at least one 3 n ×3 n operation cores, and the operation cores of the D2Q9 logical structure including a calculation unit and an in-core storage unit;
[0007] The two-dimensional spatial distribution of the fluid is divided using the lattice Boltzmann D2Q9 model to obtain a lattice matrix including m×m lattices, each lattice representing a fluid particle corresponding to the two-dimensional spatial distribution, and the flow state of the fluid particle being represented by lattice point data, the lattice point data including a position marker of the corresponding lattice in the lattice matrix, and the lattice point data being stored in the out-core storage unit;
[0008] According to the D2Q9 logical structure and the lattice matrix, each operation core is allocated lattice point data of a lattice in the lattice matrix, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the lattice in the lattice matrix.
[0009] The in-core storage unit of each operation core is divided into a Ping area storage subunit and a Pang area storage subunit based on a first-in-first-out mechanism, and the Ping area storage subunit and the Pang area storage subunit alternately read lattice point data matching the operation core from the out-core storage unit according to the position marker sequence.
[0010] The calculation unit of the operation core alternately performs migration process calculation on the lattice point data read by the Ping area storage subunit and the Pang area storage subunit, when the operation core performs calculation on the lattice point data read by the Ping area storage subunit, the Pang area storage subunit performs data transmission with the out-core storage unit, when the operation core performs calculation on the lattice point data read by the Pang area storage subunit, the Ping area storage subunit performs data transmission with the out-core storage unit, the data transmission includes reading of the lattice point data and storage of the calculation completed lattice point data, the calculation completed lattice point data includes local data and migration data, the local data is the distribution probability of the fluid particle at the center lattice in the D2Q9 model, and the migration data is the distribution probability of the fluid particle at the center lattice in the D2Q9 model in the direction of the eight adjacent lattices.
[0011] The calculation unit of the operation core performs collision process and boundary processing calculation on the local data and the lattice point data of the corresponding lattice according to the position marker of the lattice point data read by the in-core storage unit, and performs collision process and boundary processing calculation on the migration data and the lattice point data of the adjacent lattice of the corresponding lattice, respectively, or transmits the migration data to the in-core storage unit of the adjacent operation core in the D2Q9 logical structure, and the calculation unit of the adjacent operation core performs collision process and boundary processing calculation on the migration data and the lattice point data of the corresponding lattice in the matched lattice according to the position marker of the lattice point data.
[0012] According to the results of the collision process and the boundary processing calculation, it is judged whether the lattice matrix converges, if it converges, the calculation is ended and the results are output, if it does not converge, the migration process calculation is returned and restarted.
[0013] Further, the migration process calculation includes:
[0014] According to the preset discrete probability distribution function in the corresponding lattice point data of each lattice, the post-migration discrete probability distribution function is obtained after a preset time step, the post-migration discrete probability distribution function includes local discrete distribution function and migration discrete distribution function.
[0015] The macroscopic density and the macroscopic velocity of the fluid are calculated by using the post-migration discrete probability distribution function;
[0016] The equilibrium distribution function of the lattice data is calculated by using the macroscopic density and the macroscopic velocity of the fluid, and the equilibrium distribution function includes the local equilibrium distribution function and the migration equilibrium distribution function;
[0017] The local data is formed by using the local discrete distribution function and the local equilibrium distribution function, and the migration data is formed by using the post-migration discrete distribution function and the post-migration equilibrium distribution function.
[0018] Further, the data transmission includes reading and calculating of the lattice data and storing of the calculated lattice data, and includes:
[0019] The in-core memory unit stores the calculated lattice data in the out-of-core memory unit according to the position marker, associates the local data with the lattice corresponding to the position marker, and associates the migration data with the adjacent lattice of the lattice corresponding to the position marker;
[0020] The lattice data of the next lattice corresponding to the position marker in the out-of-core memory unit is read.
[0021] Further, the collision process and boundary processing calculation include:
[0022] The collision process calculation is performed by using the migration data associated with the lattice corresponding to the position marker by using the local data;
[0023] The boundary condition calculation is performed on the lattice close to the fluid-solid boundary by using the non-equilibrium extrapolation format.
[0024] Further, the boundary condition calculation on the lattice at the fluid-solid boundary by using the non-equilibrium extrapolation format includes:
[0025] The equilibrium distribution function of the wall lattice at the fluid-solid boundary is calculated according to the density and velocity of the wall lattice on the solid side;
[0026] The non-equilibrium distribution function of the wall lattice is determined according to the difference between the distribution function and the equilibrium distribution function of the fluid lattice on the fluid side at the fluid-solid boundary;
[0027] The distribution function of the wall lattice is determined according to the equilibrium distribution function and the non-equilibrium distribution function of the wall lattice, and is used to supplement the lattice data of the lattice at the fluid-solid boundary.
[0028] Further, the transmission of the migration data to the in-core memory unit of the adjacent operation core in the D2Q9 logical structure includes:
[0029] The inter-core data channel is established by using the scheduling unit of the operation core;
[0030] The migration data is transmitted to the adjacent operation core through the inter-core data channel;
[0031] The scheduling unit of the adjacent operation core stores the migration data into the off-core storage unit through the in-core storage unit, and associates the migration data with the lattice data of the adjacent lattice of the corresponding lattice according to the position marker.
[0032] Further, the Ping area storage subunit and the Pang area storage subunit alternately read the lattice data of the corresponding lattice from the off-core storage unit according to the position marker in sequence, including:
[0033] The Ping area storage subunit and the Pang area storage subunit of each operation core alternately read the lattice data of the corresponding lattice from the first lattice in the z×z lattice allocated to the current operation core in sequence.
[0034] Further, the method further comprises:
[0035] The macroscopic velocity of the fluid is obtained by using the discrete probability distribution function after the current collision process and boundary processing calculation, and the sum of the macroscopic velocities of all lattices in the fluid region after the current collision process and boundary processing calculation is compared with the macroscopic velocity of the fluid obtained according to the discrete probability distribution function after the last collision process and boundary processing calculation, to determine whether the lattice matrix converges.
[0036] Further, the method further comprises:
[0037] The multiple SoC chips including the D2Q9 logical structure are logically divided to form a D2Q9 chip structure, and the lattice data of the lattice matrix of z×z lattices divided based on the lattice Boltzmann D2Q9 model is calculated by using the D2Q9 chip structure.
[0038] In a second aspect, an embodiment of the present application provides a multi-core computing device for a lattice Boltzmann D2Q9 model, including:
[0039] The operation core logical structure generation module is configured to logically divide the operation cores of the multiple SoC chips to form a D2Q9 logical structure.
[0040] The lattice matrix generation module is configured to divide and generate a lattice matrix by using the lattice Boltzmann D2Q9 model to divide the two-dimensional spatial distribution of a fluid.
[0041] The lattice data distribution module is configured to distribute the lattice data of the corresponding region lattices in the lattice matrix according to the positions of the operation cores in the D2Q9 logical structure.
[0042] Ping / Pang storage module, for dividing the in-core storage unit of each operation core into Ping area storage subunit and Pang area storage subunit;
[0043] Migration process calculation module, for performing migration process calculation on the lattice data read by the in-core storage unit;
[0044] Collision process and boundary processing calculation module, for performing collision process calculation and boundary processing calculation on the current lattice data and the migration data according to the position mark of the lattice data;
[0045] Convergence judgment module, for judging whether the lattice converges according to the result of the collision process and boundary processing calculation.
[0046] The multi-core computing method and device for the lattice Boltzmann D2Q9 model provided by the embodiment of the present application, by dividing the plurality of operation cores of the SoC chip, makes it include at least one two-dimensional logical structure matched with the D2Q9 model, allocates the same size of lattice region in the lattice matrix to each operation core, and respectively calculates the two-dimensional space distribution of the divided lattice fluid, the adaptability of the two-dimensional logical structure of the operation core to the D2Q9 model is higher, the same size of lattice region is allocated to each operation core, the number of lattices that each operation core needs to calculate is the same, the load between the operation cores is balanced, which is beneficial to fully exert the computing performance of the chip. Meanwhile, the in-core storage space of the operation core is divided into two same storage subunits, the lattice point data of the lattice is sequentially read from the out-core storage unit alternately, and the computing unit of the operation core alternately calculates the to-be-processed data read by the two storage subunits according to the reading sequence, realizes the alternate running mode that the data in one storage subunit is calculated by the operation core and the data transmission between the other storage subunit and the out-core storage unit is performed, can fully utilize the computing resources of the operation core, reduces the resource waste, and can accommodate more lattice point data of the lattice through the out-core storage unit, and can be applied to more lattice calculation. BRIEF DESCRIPTION OF DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0048] Figure 1 The flowchart of the multi-core computing method for the lattice Boltzmann D2Q9 model according to the embodiment one of the present application;
[0049] Figure 2 The computing flowchart of the LBM according to the embodiment one of the present application;
[0050] Figure 3 A D2Q9 model diagram according to the embodiment one of the present application;
[0051] Figure 4 A two-dimensional logical structure of 3*3 operation cores according to the embodiment one of the present application;
[0052] Figure 5 A flow chart of a multi-core computing method of a lattice Boltzmann D2Q9 model according to the embodiment two of the present application;
[0053] Figure 6 A flow chart of a multi-core computing method of a lattice Boltzmann D2Q9 model according to the embodiment three of the present application;
[0054] Figure 7 A lattice diagram at a fluid-solid boundary according to the embodiment three of the present application;
[0055] Figure 8 A flow chart of a multi-core computing method of a lattice Boltzmann D2Q9 model according to the embodiment four of the present application;
[0056] Figure 9 A structure diagram of a multi-core computing device of a lattice Boltzmann D2Q9 model according to the embodiment seven of the present application. DETAILED DESCRIPTION
[0057] The present application will be further described below in conjunction with the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the present application are shown in the drawings, but not all the structures.
[0058] Embodiment one
[0059] Figure 1 A flow chart of a multi-core computing method of a lattice Boltzmann D2Q9 model according to the embodiment one of the present application, in this embodiment, the operation cores of the multi-core SoC are divided into a two-dimensional logical structure suitable for D2Q9, the in-core storage units are divided into two identical storage sub-units, the data of the out-core storage units are alternately read based on the first-in-first-out principle, and the computing units alternately calculate the to-be-processed data read by the two storage sub-units according to the reading sequence, and specifically includes the following steps:
[0060] The lattice Boltzmann LBM model is to regard the fluid as a large number of moving particles, and is realized through a calculation process of particle migration for multiple cycles and then collision and boundary processing, for predicting the motion state of the fluid, and the calculation flow of LBM is as shown in Figure 2As shown. The D2Q9 model is to divide the fluid distribution in two-dimensional space by using the lattice, and describe the distribution of micro fluid particles in nine directions of two-dimensional space respectively, as shown in Figure 3 As shown, through the discrete distribution function in each direction, the migration of particles to adjacent lattices is expressed, and after migration, collision and boundary treatment calculation are performed on each lattice, and the migration and collision and boundary treatment process are repeated, and the cycle is repeated until the model converges. In the iteration process of the model, since the migration process will generate data in nine directions, when the number of lattices is large, the cache space in the operation core is difficult to accommodate a large amount of data, and the data storage needs to be stored in the larger external storage of the core. When the operation core transmits data with the external storage, the calculation unit of the operation core will be in an idle state waiting for the next calculation data, causing resource waste and difficulty in efficiently utilizing the performance of the chip.
[0061] S101, logically divide the operation core of the multi-core SoC chip to form a D2Q9 logical structure, the D2Q9 logical structure includes at least one two-dimensional logical structure of 3 n ×3 n operation cores, the operation core of the D2Q9 logical structure includes a calculation unit and an in-core storage unit.
[0062] The operation core of the multi-core SoC chip is divided into a 3 n ×3 n two-dimensional logical structure, which can be matched with the two-dimensional spatial distribution of the fluid, and the grid point data of different regions of the lattice can be processed by different operation cores, which can be more adaptive to the algorithm characteristics, so that the load of the multiple operation cores of the SoC chip is more balanced, and the performance of the chip is fully utilized. As shown in Figure 4 , which can be similar to the characteristics of the D2Q9 model shown in Figure 3 , and is more adaptive to the algorithm of the D2Q9 model.
[0063] S102, divide the two-dimensional spatial distribution of the fluid by using the lattice Boltzmann D2Q9 model, obtain a lattice matrix including m×m lattices, each lattice represents a fluid particle corresponding to the two-dimensional spatial distribution, the flow state of the fluid particle is represented by grid point data, the grid point data includes a position mark of the corresponding lattice in the lattice matrix, and the grid point data is stored in the external storage unit.
[0064] The two-dimensional spatial distribution of the fluid is divided into m x m cells, and the flow state of the micro fluid particles in each cell is represented by the grid point data of each cell. The grid point data includes a position marker of the position of the cell in the cell matrix. The position marker can be used to perform migration, collision and boundary processing of the grid point data. In order to reduce the limitation of the storage space on the size of the data, the grid point data is stored in the external storage unit of the core.
[0065] In S103, the grid point data of each operation core is allocated to the grid point data of each operation core in the D2Q9 logical structure and the cell matrix, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the cell in the cell matrix. According to the position of the operation core in the D2Q9 logical structure, the grid point data of each operation core is allocated to the grid point data of each operation core in the D2Q9 logical structure and the cell matrix, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the cell in the cell matrix.
[0066] According to the position of the operation core in the D2Q9 logical structure, the grid point data of each operation core is allocated to the grid point data of each operation core in the D2Q9 logical structure and the cell matrix, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the cell in the cell matrix.
[0067] In S104, the in-core storage unit of each operation core is divided into Ping area storage subunit and Pang area storage subunit based on first-in first-out, and the Ping area storage subunit and the Pang area storage subunit are alternately read from the external storage unit according to the position marker order.
[0068] The in-core storage unit is divided into two identical storage subunits, and based on the principle of first-in first-out queue (FIFO), the two storage subunits alternately read data from the external storage unit, and the data read first is used for calculation unit calculation.
[0069] S105, the calculation unit of the operation core alternately performs migration process calculation on the grid data read by the Ping area storage subunit and the Pang area storage subunit, when the operation core performs calculation on the grid data read by the Ping area storage subunit, the Pang area storage subunit performs data transmission with the storage unit outside the core, when the operation core performs calculation on the grid data read by the Pang area storage subunit, the Ping area storage subunit performs data transmission with the storage unit outside the core, the data transmission includes reading of the grid data and storage of the calculation completed grid data, the calculation completed grid data includes the local grid data and the migration data, the local grid data is the distribution probability of the fluid particles in the center grid under the D2Q9 model, and the migration data is the distribution probability of the fluid particles in the center grid under the D2Q9 model in the direction of the adjacent 8 grids.
[0070] Based on the first-in first-out principle, the calculation unit performs migration process calculation on the to-be-processed data read first into the Ping area storage subunit, and then performs migration process calculation on the to-be-processed data read later into the Pang area storage subunit; when calculating the data in the Ping area storage subunit, the Pang area storage subunit performs data transmission with the storage unit outside the core, and when calculating the data in the Pang area storage subunit, the Ping area storage subunit performs data transmission with the storage unit outside the core, and the cycle is repeated. The calculation completed data obtained by the migration process calculation is the probability of the particles in the current grid migrating in the direction of 9 in the D2Q9 model, including the local grid data indicating keeping the position unchanged and 8 migration data indicating migrating to the adjacent 8 grids respectively. For example, the data transmission unit of the operation core first reads the to-be-processed data from the storage unit outside the core into the Ping area storage subunit; then the calculation unit calculates the to-be-processed data in the Ping area storage subunit, while the data transmission unit reads the to-be-processed data from the storage unit outside the core into the Pang area storage subunit; then the calculation unit calculates the to-be-processed data in the Pang area storage subunit, while the data transmission unit stores the calculation completed data in the Ping area storage subunit into the storage unit outside the core and reads new data, and the cycle is repeated.
[0071] S106, the calculation unit of the operation core performs collision process and boundary processing calculation on the local grid data and the grid data of the corresponding grid according to the position mark of the grid data read by the storage unit in the core, and performs collision process and boundary processing calculation on the migration data and the grid data of the adjacent grid of the corresponding grid respectively; or the migration data is transmitted to the storage unit in the adjacent operation core in the D2Q9 logical structure, and the calculation unit of the adjacent operation core performs collision process and boundary processing calculation on the migration data and the grid data of the corresponding grid in the matched grid according to the position mark of the grid data.
[0072] After the migration process calculation is completed, the particle migration probability distribution of each cell in 9 directions is obtained, the particle migration probability distribution in the stationary direction is used as the cell data, and the data of other adjacent cells migrating to the cell is used for collision process calculation and boundary processing calculation. Correspondingly, the particle migration probability distribution in the direction of migrating to the adjacent cell is used as the migration data, and the collision process calculation and boundary processing calculation are performed with the cell data of the cell to which it migrates. That is, the cell data after the migration process and the migration data migrating to the cell perform collision process calculation and boundary processing calculation, and the migration data migrating to the adjacent cell and the cell data of the cell to which it migrates and other migration data migrating to the cell perform collision process calculation and boundary processing calculation. If the cell is located at the edge of the region allocated by the current operation core, the migration data obtained by the migration process calculation needs to be migrated to the corresponding adjacent operation core, and the collision process calculation and boundary processing calculation of the corresponding cell are performed by the adjacent operation core.
[0073] S107, according to the results of the collision process and boundary processing calculation, it is judged whether the cell matrix converges or not, if it converges, the calculation is ended and the results are output, if it does not converge, it is returned and the migration process calculation is started again.
[0074] The convergence of the cell matrix indicates that the flow state of the fluid corresponding to the cell matrix tends to be stable in the two-dimensional space distribution, and no longer changes. The results of the current round of collision process and boundary processing calculation can be compared with the results of the last round of collision process and boundary processing calculation, and whether the cell matrix converges or not can be judged by the difference between the two results. When the difference between the two results is very small and close to 0, it can be judged that the cell matrix converges, the calculation is ended and the results are output, otherwise the next round of migration process, collision process and boundary processing calculation is performed, and the calculation is repeated until convergence.
[0075] The embodiment divides the operation cores of the multi-core SoC chip into a two-dimensional logical structure matched with the D2Q9 model, respectively calculates the two-dimensional spatial distribution of the fluid divided into the lattices, allocates the same size of the lattice region in the lattice matrix to each operation core, makes the two-dimensional logical structure of the operation core more suitable for the D2Q9 model, and balances the load of each operation core, which is beneficial to fully exert the computing performance of the chip. Then, the in-core storage space of the operation core is divided into two same Ping area storage subunits and Pang area storage subunits, the lattice point data of the lattices are sequentially read from the out-of-core storage unit based on the first-in first-out principle, and the computing unit of the operation core alternately calculates the to-be-processed data read by the Ping area storage subunit and the Pang area storage subunit according to the reading sequence. When the operation core calculates the data in one of the storage subunits, the other storage subunit and the out-of-core storage unit perform data transmission, which ensures full use of the computing resources of the operation core, greatly reduces the idle of the computing resources, and can accommodate more lattice point data of the lattices by using the out-of-core storage unit, which can be applied to the calculation of more lattices.
[0076] Specifically, the Ping area storage subunit and the Pang area storage subunit alternately read the lattice point data of the lattices matched with the operation core from the out-of-core storage unit according to the position marker sequence, and the method comprises the following steps of:
[0077] The Ping area storage subunit and the Pang area storage subunit of each operation core alternately read the lattice point data of the corresponding lattices from the first lattice in the lattice region allocated to the current operation core in sequence. The Ping area storage subunit first reads the lattice point data of the first lattice in the first row of the lattice region allocated to the operation core, then the Pang area storage subunit reads the lattice point data of the next lattice in the first row, and the alternation is performed in this way until the lattice point data of the lattices in the first row are all read, and then the lattice point data of the lattices in the second row is read in the sequence, and the same is true for the lattices in the subsequent rows, until the lattice point data of all the lattices in the lattice region allocated to the operation core are read.
[0078] Embodiment two
[0079] Figure 5 The flowchart of the lattice Boltzmann D2Q9 model multi-core computing method described in the embodiment two of the application is optimized based on the above-mentioned embodiment. In the embodiment, the migration process calculation comprises the following steps of:
[0080] According to the preset discrete probability distribution function in the corresponding lattice point data of each lattice, the post-migration discrete probability distribution function is obtained after a preset time step, and the post-migration discrete probability distribution function comprises a current lattice discrete distribution function and a migration discrete distribution function.
[0081] The macroscopic density and the macroscopic velocity of the fluid are calculated by using the post-migration discrete probability distribution function.
[0082] calculating equilibrium distribution functions of the lattice data using macroscopic density and macroscopic velocity of the fluid, the equilibrium distribution functions including local equilibrium distribution functions and migration equilibrium distribution functions;
[0083] forming local data using the local discrete distribution functions and the local equilibrium distribution functions, and forming migration data using the migration discrete distribution functions and the migration equilibrium distribution functions.
[0084] Correspondingly, the multi-core computing method of the lattice Boltzmann D2Q9 model provided in the embodiment specifically includes:
[0085] S201, logically dividing operation cores of a multi-core SoC chip to form a D2Q9 logical structure, the D2Q9 logical structure including a two-dimensional logical structure of at least one 3 n ×3 n operation core, the operation core of the D2Q9 logical structure including a calculation unit and an in-core storage unit.
[0086] S202, dividing a two-dimensional spatial distribution of a fluid by using a lattice Boltzmann D2Q9 model to obtain a lattice matrix including m×m lattices, each lattice representing a fluid particle of the corresponding two-dimensional spatial distribution, a flow state of the fluid particle being represented by lattice data, the lattice data including a position marker of the corresponding lattice in the lattice matrix, and the lattice data being stored in an out-of-core storage unit.
[0087] S203, assigning, according to the D2Q9 logical structure and the lattice matrix, lattice data of lattices in the lattice matrix to each operation core, and the position of the operation core in the D2Q9 logical structure corresponding to the position of the lattices in the lattice matrix.
[0088] S204, dividing the in-core storage unit of each operation core into Ping area storage subunits and Pang area storage subunits based on a first-in-first-out mechanism by using a depth of 2, the Ping area storage subunits and the Pang area storage subunits alternately reading, from the out-of-core storage unit, lattice data matched with the operation core according to the position marker in sequence.
[0089] The calculation unit of the operation core alternately performs migration process calculation on the lattice data read by the Ping area storage subunits and the Pang area storage subunits.
[0090] S205, obtaining, according to a preset discrete probability distribution function in the corresponding lattice data of each lattice, a post-migration discrete probability distribution function after a preset time step, the post-migration discrete probability distribution function including a local discrete distribution function and a migration discrete distribution function.
[0091] Firstly, a discrete probability distribution function f i (x, t) of particles in a lattice is defined, the discrete probability distribution function describes a probability of migration of particles to a certain direction, and the discrete probability distribution functions after migration in 9 directions are obtained according to the discrete probability distribution function, and a calculation formula is as follows:
[0092]
[0093] Wherein, f i (x, t) represents the discrete probability distribution function before migration, f i (x, t) represents the discrete probability distribution function after migration, t represents a time step, and Δt represents a time step length. i Δt represents a product of a discrete velocity and the time step length, and x represents a space position.
[0094] The discrete probability distribution function after migration is a discrete probability distribution function in 9 directions, including a local discrete distribution function representing static and a migration discrete distribution function representing migration to adjacent lattices.
[0095] S206, macroscopic density and macroscopic velocity of the fluid are calculated by using the discrete probability distribution function after migration.
[0096] The macroscopic density of the fluid can be regarded as a sum of the micro-particle distribution function, and a calculation formula is as follows:
[0097]
[0098] Wherein, ρ(x, t) represents the macroscopic density of the x space position at the t time, f i * (x, t) represents the discrete probability distribution function after migration.
[0099] The macroscopic velocity u(x, t) of the fluid is an average value of the micro-velocity e i i in 9 directions weighted by the discrete probability distribution function f i (x, t), and a calculation formula is as follows:
[0100]
[0101] Wherein, u represents the macroscopic velocity of the fluid, ρ represents the macroscopic density of the fluid, f i represents the particle distribution function in the i direction, and e i represents the discrete velocity in the i direction.
[0102] S207, the equilibrium distribution function of the lattice data is calculated by using the macroscopic density and the macroscopic velocity of the fluid, and the equilibrium distribution function includes the local equilibrium distribution function and the migration equilibrium distribution function.
[0103] equilibrium distribution function f i eq This represents the fluid particle in the discrete velocity direction e i The probability density function, representing the distribution of particles in a fluid system at equilibrium, describes the distribution of particles along different discrete velocity directions when the system is in macroscopic equilibrium, from the perspective of microscopic particle distribution. A lattice constant Δx = 1, a time step Δt = 1, and a lattice velocity are defined in units of lattice cells. The formula for calculating the equilibrium distribution function is as follows:
[0104]
[0105] Among them, f i eq Let w represent the equilibrium distribution function. i This represents the weighting coefficient for each discrete velocity direction, ρ represents the macroscopic density of the fluid, ρ0 represents the average density of the fluid (taken as a constant value of 1 when calculating incompressible fluids), c represents the lattice velocity, and e... i Let i represent the discrete velocity in the i-direction, and u represent the macroscopic velocity of the fluid.
[0106] The equilibrium distribution functions in nine directions were calculated, including the stationary lattice equilibrium distribution function and the migration equilibrium distribution function representing migration to adjacent lattices.
[0107] S208 uses the lattice discrete distribution function and the lattice equilibrium distribution function to form lattice data, and uses the migration discrete distribution function and the migration equilibrium distribution function to form migration data.
[0108] The flow state of the current cell after the migration process is represented by the lattice discrete distribution function and the lattice equilibrium distribution function. The migration discrete distribution function and the migration equilibrium distribution function represent the particle distribution probability in the direction of migration to the eight adjacent cells. These are used to calculate the subsequent collision process and boundary treatment for each cell.
[0109] S209, the computation unit of the arithmetic core performs collision and boundary processing calculations on the grid data of the current grid and the grid data of the grid corresponding to the position mark, according to the position mark of the grid data read from the core memory unit; and performs collision and boundary processing calculations on the migration data and the grid data of the adjacent grids of the grid corresponding to the position mark respectively; or the migration data is transferred to the core memory unit of the adjacent arithmetic core in the D2Q9 logic structure, and the computation unit of the adjacent arithmetic core performs collision and boundary processing calculations on the migration data and the grid data of the corresponding grid in the matched grid according to the grid data position mark.
[0110] S210, judging whether the lattice matrix converges according to the result of the collision process and the boundary processing calculation, if yes, ending the calculation and outputting the result, if not, returning and starting the migration process calculation again.
[0111] The embodiment calculates the discrete probability distribution function and the equilibrium distribution function after migration to represent the distribution probability of particles in 9 directions after migration, and provides data preparation for the collision process calculation and the boundary processing calculation of the D2Q9 model.
[0112] Embodiment three
[0113] Figure 6 The flowchart of the multi-core calculation method of the lattice Boltzmann D2Q9 model according to the embodiment two, the embodiment is optimized on the basis of the above embodiment, in the embodiment, the data transmission includes reading of the lattice point data and storage of the calculated lattice point data, and the optimization is as follows:
[0114] The in-core storage unit stores the calculated lattice point data in the out-core storage unit according to the position mark, associates the current lattice data with the lattice corresponding to the position mark, and associates the migration data with the adjacent lattice of the lattice corresponding to the position mark;
[0115] The next lattice point data of the next lattice corresponding to the position mark is read from the out-core storage unit.
[0116] Correspondingly, the multi-core calculation method of the lattice Boltzmann D2Q9 model provided by the embodiment specifically includes:
[0117] S301, logically dividing the operation cores of the multi-core SoC chip to form a D2Q9 logical structure, the D2Q9 logical structure includes a two-dimensional logical structure of at least one 3 n ×3 n operation cores, and the operation core of the D2Q9 logical structure includes a calculation unit and an in-core storage unit.
[0118] S302, dividing the two-dimensional spatial distribution of the fluid by using the lattice Boltzmann D2Q9 model to obtain a lattice matrix including m×m lattices, each lattice represents a fluid particle corresponding to the two-dimensional spatial distribution, the flow state of the fluid particle is represented by lattice point data, the lattice point data includes a position mark of the corresponding lattice in the lattice matrix, and the lattice point data is stored in an out-core storage unit.
[0119] S303, assigning the lattice point data of the lattice in the lattice matrix to each operation core according to the D2Q9 logical structure and the lattice matrix, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the lattice in the lattice matrix one by one.
[0120] S304, the in-core memory unit of each operation core is divided into Ping area storage sub-unit and Pang area storage sub-unit based on first-in first-out with a depth of 2, and the Ping area storage sub-unit and the Pang area storage sub-unit alternately read the lattice point data matched with the operation core from the out-core memory unit according to the position marker sequence.
[0121] S305, the calculation unit of the operation core alternately performs migration process calculation on the lattice point data read by the Ping area storage sub-unit and the Pang area storage sub-unit.
[0122] S306, the in-core memory unit stores the calculation completed lattice point data into the out-core memory unit according to the position marker, associates the current lattice data with the lattice corresponding to the position marker, and associates the migration data with the adjacent lattice of the lattice corresponding to the position marker.
[0123] After the migration process calculation is completed, the discrete probability distribution function of each lattice remaining stationary after migration and the discrete probability distribution function in the direction of the adjacent 8 lattices are obtained, and correspondingly, each lattice also obtains the discrete probability distribution function of the adjacent lattice migrating to the current lattice. The discrete probability distribution functions remaining in the current lattice and migrating to the current lattice are associated to represent the data needed in the following collision process and boundary processing calculation.
[0124] S307, read the lattice point data of the next lattice corresponding to the position marker in the out-core memory unit.
[0125] After the data storage is completed, the space of the in-core memory unit is released, and at this time, the lattice point data of the next lattice is read for calculating the migration process of the next lattice.
[0126] S308, the calculation unit of the operation core performs collision process and boundary processing calculation on the lattice point data corresponding to the position marker according to the position marker of the lattice point data read by the in-core memory unit, and performs collision process and boundary processing calculation on the lattice point data of the adjacent lattice corresponding to the position marker of the migration data, respectively; or the migration data is transmitted to the in-core memory unit of the adjacent operation core in the D2Q9 logical structure, and the calculation unit of the adjacent operation core performs collision process and boundary processing calculation on the migration data and the lattice point data of the corresponding lattice in the matched lattice according to the position marker of the lattice point data.
[0127] S309, according to the results of the collision process and boundary processing calculation, it is judged whether the lattice matrix converges, if it converges, the calculation is ended and the results are output, if it does not converge, it is returned and the migration process calculation is restarted.
[0128] The embodiment can avoid the limitation of small capacity of the in-core memory unit, can be applied to more grid data calculation, the calculation unit of the operation core can still maintain the calculation state while data transmission, and the resource utilization is improved.
[0129] An optional implementation of the embodiment is that the collision process and boundary treatment calculation include:
[0130] The local grid data and the position marker are associated with the migration data of the corresponding grid, and the collision process calculation is performed on the migration data.
[0131] The discrete probability distribution function and the equilibrium distribution function in the local grid data and the migration data migrated to the local grid are used to perform the collision process calculation on each grid, and the calculation formula is as follows:
[0132]
[0133] Wherein, f i (x, t) represents the discrete probability distribution function after collision, f i * (x, t) represents the discrete probability distribution function after migration obtained by migration process calculation, τ represents the relaxation time, f i eq (x, t) represents the equilibrium distribution function. In order to ensure the stability of LBM calculation, the relaxation time τ usually satisfies τ > 0.5, when τ is close to 0.5, the numerical instability may occur in the calculation process; if τ is too large, the distribution function may need a long time step to approach the equilibrium distribution function, thereby prolonging the calculation time and possibly leading to inaccurate results.
[0134] The discrete probability distribution function after collision of each grid is obtained, which is used for next migration process calculation. If the grid is located at the edge of the fluid-solid boundary, since there is no particle migration and corresponding equilibrium distribution function on the solid side, the non-equilibrium extrapolation format can be used to calculate the boundary condition of the grid close to the fluid-solid boundary, and the discrete distribution function of the grid located at the edge of the fluid-solid boundary is obtained.
[0135] Optionally, the boundary condition calculation of the grid located at the fluid-solid boundary by using the non-equilibrium extrapolation format includes:
[0136] The equilibrium distribution function of the wall grid located at the solid side of the fluid-solid boundary is calculated according to the density and velocity of the wall grid.
[0137] The fluid-structure boundary (FSB) divides the lattice at the FSB into a fluid side and a solid side. Since there is no particle migration on the solid side, a non-equilibrium extrapolation scheme is needed to derive the equilibrium distribution function on the solid side for calculations in the next migration. The vertices on the fluid side of the lattice are designated as fluid lattice points, and the vertices on the solid side are designated as wall lattice points, as follows: Figure 7 As shown in the figure, the curve represents the fluid-solid boundary, and the fluid grid point x f and wall grid points x w The link between x b The point intersects with the fluid-structure boundary. At this point, the wall grid point x... w The distribution function includes equilibrium distribution function and non-equilibrium distribution function, using fluid grid points x f The density is defined by the wall grid points x w Density:
[0138]
[0139] Using fluid grid points x f speed and x ff Velocity interpolation defines the wall grid points x w speed:
[0140]
[0141] Where Δ represents the fraction of intersecting links in the fluid region,
[0142] u w1 The macroscopic velocity u at point b b The macroscopic velocity u at point f f interpolation, u w2 The macroscopic velocity u at point b b The macroscopic velocity u at point ff ff interpolation, u represents an approximation of the macroscopic velocity at point w. b U represents the macroscopic velocity at point b. f U represents the macroscopic velocity at point f. ff This represents the macroscopic velocity at point ff.
[0143] It is possible to obtain approximately fictitious wall grid points x w equilibrium distribution function at point The calculation formula is as follows:
[0144]
[0145] Among them, w i Indicates the weighting coefficient. Let ρw represent the approximate macroscopic density, ρ0 represent the average density (taken as a constant value of 1), c represent the lattice sound velocity, and e0 represent the average density.i Represents discrete velocity. This represents an approximate value of the macroscopic velocity at point w.
[0146] The non-equilibrium distribution function of the wall grid points is determined based on the difference between the distribution function of the fluid grid points on the fluid side at the fluid-solid boundary and the equilibrium distribution function.
[0147] Using fluid grid points x f and x ff Calculate the difference between the discrete distribution function and the equilibrium distribution function of the particles at the fluid grid point x. f The non-equilibrium distribution function is calculated using the following formula:
[0148] f i (ne) (x f )=f i (x f )-f i (eq) (x f )
[0149] f i (ne) (x ff )=f i (x ff )-f i (eq) (x ff )
[0150] Among them, f i (ne) (x f Let f denote the non-equilibrium distribution function of the particles at point f. i (x f () represents the discrete distribution function of the particles at point f, f i (eq) (x f Let f represent the particle equilibrium distribution function at point f, and fi i (ne) (x ff Let f denote the non-equilibrium distribution function of particles at point ff, where f is the particle distribution function. i (x ff ) represents the discrete particle distribution function at point ff, f i (eq) (x ff ) represents the particle equilibrium distribution function at point ff.
[0151] The wall grid points x can be obtained w non-equilibrium distribution function f i (ne) (x w The calculation formula for t is as follows:
[0152]
[0153] According to the equilibrium distribution function and the non-equilibrium distribution function of the wall lattice point, the distribution function of the wall lattice point is determined, which is used to supplement the lattice point data of the lattice at the fluid-solid boundary.
[0154] The boundary processing calculation is performed by using the equilibrium distribution function and the non-equilibrium function of the wall lattice point x w , that is, the collision process calculation of the lattice at the fluid-solid boundary, to obtain the particle discrete distribution function of the wall lattice point x w after collision, which is used for the next migration process calculation, and the formula is as follows:
[0155]
[0156] Where f i (x w , t) represents the particle discrete distribution function after collision, represents the equilibrium distribution function, τ represents the relaxation time, and f i (ne) (x w , t) represents the non-equilibrium distribution function.
[0157] Embodiment Four
[0158] Figure 8 The flowchart of the multi-core computing method of the lattice Boltzmann D2Q9 model according to Embodiment Four of the present application is based on the above-mentioned embodiments and is optimized in the present embodiment. In the present embodiment, the migration data is transmitted to the intra-core storage unit of the adjacent operation core in the D2Q9 logical structure, and the specific optimization is as follows:
[0159] The inter-core data channel is established by using the scheduling unit of the operation core, the migration data is transmitted to the adjacent operation core through the inter-core data channel, the scheduling unit of the adjacent operation core stores the migration data in the extra-core storage unit through the intra-core storage unit, and the migration data is associated with the lattice point data of the adjacent lattice of the corresponding lattice according to the position marker.
[0160] Correspondingly, the multi-core computing method of the lattice Boltzmann D2Q9 model provided in the present embodiment specifically includes the following steps.
[0161] S401, the operation cores of the multi-core SoC chip are logically divided to form a D2Q9 logical structure, the D2Q9 logical structure includes a two-dimensional logical structure of at least one 3 n × 3 n operation core, and the operation cores of the D2Q9 logical structure include a calculation unit and an intra-core storage unit.
[0162] S402, divide the two-dimensional spatial distribution of the fluid by using the lattice Boltzmann D2Q9 model, to obtain a lattice matrix including m*m lattices, each lattice representing a fluid particle of the corresponding two-dimensional spatial distribution, the flow state of the fluid particle being represented by lattice data, the lattice data including a position mark of the corresponding lattice in the lattice matrix, and the lattice data being stored in an external storage unit of the core.
[0163] S403, according to the D2Q9 logical structure and the lattice matrix, assign the lattice data of the m*m lattice in the lattice matrix to each operation core, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the m*m lattice in the lattice matrix.
[0164] S404, divide the internal storage unit of each operation core into Ping area storage sub-units and Pang area storage sub-units based on the first-in-first-out by using a depth of 2, and the Ping area storage sub-units and the Pang area storage sub-units alternately read the lattice data matched with the operation core from the external storage unit according to the position mark in sequence.
[0165] S405, the calculation unit of the operation core alternately performs migration process calculation on the lattice data read by the Ping area storage sub-units and the Pang area storage sub-units, when the operation core performs calculation on the lattice data read by the Ping area storage sub-units, the Pang area storage sub-units perform data transmission with the external storage unit, when the operation core performs calculation on the lattice data read by the Pang area storage sub-units, the Ping area storage sub-units perform data transmission with the external storage unit, the data transmission includes reading of the lattice data and storage of the calculation completed lattice data, the calculation completed lattice data includes local data and migration data, the local data is the distribution probability of the fluid particle in the center lattice under the D2Q9 model, and the migration data is the distribution probability of the fluid particle in the eight adjacent lattices of the center lattice under the D2Q9 model.
[0166] S406, the calculation unit of the operation core performs collision process and boundary processing calculation on the local data and the lattice data of the lattice corresponding to the position mark according to the position mark of the lattice data read by the internal storage unit.
[0167] S407-1, respectively perform collision process and boundary processing calculation on the migration data and the lattice data of the adjacent lattice of the lattice corresponding to the position mark.
[0168] or,
[0169] S407-2, the scheduling unit of the operation core establishes an inter-core data channel, and transmits the migration data to the adjacent operation core through the inter-core data channel. The scheduling unit of the adjacent operation core stores the migration data into the out-core storage unit through the in-core storage unit, and associates the migration data with the lattice point data of the adjacent lattice corresponding to the position marker. The calculation unit of the adjacent operation core performs collision process and boundary processing calculation on the migration data and the lattice point data of the corresponding lattice according to the position marker of the lattice point data.
[0170] When the position marker of the lattice point data indicates that the position of the corresponding lattice is not at the edge of the lattice region corresponding to the current operation core, the migration data can be subjected to collision process and boundary processing calculation with the lattice point data of the adjacent lattice in the internal region of the lattice region corresponding to the current operation core. When the position marker of the lattice point data indicates that the position of the corresponding lattice is at the edge of the lattice region corresponding to the current operation core, the migration data needs to be migrated to the lattice region corresponding to the adjacent operation core, and then subjected to collision process and boundary processing calculation by the calculation unit of the adjacent operation core. At this time, the inter-core data transmission channel is established by using the Bus bus, and the corresponding inter-core communication protocol is developed. The migration data is transmitted to the adjacent operation core by the scheduling unit, and is stored in the out-core storage unit corresponding to the adjacent operation core by the scheduling unit of the adjacent operation core, for calling in the subsequent collision process and boundary processing calculation of the adjacent operation core.
[0171] S408, according to the results of the collision process and boundary processing calculation, it is judged whether the lattice matrix converges or not. If it converges, the calculation is ended and the result is output. If it does not converge, the migration process calculation is returned and restarted.
[0172] In this embodiment, the inter-core data transmission channel is established, and the corresponding high-speed transmission protocol is developed. The data transmission between the operation cores can adapt to the calculation characteristics of the D2Q9 model and meet the demand of large amount of data calculation.
[0173] Embodiment five
[0174] In this embodiment, the above embodiment is optimized. According to the results of the collision process and boundary processing calculation, it is judged whether the lattice matrix converges or not. The specific optimization is as follows:
[0175] The macroscopic velocity of the fluid is obtained by using the discrete probability distribution function after the collision process and boundary processing calculation. The sum of the macroscopic velocities of all lattices in the fluid region is compared with the macroscopic velocity of the fluid obtained according to the discrete probability distribution function after the last collision process and boundary processing calculation, so as to determine whether the lattice matrix converges.
[0176] In actual calculation, according to the calculation process of the LBM model, the migration process, the collision process and the boundary treatment calculation are carried out once at each time step, the discrete probability distribution function obtained after the collision process and the boundary treatment calculation at the current time step are used to calculate the fluid macroscopic velocity at the current time step, and the sum of the macroscopic velocities of all the lattices in the fluid region is calculated; the root mean square error of the sum of the macroscopic velocities of all the lattices in the fluid region at the current time step and the sum of the macroscopic velocities of all the lattices in the fluid region at the last time step is calculated, and the value of the root mean square is used to determine whether the model converges, and the calculation formula is as follows:
[0177]
[0178] Where Error represents the error, i represents the lattice coordinate in the X-axis direction, j represents the lattice coordinate in the Y-axis direction, t represents the time, and δ t represents the time step. x u t (i,j,t+δ t ) represents the macroscopic velocity of point (i,j) in the X-axis direction at t+δ x t. y u t (i,j,t+δ t ) represents the macroscopic velocity of point (i,j) in the Y-axis direction at t+δ y t. i,j u -6 (i,j,t) represents the macroscopic velocity of point (i,j) in the Y-axis direction at t, and ∑ -6 represents the sum of the values of all the lattices in the fluid region.
[0179] If the root mean square value is less than 10 -6 , the flow state of the fluid is considered to be stable, the lattice matrix converges, and if the root mean square value is greater than 10 -6 , the calculation of the next time step is continued.
[0180] In this embodiment, the root mean square error of the flow state of the fluid region at two time steps is used to determine whether the flow state of the fluid is stable, if it is stable, the model converges, and the prediction result of the model is output, if it is not stable, the iterative calculation is continued until the model converges.
[0181] Embodiment Six
[0182] This embodiment is based on the above-mentioned embodiments and is optimized, and in this embodiment, it further includes:
[0183] The multiple multi-core SoC chips including the D2Q9 logical structure are logically divided to form a D2Q9 chip structure, and the lattice point data of the lattice matrix of z x z lattices divided based on the lattice Boltzmann D2Q9 model are calculated by using the D2Q9 chip structure.
[0184] On the basis of dividing the multi-core SoC chip into the D2Q9 logical structure, a plurality of the SoC chips can be used to form a D2Q9 chip structure again, the lattice matrix is divided based on the same principle by using the D2Q9 chip structure, each multi-core SoC chip in the D2Q9 chip structure corresponds to a lattice region at a corresponding position, and then the lattice region corresponding to each multi-core SoC chip is divided by using the D2Q9 logical structure, and the calculation processing is performed by using the operation core of the multi-core SoC chip. In order to ensure the speed of data transmission between the plurality of chips and further ensure the performance of the multi-chip structure, the data transmission channel between the chips is established by using the optical fiber link, and a corresponding transmission protocol is developed to ensure the data transmission efficiency between the chips.
[0185] The embodiment divides the lattice matrix at the chip level and the operation core level in the chip to divide the lattice matrix at different levels, and the data processing capacity is improved again by using the multi-chip, so that more data amount can be processed at the same time, and the calculation speed is improved.
[0186] Embodiment seven
[0187] Figure 9 A structure diagram of a lattice Boltzmann D2Q9 model multi-core computing device according to the embodiment seven of the present application is shown in FIG. 8. Figure 9 As shown in FIG. 8, the device comprises:
[0188] The operation core logical structure generation module 810 is configured to logically divide the operation cores of a plurality of SoC chips to form a D2Q9 logical structure.
[0189] The lattice matrix generation module 820 is configured to divide and generate a lattice matrix by using a Boltzmann D2Q9 model to divide a two-dimensional spatial distribution of a fluid.
[0190] The lattice point data distribution module 830 is configured to distribute lattice point data of a corresponding region of the lattice matrix according to the position of the operation core in the D2Q9 logical structure.
[0191] The Ping / Pang storage module 840 is configured to divide the in-core storage unit of each operation core into a Ping area storage subunit and a Pang area storage subunit.
[0192] The migration process calculation module 850 is configured to perform migration process calculation on the lattice point data read by the in-core storage unit.
[0193] The collision process and boundary processing calculation module 860 is configured to perform collision process calculation and boundary processing calculation on the current data and the migration data according to the position mark of the lattice point data.
[0194] The convergence judgment module 870 is configured to judge whether the lattice converges according to a result of the collision process and the boundary processing calculation.
[0195] The multi-core computing device of the lattice Boltzmann D2Q9 model in the embodiment divides the operation cores of the multi-core SoC chip into a two-dimensional logical structure matched with the D2Q9 model, respectively calculates the two-dimensional spatial distribution of the fluid lattice, allocates the same size of the lattice region in the lattice matrix to each operation core, makes the two-dimensional logical structure of the operation core more suitable for the D2Q9 model, and balances the load of each operation core, which is beneficial to fully exert the computing performance of the chip. The in-core storage space of the operation core is divided into two same Ping area storage subunits and Pang area storage subunits, the lattice node data of the lattice is sequentially read from the out-core storage unit based on the first-in first-out principle, the computing unit of the operation core also alternately calculates the data to be processed read by the Ping area storage subunit and the Pang area storage subunit according to the reading sequence, when the operation core calculates the data in one of the storage subunits, the other storage subunit and the out-core storage unit perform data transmission, which ensures full use of the computing resources of the operation core, greatly reduces the idle of the computing resources, and can accommodate more lattice node data of the lattice by using the out-core storage unit, and can be applied to the calculation of more lattices.
[0196] The multi-core computing device of the lattice Boltzmann D2Q9 model provided in the embodiment can execute the multi-core computing method of the lattice Boltzmann D2Q9 model provided in any embodiment of the application, has the corresponding function modules and beneficial effects of the execution method.
[0197] The above description is only an embodiment of the application, and does not limit the application, any modification, equivalent replacement, improvement, etc. made within the principle of the application should be included in the protection scope of the application.
Claims
1. A multi-core computing method of a lattice Boltzmann D2Q9 model, characterized in that, The application relates to a lattice Boltzmann D2Q9 model for fluid two-dimensional space distribution division, a lattice matrix comprising m*m lattices is obtained, each lattice represents a corresponding fluid particle in the two-dimensional space distribution, the flow state of the fluid particle is represented by lattice point data, the lattice point data comprises a position mark of the corresponding lattice in the lattice matrix, and the lattice point data is stored in an external memory unit of a core; The operation core of a multi-core SoC chip is logically divided to form a D2Q9 logical structure, the D2Q9 logical structure including at least one two-dimensional logical structure of 3 n ×3 n operation cores, the operation core of the D2Q9 logical structure including a computing unit and an in-core storage unit; The internal memory unit of each operation core is divided into a Ping area storage subunit and a Pang area storage subunit based on a first-in-first-out principle, the Ping area storage subunit and the Pang area storage subunit alternately read the lattice point data matched with the operation core from the external memory unit according to the position mark sequence; According to the D2Q9 logical structure and the lattice matrix, the lattice point data of a lattice in the lattice matrix is allocated to each operation core, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the lattice in the lattice matrix. According to the D2Q9 logical structure and the lattice matrix, the lattice point data of a lattice in the lattice matrix is allocated to each operation core, and the position of the operation core in the D2Q9 logical structure corresponds to the position of the lattice in the lattice matrix. The calculation unit of the operation core alternately performs migration process calculation on the lattice point data read by the Ping area storage subunit and the Pang area storage subunit, when the operation core performs calculation on the lattice point data read by the Ping area storage subunit, the Pang area storage subunit performs data transmission with the external memory unit, when the operation core performs calculation on the lattice point data read by the Pang area storage subunit, the Ping area storage subunit performs data transmission with the external memory unit, the data transmission comprises reading of the lattice point data and storage of the calculation completed lattice point data, the calculation completed lattice point data comprises local data and migration data, the local data is the distribution probability of the fluid particle in the center lattice under the D2Q9 model, and the migration data is the distribution probability of the fluid particle in the eight adjacent lattice directions of the center lattice under the D2Q9 model; The calculation unit of the operation core performs collision process and boundary processing calculation on the local data and the lattice point data of the lattice corresponding to the position mark according to the position mark of the lattice point data read by the internal memory unit, and performs collision process and boundary processing calculation on the migration data and the lattice point data of the adjacent lattices of the lattice corresponding to the position mark respectively; or the migration data is transmitted to the internal memory unit of an adjacent operation core in a D2Q9 logical structure, and the calculation unit of the adjacent operation core performs collision process and boundary processing calculation on the migration data and the lattice point data of the corresponding lattice in the matched lattice according to the position mark of the lattice point data; According to the results of the collision process and the boundary processing calculation, it is judged whether the lattice matrix converges, if yes, the calculation is ended and the results are output, and if not, the migration process calculation is returned and restarted. The migration process calculation comprises the following steps:
2. The method of claim 1, wherein, According to a preset discrete probability distribution function in the lattice point data of each lattice, a post-migration discrete probability distribution function is obtained after a preset time step, the post-migration discrete probability distribution function comprises local discrete distribution function and migration discrete distribution function; The macroscopic density and the macroscopic velocity of the fluid are calculated by using the post-migration discrete probability distribution function; The equilibrium distribution function of the lattice point data is calculated by using the macroscopic density and the macroscopic velocity of the fluid, the equilibrium distribution function comprises local equilibrium distribution function and migration equilibrium distribution function; The local data is formed by using the local discrete distribution function and the local equilibrium distribution function, and the migration data is formed by using the migration discrete distribution function and the migration equilibrium distribution function. The data transmission comprises reading of the lattice point data and storage of the calculation completed lattice point data, and comprises the following steps:
3. The method of claim 1, wherein, The in-core storage unit stores the calculation completed grid data into the out-core storage unit according to the position mark, associates the current grid data with the grid corresponding to the position mark, and associates the migration data with the adjacent grid of the grid corresponding to the position mark; The out-core storage unit reads the grid data of the next grid corresponding to the position mark.
4. The method according to claim 1 or 3, characterized in that, The collision process and boundary processing calculation include: The migration data associated with the current grid data corresponding to the position mark is used for collision process calculation; The non-equilibrium extrapolation format is used for boundary condition calculation of the grid close to the fluid-solid boundary.
5. The method of claim 4, wherein, The boundary condition calculation of the grid at the fluid-solid boundary using the non-equilibrium extrapolation format includes: The equilibrium distribution function of the wall grid point at the solid side of the fluid-solid boundary is calculated according to the density and velocity of the wall grid point; The non-equilibrium distribution function of the wall grid point is determined according to the difference between the distribution function and the equilibrium distribution function of the fluid grid point at the fluid side of the fluid-solid boundary; The distribution function of the wall grid point is determined according to the equilibrium distribution function and the non-equilibrium distribution function of the wall grid point, which is used to supplement the grid data of the grid at the fluid-solid boundary.
6. The method of claim 1, wherein, The in-core storage unit of the adjacent operation core in the D2Q9 logical structure includes: The scheduling unit of the operation core establishes an inter-core data channel, and the migration data is transmitted to the adjacent operation core through the inter-core data channel. The scheduling unit of the adjacent operation core stores the migration data into the out-core storage unit through the in-core storage unit, and associates the migration data with the grid data of the adjacent grid corresponding to the position mark.
7. The method of claim 1, wherein, The Ping area storage subunit and the Pang area storage subunit alternately read the grid data of the operation core matched according to the position mark in sequence from the out-core storage unit, including: The Ping region storage subunit of each operation core alternately stores data allocated from the current operation core with the Pang region storage subunit The first lattice in the grid sequentially reads the lattice point data of the corresponding grid.
8. The method of claim 1, wherein, According to the results of the collision process and boundary processing calculation, whether the grid matrix converges is determined, including: The macroscopic velocity of the fluid is obtained by using the discrete probability distribution function after the collision process and boundary processing calculation, and the sum of the macroscopic velocities of all grids in the fluid region is compared with the macroscopic velocity of the fluid obtained according to the discrete probability distribution function after the last collision process and boundary processing calculation, to determine whether the grid matrix converges.
9. The method of claim 1, wherein, The method further includes: The D2Q9 chip structure is formed by logically dividing a plurality of SoC chips including the D2Q9 logical structure, and the grid data of the grid matrix of z×z grids divided based on the lattice Boltzmann D2Q9 model is calculated by using the D2Q9 chip structure.
10. A multi-core computing device for a lattice-Boltzmann D2Q9 model, characterized by, It includes: An operation core logical structure generation module is configured to logically divide a plurality of operation cores of SoC chips to form a D2Q9 logical structure; A grid matrix generation module is configured to divide a two-dimensional spatial distribution of a fluid to generate a grid matrix by using a Boltzmann D2Q9 model; A grid data distribution module is configured to distribute grid data of corresponding region grids of the grid matrix according to positions of operation cores in the D2Q9 logical structure; A Ping / Pang storage module is configured to divide an in-core storage unit of each operation core into a Ping area storage subunit and a Pang area storage subunit; The migration process calculation module is configured to perform migration process calculation on the grid data read by the in-core storage unit; The collision process and boundary treatment calculation module is configured to perform collision process calculation and boundary treatment calculation on the current grid data and the migration data according to the position mark of the grid data; The convergence judgment module is configured to judge whether the grid converges according to the result of the collision process and boundary treatment calculation.
Citation Information
Patent Citations
Parallel acceleration method and system of lattice Boltzmann method
CN102945295A
Large eddy simulation system and method for realizing cooperative computing based on latticed-Boltzmann theory
CN103778098A