Multi-core calculation method and device for lattice Boltzmann D2Q9 model
By dividing the operation core of the multi-core SoC chip into D2Q9 logical structures and alternately reading and calculating grid data, the problem of chip resource waste is solved and more efficient computing performance is achieved.
Patent Information
- Application Number
- CN202411990052.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-31
AI Technical Summary
When multi-core SoC chips calculate fluid flow, due to limited cache space, the calculation and data transmission cannot be carried out simultaneously, resulting in waste of resources and unable to fully utilize the chip performance.
By dividing the operation core logic of the multi-core SoC chip into a D2Q9 logical structure, and dividing the internal storage unit into a Ping area storage subunit and a Pang area storage subunit, alternately reading and computing grid data from the off-core storage unit, the computing resources of the operation core are fully utilized.
It effectively reduces resource waste, improves the utilization rate of chip performance, and can be suitable for calculations of more grids.
Smart Images

Figure CN119761261A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of multi-core computing technology, and in particular to a multi-core computing method and device for a lattice Boltzmann D2Q9 model. Background Art
[0002] The Lattice Boltzmann Method (LBM) is a computational fluid dynamics method based on statistical physics principles, which is used to simulate and study the behavior of fluids. The basic idea of LBM is to regard the fluid as consisting of a large number of small particles in random motion, 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 contains 9 discrete velocity directions of particles and is used for fluid flow simulation in two-dimensional space.
[0003] When using the D2Q9 model to calculate fluid flow, the two-dimensional space is divided into multiple grids to calculate particle migration and particle collision between grids. However, when faced with calculations of more grids, due to the small cache space inside the chip, after a calculation is completed, data transmission is required to store the large amount of data generated by the calculation into the external storage space, release the cache space inside the chip, and read the data required for the next calculation at the same time, and then perform the next calculation. The chip calculation and data transmission cannot be performed at the same time, resulting in a waste of resources. Summary of the invention
[0004] The embodiment of the present invention provides a multi-core computing method and device for a lattice Boltzmann D2Q9 model to solve the technical problems of waste of computing resources in multi-core SoC chips and inability to fully exert chip performance.
[0005] In a first aspect, an embodiment of the present invention provides a multi-core computing method for a lattice Boltzmann D2Q9 model, comprising:
[0006] The computing cores of the multi-core SoC chip are logically divided to form a D2Q9 logic structure, wherein the D2Q9 logic structure includes at least one 3 n ×3 n A two-dimensional logic structure of a computing core, wherein the computing core of the D2Q9 logic structure includes a computing unit and an in-core storage unit;
[0007] The two-dimensional spatial distribution of the fluid is divided by the lattice Boltzmann D2Q9 model to obtain a lattice matrix including m×m grids. Each grid 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 contains the position mark of the corresponding grid in the lattice matrix. The grid point data is stored in the off-core storage unit.
[0008] According to the D2Q9 logical structure and the lattice matrix, each operation core is assigned a lattice matrix. The grid point data of the grid, and the position of the operation core in the D2Q9 logic structure is the same as The positions of the grids in the grid matrix correspond one to one;
[0009] The in-core storage unit of each computing core is divided into a Ping area storage subunit and a Pang area storage subunit based on a first-in-first-out order by using a depth of 2. The Ping area storage subunit and the Pang area storage subunit alternately read the grid point data matched by the computing core from the out-core storage unit according to the position mark sequence;
[0010] The computing 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 calculates the grid data read by the Ping area storage subunit, the Pang area storage subunit transmits data with the storage unit outside the core. When the operation core calculates the grid data read by the Pang area storage subunit, the Ping area storage subunit transmits data with the storage unit outside the core. The data transmission includes reading the grid data and storing the calculated grid data. The calculated grid data includes the grid data and the migration data. The grid data is the distribution probability of the fluid particles in the central grid under the D2Q9 model. The migration data is the distribution probability of the fluid particles in the 8 grid directions adjacent to the central grid under the D2Q9 model.
[0011] The computing unit of the computing core performs collision process and boundary processing calculations on the grid data and the grid data of the grid corresponding to the position mark according to the position mark of the grid data read by the storage unit in the core, and performs collision process 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 transmits the migration data to the storage unit in the core of the adjacent computing core in the D2Q9 logic structure, and the computing unit of the adjacent computing core performs collision process and boundary processing calculations 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;
[0012] According to the results of the collision process and the boundary processing calculation, it is determined whether the lattice matrix converges. If it converges, the calculation is terminated and the result is output. If it does not converge, it returns and restarts the migration process calculation.
[0013] Furthermore, the migration process calculation includes:
[0014] According to the preset discrete probability distribution function in the grid point data corresponding to each grid, after a preset time step, a post-migration discrete probability distribution function is obtained, wherein the post-migration discrete probability distribution function includes a grid discrete distribution function and a migration discrete distribution function;
[0015] The macroscopic density and macroscopic velocity of the fluid are calculated using the discrete probability distribution function after migration;
[0016] Calculating the equilibrium distribution function of the grid data using the macroscopic density and macroscopic velocity of the fluid, wherein the equilibrium distribution function includes a grid equilibrium distribution function and a migration equilibrium distribution function;
[0017] The grid data are formed using the grid discrete distribution function and the grid equilibrium distribution function, and the migration data are formed using the migration discrete distribution function and the migration equilibrium distribution function.
[0018] Furthermore, the data transmission includes reading grid point data and storing the calculated grid point data, including:
[0019] The in-core storage unit stores the calculated grid point data into the out-core storage unit according to the position mark, associates the 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;
[0020] Read the grid point data of the next grid marked at the corresponding position of the off-core storage unit.
[0021] Furthermore, the collision process and boundary processing calculation include:
[0022] The collision process is calculated using the migration data associated with the grid corresponding to the position mark data;
[0023] The boundary conditions of the grid near the fluid-solid boundary are calculated using a non-equilibrium extrapolation scheme.
[0024] Furthermore, the boundary condition calculation of the grid at the fluid-solid boundary using the non-equilibrium extrapolation format includes:
[0025] The equilibrium distribution function of the wall grid points is calculated according to the density and velocity of the wall grid points located on the solid side at the fluid-solid boundary;
[0026] Determining the non-equilibrium distribution function of the wall grid points according to the difference between the distribution function of the fluid grid points located on the fluid side at the fluid-solid boundary and the equilibrium distribution function;
[0027] The distribution function of the wall grid points is determined according to the equilibrium distribution function and the non-equilibrium distribution function of the wall grid points, and is used to supplement the grid point data of the grid at the fluid-solid boundary.
[0028] Furthermore, the step of transferring the migration data to the in-core storage unit of the adjacent computing core in the D2Q9 logic structure includes:
[0029] Use the scheduling unit of the computing core to establish an inter-core data channel;
[0030] Transmit the migration data to the adjacent computing core through the inter-core data channel;
[0031] The scheduling unit of the adjacent computing core stores the migration data into the external core storage unit through the internal core storage unit, and associates the migration data with the grid point data of the adjacent grid corresponding to the position mark according to the position mark.
[0032] Furthermore, the Ping area storage subunit and the Pang area storage subunit alternately read the grid point data matched by the operation core from the off-core storage unit according to the position mark sequence, including:
[0033] The Ping area storage subunit and the Pang area storage subunit of each computing core are alternately allocated from the current computing core. The first grid in each grid reads the grid point data of the corresponding grid in turn.
[0034] Furthermore, judging whether the grid matrix converges according to the results of the collision process and the boundary processing calculation includes:
[0035] The macroscopic velocity of the fluid is obtained by using the discrete probability distribution function calculated after this collision process and boundary processing, and the sum of the macroscopic velocities of all grids in the fluid area is compared with the macroscopic velocity of the fluid obtained according to the discrete probability distribution function after the previous collision process and boundary processing calculation to determine the convergence of the grid matrix.
[0036] Furthermore, the method further comprises:
[0037] A plurality of multi-core SoC chips including the D2Q9 logic structure are logically divided to form a D2Q9 chip structure, and the D2Q9 chip structure is used to calculate the grid point data of a grid matrix of z×z grids divided based on a lattice Boltzmann D2Q9 model.
[0038] In a second aspect, an embodiment of the present invention provides a multi-core computing device of a lattice Boltzmann D2Q9 model, comprising:
[0039] A computing core logic structure generation module is used to logically divide the computing cores of multiple SoC chips into a D2Q9 logic structure;
[0040] A lattice matrix generation module is used to divide the two-dimensional spatial distribution of the fluid using the Boltzmann D2Q9 model to generate a lattice matrix;
[0041] A grid point data allocation module is used to allocate grid point data of corresponding regional grids in the grid matrix according to the position of the operation core in the D2Q9 logic structure;
[0042] Ping / Pang storage module, used to divide the in-core storage unit of each computing core into Ping area storage sub-unit and Pang area storage sub-unit;
[0043] A migration process calculation module, used for performing migration process calculation on the grid point data read from the storage unit in the core;
[0044] The collision process and boundary processing calculation module is used to perform collision process calculation and boundary processing calculation on the grid data and the migration data according to the position mark of the grid data;
[0045] The convergence judgment module is used to judge whether the grid is converged according to the results of the collision process and boundary processing calculation.
[0046] An embodiment of the present invention provides a multi-core computing method and device for a lattice Boltzmann D2Q9 model, which divides multiple computing cores of a SoC chip so that they include at least one two-dimensional logical structure that matches the D2Q9 model, allocates a grid area of the same size in a grid matrix to each computing core, and calculates the two-dimensional spatial distribution of the fluid divided into grids. The two-dimensional logical structure of the computing core is more compatible with the D2Q9 model, and the same size of grid area is allocated to each computing core. Each computing core needs to calculate the same number of grids, and the load between the computing cores is relatively balanced, which is conducive to giving full play to the computing performance of the chip. At the same time, the in-core storage space of the computing core is divided into two identical storage sub-units, and the grid point data of the grid are read alternately from the off-core storage unit in sequence. The computing unit of the computing core then alternately calculates the data to be processed read by the two storage sub-units according to the reading order, thereby realizing an alternating operation mode in which when the computing core calculates the data in one of the storage sub-units, the other storage sub-unit transmits data with the off-core storage unit. This can make full use of the computing resources of the computing core, reduce resource waste, and accommodate more grid point data of grids through the off-core storage unit, which can be suitable for the calculation of more grids. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1 This is a flow chart of a multi-core computing method for a lattice Boltzmann D2Q9 model according to Embodiment 1 of the present invention;
[0049] Figure 2 This is a calculation flow chart of the LBM described in Example 1 of the present invention;
[0050] Figure 3 This is a schematic diagram of the D2Q9 model described in Embodiment 1 of the present invention;
[0051] Figure 4 The two-dimensional logical structure of 3×3 computing cores described in the first embodiment of the present invention;
[0052] Figure 5 This is a flow chart of a multi-core computing method for a lattice Boltzmann D2Q9 model according to the second embodiment of the present invention;
[0053] Figure 6 This is a flow chart of a multi-core computing method for a lattice Boltzmann D2Q9 model according to Embodiment 3 of the present invention;
[0054] Figure 7 A schematic diagram of a grid at a fluid-solid boundary according to the third embodiment of the present invention;
[0055] Figure 8 This is a flow chart of a multi-core computing method for a lattice Boltzmann D2Q9 model according to the fourth embodiment of the present invention;
[0056] Fig. 9 This is a structural schematic diagram of a multi-core computing device of a lattice Boltzmann D2Q9 model described in Example 7 of the present invention. DETAILED DESCRIPTION
[0057] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0058] Embodiment 1
[0059] Figure 1 This is a flowchart of a multi-core computing method of a lattice Boltzmann D2Q9 model according to the first embodiment of the present invention. This embodiment divides the computing core of the multi-core SoC into a two-dimensional logical structure adapted to D2Q9, divides the storage unit in the core into two identical storage sub-units, reads the data of the storage unit outside the core alternately based on the first-in-first-out principle, and the computing unit calculates the data to be processed read by the two storage sub-units alternately according to the reading order. Specifically, the method includes the following steps:
[0060] The Lattice Boltzmann (LBM) model treats the fluid as a large number of moving particles, and is implemented through a calculation process of multiple cycles of particle migration followed by collision and boundary processing. It is used to predict the motion state of the fluid. The calculation process of LBM is as follows: Figure 2The D2Q9 model uses a grid to divide the fluid distribution in two-dimensional space, and then describes the distribution of microscopic fluid particles in nine directions in two-dimensional space, as shown in Figure 2. Figure 3 As shown in the figure, the discrete distribution function in each direction is used to express the migration of particles to adjacent grids, and collision and boundary processing calculations are performed on each grid after migration, and then the migration, collision and boundary processing processes are repeated, and the cycle is repeated until the model converges. During the iteration of the model, since the migration process will generate data in 9 directions, when the number of grids is large, the cache space inside the computing core is difficult to accommodate a large amount of data, and it is necessary to use a larger external core storage for data storage. When the computing core is transmitting data to the external core storage, the computing unit of the computing core will be in an idle state waiting for the next calculation data, resulting in a waste of resources and difficulty in efficiently exerting chip performance.
[0061] S101, logically divide the computing cores of the multi-core SoC chip to form a D2Q9 logic structure, wherein the D2Q9 logic structure includes at least one 3 n ×3 n The two-dimensional logical structure of a computing core, the computing core of the D2Q9 logical structure includes a computing unit and an in-core storage unit.
[0062] The computing cores of the multi-core SoC chip are divided into three n ×3 n Arranging the two-dimensional logical structure can facilitate matching with the two-dimensional spatial distribution of the fluid. Using different computing cores to process the grid point data of grids in different regions can better adapt to the characteristics of the algorithm, making the load of multiple computing cores of the SoC chip more balanced and making full use of the chip performance. For example, the chip is divided into a two-dimensional logical structure of 3×3 computing cores, such as Figure 4 As shown, it can Figure 3 The D2Q9 model shown has similar characteristics and is more suitable for the algorithm of the D2Q9 model.
[0063] S102, using the lattice Boltzmann D2Q9 model to divide the two-dimensional spatial distribution of the fluid, to obtain a lattice matrix including m×m grids, each grid 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 the position mark of the corresponding grid in the lattice matrix, and the grid point data is stored in the off-core storage unit.
[0064] The two-dimensional spatial distribution of the fluid is divided into m×m grids, and the grid point data of each grid is used to represent the flow state of the microscopic fluid particles in the grid. The grid point data contains the position mark of the grid in the grid matrix, and the position mark can be used to perform migration, collision and boundary processing calculations on the grid point data. In order to reduce the limitation of storage space on data size and enable the operation core to calculate the grid point data of more grids, the grid point data is stored in the off-core storage unit.
[0065] S103, assigning each operation core in the lattice matrix according to the D2Q9 logical structure and the lattice matrix The grid point data of the grid, and the position of the operation core in the D2Q9 logic structure is the same as The positions of the grids in the grid matrix correspond one to one.
[0066] According to the position of the operation core in the D2Q9 logic structure, the grid point data of the grid in the corresponding area of the grid matrix is allocated to each operation core for calculation and processing. Exemplarily, the fluid is divided into a grid matrix of 99×99 grids in two-dimensional space. When allocating with 3×3 operation cores, the grid matrix is divided into 3×3 areas, and each area contains 33×33 grids. According to the position of the operation core, the grid point data of the 33×33 grids in the corresponding area of the grid matrix is allocated to it.
[0067] S104, using a depth of 2 to divide the in-core storage unit of each computing core into a Ping area storage sub-unit and a Pang area storage sub-unit based on a first-in-first-out order, the Ping area storage sub-unit and the Pang area storage sub-unit alternately read the grid data matching the computing core from the out-of-core storage unit according to the position mark order.
[0068] The in-core storage unit is divided into two identical storage sub-units. Based on the principle of first-in-first-out queue (FIFO), the two storage sub-units read data from the out-core storage unit alternately, and the data read first is used for calculation by the calculation unit first.
[0069] S105, the computing unit of the computing core alternately performs migration process calculations on the grid data read by the Ping area storage subunit and the Pang area storage subunit. When the computing core calculates the grid data read by the Ping area storage subunit, the Pang area storage subunit transmits data with the storage unit outside the core. When the computing core calculates the grid data read by the Pang area storage subunit, the Ping area storage subunit transmits data with the storage unit outside the core. The data transmission includes reading the grid data and storing the calculated grid data. The calculated grid data includes the grid data and the migration data. The grid data is the distribution probability of the fluid particles in the central grid under the D2Q9 model. The migration data is the distribution probability of the fluid particles in the 8 grid directions adjacent to the central grid under the D2Q9 model.
[0070] Based on the first-in-first-out principle, the calculation unit performs migration process calculation on the pending data first read into the Ping area storage subunit, and after the calculation is completed, the migration process calculation is performed on the pending data read into the Pang area storage subunit; when calculating the data in the Ping area storage subunit, the Pang area storage subunit transmits data with the out-of-core storage unit, and when calculating the data in the Pang area storage subunit, the Ping area storage subunit transmits data with the out-of-core storage unit, and this cycle is repeated. The calculation completion data obtained by the migration process calculation is the probability of the particles of the current grid migrating to the 9 directions of the D2Q9 model, including the data of the grid that keeps the position unchanged and the 8 migration data that migrate to the 8 adjacent grids respectively. Exemplarily, the data transmission unit of the computing core first reads the data to be processed from the external storage unit to the Ping area storage subunit; then the computing unit calculates the data to be processed in the Ping area storage subunit, and at the same time the data transmission unit reads the data to be processed from the external storage unit to the Pang area storage subunit; then the computing unit calculates the data to be processed in the Pang area storage subunit, and at the same time the data transmission unit stores the calculated data in the Ping area storage subunit into the external storage unit and reads new data, and this cycle repeats.
[0071] S106, the computing unit of the computing core performs collision process and boundary processing calculations on the grid data and the grid data of the grid corresponding to the position mark according to the position mark of the grid data read by the storage unit in the core, and performs collision process and boundary processing calculations on the migration data and the grid data of the adjacent grids corresponding to the grid with the position mark; or transmits the migration data to the storage unit in the core of the adjacent computing core in the D2Q9 logical structure, and the computing unit of the adjacent computing core performs collision process 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.
[0072] After the migration process calculation is completed, the particle migration probability distribution of each grid in 9 directions is obtained. The particle migration probability distribution in the direction of keeping still is used as the data of this grid, and the data migrated to this grid from other adjacent grids are used to perform collision process calculation and boundary processing calculation. Correspondingly, the particle migration probability distribution in the direction of migration to the adjacent grid is used as migration data, and the collision process calculation and boundary processing calculation are performed with the data of the grid to which the migration is transferred. That is, the data of the grid after the migration process is used to perform collision process calculation and boundary processing calculation with the migration data migrated to this grid, and the migration data migrated to the adjacent grid is used to perform collision process calculation and boundary processing calculation with the data of the grid to which the migration is transferred and other migration data migrated to the grid. If the grid is located at the edge of the area 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 grid are performed using the adjacent operation core.
[0073] S107, judging whether the grid matrix converges according to the results of the collision process and the boundary processing calculation, if converged, ending the calculation and outputting the result, if not converged, returning and restarting the migration process calculation.
[0074] The convergence of the lattice matrix means that the flow state of the fluid corresponding to the lattice matrix in the two-dimensional space distribution tends to be stable and no longer changes. The results of the current round of collision process and boundary processing calculations can be compared with the results of the previous round of collision process and boundary processing calculations. The difference between the two results can be used to determine whether the lattice matrix has converged. When the difference between the two results is extremely small and close to 0, it can be determined that the lattice matrix has converged, the calculation is terminated and the results are output. Otherwise, the next round of migration process, collision process and boundary processing calculations are carried out, and the calculation is repeated until convergence.
[0075] This embodiment divides the computing core of the multi-core SoC chip into a two-dimensional logical structure that matches the D2Q9 model, calculates the two-dimensional spatial distribution of the fluid divided into grids, and allocates a grid area of the same size in the grid matrix to each computing core, so that the two-dimensional logical structure of the computing core is more suitable for the D2Q9 model, and the load of each computing core is relatively balanced, which is conducive to giving full play to the computing performance of the chip. Then the storage space in the core of the computing core is divided into two identical Ping area storage sub-units and Pang area storage sub-units, and the grid point data of the grid is read alternately from the storage unit outside the core based on the first-in-first-out principle. The computing unit of the computing core also alternately calculates the data to be processed read by the Ping area storage sub-unit and the Pang area storage sub-unit according to the reading order. When the computing core calculates the data in one of the storage sub-units, the other storage sub-unit transmits data with the storage unit outside the core, which ensures that the computing resources of the computing core are fully utilized, greatly reducing the idleness of computing resources, and at the same time, the storage unit outside the core can be used to accommodate the grid point data of more grids, which can be applied to the calculation of more grids.
[0076] Specifically, the Ping area storage subunit and the Pang area storage subunit alternately read the grid point data matched by the operation core from the off-core storage unit according to the position mark sequence, including:
[0077] The Ping area storage subunit and the Pang area storage subunit of each computing core are alternately allocated from the current computing core. The first grid in each grid reads the grid point data of the corresponding grid in turn. The Ping area storage subunit first reads the grid point data of the first grid in the first row in the grid area assigned to the computing core, and then the Pang area storage subunit reads the grid point data of the next grid in the first row, and so on, until the grid point data of the first row of grids are all read, and then the grid point data of the second row of grids are read in this order, and so on, until the grid point data of all grids in the grid area assigned to the computing core are all read.
[0078] Embodiment 2
[0079] Figure 5 This is a flow chart of a multi-core computing method for a lattice Boltzmann D2Q9 model according to the second embodiment of the present invention. This embodiment is optimized based on the above embodiment. In this embodiment, the migration process calculation includes:
[0080] According to the preset discrete probability distribution function in the grid point data corresponding to each grid, after a preset time step, a post-migration discrete probability distribution function is obtained, wherein the post-migration discrete probability distribution function includes a grid discrete distribution function and a migration discrete distribution function;
[0081] The macroscopic density and macroscopic velocity of the fluid are calculated using the discrete probability distribution function after migration;
[0082] Calculating the equilibrium distribution function of the grid data using the macroscopic density and macroscopic velocity of the fluid, wherein the equilibrium distribution function includes a grid equilibrium distribution function and a migration equilibrium distribution function;
[0083] The grid data are formed using the grid discrete distribution function and the grid equilibrium distribution function, and the migration data are formed using the migration discrete distribution function and the migration equilibrium distribution function.
[0084] Accordingly, the multi-core calculation method of the lattice Boltzmann D2Q9 model provided in this embodiment specifically includes:
[0085] S201, logically divide the computing cores of the multi-core SoC chip to form a D2Q9 logic structure, wherein the D2Q9 logic structure includes at least one 3 n ×3 n The two-dimensional logical structure of a computing core, the computing core of the D2Q9 logical structure includes a computing unit and an in-core storage unit.
[0086] S202, using the lattice Boltzmann D2Q9 model to divide the two-dimensional spatial distribution of the fluid, to obtain a lattice matrix including m×m grids, each grid 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 the position mark of the corresponding grid in the lattice matrix, and the grid point data is stored in the off-core storage unit.
[0087] S203, assigning each operation core in the lattice matrix according to the D2Q9 logical structure and the lattice matrix The grid point data of the grid, and the position of the operation core in the D2Q9 logic structure is the same as The positions of the grids in the grid matrix correspond one to one.
[0088] S204, using a depth of 2 to divide the in-core storage unit of each computing core into a Ping area storage sub-unit and a Pang area storage sub-unit based on a first-in-first-out order, the Ping area storage sub-unit and the Pang area storage sub-unit alternately read the grid data matching the computing core from the out-of-core storage unit according to the position mark order.
[0089] The computing unit of the operation core alternately performs migration process calculation on the grid point data read by the Ping area storage sub-unit and the Pang area storage sub-unit:
[0090] S205, according to the discrete probability distribution function preset in the grid point data corresponding to each grid, after a preset time step, obtain a post-migration discrete probability distribution function, wherein the post-migration discrete probability distribution function includes a grid discrete distribution function and a migration discrete distribution function.
[0091] First, define the discrete probability distribution function f of the particles in the grid i (x, t), the discrete probability distribution function describes the probability of a particle migrating to a specific direction. According to the discrete probability distribution function after one time step, the discrete probability distribution function after migration in nine directions is obtained. The calculation formula is as follows:
[0092]
[0093] Among them, f i (x, t) represents the discrete probability distribution function before migration, represents the discrete probability distribution function after migration, t represents the time step, Δt represents the time step length, e i Δt represents the product of discrete velocity and time step, and x represents spatial position.
[0094] The discrete probability distribution function after migration is a discrete probability distribution function in nine directions, including a discrete distribution function of the grid representing stillness and a migration discrete distribution function representing migration to an adjacent grid.
[0095] S206, calculating the macroscopic density and macroscopic velocity of the fluid using the discrete probability distribution function after migration.
[0096] The macroscopic density of the fluid can be regarded as the sum of the microscopic particle distribution functions, and the calculation formula is as follows:
[0097]
[0098] Among them, ρ(x,t) represents the macroscopic density of the spatial position x at time t, f i * (x, t) represents the discrete probability distribution function after migration.
[0099] The macroscopic velocity u(x,t) of the fluid is given by the discrete probability distribution function f i (x, t) weighted microscopic velocity e in each direction i The average value is calculated as follows:
[0100]
[0101] Where u represents the macroscopic velocity of the fluid, ρ represents the macroscopic density of the fluid, and f i represents the particle distribution function in the i direction, e i Represents the discrete velocity in the i direction.
[0102] S207, calculating the equilibrium distribution function of the grid data using the macroscopic density and macroscopic velocity of the fluid, wherein the equilibrium distribution function includes a grid equilibrium distribution function and a migration equilibrium distribution function.
[0103] Equilibrium distribution function f i eq represents the fluid particles in the discrete velocity direction e i The distribution probability density when the fluid system reaches equilibrium state on the grid is described from the perspective of microscopic particle distribution when the fluid system is in equilibrium state on the grid. The grid constant Δx = 1, the time step Δt = 1, and the grid speed are defined as The equilibrium distribution function calculation formula is as follows:
[0104]
[0105] Among them, f i eq represents the equilibrium distribution function, w i represents the weighting coefficient of each discrete velocity direction, ρ represents the macroscopic density of the fluid, ρ0 represents the average density of the fluid, which is set to 1 when calculating incompressible fluids, c represents the lattice velocity, e i represents the discrete velocity in the i direction, and u represents the macroscopic velocity of the fluid.
[0106] The equilibrium distribution functions in nine directions are calculated, including the equilibrium distribution function of the grid representing stillness and the migration equilibrium distribution function representing migration to the adjacent grid.
[0107] S208, forming local data using the local discrete distribution function and the local equilibrium distribution function, and forming migration data using the migration discrete distribution function and the migration equilibrium distribution function.
[0108] The grid discrete distribution function and grid equilibrium distribution function are used to represent the flow state of the current grid after the migration process. The migration discrete distribution function and migration equilibrium distribution function represent the distribution probability of particles migrating to the eight adjacent grids, which are used to perform subsequent collision process calculations and boundary processing calculations for each grid.
[0109] S209, the computing unit of the computing core performs collision process and boundary processing calculations on the grid data and the grid data of the grid corresponding to the position mark according to the position mark of the grid data read by the storage unit in the core, and performs collision process and boundary processing calculations on the migration data and the grid data of the adjacent grids corresponding to the grid with the position mark; or transmits the migration data to the storage unit in the core of the adjacent computing core in the D2Q9 logical structure, and the computing unit of the adjacent computing core performs collision process 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 results of the collision process and the boundary processing calculation, if converged, ending the calculation and outputting the result, if not converged, returning and restarting the migration process calculation.
[0111] This embodiment represents the distribution probability of particles in nine directions after migration by calculating the discrete probability distribution function and the equilibrium distribution function after migration, so as to provide data preparation for the collision process calculation and boundary processing calculation of the D2Q9 model.
[0112] Embodiment 3
[0113] Figure 6 This is a flow chart of a multi-core computing method for a lattice Boltzmann D2Q9 model described in Embodiment 2 of the present invention. This embodiment is optimized based on the above embodiment. In this embodiment, data transmission includes reading of grid point data and storage of calculation-completed grid point data. The specific optimization is as follows:
[0114] The in-core storage unit stores the calculated grid point data into the out-core storage unit according to the position mark, associates the 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;
[0115] Read the grid point data of the next grid marked at the corresponding position of the off-core storage unit.
[0116] Accordingly, the multi-core calculation method of the lattice Boltzmann D2Q9 model provided in this embodiment specifically includes:
[0117] S301, logically divide the computing cores of the multi-core SoC chip to form a D2Q9 logic structure, wherein the D2Q9 logic structure includes at least one 3 n ×3 n The two-dimensional logical structure of a computing core, the computing core of the D2Q9 logical structure includes a computing unit and an in-core storage unit.
[0118] S302, using the lattice Boltzmann D2Q9 model to divide the two-dimensional spatial distribution of the fluid, obtain a lattice matrix including m×m grids, each grid 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 contains the position mark of the corresponding grid in the lattice matrix, and the grid point data is stored in the off-core storage unit.
[0119] S303, assigning each operation core in the lattice matrix according to the D2Q9 logical structure and the lattice matrix The grid point data of the grid, and the position of the operation core in the D2Q9 logic structure is the same as The positions of the grids in the grid matrix correspond one to one.
[0120] S304, using a depth of 2 to divide the in-core storage unit of each computing core into a Ping area storage sub-unit and a Pang area storage sub-unit based on a first-in-first-out order, the Ping area storage sub-unit and the Pang area storage sub-unit alternately read the grid data matching the computing core from the off-core storage unit according to the position mark order.
[0121] S305, the computing unit of the computing core alternately performs migration process calculations on the grid point data read by the Ping area storage sub-unit and the Pang area storage sub-unit.
[0122] S306, the in-core storage unit stores the calculated grid point data into the out-core storage unit according to the position mark, associates the grid data with the grid corresponding to the position mark, and associates the migration data with the adjacent grids of the grid corresponding to the position mark.
[0123] After the migration process is calculated, the discrete probability distribution function of each grid remaining stationary after migration and the discrete probability distribution function in the direction of the eight adjacent grids are obtained. Correspondingly, each grid will also obtain the discrete probability distribution function of the adjacent grids migrating to the current grid. The discrete probability distribution function retained in the current grid and migrated to the current grid are associated, indicating the data needed for the subsequent collision process and boundary processing calculations.
[0124] S307, reading the grid point data of the next grid marked at the corresponding position of the off-core storage unit.
[0125] After the data storage is completed, the space of the storage unit in the core will be released, and the grid point data of the next grid will be read at this time to calculate the migration process of the next grid.
[0126] S308, the computing unit of the computing core performs collision process and boundary processing calculations on the grid data and the grid data of the grid corresponding to the position mark according to the position mark of the grid data read by the in-core storage unit, and performs collision process and boundary processing calculations on the migration data and the grid data of the adjacent grids corresponding to the grid with the position mark; or transmits the migration data to the in-core storage unit of the adjacent computing core in the D2Q9 logical structure, and the computing unit of the adjacent computing core performs collision process 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.
[0127] S309, judging whether the lattice matrix converges according to the results of the collision process and the boundary processing calculation, if converged, ending the calculation and outputting the result, if not converged, returning and restarting the migration process calculation.
[0128] This embodiment can avoid the limitation of the small capacity of the in-core storage unit by storing the calculated grid point data into the off-core storage unit during data transmission, releasing the in-core storage unit, and then reading the data of the next grid. It can be applicable to data calculations for more grids. While data is being transmitted, the computing unit of the computing core can still maintain the computing state, thereby improving resource utilization.
[0129] An optional implementation of this embodiment is that the collision process and boundary processing calculation include:
[0130] The collision process is calculated using the data of the grid and the migration data associated with the grid corresponding to the position mark; the boundary conditions of the grid close to the fluid-solid boundary are calculated using the non-equilibrium extrapolation format.
[0131] The discrete probability distribution function and equilibrium distribution function of the grid data associated with each grid and the migration data migrated to the grid are used to calculate the collision process of each grid. The calculation formula is as follows:
[0132]
[0133] Among them, f i (x, t) represents the discrete probability distribution function after collision, f i * (x, t) represents the discrete probability distribution function after migration calculated during the migration process, τ represents the relaxation time, and 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 calculation process is prone to numerical instability; if τ is too large, the distribution function may take a long time step to approach the equilibrium distribution function, thereby extending the calculation time and possibly causing inaccurate results.
[0134] The obtained discrete probability distribution function of each grid after collision is used to calculate the next migration process. 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 boundary conditions of the grid close to the fluid-solid boundary can be calculated by the non-equilibrium extrapolation format to obtain the discrete distribution function of the grid located at the edge of the fluid-solid boundary.
[0135] Optionally, the boundary condition calculation of the grid at the fluid-solid boundary using the non-equilibrium extrapolation format includes:
[0136] The equilibrium distribution function of the wall grid points is calculated according to the density and velocity of the wall grid points located on the solid side at the fluid-solid boundary;
[0137] The fluid-solid boundary divides the grid at the fluid-solid boundary into the fluid side and the solid side. Since there is no particle migration on the solid side, it is necessary to use the non-equilibrium extrapolation format to obtain the equilibrium distribution function on the solid side for the calculation data of the next migration. The vertices of the grid on the fluid side are used as fluid grid points, and the vertices of the grid on the solid side are used as wall grid points, such as Figure 7 As shown in the figure, the curve is the fluid-solid boundary, and the fluid grid point x f and the wall grid point x w The link between b At this point, the wall grid point x w The distribution function includes equilibrium distribution function and non-equilibrium distribution function. f The density of the wall grid points x is defined w Density:
[0138]
[0139] Using the fluid grid x f The speed and x ff The velocity interpolation of the wall grid points x is defined w speed:
[0140]
[0141] where Δ represents the fraction of intersecting links in the fluid region,
[0142] u w1 represents the macroscopic velocity u of point b b and the macroscopic velocity u at point f f The interpolation value, u w2 represents the macroscopic velocity u of point b b The macroscopic velocity u of point ff ff The interpolation of represents the approximate value of the macroscopic velocity at point w, u b represents the macroscopic velocity of point b, u f represents the macroscopic velocity of point f, u ff Represents the macroscopic velocity at point ff.
[0143] We can get an approximate imaginary wall grid point x w The equilibrium distribution function at The calculation formula is as follows:
[0144]
[0145] Among them, w i represents the weight coefficient, represents the approximate macroscopic density at point w, ρ0 represents the average density, which is set to 1, c represents the lattice sound velocity, and ei represents the discrete speed, Represents the approximate value of the macroscopic velocity at point w.
[0146] The non-equilibrium distribution function of the wall grid point is determined according to the difference between the distribution function of the fluid grid point located on the fluid side at the fluid-solid boundary and the equilibrium distribution function.
[0147] Using the fluid grid x f and x ff The difference between the particle discrete distribution function and the equilibrium distribution function is used to calculate the fluid grid point x f The non-equilibrium distribution function is calculated as follows:
[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 ) represents the non-equilibrium distribution function of the particle at point f, f i (x f ) represents the discrete distribution function of the particle at point f, f i (eq) (x f ) represents the particle equilibrium distribution function at point f, fi i (ne) (x ff ) represents the particle non-equilibrium distribution function at point ff, f i (x ff ) represents the discrete distribution function of particles at point ff, f i (eq) (x ff ) represents the particle equilibrium distribution function at point ff.
[0151] The wall grid point x w The non-equilibrium distribution function f i (ne) (x w ,t), the calculation formula is as follows:
[0152]
[0153] The distribution function of the wall grid points is determined according to the equilibrium distribution function and the non-equilibrium distribution function of the wall grid points, and is used to supplement the grid point data of the grid at the fluid-solid boundary.
[0154] Using the wall grid point x w The equilibrium distribution function and the non-equilibrium function are used for boundary processing calculation, that is, the collision process calculation of the grid at the fluid-solid boundary is performed to obtain the wall grid point x after the collision. w The particle discrete distribution function is used to calculate the next migration process. The formula is as follows:
[0155]
[0156] Among them, f i (x w ,t) represents the discrete distribution function of particles 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 4
[0158] Figure 8 This is a flow chart of a multi-core computing method of a lattice Boltzmann D2Q9 model according to the fourth embodiment of the present invention. This embodiment is optimized based on the above embodiment. In this embodiment, the migration data is transmitted to the in-core storage unit of the adjacent computing core in the D2Q9 logical structure. The specific optimization is as follows:
[0159] An inter-core data channel is established using the scheduling unit of the computing core, and the migration data is transmitted to the adjacent computing core through the inter-core data channel. The scheduling unit of the adjacent computing core stores the migration data in the external storage unit through the internal storage unit, and associates the migration data with the grid point data of the adjacent grid corresponding to the position mark according to the position mark.
[0160] Accordingly, the multi-core calculation method of the lattice Boltzmann D2Q9 model provided in this embodiment specifically includes:
[0161] S401, logically divide the computing cores of the multi-core SoC chip to form a D2Q9 logic structure, wherein the D2Q9 logic structure includes at least one 3 n ×3 n The two-dimensional logical structure of a computing core, the computing core of the D2Q9 logical structure includes a computing unit and an in-core storage unit.
[0162] S402, using the lattice Boltzmann D2Q9 model to divide the two-dimensional spatial distribution of the fluid, obtain a lattice matrix including m×m grids, each grid 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 contains the position mark of the corresponding grid in the lattice matrix, and the grid point data is stored in the off-core storage unit.
[0163] S403, assigning each operation core in the lattice matrix according to the D2Q9 logical structure and the lattice matrix The grid point data of the grid, and the position of the operation core in the D2Q9 logic structure is the same as The positions of the grids in the grid matrix correspond one to one.
[0164] S404, using a depth of 2 to divide the in-core storage unit of each computing core into a Ping area storage sub-unit and a Pang area storage sub-unit based on a first-in-first-out order, the Ping area storage sub-unit and the Pang area storage sub-unit alternately read the grid data matching the computing core from the off-core storage unit according to the position mark order.
[0165] S405, the computing unit of the computing core alternately performs migration process calculations on the grid data read by the Ping area storage subunit and the Pang area storage subunit. When the computing core calculates the grid data read by the Ping area storage subunit, the Pang area storage subunit transmits data with the storage unit outside the core. When the computing core calculates the grid data read by the Pang area storage subunit, the Ping area storage subunit transmits data with the storage unit outside the core. The data transmission includes reading the grid data and storing the calculated grid data. The calculated grid data includes the grid data and the migration data. The grid data is the distribution probability of the fluid particles in the central grid under the D2Q9 model. The migration data is the distribution probability of the fluid particles in the 8 grid directions adjacent to the central grid under the D2Q9 model.
[0166] S406, the calculation unit of the operation core performs collision process and boundary processing calculations on the grid data of the grid corresponding to the position mark according to the position mark of the grid data read by the storage unit in the core.
[0167] S407-1, performing collision process and boundary processing calculations on the grid point data of the adjacent grids of the migration data and the position mark pair grid respectively;
[0168] or,
[0169] S407-2, using the scheduling unit of the computing core to establish an inter-core data channel, the migration data is transmitted to the adjacent computing core through the inter-core data channel, the scheduling unit of the adjacent computing core stores the migration data in the external storage unit through the internal storage unit, and associates the migration data with the grid point data of the adjacent grid corresponding to the position mark according to the position mark. The calculation unit of the adjacent computing core performs collision process and boundary processing calculation on the migration data and the grid point data of the corresponding grid in the matched grid according to the grid point data position mark.
[0170] When the position mark of the grid data shows that the position of the corresponding grid is not at the edge of the grid area corresponding to the current operation core, the migration data can be used to perform collision process and boundary processing calculations with the grid data of the adjacent grid inside the grid area corresponding to the current operation core; when the position mark of the grid data shows that the position of the corresponding grid is at the edge of the grid area corresponding to the current operation core, the migration data needs to be migrated to the grid area corresponding to the adjacent operation core, and then the calculation unit of the adjacent operation core performs the collision process and boundary processing calculations. At this time, the Bus is used to establish an inter-core data transmission channel, and the corresponding inter-core communication protocol is developed. The scheduling unit schedules the migration data to be transmitted to the adjacent operation core, and the scheduling unit of the adjacent operation core stores it in its corresponding off-core storage unit for the adjacent operation core to call in the subsequent collision process and boundary processing calculation.
[0171] S408, judging whether the grid matrix converges according to the results of the collision process and the boundary processing calculation, if converged, ending the calculation and outputting the result, if not converged, returning and restarting the migration process calculation.
[0172] This embodiment establishes a data transmission channel between cores, develops a corresponding high-speed transmission protocol, and performs data transmission between computing cores, which can adapt to the computing characteristics of the D2Q9 model and meet the needs of large-scale data computing.
[0173] Embodiment 5
[0174] This embodiment is optimized based on the above embodiment. In this embodiment, whether the grid matrix converges is determined based on the results of the collision process and boundary processing calculations. The specific optimization is as follows:
[0175] The macroscopic velocity of the fluid is obtained by using the discrete probability distribution function calculated after this collision process and boundary processing, and the sum of the macroscopic velocities of all grids in the fluid area is compared with the macroscopic velocity of the fluid obtained according to the discrete probability distribution function after the previous collision process and boundary processing calculation to determine the convergence of the grid matrix.
[0176] In actual calculations, according to the calculation process of the LBM model, a migration process, a collision process and a boundary processing calculation are performed at each time step. The macroscopic velocity of the fluid at the current time step is calculated by using the discrete probability distribution function obtained after the collision process and boundary processing calculations at the current time step, and the sum of the macroscopic velocities of all grids in the fluid area is calculated; the root mean square error between the sum of the macroscopic velocities of all grids in the fluid area at the current time step and the sum of the macroscopic velocities of all grids in the fluid area at the previous time step is calculated, and the root mean square value is used to judge whether the model converges. The calculation formula is as follows:
[0177]
[0178] Where Error represents the error, i represents the grid point coordinates in the X-axis direction, j represents the grid point coordinates in the Y-axis direction, and t represents the time. t Indicates the time step. u x (i,j,t+δ t ) indicates that the point (i, j) is at t+δ t The macroscopic velocity in the X-axis direction at the moment. x (i,j,t) represents the macroscopic velocity of point (i,j) in the X-axis direction at time t. y (i,j,t+δ t ) indicates that the point (i, j) is at t+δ t The macroscopic velocity in the Y-axis direction at the moment, u y (i,j,t) represents the macroscopic velocity of point (i,j) in the Y-axis direction at time t, ∑ i,j represents the sum of the values at all grid points within the fluid domain.
[0179] If the RMS value is less than 10 -6 , the fluid flow state is considered to be stable and the lattice matrix converges. If the RMS value is greater than 10 -6 Then continue the calculation for the next time step.
[0180] This embodiment determines whether the flow state of the fluid tends to be stable through the root mean square error of the flow state of the fluid region at two time steps. If it is stable, the model converges and the prediction result of the model is output. If it is unstable, iterative calculation continues until the model converges.
[0181] Embodiment 6
[0182] This embodiment is optimized based on the above embodiment, and in this embodiment, it also includes:
[0183] A plurality of multi-core SoC chips including the D2Q9 logic structure are logically divided to form a D2Q9 chip structure, and the D2Q9 chip structure is used to calculate the grid point data of a grid matrix of z×z grids divided based on a lattice Boltzmann D2Q9 model.
[0184] On the basis of dividing the multi-core SoC chip into a D2Q9 logic structure, multiple such SoC chips can be used to form a D2Q9 chip structure again. The D2Q9 chip structure can be used to divide the lattice matrix based on the same principle. Each multi-core SoC chip in the D2Q9 chip structure corresponds to a lattice area at a corresponding position. The D2Q9 logic structure is then used to divide the lattice area corresponding to each multi-core SoC chip, and the calculation processing is performed using the computing core of the multi-core SoC chip. In order to ensure the speed of data transmission between multiple chips, and thus ensure the performance of the multi-chip structure, an optical fiber link is used to establish a data transmission channel between chips, and a corresponding transmission protocol is developed to ensure the efficiency of data transmission between chips.
[0185] This embodiment divides the lattice matrix into layers at the chip level and the computing core level within the chip, and further improves the data processing capability by using multiple chips, which can process more data at the same time and improve the calculation speed.
[0186] Embodiment 7
[0187] Fig. 9 Schematic diagram of the structure of a multi-core computing device of a lattice Boltzmann D2Q9 model according to Embodiment 7 of the present invention, as shown in FIG. Fig. 9 As shown, the device comprises:
[0188] The computing core logic structure generation module 810 is used to logically divide the computing cores of multiple SoC chips into a D2Q9 logic structure;
[0189] A lattice matrix generation module 820 is used to divide the two-dimensional spatial distribution of the fluid using the Boltzmann D2Q9 model to generate a lattice matrix;
[0190] The grid point data allocation module 830 is used to allocate the grid point data of the corresponding regional grid in the grid matrix according to the position of the operation core in the D2Q9 logic structure;
[0191] A Ping / Pang storage module 840, used to divide the storage unit in each computing core into a Ping area storage sub-unit and a Pang area storage sub-unit;
[0192] A migration process calculation module 850 is used to perform migration process calculation on the grid point data read from the storage unit in the core;
[0193] The collision process and boundary processing calculation module 860 is used to perform collision process calculation and boundary processing calculation on the grid data and the migration data according to the position mark of the grid data;
[0194] The convergence judgment module 870 is used to judge whether the grid is converged according to the results of the collision process and boundary processing calculation.
[0195] The multi-core computing device of the lattice Boltzmann D2Q9 model described in this embodiment divides the computing cores of the multi-core SoC chip into a two-dimensional logical structure matching the D2Q9 model, respectively calculates the two-dimensional spatial distribution of the fluid divided into lattices, and allocates a lattice area of the same size in the lattice matrix to each computing core, so that the two-dimensional logical structure of the computing core is more suitable for the D2Q9 model, and the load of each computing core is relatively balanced, which is conducive to giving full play to the computing performance of the chip. Then, the in-core storage space of the computing core is divided into two identical Ping area storage sub-units and Pang area storage sub-units, and the grid point data of the grid is read alternately from the out-core storage unit based on the first-in-first-out principle. The computing unit of the computing core also alternately calculates the data to be processed read by the Ping area storage sub-unit and the Pang area storage sub-unit according to the reading order. When the computing core calculates the data in one of the storage sub-units, the other storage sub-unit transmits data with the out-core storage unit, which ensures that the computing resources of the computing core are fully utilized, greatly reducing the idleness of computing resources, and at the same time, the out-core storage unit can be used to accommodate the grid point data of more grids, which can be applied to the calculation of more grids.
[0196] The multi-core computing device of the lattice Boltzmann D2Q9 model provided in the embodiment of the present invention can execute the multi-core computing method of the lattice Boltzmann D2Q9 model provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.
[0197] The above descriptions are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A multi-core computing method for a lattice Boltzmann D2Q9 model, characterized in that: include: The computing cores of the multi-core SoC chip are logically divided to form a D2Q9 logic structure, wherein the D2Q9 logic structure includes at least one 3 n ×3 n A two-dimensional logic structure of a computing core, wherein the computing core of the D2Q9 logic structure includes a computing unit and an in-core storage unit; The two-dimensional spatial distribution of the fluid is divided by the lattice Boltzmann D2Q9 model to obtain a lattice matrix including m×m grids. Each grid 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 contains the position mark of the corresponding grid in the lattice matrix. The grid point data is stored in the off-core storage unit. According to the D2Q9 logical structure and the lattice matrix, each operation core is assigned a lattice matrix. The grid point data of the grid, and the position of the operation core in the D2Q9 logic structure is the same as The positions of the grids in the grid matrix correspond one to one; The in-core storage unit of each computing core is divided into a Ping area storage subunit and a Pang area storage subunit based on a first-in-first-out order. The Ping area storage subunit and the Pang area storage subunit alternately read the grid point data matched by the computing core from the out-core storage unit according to the position mark sequence. The computing 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 calculates the grid data read by the Ping area storage subunit, the Pang area storage subunit transmits data with the storage unit outside the core. When the operation core calculates the grid data read by the Pang area storage subunit, the Ping area storage subunit transmits data with the storage unit outside the core. The data transmission includes reading the grid data and storing the calculated grid data. The calculated grid data includes the grid data and the migration data. The grid data is the distribution probability of the fluid particles in the central grid under the D2Q9 model. The migration data is the distribution probability of the fluid particles in the 8 grid directions adjacent to the central grid under the D2Q9 model. The computing unit of the computing core performs collision process and boundary processing calculations on the grid data and the grid data of the grid corresponding to the position mark according to the position mark of the grid data read by the storage unit in the core, and performs collision process and boundary processing calculations on the migration data and the grid data of the adjacent grids of the grid with the position mark respectively; or transmits the migration data to the storage unit in the core of the adjacent computing core in the D2Q9 logic structure, and the computing unit of the adjacent computing core performs collision process and boundary processing calculations 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; According to the results of the collision process and the boundary processing calculation, it is determined whether the lattice matrix converges. If it converges, the calculation is terminated and the result is output. If it does not converge, it returns and restarts the migration process calculation.
2. The method according to claim 1, characterized in that The migration process calculation includes: According to the preset discrete probability distribution function in the grid point data corresponding to each grid, after a preset time step, a post-migration discrete probability distribution function is obtained, wherein the post-migration discrete probability distribution function includes a grid discrete distribution function and a migration discrete distribution function; The macroscopic density and macroscopic velocity of the fluid are calculated using the discrete probability distribution function after migration; Calculating the equilibrium distribution function of the grid data using the macroscopic density and macroscopic velocity of the fluid, wherein the equilibrium distribution function includes a grid equilibrium distribution function and a migration equilibrium distribution function; The grid data are formed using the grid discrete distribution function and the grid equilibrium distribution function, and the migration data are formed using the migration discrete distribution function and the migration equilibrium distribution function.
3. The method according to claim 1, characterized in that The data transmission includes reading grid point data and storing the calculated grid point data, including: The in-core storage unit stores the calculated grid point data into the out-core storage unit according to the position mark, associates the 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; Read the grid point data of the next grid marked at the corresponding position of the off-core storage unit.
4. The method according to claim 1 or 3, characterized in that: The collision process and boundary processing calculation include: The collision process is calculated using the migration data associated with the grid corresponding to the position mark data; The boundary conditions of the grid near the fluid-solid boundary are calculated using a non-equilibrium extrapolation scheme.
5. The method according to claim 4, characterized in that 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 points is calculated according to the density and velocity of the wall grid points located on the solid side at the fluid-solid boundary; Determining the non-equilibrium distribution function of the wall grid points according to the difference between the distribution function of the fluid grid points located on the fluid side at the fluid-solid boundary and the equilibrium distribution function; The distribution function of the wall grid points is determined according to the equilibrium distribution function and the non-equilibrium distribution function of the wall grid points, and is used to supplement the grid point data of the grid at the fluid-solid boundary.
6. The method according to claim 1, characterized in that The method of transmitting the migration data to the in-core storage unit of the adjacent computing core in the D2Q9 logic structure includes: An inter-core data channel is established using the scheduling unit of the computing core, and the migration data is transmitted to the adjacent computing core through the inter-core data channel. The scheduling unit of the adjacent computing core stores the migration data in the external storage unit through the internal storage unit, and associates the migration data with the grid point data of the adjacent grid corresponding to the position mark according to the position mark.
7. The method according to claim 1, characterized in that The Ping area storage subunit and the Pang area storage subunit alternately read the grid point data matched by the operation core from the out-of-core storage unit according to the position mark sequence, including: The Ping area storage subunit and the Pang area storage subunit of each computing core are alternately allocated from the current computing core. The first grid in each grid reads the grid point data of the corresponding grid in turn.
8. The method according to claim 1, characterized in that The step of judging whether the grid matrix is converged according to the results of the collision process and the boundary processing calculation includes: The macroscopic velocity of the fluid is obtained by using the discrete probability distribution function calculated after this collision process and boundary processing, and the sum of the macroscopic velocities of all grids in the fluid area is compared with the macroscopic velocity of the fluid obtained according to the discrete probability distribution function after the previous collision process and boundary processing calculation to determine the convergence of the grid matrix.
9. The method according to claim 1, characterized in that: The method further comprises: A plurality of multi-core SoC chips including the D2Q9 logic structure are logically divided to form a D2Q9 chip structure, and the D2Q9 chip structure is used to calculate the grid point data of a grid matrix of z×z grids divided based on a lattice Boltzmann D2Q9 model.
10. A multi-core computing device for a lattice Boltzmann D2Q9 model, characterized in that: include: A computing core logic structure generation module is used to logically divide the computing cores of multiple SoC chips into a D2Q9 logic structure; A lattice matrix generation module is used to divide the two-dimensional spatial distribution of the fluid using the Boltzmann D2Q9 model to generate a lattice matrix; A grid point data allocation module is used to allocate grid point data of corresponding regional grids in the grid matrix according to the position of the operation core in the D2Q9 logic structure; Ping / Pang storage module, used to divide the in-core storage unit of each computing core into Ping area storage sub-unit and Pang area storage sub-unit; A migration process calculation module, used for performing migration process calculation on the grid point data read from the storage unit in the core; The collision process and boundary processing calculation module is used to perform collision process calculation and boundary processing calculation on the grid data and the migration data according to the position mark of the grid data; The convergence judgment module is used to judge whether the grid is converged according to the results of the collision process and boundary processing 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
Neural network pipeline multi-core parallel computing method
CN115034366A
Memory control algorithm, and method and apparatus for fluid numerical analysis based on lattice boltzmann method using same
KR101489708B1