Weighted search-based Laplacian grid optimization method and device
By introducing a weighted search-based grid optimization method in Laplace smooth algorithm, the problems of poor grid uniformity and optimization logic limitations of existing algorithms when optimizing unstructured grids are solved, and a more stable grid is achieved Quality optimization effect.
Patent Information
- Application Number
- CN202510047485.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When optimizing unstructured grids, the existing Laplace smooth algorithm has poor grid uniformity, limited optimization logic, lacks intervention of grid quality modules, and uncertain optimization sequence, resulting in unstable grid quality optimization effect.
Using the Laplace grid optimization method based on the weighted search formula, the grid mass coefficients of the mesh nodes to be optimized and their adjacent panels are weighted to calculate the position to be judged and the mesh mass coefficients. , record the best points and adjust the position of the grid node.
The topological adjacency mesh quality of the two-dimensional grid is significantly improved, the geometric optimization effect of the grid is improved, and the unnecessary position changes and quality reduction risks of the original algorithm when the overall grid quality is good.
Smart Images

Figure CN119475926A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of finite element simulation and finite element mesh generation, and in particular to a Laplace mesh optimization method and device based on weighted search. Background Art
[0002] The conventional Laplace smoothing algorithm is effective for most meshes and can effectively improve the quality of the mesh, but the problems are: 1. The grid uniformity obtained after smoothing the unstructured grid cells is poor; 2. Since there is no mesh quality module involved, the algorithm's optimization logic only considers the optimal shape as the ideal mesh unit quality, which has certain limitations; 3. The conventional Laplace smoothing algorithm does not specify the optimization order of mesh nodes. Using different mesh node optimization orders can obtain different mesh quality optimization effects. 4. When the overall grid quality is good, the position of each grid node will still be changed, which takes more time. On the other hand, there is also a risk of turning the originally qualified grid unit into a unit of poor quality. Summary of the invention
[0003] In view of the technical defects and technical drawbacks in the prior art, the embodiments of the present invention provide a weighted search-based Laplace grid optimization method and device that overcome the above problems or at least partially solve the above problems. The specific scheme is as follows: As a first aspect of the present invention, a weighted search-based Laplace grid optimization method is provided, the method comprising: Step 1, obtaining the mesh node to be optimized, and calculating the mesh quality coefficient α of the adjacent facets of the mesh node to be optimized; Step 2, obtaining N adjacent grid nodes around the grid node to be optimized; Step 3, weight each adjacent mesh node around the mesh node to be optimized by a preset value in turn, and after weighting a mesh node each time, calculate the position to be determined of the mesh node to be optimized and the mesh quality coefficient αi of the adjacent facets, if αi is greater than α, then record the corresponding position to be determined and the mesh quality coefficient αi into the key-value pair set; Step 4, taking the optimal point in the key-value pair set as the position to be optimized of the grid node to be optimized, and adjusting the position of the grid node to be optimized; Among them, in step 3, only one of the N adjacent grid nodes around the grid node to be optimized is weighted each time, that is, when the next grid node is weighted, the weight assigned by the previous grid node is withdrawn, and αi is the grid quality coefficient calculated after weighting an adjacent grid node of the grid node to be optimized.
[0004] Further, step 3 includes: Step 301, weighting the i-th adjacent grid node by a preset value; Step 302, calculate the mesh quality coefficient of the position Vi' to be determined of the mesh node to be optimized and the adjacent facets after weighting the i-th adjacent mesh node according to step 301 αi ; Step 303, determine whether αi is greater than α; if αi is greater than α, execute step 304, otherwise execute step 305; Step 304, record (Vi', αi) in the key-value pair set β, and execute step 305; Step 305, iteration i=i+1; Step 306, determine whether i is less than or equal to N, if i is less than or equal to N, return to step 301, otherwise execute step 307; Step 307, the process ends; Here, the initial value of i is 1.
[0005] Furthermore, step 4 specifically includes: If i is greater than N, determine whether the key-value pair set β is empty. If not, use the position to be determined in the key-value pair corresponding to the maximum grid quality coefficient in the key-value pair set as the position to be optimized of the grid node to be optimized, adjust the position of the grid node to be optimized, and clear the key-value pair set β. Return to step 1 and calculate the mesh quality coefficient α of the adjacent facets of the next mesh node to be optimized.
[0006] Furthermore, let the grid node to be optimized be grid node i, and the calculation formula for the position to be determined of grid node i is as follows: ; Where: M(i) is the calculated value of the weighted search Laplace operator of grid node i, Wtotal is the sum of the weights of the grid nodes adjacent to grid node i, Vi represents the current position of grid node i, Ne(i) is the set of adjacent topological grid nodes of grid node i, W(j) is the weight value assigned to the jth grid node adjacent to grid node i when adjusting the position of grid node i; According to the calculated value of M(i), the position to be determined of the grid node i is obtained as Vi'=Vi+M(i).
[0007] Furthermore, let the mesh node to be optimized be mesh node i, and the calculation formula of the mesh quality coefficient of the adjacent facets of mesh node i is as follows: ; Where αi is the mesh quality coefficient of the adjacent facets of mesh node i; parameter N is the sum of the number of adjacent facets around mesh node i; adjFcs(i) is the set of topological adjacent facets of mesh node i; Q(k) is the mesh quality coefficient of the facet identified as k.
[0008] As a second aspect of the present invention, a weighted search-based Laplace grid optimization device is provided, the device comprising: A mesh quality coefficient α calculation module is used to obtain the mesh nodes to be optimized and calculate the mesh quality coefficient α of the adjacent facets of the mesh nodes to be optimized; An adjacent grid node acquisition module is used to acquire N adjacent grid nodes around the grid node to be optimized; A calculation module is used to weight each adjacent grid node around the grid node to be optimized by a preset value in turn, and after weighting a grid node each time, calculate the position to be determined of the grid node to be optimized and the grid quality coefficient αi of the adjacent facets, and if αi is greater than α, the corresponding position to be determined and the grid quality coefficient αi are recorded in the key-value pair set; The optimization and adjustment module takes the optimal point in the key-value pair set as the position to be optimized of the grid node to be optimized, and adjusts the position of the grid node to be optimized; Among them, each time only one of the N adjacent grid nodes around the grid node to be optimized is weighted, and αi is the grid quality coefficient calculated after weighting one adjacent grid node of the grid node to be optimized.
[0009] Furthermore, the calculation module is specifically used for: A, weights the i-th adjacent grid node with a preset value; B. Calculate the position Vi' of the mesh node to be optimized and the mesh quality coefficient of the adjacent face after weighting the i-th adjacent mesh node according to step A. αi ; C, determine whether αi is greater than α; if αi is greater than α, execute step D, otherwise execute step E; D, record (Vi', αi) in the key-value pair set β, and execute step E; E, iteration i=i+1; F, determine whether i is less than or equal to N. If i is less than or equal to N, return to step A; Here, the initial value of i is 1.
[0010] Furthermore, the optimization and adjustment module is specifically used for: If i is greater than N, determine whether the key-value pair set β is empty. If not, use the position to be determined in the key-value pair corresponding to the maximum grid quality coefficient in the key-value pair set as the position to be optimized of the grid node to be optimized, adjust the position of the grid node to be optimized, and clear the key-value pair set β. Return to step 1 and calculate the mesh quality coefficient α of the adjacent facets of the next mesh node to be optimized.
[0011] Furthermore, let the grid node to be optimized be grid node i, and the calculation formula for the position to be determined of grid node i is as follows: ; Where: M(i) is the calculated value of the weighted search Laplace operator of grid node i, Wtotal is the sum of the weights of the adjacent grid nodes of grid node i, Vi represents the current position of grid node i, Ne(i) is the set of adjacent topological grid nodes of grid node i, and W(j) is the weight value assigned to the jth grid node adjacent to grid node i when adjusting the position of grid node i.
[0012] Furthermore, the calculation formula of the grid quality coefficient based on the position to be determined is as follows: ; Where αi is the mesh quality coefficient of the adjacent facets of mesh node i; parameter N is the sum of the number of adjacent facets around mesh node i; adjFcs(i) is the set of topological adjacent facets of mesh node i; Q(k) is the mesh quality coefficient of the facet identified as k.
[0013] The present invention has the following beneficial effects: The present invention uses the weighted Laplace optimization method to optimize the two-dimensional grid, and the effect is significant. Each grid node to be optimized starts from the center of all its adjacent grid nodes, and finds the target optimization position based on the greedy search strategy. Ultimately, most grid nodes can improve the quality of their topologically adjacent surface grids by adjusting their geometric positions, thereby achieving the effect of grid geometry optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A schematic diagram of a flow chart of a weighted search Laplace grid optimization method provided in an embodiment of the present invention; Figure 2 A comparison of weighted search Laplace optimization effects under different weights provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0015] 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 present invention, not all 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.
[0016] like Figure 1 As shown, a weighted search-based Laplace grid optimization method is provided in an embodiment of the present invention, and the method includes: Step 1, obtaining the mesh node to be optimized, and calculating the mesh quality coefficient α of the adjacent facets of the mesh node to be optimized; Step 2, obtaining N adjacent grid nodes around the grid node to be optimized; Step 3, weight each adjacent mesh node around the mesh node to be optimized by a preset value in turn, and after weighting a mesh node each time, calculate the position to be determined of the mesh node to be optimized and the mesh quality coefficient αi of the adjacent facets, if αi is greater than α, then record the corresponding position to be determined and the mesh quality coefficient αi into the key-value pair set; Step 4, taking the optimal point in the key-value pair set as the position to be optimized of the grid node to be optimized, and adjusting the position of the grid node to be optimized; Among them, in step 3, only one of the N adjacent grid nodes around the grid node to be optimized is weighted each time, that is, when the next grid node is weighted, the weight assigned by the previous grid node is withdrawn, α is the initial grid quality coefficient of the grid node to be optimized, that is, the grid quality coefficient of the current position of the grid node to be optimized, and αi is the grid quality coefficient calculated after weighting an adjacent grid node of the grid node to be optimized.
[0017] The grid nodes to be optimized are illegal grids in the two-dimensional grid, that is, irregular grids. Specifically, the illegal grids include: a. Extremely thin and long (high aspect ratio) cells. Judgment method: Calculate the aspect ratio of the cell. If the aspect ratio exceeds a certain threshold (such as the common 3:1 or 5:1), it is judged as an illegal grid.
[0018] b. Units with poor geometric shapes, which cannot approximate the geometric domain well, usually include triangles and quadrilateral units with too small or too large internal angles. Set a specified threshold for the internal angles of these grid units. If the internal angles are less than or greater than the specified threshold, these units are illegal grid units.
[0019] The present invention uses the weighted Laplace optimization method to optimize the two-dimensional grid, and the effect is significant. Each grid node to be optimized starts from the center of all its adjacent grid nodes, and finds the target optimization position based on the greedy search strategy. Ultimately, most grid nodes can improve the quality of their topologically adjacent surface grids by adjusting their geometric positions, thereby achieving the effect of grid geometry optimization.
[0020] In some embodiments, step 3 specifically includes: Step 301, weighting the i-th adjacent grid node by a preset value; Step 302, calculate the mesh quality coefficient of the position Vi' to be determined of the mesh node to be optimized and the adjacent facets after weighting the i-th adjacent mesh node according to step 301 αi ; Step 303, determine whether αi is greater than α; if αi is greater than α, execute step 304, otherwise execute step 305; Step 304, record (Vi', αi) in the key-value pair set β, and execute step 305; Step 305, iteration i=i+1; Step 306, determine whether i is less than or equal to N, if i is less than or equal to N, return to step 301; Here, the initial value of i is 1.
[0021] Step 4 specifically includes: If i is greater than N, determine whether the key-value pair set β is empty. If not, use the position to be determined in the key-value pair corresponding to the maximum grid quality coefficient in the key-value pair set as the position to be optimized of the grid node to be optimized, adjust the position of the grid node to be optimized, and clear the key-value pair set β. Return to step 1, calculate the mesh quality coefficient α of the adjacent facets of the next mesh node to be optimized, and complete the optimization of the next mesh node to be optimized according to the optimization method of the previous mesh node to be optimized, and traverse all the mesh nodes to be optimized that need to be optimized in turn.
[0022] Theoretically, when the weight of one of the adjacent grid nodes is much greater than the weight of other adjacent grid nodes, the grid node to be optimized will eventually approach the adjacent grid node without coordinate overlap. Since the conventional Laplace algorithm does not involve the participation of the quality detection function, it is considered that the center point is the position with better grid quality. In the weighted search Laplace optimization process provided by the present invention, the position to be optimized of the grid node needs to be evaluated using the grid quality detection related function. In the present invention, if the position to be optimized (position to be determined) of the grid node to be optimized obtained by the weighting operator of one of the adjacent grid nodes is not improved compared with the overall surrounding grid quality of the previous position, the weight assigned to the adjacent grid node is recovered, and it is iterated to the next adjacent grid node, and the same amount of weight value is assigned to it; if after a round of search, there are multiple candidate positions that can make the overall grid quality better than before optimization, then the candidate position with the highest overall grid quality coefficient is selected as the final optimized position; if there is no new grid node with better overall grid quality than the previous position, the final position of the optimized grid node can be determined.
[0023] In some embodiments, let the grid node to be optimized be grid node i, and the calculation formula for the position to be determined of grid node i is as follows: ; Where: M(i) is the calculated value of the weighted search Laplace operator of grid node i, Wtotal is the sum of the weights of the grid nodes adjacent to grid node i, Vi represents the current position of grid node i, Ne(i) is the set of adjacent topological grid nodes of grid node i, W(j) is the weight value assigned to the jth grid node adjacent to grid node i when adjusting the position of grid node i; According to the calculated value of M(i), the position to be determined of the grid node i is obtained as Vi'=Vi+M(i).
[0024] In some embodiments, let the mesh node to be optimized be mesh node i, and the calculation formula of the mesh quality coefficient of the adjacent facets of mesh node i is as follows: ; Where αi is the mesh quality coefficient of the adjacent facets of mesh node i; parameter N is the sum of the number of adjacent facets around mesh node i; adjFcs(i) is the set of topological adjacent facets of mesh node i; Q(k) is the mesh quality coefficient of the facet identified as k.
[0025] The present invention proposes a Laplace geometry optimization algorithm that searches for optimal positions through weighted adjacent grid nodes, which can better apply grid optimization demand scenarios and obtain better grid quality optimization effects than conventional Laplace optimization algorithms.
[0026] The embodiment of the present invention further provides a Laplace grid optimization device based on weighted search, the device comprising: A mesh quality coefficient α calculation module is used to obtain the mesh nodes to be optimized and calculate the mesh quality coefficient α of the adjacent facets of the mesh nodes to be optimized; An adjacent grid node acquisition module is used to acquire N adjacent grid nodes around the grid node to be optimized; A calculation module is used to weight each adjacent grid node around the grid node to be optimized by a preset value in turn, and after weighting a grid node each time, calculate the position to be determined of the grid node to be optimized and the grid quality coefficient αi of the adjacent facets, and if αi is greater than α, the corresponding position to be determined and the grid quality coefficient αi are recorded in the key-value pair set; The optimization and adjustment module takes the optimal point in the key-value pair set as the position to be optimized of the grid node to be optimized, and adjusts the position of the grid node to be optimized; Among them, each time only one of the N adjacent grid nodes around the grid node to be optimized is weighted, and αi is the grid quality coefficient calculated after weighting one adjacent grid node of the grid node to be optimized.
[0027] In a specific embodiment, since different weighted weights will affect the step size of the offset of the grid node to be optimized in each iteration and the iterative discussion of the grid node to be optimized reaching the final position, the sum of the number of adjacent grid nodes around the grid node to be optimized is denoted as N. The example of the present invention selects additional weighted weights (preset values) as 0 (conventional Laplace optimization method), N / 4, N / 2, 3N / 4, N and 2N in turn in the comparative experiment. The topology of multiple groups of face grids is optimized according to the grid optimization effect and the algorithm execution time, and the optimization time, grid optimization amplitude and iteration rounds are recorded. The optimization amplitude ε is defined as: ; The final effect is as follows Figure 2 shown.
[0028] Judging from the test data of this embodiment, the weighted search Laplace algorithm provided by the present invention takes longer time than the conventional Laplace algorithm. This is because the conventional Laplace optimization only calculates and adjusts the position once, while the weighted search Laplace optimization method not only requires multiple iterations to search for the optimal grid node position, but also requires the participation of the quality detection module in each iteration process to perform unit quality detection on the optimized temporary position, so the total time is often longer.
[0029] Compared with the conventional Laplace method, the weighted Laplace method provided by the present invention will skip the qualified grid nodes and only optimize the grid nodes with improvement space, so when the overall quality of the grid topology is good, this type of Laplace method can achieve better optimization effect. The comparative experiment in this paper mainly uses five groups of additional weight settings from n / 4 to 2n. It is found that when the weight setting is too large, the optimization position offset of each step is large, and the corresponding optimization speed will be faster, but the probability of deviation from the theoretical optimal position will increase accordingly, and the final optimization range will be smaller than the optimization range of low weight. This does not mean that the setting of weights should be as small as possible, because when the weight is small, the optimization position offset of each step is small. Although the probability of reaching the theoretical optimal position is increased, the number of iterations will increase accordingly, and it will take longer. Therefore, when using the weighted search Laplace optimization algorithm, it depends on the optimization effect required by the user and the number of grid nodes to be optimized in the scene. It is more wise to choose the corresponding weight.
[0030] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A Laplace grid optimization method based on weighted search, characterized in that: The method comprises: Step 1, obtaining the mesh node to be optimized, and calculating the mesh quality coefficient α of the adjacent facets of the mesh node to be optimized; Step 2, obtaining N adjacent grid nodes around the grid node to be optimized; Step 3, weight each adjacent mesh node around the mesh node to be optimized by a preset value in turn, and after weighting a mesh node each time, calculate the position to be determined of the mesh node to be optimized and the mesh quality coefficient αi of the adjacent facets, if αi is greater than α, then record the corresponding position to be determined and the mesh quality coefficient αi into the key-value pair set; Step 4, taking the optimal point in the key-value pair set as the position to be optimized of the grid node to be optimized, and adjusting the position of the grid node to be optimized; In step 3, only one of the N adjacent grid nodes around the grid node to be optimized is weighted each time, and αi is a grid quality coefficient calculated after weighting one of the adjacent grid nodes of the grid node to be optimized.
2. The weighted search Laplace grid optimization method according to claim 1, characterized in that: Step 3 includes: Step 301, weighting the i-th adjacent grid node by a preset value; Step 302, calculate the mesh quality coefficient of the position Vi' to be determined of the mesh node to be optimized and the adjacent facets after weighting the i-th adjacent mesh node according to step 301 αi ; Step 303, determine whether αi is greater than α; if αi is greater than α, execute step 304, otherwise execute step 305; Step 304, record (Vi', αi) in the key-value pair set β, and execute step 305; Step 305, iteration i=i+1; Step 306, determine whether i is less than or equal to N, if i is less than or equal to N, return to step 301; Here, the initial value of i is 1.
3. The weighted search Laplace grid optimization method according to claim 2, characterized in that: Step 4 specifically includes: If i is greater than N, determine whether the key-value pair set β is empty. If not, use the position to be determined in the key-value pair corresponding to the maximum grid quality coefficient in the key-value pair set as the position to be optimized of the grid node to be optimized, adjust the position of the grid node to be optimized, and clear the key-value pair set β. Return to step 1 and calculate the mesh quality coefficient α of the adjacent facet of the next mesh node to be optimized.
4. The weighted search-based Laplace grid optimization method according to claim 1 or 2, characterized in that: Let the grid node to be optimized be grid node i, and the calculation formula for the position to be determined of grid node i is as follows: ; Where: M(i) is the calculated value of the weighted search Laplace operator of grid node i, Wtotal is the sum of the weights of the grid nodes adjacent to grid node i, Vi represents the current position of grid node i, Ne(i) is the set of adjacent topological grid nodes of grid node i, W(j) is the weight value assigned to the jth grid node adjacent to grid node i when adjusting the position of grid node i; According to the calculated value of M(i), the position to be determined of the grid node i is obtained as Vi'=Vi+M(i).
5. The weighted search-based Laplace grid optimization method according to claim 1 or 2, characterized in that: Let the mesh node to be optimized be mesh node i, and the calculation formula of the mesh quality coefficient of the adjacent facets of mesh node i is as follows: ; Where αi is the mesh quality coefficient of the adjacent facets of mesh node i; parameter N is the sum of the number of adjacent facets around mesh node i; adjFcs(i) is the set of topological adjacent facets of mesh node i; Q(k) is the mesh quality coefficient of the facet identified as k.
6. A Laplace grid optimization device based on weighted search, characterized in that: The device comprises: A mesh quality coefficient α calculation module is used to obtain the mesh nodes to be optimized and calculate the mesh quality coefficient α of the adjacent facets of the mesh nodes to be optimized; An adjacent grid node acquisition module is used to acquire N adjacent grid nodes around the grid node to be optimized; A calculation module is used to weight each adjacent grid node around the grid node to be optimized by a preset value in turn, and after weighting a grid node each time, calculate the position to be determined of the grid node to be optimized and the grid quality coefficient αi of the adjacent facets, and if αi is greater than α, the corresponding position to be determined and the grid quality coefficient αi are recorded in the key-value pair set; The optimization and adjustment module takes the optimal point in the key-value pair set as the position to be optimized of the grid node to be optimized, and adjusts the position of the grid node to be optimized; Among them, each time only one of the N adjacent grid nodes around the grid node to be optimized is weighted, and αi is the grid quality coefficient calculated after weighting one adjacent grid node of the grid node to be optimized.
7. The weighted search-based Laplace grid optimization device according to claim 6, characterized in that: The computing module is specifically used for: A, weights the i-th adjacent grid node with a preset value; B. Calculate the position Vi' of the mesh node to be optimized and the mesh quality coefficient of the adjacent face after weighting the i-th adjacent mesh node according to step A. αi ; C, determine whether αi is greater than α; if αi is greater than α, execute step D, otherwise execute step E; D, record (Vi', αi) in the key-value pair set β, and execute step E; E, iteration i=i+1; F, determine whether i is less than or equal to N. If i is less than or equal to N, return to step A; Here, the initial value of i is 1.
8. The weighted search-based Laplace grid optimization device according to claim 7, characterized in that: The optimization and adjustment module is specifically used for: If i is greater than N, determine whether the key-value pair set β is empty. If not, use the position to be determined in the key-value pair corresponding to the maximum grid quality coefficient in the key-value pair set as the position to be optimized of the grid node to be optimized, adjust the position of the grid node to be optimized, and clear the key-value pair set β. Return to step 1 and calculate the mesh quality coefficient α of the adjacent facet of the next mesh node to be optimized.
9. The weighted search-based Laplace grid optimization device according to claim 6 or 7, characterized in that: Let the grid node to be optimized be grid node i, and the calculation formula of the position to be determined of grid node i is as follows: ; Where: M(i) is the calculated value of the weighted search Laplace operator of grid node i, Wtotal is the sum of the weights of the adjacent grid nodes of grid node i, Vi represents the current position of grid node i, Ne(i) is the set of adjacent topological grid nodes of grid node i, and W(j) is the weight value assigned to the jth grid node adjacent to grid node i when adjusting the position of grid node i.
10. The weighted search-based Laplace grid optimization device according to claim 6 or 7, characterized in that: The calculation formula of the grid quality coefficient based on the position to be determined is as follows: ; Where αi is the mesh quality coefficient of the adjacent facets of mesh node i; parameter N is the sum of the number of adjacent facets around mesh node i; adjFcs(i) is the set of topological adjacent facets of mesh node i; Q(k) is the mesh quality coefficient of the facet identified as k.