Sparse matrix storage access method, device, equipment and medium for fluid computing

By establishing a mapping table between connection surfaces and non-diagonal non-zero elements of sparse matrix, combining preset matrix storage rules and main diagonal elements, the problem of low storage and access efficiency of sparse matrix in fluid mechanics scenarios is solved, and efficient memory usage and data access is achieved.

CN119646246BActive Publication Date: 2025-04-18CALCULATION AERODYNAMICS INST CHINA AERODYNAMICS RES & DEV CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510181470.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-04-18
Estimated Expiration
2045-02-19

AI Technical Summary

Technical Problem

The prior art has low storage and access efficiency of sparse matrices in fluid mechanics scenarios, resulting in waste of memory space and poor data access performance.

Method used

By establishing a target mapping table for the connection surface between grid cells and the matrix position storage information of non-diagonal non-zero elements of sparse matrix, combining preset matrix storage rules and main diagonal elements, efficient matrix storage and data access are achieved.

Benefits of technology

It effectively reduces the waste of memory space in sparse matrix storage, improves data access efficiency, and reduces access overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646246B_ABST
    Figure CN119646246B_ABST
Patent Text Reader

Abstract

The present application discloses a sparse matrix storage access method, device, equipment and medium for fluid computing, which relates to the field of fluid mechanics, including: based on the grid units in the current fluid mechanics scene, discretely solving the flow control equation to obtain a coefficient matrix; the coefficient matrix is ​​a sparse matrix; based on the mapping relationship between the connection surface between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, a target mapping table is determined, and a matrix storage operation is triggered based on a preset matrix storage rule, a target mapping table and the main diagonal elements and non-diagonal non-zero elements in the coefficient matrix; after completing the matrix storage, the matrix position index corresponding to the connection surface to be accessed is determined based on the corresponding target surface number in the target mapping table, and the target non-diagonal non-zero element value is obtained using the matrix position index to complete the connection surface data access operation. The present application solves the problem of large waste of memory space in sparse matrix storage and poor random data access performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of fluid mechanics, and in particular to a sparse matrix storage access method, device, equipment and medium for fluid computing. Background Art

[0002] At present, the spatial and temporal discretization of the fluid region in the fluid dynamics scene involves sparse matrix-vector operations with a large number of zero cells. Especially as the number of grids increases, the discretized matrix-vector operations occupy a large amount of simulation time. Figure 1 (Wherein, the horizontal and vertical coordinates in the figure below are the x-axis coordinates and z-axis coordinates in the calculated xyz coordinate system, respectively; the horizontal coordinate in the figure above represents the matrix row number, and the vertical coordinate represents the matrix column number). It gives the distribution of coefficients of the discrete matrix A (matrix size is 17400×17400) of the two-dimensional airfoil grid with a grid volume of 17400, where the number of non-zero elements is 71674, and the non-diagonal non-zero elements are symmetrically distributed. The larger the grid volume, the more zero elements in the A matrix, and the greater the waste of memory space.

[0003] Due to the characteristics of sparse matrices, there are a large number of zero cells in the matrix. Although the traditional two-dimensional array storage method stores a large number of zero cells, it will cause a lot of waste in storage space and increase the calculation time of matrix vectors, resulting in low data access efficiency. Some existing solutions use row compression storage (CSR, Compressed SparseRow matrix), which represents sparse matrices by recording the number of non-zero cells in each row and the position and value of each non-zero cell. Although it can reduce the storage of zero cells, how to efficiently access data and select the appropriate method to ensure fast access and calculation of matrix non-zero cells is still a challenge. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a sparse matrix storage access method, device, equipment and medium for fluid computing, which can effectively solve the problem of large waste of sparse matrix storage memory space and poor random data access performance, thereby improving data access efficiency and reducing access overhead. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a sparse matrix storage access method for fluid computing, comprising:

[0006] Discretely solve the corresponding flow control equation based on the grid cells in the current fluid mechanics scene to obtain a corresponding coefficient matrix; the coefficient matrix is ​​a sparse matrix;

[0007] Determine a corresponding target mapping table based on a mapping relationship between the connection surfaces between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and trigger a corresponding matrix storage operation based on a preset matrix storage rule, the target mapping table, and the main diagonal elements in the coefficient matrix and the non-diagonal non-zero elements;

[0008] After completing the matrix storage, the matrix position index corresponding to the connection surface to be accessed is determined based on the corresponding target surface number in the target mapping table, and the corresponding target non-diagonal non-zero element value is obtained using the matrix position index to complete the corresponding connection surface data access operation.

[0009] Optionally, the discrete solution of the corresponding flow control equation based on the grid cells in the current fluid mechanics scene to obtain the corresponding coefficient matrix includes:

[0010] Determine the flow governing equations for the current fluid dynamics scenario through mathematical modeling;

[0011] The flow control equation is discretized using the grid cells in the current fluid mechanics scene to obtain a corresponding linear equation, and a corresponding coefficient matrix is ​​determined from the linear equation.

[0012] Optionally, the determining a corresponding target mapping table based on a mapping relationship between the connection surfaces between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix includes:

[0013] Obtaining numbers corresponding to connection surfaces between the grid units to obtain surface numbers;

[0014] Constructing a corresponding one-dimensional array based on the surface numbers to obtain a target surface number array;

[0015] Determine the matrix upper triangular index and the matrix lower triangular index corresponding to the connection surface through a mapping relationship between the connection surface and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix;

[0016] Constructing one-dimensional arrays according to the upper triangular index of the matrix and the lower triangular index of the matrix respectively, so as to obtain an upper triangular index array of a target matrix and a lower triangular index array of a target matrix;

[0017] A target mapping table is determined based on the target face number array, the target matrix upper triangle index array, and the target matrix lower triangle index array.

[0018] Optionally, triggering a corresponding matrix storage operation based on a preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix includes:

[0019] Obtaining the main diagonal elements in the coefficient matrix, and constructing a one-dimensional array based on the main diagonal elements to obtain a target main diagonal element array;

[0020] Obtain the non-diagonal non-zero elements in the coefficient matrix, and determine a target storage matrix corresponding to the non-diagonal non-zero elements by adopting a row compression storage method;

[0021] A corresponding matrix storage operation is triggered based on the target main diagonal element array, the target storage matrix, and the target mapping table.

[0022] Optionally, the adopting row compression storage mode to determine the target storage matrix corresponding to the non-diagonal non-zero elements includes:

[0023] Determine a corresponding row offset based on the number of the non-diagonal non-zero elements of each row in the coefficient matrix, and construct a one-dimensional array according to the row offset to obtain a target row offset array;

[0024] Obtaining the column number index of the non-diagonal non-zero elements of each row in the coefficient matrix, and constructing a one-dimensional array according to the column number index to obtain a target column number index array;

[0025] Constructing a one-dimensional array according to the values ​​of the non-diagonal non-zero elements to obtain a target non-diagonal non-zero element array;

[0026] A target storage matrix is ​​determined based on the target row offset array, the target column number index array, and the target off-diagonal non-zero element array.

[0027] Optionally, the method further includes:

[0028] After completing the matrix storage, for the current grid cell value to be accessed, the value of the main diagonal element at the corresponding position in the target main diagonal element array is obtained to complete the corresponding cell value access operation.

[0029] Optionally, determining a matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table, and obtaining a corresponding target non-diagonal non-zero element value using the matrix position index includes:

[0030] Determine the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table and the target matrix upper triangle index value and the target matrix lower triangle index value corresponding to the target surface number;

[0031] The corresponding target non-diagonal non-zero element value is determined by using the matrix position index, the target column number index array, and the target non-diagonal non-zero element array to complete the corresponding connection surface data access operation.

[0032] In a second aspect, the present application provides a sparse matrix storage access device for fluid computing, comprising:

[0033] A matrix acquisition module, used for discretely solving the corresponding flow control equation based on the grid cells in the current fluid mechanics scene to obtain a corresponding coefficient matrix; the coefficient matrix is ​​a sparse matrix;

[0034] A matrix storage module, used to determine a corresponding target mapping table based on a mapping relationship between the connection surface between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and trigger a corresponding matrix storage operation based on a preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix;

[0035] A data access module is used to determine the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table after completing the matrix storage, and use the matrix position index to obtain the corresponding target non-diagonal non-zero element value to complete the corresponding connection surface data access operation.

[0036] In a third aspect, the present application provides an electronic device, including:

[0037] Memory, used to store computer programs;

[0038] A processor is used to execute the computer program to implement the steps of the aforementioned sparse matrix storage access method for fluid computing.

[0039] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the steps of the aforementioned sparse matrix storage access method for fluid computing.

[0040] It can be seen that in the present application, the corresponding flow control equation is discretely solved based on the grid units in the current fluid mechanics scene to obtain the corresponding coefficient matrix; the coefficient matrix is ​​a sparse matrix; the corresponding target mapping table is determined based on the mapping relationship between the connection surface between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and the corresponding matrix storage operation is triggered based on the preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix; after the matrix storage is completed, the matrix position index corresponding to the connection surface to be accessed is determined based on the corresponding target surface number in the target mapping table, and the corresponding target non-diagonal non-zero element value is obtained using the matrix position index to complete the corresponding connection surface data access operation. That is, in this embodiment, when storing the coefficient matrix, it is necessary to establish a target mapping table for the matrix position storage information of the connection surface between the grid units and the non-diagonal non-zero elements in the coefficient matrix, and then use the target mapping table, the main diagonal elements in the coefficient matrix, and the non-diagonal non-zero elements for storage. Afterwards, for the connection surface to be accessed, the target non-diagonal non-zero element value is determined by the corresponding target surface number in the target mapping table to complete the corresponding connection surface data access operation. In this way, the problem of large waste of sparse matrix storage memory space and poor random data access performance can be effectively solved, thereby improving data access efficiency and reducing access overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0042] Figure 1 A schematic diagram of the discrete matrix coefficient distribution of a two-dimensional airfoil grid provided in this application;

[0043] Figure 2 A flow chart of a sparse matrix storage access method for fluid computing provided in this application;

[0044] Figure 3 A schematic diagram of a process for obtaining a coefficient matrix provided in this application;

[0045] Figure 4 A schematic diagram of a 7-unit grid provided for this application;

[0046] Figure 5 A coefficient matrix schematic diagram provided for this application;

[0047] Figure 6 A schematic diagram of a modified matrix storage structure provided in this application;

[0048] Figure 7 A schematic diagram of the structure of a sparse matrix storage access device for fluid computing provided in this application;

[0049] Figure 8 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] Due to the characteristics of sparse matrices, there are a large number of zero cells in the matrix. Although the traditional two-dimensional array storage method stores a large number of zero cells, it will cause a lot of waste in storage space and will increase the operation time of matrix vectors, thereby reducing the efficiency of data access. In some existing schemes, row compression storage is adopted to represent sparse matrices by recording the number of non-zero cells in each row and the position and value of each non-zero cell. Although the storage of zero cells can be reduced, how to efficiently access data and select a suitable method to ensure fast access and calculation of matrix non-zero cells is still a challenge. To this end, the present application provides a sparse matrix storage access scheme for fluid computing, which can effectively solve the problem of large waste of sparse matrix storage memory space and poor random data access performance, thereby improving data access efficiency and reducing access overhead.

[0052] See also Figure 2 As shown, an embodiment of the present invention discloses a sparse matrix storage access method for fluid computing, comprising:

[0053] Step S11: Discretely solve the corresponding flow control equation based on the grid cells in the current fluid mechanics scene to obtain a corresponding coefficient matrix; the coefficient matrix is ​​a sparse matrix.

[0054] Specifically, in this embodiment, the discrete solution of the corresponding flow control equation based on the grid units in the current fluid mechanics scene to obtain the corresponding coefficient matrix includes: determining the flow control equation of the current fluid mechanics scene through mathematical modeling; discretizing the flow control equation using the grid units in the current fluid mechanics scene to obtain the corresponding linear equation, and determining the corresponding coefficient matrix from the linear equation. Figure 3As shown in FIG. 1 , it can be seen that the specific solution process is to discretize the flow control equation (group) based on the grid unit and convert it into a linear equation (group) for solution. The discretization process of the equation (group) obtains the linear equation (group), that is, Figure 3 The coefficients of the matrix equation in (the coefficient matrix and the coefficient of the right-hand side ). Wherein, the flow control equation is as follows:

[0055] ;

[0056] In the formula, is a conserved variable; is a finite control body; is the convective flux vector; is the viscous flux vector; For time; is a surface unit; is the source term; represents differential; is the symbol for partial differential; is the integral symbol; is the closed line integral symbol. The matrix equation is as follows:

[0057] ;

[0058] In the formula, are the flow field variables that need to be solved.

[0059] Step S12, determine the corresponding target mapping table based on the mapping relationship between the connection surface between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and trigger the corresponding matrix storage operation based on the preset matrix storage rule, the target mapping table, and the main diagonal elements in the coefficient matrix and the non-diagonal non-zero elements.

[0060] In this embodiment, when obtaining the coefficient matrix Afterwards, the coefficient matrix is ​​stored. Taking the example of 7 grid units, Figure 4 As shown, the adjacent units of grid unit 1 are grid unit 2 and grid unit 5, and the adjacent units of grid unit 2 are grid unit 1, grid unit 3 and grid unit 4. For grid cells and grid cells connection surface. Figure 5 The coefficient matrix after the equation is discretized by the traditional two-dimensional array storage method is shown as follows: , the matrix size is 7×7 (grid unit×grid unit), the coefficient matrix The coefficients and storage locations of are obtained by calculation. As can be seen from the figure, the main diagonal elements are the non-zero elements of each row, and the storage locations of the non-diagonal non-zero elements of each row are symmetrical ( and ),in Represents a grid cell For grid cells Contribution Represents a grid cell For grid cells contribution.

[0061] It should be noted that in this embodiment, the connection surface is used Establish a mapping table of the connection surface and the non-diagonal non-zero element matrix position storage information to achieve matrix Efficient and accurate storage and subsequent iterative process processing. Figure 6 As shown, the traditional two-dimensional array storage method is changed to several one-dimensional arrays for efficient storage of non-zero units, thereby improving memory usage and access efficiency. The corresponding values ​​of the grid cells (i.e., the main diagonal elements) are stored separately, and the corresponding values ​​of the connecting surfaces between the grids (i.e., the non-diagonal non-zero elements) are stored using a CSR matrix, and a mapping table of the storage information of the connecting surfaces and the non-diagonal non-zero element matrix positions is established to achieve efficient data storage.

[0062] Regarding the establishment of a mapping table between the connection surface and the matrix position storage information of the non-diagonal non-zero elements, the corresponding target mapping table is determined based on the mapping relationship between the connection surface between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, including: obtaining the number corresponding to the connection surface between the grid units to obtain the surface number; constructing a corresponding one-dimensional array based on the surface number to obtain the target surface number array (i.e., the Figure 6 In Array, where '[A]' means the size of the array is A. Represents the total number of computing units); determine the matrix upper triangular index and the matrix lower triangular index corresponding to the connection surface through the mapping relationship between the connection surface and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix; construct a one-dimensional array according to the matrix upper triangular index and the matrix lower triangular index, respectively, to obtain the target matrix upper triangular index array (that is, the Figure 6 In array) and the lower triangular index array of the target matrix (that is, the Figure 6 In array); determine the target mapping table based on the target face number array, the target matrix upper triangle index array and the target matrix lower triangle index array.

[0063] Regarding the storage of the main diagonal elements and the non-diagonal non-zero elements, the triggering of the corresponding matrix storage operation based on the preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix includes: obtaining the main diagonal elements in the coefficient matrix, and constructing a one-dimensional array based on the main diagonal elements to obtain a target main diagonal element array (i.e., the Figure 6 In array); obtain the non-diagonal non-zero elements in the coefficient matrix, and determine the target storage matrix corresponding to the non-diagonal non-zero elements by row compression storage; trigger the corresponding matrix storage operation based on the target main diagonal element array, the target storage matrix and the target mapping table.

[0064] Furthermore, in this embodiment, the use of row compression storage to determine the target storage matrix corresponding to the non-diagonal non-zero elements includes: determining the corresponding row offset based on the number of the non-diagonal non-zero elements in each row of the coefficient matrix, and constructing a one-dimensional array according to the row offset to obtain a target row offset array (i.e., Figure 6 In array); obtain the column number index of the non-diagonal non-zero elements of each row in the coefficient matrix, and construct a one-dimensional array according to the column number index to obtain the target column number index array (i.e., the Figure 6 In array); construct a one-dimensional array according to the values ​​of the non-diagonal non-zero elements to obtain a target non-diagonal non-zero element array (i.e., the Figure 6 In array); determining a target storage matrix based on the target row offset array, the target column number index array, and the target off-diagonal non-zero element array.

[0065] This method directly assigns the relevant information of the connection surface to the matrix during the numerical discretization process. On the one hand, there is no need to apply for additional data to store the discrete process information, saving memory space; on the other hand, the mapping relationship can realize efficient access to the matrix and reduce the overhead caused by additional index search. According to the program's calculation logic and data access pattern, the memory access requirements of the next few steps can be predicted and pre-extraction operations can be triggered; in addition, data that is frequently accessed in subsequent calculations can be closer in memory, reducing the jumpiness of memory access.

[0066] Step S13: After completing the matrix storage, determine the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table, and use the matrix position index to obtain the corresponding target non-diagonal non-zero element value to complete the corresponding connection surface data access operation.

[0067] It should be understood that in the discrete calculation process of this embodiment, the corresponding values ​​of the grid cells and the corresponding values ​​of the connection surfaces are stored separately. When the values ​​on the grid cells are frequently accessed, only the values ​​in the local diagonal element array need to be accessed, reducing global memory access. The diagonal elements are more correlated, and these elements are sorted together. In subsequent calculations, the memory is closer, reducing the jumpiness of memory access. That is, after completing the matrix storage, for the current grid cell value to be accessed, the value of the main diagonal element at the corresponding position in the target main diagonal element array is obtained to complete the corresponding cell value access operation.

[0068] At the same time, when you need to access the value of the connection surface, the surface number , through the mapping relationship and Get the corresponding non-zero element value of the off-diagonal line , you can efficiently access the values ​​on the corresponding face (e.g.: , the index value is 3, then the non-diagonal non-zero elements are ). That is, the matrix position index corresponding to the connection surface to be accessed is determined based on the corresponding target surface number in the target mapping table, and the corresponding target non-diagonal non-zero element value is obtained using the matrix position index, including: determining the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table and the target matrix upper triangle index value and the target matrix lower triangle index value corresponding to the target surface number; using the matrix position index and the target column number index array and the target non-diagonal non-zero element array to determine the corresponding target non-diagonal non-zero element value to complete the corresponding connection surface data access operation. In this way, it is ensured that the connection relationship of each connection surface can efficiently access the corresponding position of the data, and the overhead caused by the additional index can be reduced when accessing non-zero cells.

[0069] In summary, in this embodiment, for solving the flow control equation of computational fluid dynamics, the equation is first discretized to obtain the coefficients of the discretized matrix. A mapping relationship is established between the storage matrix position and the connection surface, and a mapping relationship between the storage matrix position and the connection surface is used. This method does not require the storage of a large number of zero units, nor does it require additional application of data to store discrete process information. When solving linear algebraic equations, efficient data access is achieved through the surface mapping relationship, which can effectively save memory space and improve computing efficiency.

[0070] It can be seen that in the embodiment of the present application, the corresponding flow control equation is discretely solved based on the grid units in the current fluid mechanics scene to obtain the corresponding coefficient matrix; the coefficient matrix is ​​a sparse matrix; the corresponding target mapping table is determined based on the mapping relationship between the connection surface between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and the corresponding matrix storage operation is triggered based on the preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix; after completing the matrix storage, the matrix position index corresponding to the connection surface to be accessed is determined based on the corresponding target surface number in the target mapping table, and the corresponding target non-diagonal non-zero element value is obtained using the matrix position index to complete the corresponding connection surface data access operation. That is, in this embodiment, when storing the coefficient matrix, it is necessary to establish a target mapping table for the matrix position storage information of the connection surface between the grid units and the non-diagonal non-zero elements in the coefficient matrix, and then use the target mapping table, the main diagonal elements in the coefficient matrix, and the non-diagonal non-zero elements for storage. Afterwards, for the connection surface to be accessed, the target non-diagonal non-zero element value is determined by the corresponding target surface number in the target mapping table to complete the corresponding connection surface data access operation. In this way, the problem of large waste of sparse matrix storage memory space and poor random data access performance can be effectively solved, thereby improving data access efficiency and reducing access overhead.

[0071] See also Figure 7 As shown, the embodiment of the present application also discloses a sparse matrix storage access device for fluid computing, including:

[0072] A matrix acquisition module 11 is used to discretely solve the corresponding flow control equation based on the grid cells in the current fluid mechanics scene to obtain a corresponding coefficient matrix; the coefficient matrix is ​​a sparse matrix;

[0073] A matrix storage module 12, configured to determine a corresponding target mapping table based on a mapping relationship between the connection surfaces between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and trigger a corresponding matrix storage operation based on a preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix;

[0074] The data access module 13 is used to determine the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table after completing the matrix storage, and use the matrix position index to obtain the corresponding target non-diagonal non-zero element value to complete the corresponding connection surface data access operation.

[0075] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0076] It can be seen that in this application, when storing the coefficient matrix, it is necessary to establish a target mapping table for storing the matrix position information of the connection surface between the grid units and the non-diagonal non-zero elements in the coefficient matrix, and then use the target mapping table, the main diagonal elements in the coefficient matrix and the non-diagonal non-zero elements for storage. Afterwards, for the connection surface to be accessed, the target non-diagonal non-zero element value is determined by the corresponding target surface number in the target mapping table to complete the corresponding connection surface data access operation. In this way, the problem of large waste of sparse matrix storage memory space and poor random data access performance can be effectively solved, thereby improving data access efficiency and reducing access overhead.

[0077] In some specific embodiments, the matrix acquisition module 11 can be specifically used to: determine the flow control equation of the current fluid mechanics scene through mathematical modeling; discretize the flow control equation using the grid units in the current fluid mechanics scene to obtain the corresponding linear equation, and determine the corresponding coefficient matrix from the linear equation.

[0078] In some specific embodiments, the matrix storage module 12 can be specifically used to: obtain the number corresponding to the connecting surface between the grid units to obtain the surface number; construct a corresponding one-dimensional array based on the surface number to obtain a target surface number array; determine the matrix upper triangular index and the matrix lower triangular index corresponding to the connecting surface through the mapping relationship between the connecting surface and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix; construct a one-dimensional array according to the matrix upper triangular index and the matrix lower triangular index respectively to obtain a target matrix upper triangular index array and a target matrix lower triangular index array; determine the target mapping table based on the target surface number array, the target matrix upper triangular index array and the target matrix lower triangular index array.

[0079] In some specific embodiments, the matrix storage module 12 can be specifically used to: obtain the main diagonal elements in the coefficient matrix, and construct a one-dimensional array based on the main diagonal elements to obtain a target main diagonal element array; obtain the non-diagonal non-zero elements in the coefficient matrix, and use row compression storage to determine the target storage matrix corresponding to the non-diagonal non-zero elements; trigger corresponding matrix storage operations based on the target main diagonal element array, the target storage matrix and the target mapping table.

[0080] In some specific embodiments, the matrix storage module 12 can be specifically used to: determine the corresponding row offset based on the number of the non-diagonal non-zero elements in each row of the coefficient matrix, and construct a one-dimensional array according to the row offset to obtain a target row offset array; obtain the column number index of the non-diagonal non-zero elements in each row of the coefficient matrix, and construct a one-dimensional array according to the column number index to obtain a target column number index array; construct a one-dimensional array according to the value of the non-diagonal non-zero elements to obtain a target non-diagonal non-zero element array; determine the target storage matrix based on the target row offset array, the target column number index array and the target non-diagonal non-zero element array.

[0081] In some specific embodiments, the device is used for sparse matrix storage access for fluid computing, and can also be used to: after completing the matrix storage, for the current grid cell value to be accessed, obtain the value of the main diagonal element at the corresponding position in the target main diagonal element array to complete the corresponding cell value access operation.

[0082] In some specific embodiments, the data access module 13 can be specifically used to: determine the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table and the target matrix upper triangular index value and the target matrix lower triangular index value corresponding to the target surface number; use the matrix position index and the target column number index array and the target non-diagonal non-zero element array to determine the corresponding target non-diagonal non-zero element value to complete the corresponding connection surface data access operation.

[0083] Furthermore, the present application also discloses an electronic device. Figure 8 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0084] Figure 8 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the sparse matrix storage access method for fluid computing disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0085] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0086] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0087] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the sparse matrix storage access method for fluid computing performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0088] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the sparse matrix storage access method for fluid computing disclosed above is implemented. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.

[0089] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0090] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0091] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0092] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0093] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A sparse matrix storage access method for fluid computing, characterized in that: include: Discretely solve the corresponding flow control equations based on the grid cells in the current fluid mechanics scene to obtain the corresponding coefficient matrix; The coefficient matrix is ​​a sparse matrix; Determine a corresponding target mapping table based on a mapping relationship between the connection surfaces between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and trigger a corresponding matrix storage operation based on a preset matrix storage rule, the target mapping table, and the main diagonal elements in the coefficient matrix and the non-diagonal non-zero elements; After completing the matrix storage, determining the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table, and obtaining the corresponding target non-diagonal non-zero element value using the matrix position index to complete the corresponding connection surface data access operation; The determining of the corresponding target mapping table based on the mapping relationship between the connection surfaces between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix includes: Obtaining numbers corresponding to connection surfaces between the grid units to obtain surface numbers; Constructing a corresponding one-dimensional array based on the surface numbers to obtain a target surface number array; Determine the matrix upper triangular index and the matrix lower triangular index corresponding to the connection surface through a mapping relationship between the connection surface and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix; Constructing one-dimensional arrays according to the upper triangular index of the matrix and the lower triangular index of the matrix respectively, so as to obtain an upper triangular index array of a target matrix and a lower triangular index array of a target matrix; Determine a target mapping table based on the target face number array, the target matrix upper triangle index array, and the target matrix lower triangle index array; The triggering of corresponding matrix storage operations based on the preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix includes: Obtaining the main diagonal elements in the coefficient matrix, and constructing a one-dimensional array based on the main diagonal elements to obtain a target main diagonal element array; Obtain the non-diagonal non-zero elements in the coefficient matrix, and determine a target storage matrix corresponding to the non-diagonal non-zero elements by adopting a row compression storage method; triggering a corresponding matrix storage operation based on the target main diagonal element array, the target storage matrix, and the target mapping table; The step of using row compression storage to determine a target storage matrix corresponding to the non-diagonal non-zero elements includes: Determine a corresponding row offset based on the number of the non-diagonal non-zero elements of each row in the coefficient matrix, and construct a one-dimensional array according to the row offset to obtain a target row offset array; Obtaining the column number index of the non-diagonal non-zero elements of each row in the coefficient matrix, and constructing a one-dimensional array according to the column number index to obtain a target column number index array; Constructing a one-dimensional array according to the values ​​of the non-diagonal non-zero elements to obtain a target non-diagonal non-zero element array; Determine a target storage matrix based on the target row offset array, the target column number index array, and the target off-diagonal non-zero element array; The step of determining a matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table, and obtaining a corresponding target non-diagonal non-zero element value using the matrix position index includes: Determine the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table and the target matrix upper triangle index value and the target matrix lower triangle index value corresponding to the target surface number; The corresponding target non-diagonal non-zero element value is determined by using the matrix position index, the target column number index array, and the target non-diagonal non-zero element array to complete the corresponding connection surface data access operation.

2. The sparse matrix storage access method for fluid computing according to claim 1, characterized in that: The discrete solution of the corresponding flow control equation based on the grid cells in the current fluid mechanics scene to obtain the corresponding coefficient matrix includes: Determine the flow governing equations for the current fluid dynamics scenario through mathematical modeling; The flow control equation is discretized using the grid cells in the current fluid mechanics scene to obtain a corresponding linear equation, and a corresponding coefficient matrix is ​​determined from the linear equation.

3. The sparse matrix storage access method for fluid computing according to claim 1, characterized in that: Also includes: After completing the matrix storage, for the current grid cell value to be accessed, the value of the main diagonal element at the corresponding position in the target main diagonal element array is obtained to complete the corresponding cell value access operation.

4. A sparse matrix storage access device for fluid computing, characterized in that: include: A matrix acquisition module is used to discretely solve the corresponding flow control equation based on the grid cells in the current fluid mechanics scene to obtain the corresponding coefficient matrix; The coefficient matrix is ​​a sparse matrix; A matrix storage module, used to determine a corresponding target mapping table based on a mapping relationship between the connection surface between the grid units and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix, and trigger a corresponding matrix storage operation based on a preset matrix storage rule, the target mapping table, and the main diagonal elements and the non-diagonal non-zero elements in the coefficient matrix; A data access module, for determining, after completing matrix storage, a matrix position index corresponding to a connection surface to be accessed based on a corresponding target surface number in the target mapping table, and obtaining a corresponding target non-diagonal non-zero element value using the matrix position index to complete a corresponding connection surface data access operation; The matrix storage module is used to: obtain the number corresponding to the connection surface between the grid units to obtain the surface number; construct a corresponding one-dimensional array based on the surface number to obtain a target surface number array; determine the matrix upper triangular index and the matrix lower triangular index corresponding to the connection surface through the mapping relationship between the connection surface and the matrix position storage information of the non-diagonal non-zero elements in the coefficient matrix; Constructing a one-dimensional array according to the upper triangular index of the matrix and the lower triangular index of the matrix respectively to obtain a target matrix upper triangular index array and a target matrix lower triangular index array; determining a target mapping table based on the target surface number array, the target matrix upper triangular index array and the target matrix lower triangular index array; The matrix storage module is used to: obtain the main diagonal elements in the coefficient matrix, and construct a one-dimensional array based on the main diagonal elements to obtain a target main diagonal element array; obtain the non-diagonal non-zero elements in the coefficient matrix, and determine the target storage matrix corresponding to the non-diagonal non-zero elements by row compression storage; trigger a corresponding matrix storage operation based on the target main diagonal element array, the target storage matrix and the target mapping table; The matrix storage module is used to: determine the corresponding row offset based on the number of the non-diagonal non-zero elements of each row in the coefficient matrix, and construct a one-dimensional array according to the row offset to obtain a target row offset array; obtain the column number index of the non-diagonal non-zero elements of each row in the coefficient matrix, and construct a one-dimensional array according to the column number index to obtain a target column number index array; A one-dimensional array is constructed according to the values ​​of the non-diagonal non-zero elements to obtain a target non-diagonal non-zero element array; a target storage matrix is ​​determined based on the target row offset array, the target column number index array and the target non-diagonal non-zero element array; The data access module is used to: determine the matrix position index corresponding to the connection surface to be accessed based on the corresponding target surface number in the target mapping table and the target matrix upper triangle index value and the target matrix lower triangle index value corresponding to the target surface number; use the matrix position index and the target column number index array and the target non-diagonal non-zero element array to determine the corresponding target non-diagonal non-zero element value to complete the corresponding connection surface data access operation.

5. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the sparse matrix storage access method for fluid computing as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the sparse matrix storage access method for fluid computing as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method for storing diagonal data of sparse matrix and SpMV (Sparse Matrix Vector) realization method based on method

    CN102141976A

  • Overdetermined matrix equation parallel method and system for fluid mechanics grid generation

    CN117436370A