A fluid mechanics grid processing method, device, equipment and medium based on
By combining a mesh renumbering quality discrimination index based on the local anomaly factor algorithm with greedy and cell quotient algorithms, CFD mesh renumbering is optimized, solving the problem of low efficiency of traditional indices in complex scenarios and improving the computational efficiency of fluid dynamics numerical simulation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NAT UNIV OF DEFENSE TECH
- Filing Date
- 2023-04-21
- Publication Date
- 2026-05-12
AI Technical Summary
Existing CFD mesh renumbering quality criteria cannot accurately evaluate the computational performance of sparse matrices in complex application scenarios, resulting in low efficiency of parallel fluid simulation. Furthermore, existing algorithms mainly focus on linear system optimization, neglecting the impact of equation discretization.
A quality criterion for mesh renumbering based on the local anomaly factor algorithm is adopted. By evaluating the degree of aggregation of non-zero elements within the sparse matrix, a suitable mesh renumbering algorithm is selected. The greedy algorithm and the element quotient algorithm are combined to perform mesh renumbering, thereby optimizing the numerical simulation of fluid dynamics.
It significantly shortens the execution time of numerical simulations in fluid mechanics and improves the computational efficiency of parallel fluid simulations, especially showing better performance in complex engineering problems.
Smart Images

Figure CN116306380B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computational fluid dynamics, and in particular to a method, apparatus, device, and medium based on fluid dynamics grid processing. Background Technology
[0002] Computational Fluid Dynamics (CFD) is widely used in aerospace, reactor hydrodynamics, ocean propagation, and explosion simulations. However, due to the enormous computational demands, simulating the minute structures of flow fields in real-world engineering cases remains inefficient. Therefore, parallel performance optimization techniques have received widespread attention in both academia and industry. Grid numbering directly determines the structure of the discretized matrix, which in turn has a significant impact on the performance of parallel fluid simulations. Currently, accelerating fluid simulations through grid renumbering has become a mature method.
[0003] For decades, traditional CFD mesh renumbering quality metrics, such as "bandwidth" or "profile," have been used to differentiate the matrix structure of linear systems, providing valuable guidance for selecting effective sorting methods. The structure of a sparse matrix determines the access order of parallel computations. This has a significant impact on the performance of modern computer architectures with multi-level storage hierarchies. First, the two simple metrics, "bandwidth" and "profile," cannot accurately assess the computational performance of sparse matrices corresponding to complex applications. In complex application scenarios, lower bandwidth does not always lead to better performance. Second, existing mesh numbering algorithms primarily focus on solving optimization problems in linear systems. However, the equation discretization process also constitutes a significant proportion in CFD simulations. Therefore, it is necessary to consider the impact of mesh numbering on the overall computational process of complex fluid simulation cases.
[0004] Therefore, providing a method for selecting appropriate mesh renumbering to accelerate computational fluid dynamics numerical simulations is a technical problem that urgently needs to be solved by those in the field. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, device and medium based on hydrodynamic grid processing, for selecting a suitable grid renumbering algorithm, thereby accelerating computational hydrodynamic numerical simulation.
[0006] To address the aforementioned technical problems, this application provides a hydrodynamic mesh processing method, comprising:
[0007] Obtain a grid containing the current feature data of the target fluid;
[0008] The grid is input into the target grid renumbering algorithm; wherein, the target grid renumbering algorithm is based on the local anomaly factor algorithm, and the grid renumbering quality discrimination index is obtained from the grid renumbering algorithm; the grid renumbering quality discrimination index based on the local anomaly factor algorithm is determined according to the degree of aggregation of non-zero elements inside the sparse matrix generated by the grid;
[0009] Fluid dynamics numerical simulation was performed using the aforementioned target mesh renumbering algorithm;
[0010] The characteristic data of the target fluid at a preset time are determined based on the results of the fluid dynamics numerical simulation.
[0011] Preferably, determining the grid renumbering quality discrimination index based on the local anomaly factor algorithm according to the degree of clustering of the non-zero elements within the sparse matrix generated by the grid includes:
[0012] The adjacency relationships of the non-zero elements generated by the mesh are used to generate the corresponding sparse matrix, which is then converted into a coordinate system.
[0013] Obtain the number of non-zero elements in the sparse matrix;
[0014] Get the first distance value between the current target point and the points surrounding the target;
[0015] Obtain the second distance value of the element k furthest from the current target point;
[0016] The k-th reachable distance from the target's surrounding points to the current target point is determined based on the first distance value and the second distance value.
[0017] Get the number of all elements within the k-th distance from the current target point;
[0018] The reachability density value of the current target point is determined based on the sum of the k-th reachable distances from all surrounding points to the current target point and the number of all elements;
[0019] Obtain the reachable density values of points surrounding each target;
[0020] The current local outlier factor of the current target point is determined based on the reachability density value of the current target point, the reachability density value of the points surrounding the target, and the number of all elements.
[0021] If the current local outlier factor is greater than 1, the current target point is determined to be an outlier.
[0022] The next point of the current target point is taken as the new current target point, and the step of obtaining the first distance value between the current target point and the surrounding points is returned until all the non-zero elements are determined to be abnormal points, and then the return stops.
[0023] Preferably, the step of converting the non-zero element adjacency relationships generated by the mesh into the corresponding sparse matrix into a coordinate system includes:
[0024] The adjacency relationship of the non-zero elements generated by the mesh is used to generate the coordinates of each non-zero element in the corresponding sparse matrix, which are defined as the row and column values of the corresponding non-zero element.
[0025] The sparse matrix is transformed into a coordinate system with elements only in the first quadrant based on the row and column values of each of the non-zero elements.
[0026] Preferably, establishing a grid renumbering algorithm based on a greedy algorithm includes:
[0027] Define the initial numbering cells and create the neighbor container;
[0028] Starting from the initial numbering unit, the neighbors of the initial numbering unit are pushed into the neighbor container as numbering units;
[0029] Let the first element in the neighbor container be the initial numbering unit;
[0030] Return to the step of starting numbering from the initial numbered unit until all units have been renumbered and then stop returning.
[0031] Preferably, establishing a grid renumbering algorithm based on cell quotient includes:
[0032] Get the first bandwidth under the current number;
[0033] Obtain the sum of the adjacent cell numbers, the number of related neighboring cells, and the cell quotient for each cell;
[0034] All units are renumbered according to the unit quotient and used as the new current number;
[0035] Get the second bandwidth under the new current number;
[0036] If the first bandwidth and the second bandwidth meet the preset requirements, the new current number is used as the number of the grid.
[0037] If the first bandwidth and the second bandwidth do not meet the preset requirements, return to the step of obtaining the first bandwidth under the current number, and stop when the iterative convergence index meets the preset value.
[0038] Preferably, after acquiring the grid containing the current feature data of the target fluid, the method further includes:
[0039] The grid is decomposed into sub-grids of a preset size;
[0040] Correspondingly, the step of inputting the mesh into the target mesh renumbering algorithm includes:
[0041] Each of the sub-grids is input into the target grid renumbering algorithm.
[0042] Preferably, the network renumbering algorithm is a greedy algorithm-based grid renumbering algorithm or a cell quotient algorithm-based grid renumbering algorithm; determining the target grid renumbering algorithm includes:
[0043] Obtain a first grid number and a second grid number; wherein, the first grid number is obtained by optimizing the initial grid number using the greedy algorithm, and the second grid number is obtained by optimizing the initial grid number using the cell quotient algorithm;
[0044] The number of first non-zero elements corresponding to the first grid number, the number of second non-zero elements corresponding to the second grid number, and the number of initial non-zero elements corresponding to the initial grid number are obtained respectively using the grid renumbering quality discrimination index based on the local anomaly factor algorithm.
[0045] Obtain the minimum value among the first number of non-zero elements, the second number of non-zero elements, and the initial number of non-zero elements;
[0046] The algorithm corresponding to the minimum value is used as the target grid renumbering algorithm.
[0047] To address the aforementioned technical problems, this application also provides a fluid dynamics-based grid processing device, comprising:
[0048] The acquisition module is used to acquire a grid containing the current feature data of the target fluid;
[0049] An input module is used to input the mesh into a target mesh renumbering algorithm; wherein the target mesh renumbering algorithm is based on a local anomaly factor algorithm, and the mesh renumbering quality discrimination index is obtained from the mesh renumbering algorithm; the mesh renumbering quality discrimination index based on the local anomaly factor algorithm is determined according to the degree of aggregation of non-zero elements within the sparse matrix generated by the mesh;
[0050] The numerical simulation module is used to perform fluid dynamics numerical simulations using the target mesh renumbering algorithm.
[0051] The determination module is used to determine the characteristic data of the target fluid at a preset time based on the results of the fluid dynamics numerical simulation.
[0052] To address the aforementioned technical problems, this application also provides a hydrodynamic mesh processing device, comprising:
[0053] Memory, used to store computer programs;
[0054] A processor is used to implement the steps of the above-described hydrodynamic mesh processing method when executing the computer program.
[0055] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the fluid dynamics-based mesh processing method described above.
[0056] This application provides a method for processing a hydrodynamic mesh, comprising: acquiring a mesh containing current feature data of a target fluid; inputting the mesh into a target mesh renumbering algorithm; wherein the target mesh renumbering algorithm is a mesh renumbering quality discrimination index based on the local anomaly factor algorithm, which is obtained from the mesh renumbering algorithm and determined based on the degree of aggregation of non-zero elements within the sparse matrix generated by the mesh; performing hydrodynamic numerical simulation using the target mesh renumbering algorithm; and determining the feature data of the target fluid at a preset time based on the results of the hydrodynamic numerical simulation. In this method, when determining the target mesh renumbering algorithm, the mesh renumbering quality discrimination index based on the local anomaly factor algorithm is selected from the mesh renumbering algorithms. Since the mesh renumbering quality discrimination index based on the local anomaly factor algorithm incorporates the degree of aggregation of non-zero elements within the sparse matrix into the considerations required by the renumbering algorithm, it can effectively judge the quality of the hydrodynamic mesh renumbering algorithm; secondly, by selecting a suitable renumbering algorithm, the execution time of the numerical simulation is significantly shortened in terms of both matrix assembly and solution, improving the overall iteration time for hydrodynamic numerical simulation calculations.
[0057] In addition, this application also provides a fluid dynamics-based grid processing device, a fluid dynamics-based grid processing equipment, and a computer-readable storage medium, which have the same or corresponding technical features as the fluid dynamics-based grid processing method mentioned above, and have the same effects. Attached Figure Description
[0058] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 A flowchart of a hydrodynamic mesh processing method provided in this application embodiment;
[0060] Figure 2 A flowchart of a grid renumbering quality discrimination index algorithm for establishing a local anomaly factor algorithm is provided in an embodiment of this application;
[0061] Figure 3 A flowchart illustrating a grid renumbering method based on a greedy algorithm, provided for embodiments of this application;
[0062] Figure 4 A flowchart illustrating a grid renumbering method based on cell quotient provided in this application embodiment;
[0063] Figure 5 A schematic diagram illustrating a numerical simulation based on the finite volume method provided in this application embodiment;
[0064] Figure 6 A structural diagram of a hydrodynamic grid processing device provided in one embodiment of this application;
[0065] Figure 7 A structural diagram of a hydrodynamic grid processing device provided in another embodiment of this application;
[0066] Figure 8 A flowchart of a hydrodynamic mesh processing method provided for another embodiment of this application. Detailed Implementation
[0067] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0068] The core of this application is to provide a method, apparatus, device, and medium based on fluid dynamics grid processing, for selecting a suitable grid renumbering algorithm, thereby accelerating computational fluid dynamics numerical simulation.
[0069] Computational fluid dynamics (CFD) is widely used in aerospace, reactor hydrodynamics, ocean propagation, and explosion simulations. However, due to the enormous computational demands, simulating the minute structures of flow fields in real-world engineering cases remains inefficient. Therefore, parallel performance optimization techniques have received widespread attention in both academia and industry. Grid numbering directly determines the structure of the discretized matrix, which in turn significantly impacts the performance of parallel fluid simulations. Currently, accelerating fluid simulations through grid renumbering has become a mature method.
[0070] For decades, traditional CFD mesh renumbering quality metrics, such as "bandwidth" or "profile," have been used to distinguish the matrix structure of linear systems, thus providing valuable guidance for selecting effective sorting methods. The structure of a sparse matrix determines the access order of parallel computations. This has a significant impact on the performance of modern computer architectures with multi-level storage hierarchies. Taking the most widely used Finite Volume Method (FVM) as an example, after numbering the discrete cells of the simulation domain, the sparse linear system needs to be assembled in parallel. The assembly process is based on the parameters and numbering of the connected mesh cells. Many well-known numbering algorithms, such as Radar Coded Messages (RCM), have proven their stability, speed, and efficiency in simple benchmark cases. However, in fluid simulations of complex engineering problems, choosing a better numbering method still faces significant challenges. First, the two simple metrics mentioned above, bandwidth and profile, cannot accurately evaluate the computational performance of sparse matrices corresponding to complex applications. In complex application scenarios, lower bandwidth does not always lead to better performance. Second, existing mesh numbering algorithms mainly focus on solving the optimization of linear systems. However, the equation discretization process also accounts for a significant proportion of CFD simulations. Therefore, it is necessary to consider the impact of grid numbering on the overall computational process of complex fluid simulation cases.
[0071] Therefore, given the increasingly complex real-world CFD cases and the continuously developing mesh renumbering algorithms, how to design a new mesh renumbering quality discrimination index that combines the sparse matrix characteristics of the linear system generated after mesh renumbering, and further improve the efficiency of parallel fluid numerical simulation based on FVM, has become a key issue that urgently needs to be addressed in this field.
[0072] To address the limitation that traditional mesh renumbering quality criteria can only express the sparse matrix properties of meshes to a limited extent, a CFD mesh renumbering quality criteria based on the local anomaly factor algorithm is proposed. This index can further determine the efficiency of different CFD mesh renumbering methods in numerical simulation iterative processing.
[0073] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Figure 1 A flowchart of a hydrodynamic mesh processing method provided for embodiments of this application is shown below. Figure 1 As shown, the method includes:
[0074] S10: Obtain the grid containing the current characteristic data of the target fluid;
[0075] S11: Input the mesh into the target mesh renumbering algorithm;
[0076] Among them, the target grid renumbering algorithm is based on the local anomaly factor algorithm, and the grid renumbering quality discrimination index is obtained from the grid renumbering algorithm; the grid renumbering quality discrimination index based on the local anomaly factor algorithm is determined according to the degree of aggregation of non-zero elements inside the sparse matrix generated by the grid.
[0077] S12: Numerical simulation of fluid dynamics using the target mesh renumbering algorithm;
[0078] S13: Determine the characteristic data of the target fluid at the preset time based on the results of the fluid dynamics numerical simulation.
[0079] For the target fluid, the characteristic data corresponding to the target fluid and the method of obtaining the characteristic data are not limited and are determined according to the actual situation. For example, the flow of water in a pipe under certain conditions for 30 seconds, where the target fluid is water, will form a grid in the area through which the water flows. Each grid contains the current characteristic data of the water, which can refer to changes in physical quantities such as water velocity, pressure, and heat.
[0080] To select a suitable grid renumbering algorithm, this embodiment selects the target grid renumbering algorithm from among the network renumbering algorithms. No limitation is placed on the network renumbering algorithm used to select the target grid renumbering algorithm.
[0081] In this embodiment, the target mesh renumbering algorithm is determined based on the mesh renumbering quality discrimination index of the local anomaly factor algorithm. The mesh renumbering quality discrimination index based on the local anomaly factor algorithm is determined according to the degree of aggregation of non-zero elements within the sparse matrix generated by the mesh. Specifically, determining the mesh renumbering quality discrimination index based on the local anomaly factor algorithm based on the degree of aggregation of non-zero elements within the sparse matrix generated by the mesh includes:
[0082] The adjacency relationships of non-zero elements generated by the mesh are converted into a sparse matrix and then into a coordinate system.
[0083] To obtain the number of non-zero elements in a sparse matrix;
[0084] Get the first distance value between the current target point and the points surrounding the target;
[0085] Get the second distance value of the element k farthest from the current target point;
[0086] Determine the k-th reachable distance from the target point to the current target point based on the first distance value and the second distance value;
[0087] Get the number of all elements within the k-th furthest distance from the current target point;
[0088] The reachability density value of the current target point is determined by the sum of the k-th reachable distances from all surrounding points to the current target point and the number of all elements.
[0089] Obtain the reachable density values of points surrounding each target;
[0090] The current local outlier factor of the current target point is determined based on the reachability density value of the current target point, the reachability density values of the points surrounding the target, and the number of all elements.
[0091] If the local outlier factor is greater than 1, the current target point is identified as an outlier.
[0092] The next point after the current target point is taken as the new current target point, and the step of obtaining the first distance value between the current target point and the surrounding points is returned until all non-zero elements are determined to be outliers.
[0093] Figure 2 This is a flowchart illustrating a grid renumbering quality discrimination index algorithm for establishing a local anomaly factor algorithm, provided as an embodiment of this application. Figure 2 As shown, the method includes:
[0094] S14: Input matrix coordinate system, number of non-zero elements is ;
[0095] S15: ;
[0096] S16: ;
[0097] S17: Determine the target point ;
[0098] S18: Calculation point The k-th distance;
[0099] S19: Calculation point The number of surrounding points o in the k-th neighborhood;
[0100] S20: Calculate all surrounding points o to The k-th reachable distance;
[0101] S21: Calculation point Locally achievable density;
[0102] S22: Calculation point Local outlier LOF;
[0103] S23: Judgment If yes, return to step S16; if no, proceed to step S24.
[0104] S24: Output the LOF sequence with non-zero elements.
[0105] Specifically, the process of establishing the grid renumbering quality discrimination index algorithm for the local anomaly factor algorithm is as follows:
[0106] (1) Define the distance between the target point p and the surrounding points o as . ;
[0107] (2) Define the k-th distance (k-distance) of point p: the distance value that is k-th farthest from point p, that is, the distance of the element k-th farthest from point p, expressed as ;
[0108] (3) Define the k-th distance neighborhood : All points within the k-th furthest distance from point p, i.e., the k neighbors of point p, and Indicates the number of elements in the neighborhood;
[0109] (4) Define reachable distance (r-distance): The k-th reachable distance from point o to point p is:
[0110]
[0111] That is, the reachable distance from point o to point p is at least the k-th distance from point o, or it is the true distance between point o and point p. In other words, the reachable distances from o to the k closest points to point o are considered equal, and are all... This distance also measures whether o is a neighbor of p, and whether p is also a neighbor of o. If p is an outlier, but o is a normal point, then it is very likely that although o is a neighbor of p, p is not a neighbor of o.
[0112] (5) Define local reachability density The locally reachable density of point p is expressed as:
[0113]
[0114] This represents the reciprocal of the average reachability distance from point p to p within its k-th neighborhood. The numerator is the number of elements in the neighborhood, and the denominator is the reachability distance from each of p's k neighbors to p. If p is not a neighbor of its neighboring points, the smaller the local reachability density of p, the greater the probability that p is an outlier.
[0115] (6) Define the local outlier factor LOF The local outlier of point p is expressed as:
[0116]
[0117] Represents the neighborhood points of point p. The local outlier factor is the average ratio of the local reachability density of point p to the local reachability density of point p. That is, for each neighbor o of p, the ratio of the local reachability density of o to the local reachability density of p is calculated, and then the ratio is taken across all neighbors. In other words, the larger the local outlier factor of p, the higher the outlier score of p, and the greater the probability that p is an outlier.
[0118] If the local outlier factor of the target point is close to 1, it means that the density of its neighboring points is similar, and p may be in the same cluster as the neighboring points. If the local outlier factor is less than 1, it means that the density of p is higher than the density of its neighboring points, and p is a dense point. If the local outlier factor is greater than 1, it means that the density of p is less than the density of its neighboring points, and p is more likely to be an outlier.
[0119] (7) Calculate the local outlier factor for all non-zero elements.
[0120] The above steps establish a quality criterion for local outlier factor grid renumbering. For the local outlier factors calculated by each network renumbering algorithm, the algorithm with the smallest number of non-zero elements in the local outlier factors is selected as the target grid renumbering algorithm. Fluid dynamics numerical simulation is then performed using the target grid renumbering algorithm to ultimately determine the characteristic data of the target fluid at a preset time. For example, the state of a water pipe under a certain condition after 30 seconds of flow, including changes in physical quantities such as velocity, pressure, and heat at various points in the pipe. The current state of the water pipe is the input before calculation, and the state of the water pipe 30 seconds later is the calculated state.
[0121] This embodiment provides a method for processing fluid dynamics meshes, including: acquiring a mesh containing current feature data of a target fluid; inputting the mesh into a target mesh renumbering algorithm; wherein the target mesh renumbering algorithm is a mesh renumbering quality discrimination index based on the local anomaly factor algorithm, which is determined based on the degree of aggregation of non-zero elements within the sparse matrix generated by the mesh; performing fluid dynamics numerical simulation using the target mesh renumbering algorithm; and determining the feature data of the target fluid at a preset time based on the results of the fluid dynamics numerical simulation. In this method, when determining the target mesh renumbering algorithm, the mesh renumbering quality discrimination index based on the local anomaly factor algorithm is selected from the mesh renumbering algorithms. Since the mesh renumbering quality discrimination index based on the local anomaly factor algorithm incorporates the degree of aggregation of non-zero elements within the sparse matrix into the considerations required by the renumbering algorithm, it can effectively judge the quality of the fluid dynamics mesh renumbering algorithm; secondly, by selecting a suitable renumbering algorithm, the execution time of the numerical simulation is significantly shortened in terms of both matrix assembly and solution, improving the overall iteration time for fluid dynamics numerical simulation calculations.
[0122] In practice, for ease of calculation, a preferred implementation method is to convert the adjacency relationships of non-zero elements generated by the mesh into a corresponding sparse matrix and then into a coordinate system, including:
[0123] The adjacency relationships of non-zero elements generated by the mesh are used to generate the coordinates of each non-zero element in the corresponding sparse matrix, which are defined as the row and column values of the corresponding non-zero element.
[0124] The sparse matrix is transformed into a coordinate system with elements only in the first quadrant based on the row and column values of each non-zero element.
[0125] In the method provided in this embodiment, the coordinates of each non-zero element in the matrix are defined as the row and column values of that non-zero element. Each non-zero element has one and only one definite coordinate. The entire sparse matrix forms a coordinate system with elements (non-zero elements) only in the first quadrant. Compared with a coordinate system with elements in all quadrants, the coordinate system with elements in the first quadrant in this embodiment is more convenient for calculation.
[0126] To achieve renumbering, a preferred implementation is to establish a grid renumbering algorithm based on a greedy algorithm, including:
[0127] Define the initial numbering cells and create the neighbor container;
[0128] Starting from the initial numbering unit, push the neighbors of the initial numbering unit into the neighbor container as numbering units;
[0129] Let the first element in the neighboring container be the initial numbering unit;
[0130] Return to the steps starting from the initial numbered cell, and stop returning after all cells have been renumbered.
[0131] Figure 3 A flowchart illustrating a grid renumbering method based on a greedy algorithm, provided for embodiments of this application. Figure 3 As shown, the method includes:
[0132] S25: Input initial mesh ;
[0133] S26: For the initial numbering unit, All initial cell numbers are set to 0;
[0134] in, k The specific value is determined by the program.
[0135] S27: Neighbor pressed in L ;
[0136] in, LIt is a container, which can be a list, used to store the unnumbered neighbors of a certain grid cell;
[0137] S28: Judgment If yes, proceed to step S29; otherwise, end.
[0138] in, This represents all grid points within the area;
[0139] S29: ;
[0140] in, It is the first grid inside the container. The number representing the element;
[0141] S30: Unnumbered neighbor push L ;
[0142] S31: From L Delete ;
[0143] S32: Return to step S28.
[0144] The method provided in this embodiment realizes the renumbering of grids based on a greedy algorithm.
[0145] In addition to renumbering the grid based on a greedy algorithm, this embodiment also provides a grid renumbering algorithm based on cell quotient. Preferably, establishing the grid renumbering algorithm based on cell quotient includes:
[0146] Get the first bandwidth under the current number;
[0147] Obtain the sum of the adjacent cell numbers, the number of related neighboring cells, and the cell quotient for each cell;
[0148] Renumber all cells according to the cell quotient and use them as the new current numbers;
[0149] Get the second bandwidth under the new current number;
[0150] If the first and second bandwidths meet the preset requirements, the new current number is used as the grid number;
[0151] If the first bandwidth and the second bandwidth do not meet the preset requirements, return to the step of obtaining the first bandwidth under the current number, and stop when the iteration convergence index meets the preset value.
[0152] Both the first bandwidth and the second bandwidth refer to the maximum bandwidth. In the cell quotient-based mesh renumbering method, 1) set the initial iteration coefficients. 2) Calculate the maximum bandwidth under the current number. 3) Calculate the sum of the adjacent unit numbers, the number of related neighboring units, and the unit quotient (sum of numbers divided by the number of neighboring units) for each unit; 4) Renumber all units according to the size of the unit quotient; 5) Calculate the maximum bandwidth under the current number. 6) Compare bandwidth and The size, if If the preset requirement is met, the optimization iteration process is terminated; otherwise, the calculation is repeated until the convergence index (the preset value) is met.
[0153] Figure 4 A flowchart illustrating a grid renumbering method based on cell quotient provided in this application embodiment. Figure 4 As shown, the method includes:
[0154] S33: Input initial mesh ;
[0155] S34: Set initial iteration coefficients ;
[0156] S35: Judgment If yes, proceed to step S36; otherwise, end.
[0157] in, It is the change in bandwidth before and after numbering, which is the convergence iteration coefficient. The closer this coefficient is to 0, the more stable it is before and after renumbering.
[0158] S36: Calculate the current bandwidth ;
[0159] S37: , ;
[0160] in, Used for counting, with no special meaning; It is a container;
[0161] S38: Judgment If yes, proceed to step S39; if no, proceed to step S42.
[0162] S39: Calculation The neighbor's number and, pressed into the container. L ;
[0163] S40: Calculation The number of neighboring units and push them into the container L ;
[0164] S41: And return to step S38;
[0165] S42: , ;
[0166] in, Used for counting; It is also a container for storage. A relationship (key-value relationship), also known as a mapping relationship. A container contains a... key The value corresponds to one value Value, that is, each One ,in, It is the key , It is value ;
[0167] S43: Judgment If yes, proceed to step S44; if no, proceed to step S47.
[0168] S44: Calculation ;
[0169] S45: K China and of relation;
[0170] S46: and return to step S43;
[0171] S47: According to K middle key The ascending sequence will Renumbered and updated to ;
[0172] S48: Calculate current bandwidth ;
[0173] S49: Return to step S35.
[0174] The method provided in this embodiment implements grid renumbering based on cell quotient.
[0175] To improve computational efficiency, a preferred implementation method, after acquiring a grid containing current feature data of the target fluid, further includes the following based on the hydrodynamic grid processing method:
[0176] Decompose the grid into subgrids of a preset size;
[0177] Correspondingly, inputting the mesh into the target mesh renumbering algorithm includes:
[0178] Each subgrid is input into the target grid renumbering algorithm.
[0179] Figure 5 This is a schematic diagram illustrating a numerical simulation based on the finite volume method, provided as an embodiment of this application.
[0180] like Figure 5 As shown, the grid Decomposed into multiple sub-grids, such as , ... Each subgrid is renumbered in parallel; then, parallel numerical simulation is performed based on the finite volume method.
[0181] In the method provided in this embodiment, after splitting the grid, each sub-grid is renumbered in parallel and subjected to parallel numerical simulation, which can greatly improve the efficiency of numerical simulation.
[0182] In implementation, when the network renumbering algorithm is a greedy algorithm-based grid renumbering algorithm or a cell quotient algorithm-based grid renumbering algorithm, determining the target grid renumbering algorithm includes:
[0183] Obtain the first grid number and the second grid number; wherein, the first grid number is obtained by optimizing the initial grid number using a greedy algorithm, and the second grid number is obtained by optimizing the initial grid number using a cell quotient algorithm;
[0184] The number of first non-zero elements corresponding to the first grid number, the number of second non-zero elements corresponding to the second grid number, and the number of initial non-zero elements corresponding to the initial grid number are obtained by using the grid renumbering quality discrimination index based on the local anomaly factor algorithm.
[0185] Find the minimum value among the first number of non-zero elements, the second number of non-zero elements, and the initial number of non-zero elements;
[0186] The algorithm corresponding to the minimum value is used as the target grid renumbering algorithm.
[0187] Let the number of non-zero elements with a local outlier greater than 1 in the unit quotient algorithm be denoted as . Let the number of non-zero elements with a local outlier greater than 1 in the greedy algorithm be denoted as . The number of non-zero local outlier elements in the original mesh is denoted as . The algorithm that compares the three factors and selects the one with the smaller number of factors is denoted as the local outlier factor. The corresponding algorithm serves as the final renumbering algorithm, i.e., the target renumbering algorithm.
[0188] In the above embodiments, the fluid dynamics-based grid processing method has been described in detail. This application also provides embodiments of a fluid dynamics-based grid processing device and a fluid dynamics-based grid processing equipment. It should be noted that this application describes the embodiments of the device from two perspectives: one is based on functional modules, and the other is based on hardware.
[0189] Figure 6 A structural diagram of a hydrodynamic mesh processing device provided in one embodiment of this application. This embodiment, from the perspective of functional modules, includes:
[0190] Acquisition module 10 is used to acquire a grid containing the current feature data of the target fluid;
[0191] Input module 11 is used to input the mesh into the target mesh renumbering algorithm; wherein, the target mesh renumbering algorithm is based on the local anomaly factor algorithm and the mesh renumbering quality discrimination index is obtained from the mesh renumbering algorithm; the mesh renumbering quality discrimination index based on the local anomaly factor algorithm is determined according to the degree of aggregation of non-zero elements inside the sparse matrix generated by the mesh;
[0192] Numerical simulation module 12 is used for fluid dynamics numerical simulation using the target mesh renumbering algorithm;
[0193] The determination module 13 is used to determine the characteristic data of the target fluid at a preset time based on the results of the fluid dynamics numerical simulation.
[0194] Since the embodiments of the apparatus and the method correspond to each other, please refer to the description of the embodiments in the method section for the apparatus embodiments, which will not be repeated here. Furthermore, it has the same beneficial effects as the fluid dynamics-based mesh processing method mentioned above.
[0195] Figure 7 This is a structural diagram of a fluid dynamics-based mesh processing device provided in another embodiment of this application. This embodiment is based on a hardware perspective, such as... Figure 7 As shown, the hydrodynamic mesh processing device includes:
[0196] Memory 20 is used to store computer programs;
[0197] The processor 21 is used to implement the steps of the hydrodynamic mesh processing method mentioned in the above embodiments when executing a computer program.
[0198] The fluid dynamics-based mesh processing device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0199] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.
[0200] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the fluid dynamics-based mesh processing method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the fluid dynamics-based mesh processing method mentioned above.
[0201] In some embodiments, the hydrodynamic grid processing device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0202] Those skilled in the art will understand that Figure 7 The structures shown do not constitute a limitation on hydrodynamic grid processing devices and may include more or fewer components than illustrated.
[0203] The fluid dynamics-based mesh processing device provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: fluid dynamics-based mesh processing method, with the same effect as above.
[0204] This application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.
[0205] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0206] The computer-readable storage medium provided in this application includes the aforementioned hydrodynamic mesh processing method, with the same effect.
[0207] To enable those skilled in the art to better understand the present application, the following description is provided in conjunction with the appendix. Figure 8 The present application will be further described in detail with reference to specific embodiments. Figure 8 A flowchart illustrating a hydrodynamic mesh processing method provided in another embodiment of this application. Figure 8 As shown, the method includes:
[0208] S50: Determine the algorithm for implementing renumbering;
[0209] S51: Establish a quality evaluation index for LOF grid renumbering;
[0210] S52: Determine the target renumbering algorithm;
[0211] S53: CFD numerical simulation calculation.
[0212] This embodiment provides a CFD sparse matrix discrimination index based on the local anomaly factor algorithm to select a suitable mesh renumbering method. 1. It can effectively judge the quality of CFD mesh renumbering algorithms. It overcomes the one-sidedness of traditional CFD sparse matrix quality discrimination indices (only considering the distance from the outermost non-zero elements of the sparse matrix to the row diagonal), and incorporates the degree of clustering of internal non-zero elements (the distance to half the non-zero elements closest to the corresponding row diagonal) into the considerations of the renumbering algorithm. 2. It improves the overall iteration time of CFD numerical simulation computation. This application is expected to combine the underlying logic of computer memory access during CFD sparse matrix solving (the better the clustering of the matrix, the higher the cache hit rate) to select a suitable renumbering algorithm, significantly shortening the execution time of numerical simulation from both matrix assembly and solution aspects.
[0213] The foregoing provides a detailed description of a fluid dynamics-based grid processing method, apparatus, device, and medium. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0214] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for processing meshes based on fluid dynamics, characterized in that, include: Obtain a grid containing the current feature data of the target fluid; The grid is input into the target grid renumbering algorithm; wherein, the target grid renumbering algorithm is based on the local anomaly factor algorithm, and the grid renumbering quality discrimination index is obtained from the grid renumbering algorithm; the grid renumbering quality discrimination index based on the local anomaly factor algorithm is determined according to the degree of aggregation of non-zero elements inside the sparse matrix generated by the grid; Fluid dynamics numerical simulation was performed using the aforementioned target mesh renumbering algorithm; The characteristic data of the target fluid at a preset time are determined based on the results of the fluid dynamics numerical simulation. The quality criterion for grid renumbering based on the local anomaly factor algorithm is determined by the degree of clustering of non-zero elements within the sparse matrix generated by the grid, including: The adjacency relationships of the non-zero elements generated by the mesh are used to generate the corresponding sparse matrix, which is then converted into a coordinate system. Obtain the number of non-zero elements in the sparse matrix; Get the first distance value between the current target point and the points surrounding the target; Obtain the second distance value of the element k furthest from the current target point; The k-th reachable distance from the target's surrounding points to the current target point is determined based on the first distance value and the second distance value. Get the number of all elements within the k-th distance from the current target point; The reachability density value of the current target point is determined based on the sum of the k-th reachable distances from all surrounding points to the current target point and the number of all elements; Obtain the reachable density values of points surrounding each target; The current local outlier factor of the current target point is determined based on the reachability density value of the current target point, the reachability density value of the points surrounding the target, and the number of all elements. If the current local outlier factor is greater than 1, the current target point is determined to be an outlier. The next point of the current target point is taken as the new current target point, and the step of obtaining the first distance value between the current target point and the surrounding points is returned until all the non-zero elements are determined to be abnormal points and then the return stops. The step of converting the non-zero element adjacency relationship generated by the mesh into the corresponding sparse matrix into a coordinate system includes: The adjacency relationship of the non-zero elements generated by the mesh is used to generate the coordinates of each non-zero element in the corresponding sparse matrix, which are defined as the row and column values of the corresponding non-zero element. The sparse matrix is transformed into a coordinate system with elements only in the first quadrant based on the row and column values of each of the non-zero elements.
2. The hydrodynamic mesh processing method according to claim 1, characterized in that, The establishment of a grid renumbering algorithm based on a greedy algorithm includes: Define the initial numbering cells and create the neighbor container; Starting from the initial numbering unit, the neighbors of the initial numbering unit are pushed into the neighbor container as numbering units; Let the first element in the neighbor container be the initial numbering unit; Return to the step of starting numbering from the initial numbered unit until all units have been renumbered and then stop returning.
3. The hydrodynamic mesh processing method according to claim 1, characterized in that, The establishment of a grid renumbering algorithm based on cell quotient includes: Get the first bandwidth under the current number; Obtain the sum of the adjacent cell numbers, the number of related neighboring cells, and the cell quotient for each cell; All units are renumbered according to the unit quotient and used as the new current number; Get the second bandwidth under the new current number; If the first bandwidth and the second bandwidth meet the preset requirements, the new current number is used as the number of the grid. If the first bandwidth and the second bandwidth do not meet the preset requirements, return to the step of obtaining the first bandwidth under the current number, and stop when the iterative convergence index meets the preset value.
4. The hydrodynamic mesh processing method according to any one of claims 1 to 3, characterized in that, After acquiring the grid containing the current feature data of the target fluid, the method further includes: The grid is decomposed into sub-grids of a preset size; Correspondingly, the step of inputting the mesh into the target mesh renumbering algorithm includes: Each of the sub-grids is input into the target grid renumbering algorithm.
5. The hydrodynamic mesh processing method according to claim 4, characterized in that, The grid renumbering algorithm is either a greedy algorithm-based grid renumbering algorithm or a cell quotient algorithm-based grid renumbering algorithm. The algorithm for determining the target grid renumbering includes: Obtain a first grid number and a second grid number; wherein, the first grid number is obtained by optimizing the initial grid number using the greedy algorithm, and the second grid number is obtained by optimizing the initial grid number using the cell quotient algorithm; The number of first non-zero elements corresponding to the first grid number, the number of second non-zero elements corresponding to the second grid number, and the number of initial non-zero elements corresponding to the initial grid number are obtained respectively using the grid renumbering quality discrimination index based on the local anomaly factor algorithm. Obtain the minimum value among the first number of non-zero elements, the second number of non-zero elements, and the initial number of non-zero elements; The algorithm corresponding to the minimum value is used as the target grid renumbering algorithm.
6. A fluid dynamics-based grid processing device, characterized in that, include: The acquisition module is used to acquire a grid containing the current feature data of the target fluid; An input module is used to input the mesh into a target mesh renumbering algorithm; wherein the target mesh renumbering algorithm is based on a local anomaly factor algorithm, and the mesh renumbering quality discrimination index is obtained from the mesh renumbering algorithm; the mesh renumbering quality discrimination index based on the local anomaly factor algorithm is determined according to the degree of aggregation of non-zero elements within the sparse matrix generated by the mesh; The numerical simulation module is used to perform fluid dynamics numerical simulations using the target mesh renumbering algorithm. The determination module is used to determine the characteristic data of the target fluid at a preset time based on the results of the fluid dynamics numerical simulation; The quality criterion for grid renumbering based on the local anomaly factor algorithm is determined by the degree of clustering of non-zero elements within the sparse matrix generated by the grid, including: The adjacency relationships of the non-zero elements generated by the mesh are used to generate the corresponding sparse matrix, which is then converted into a coordinate system. Obtain the number of non-zero elements in the sparse matrix; Get the first distance value between the current target point and the points surrounding the target; Obtain the second distance value of the element k furthest from the current target point; The k-th reachable distance from the target's surrounding points to the current target point is determined based on the first distance value and the second distance value. Get the number of all elements within the k-th distance from the current target point; The reachability density value of the current target point is determined based on the sum of the k-th reachable distances from all surrounding points to the current target point and the number of all elements; Obtain the reachable density values of points surrounding each target; The current local outlier factor of the current target point is determined based on the reachability density value of the current target point, the reachability density value of the points surrounding the target, and the number of all elements. If the current local outlier factor is greater than 1, the current target point is determined to be an outlier. The next point of the current target point is taken as the new current target point, and the step of obtaining the first distance value between the current target point and the surrounding points is returned until all the non-zero elements are determined to be abnormal points and then the return stops. The step of converting the non-zero element adjacency relationship generated by the mesh into the corresponding sparse matrix into a coordinate system includes: The adjacency relationship of the non-zero elements generated by the mesh is used to generate the coordinates of each non-zero element in the corresponding sparse matrix, which are defined as the row and column values of the corresponding non-zero element. The sparse matrix is transformed into a coordinate system with elements only in the first quadrant based on the row and column values of each of the non-zero elements.
7. A fluid dynamics-based grid processing device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the hydrodynamic mesh processing method as described in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the hydrodynamic mesh processing method as described in any one of claims 1 to 5.