A method for calculating wall distance of a Cartesian grid under load balancing in a parallel framework, a medium and equipment

By constructing a KD tree in a parallel framework and recording the number of searches for Cartesian grid cells, and setting weights for partitioning, the load imbalance problem in Cartesian grid wall distance calculation is solved, and the computational efficiency and scalability are improved.

CN119442360BActive Publication Date: 2025-10-10NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411465654.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-10-10
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

In a parallel computing framework, the Cartesian grid wall distance calculation suffers from a load imbalance problem, resulting in low computational efficiency. In particular, when generating adaptive Cartesian grids in large-scale parallel, the computational time differences between processes are obvious.

Method used

By constructing a surface data index structure based on the KD tree, the number of Cartesian grid cell searches in the KD tree is recorded, and weights are set based on the number of searches to perform grid parallel partitioning to ensure load balancing among cores.

Benefits of technology

The time for calculating wall distances is significantly shortened, the efficiency and parallel scalability of adaptive Cartesian grid generation are improved, and the imbalance of computational load between processes is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119442360B_ABST
    Figure CN119442360B_ABST
Patent Text Reader

Abstract

The application provides a load balancing Cartesian grid wall distance calculation method under a parallel framework, a medium and equipment, which predicts the iteration number of each Cartesian grid unit in the surface data index structure by combining the characteristics of the newly generated Cartesian grid unit before and after grid encryption and the old Cartesian grid unit, sets the partition weight in direct proportion to the iteration number, and considers the weight partition before calculating the wall distance, so that the inter-process calculation load imbalance in the wall distance calculation is relieved, the time required for calculating the wall distance in the large-scale parallel adaptive Cartesian grid generation process is significantly shortened, and the adaptive Cartesian grid generation efficiency and parallel scalability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of fluid mechanics, and in particular relates to a method, medium and device for calculating Cartesian grid wall distance with load balance under a parallel framework. Background Art

[0002] As a grid type with simple generation, low memory requirements, high computational efficiency, and a high degree of automation, Cartesian grids have been a hot topic in computational fluid dynamics research in recent years. However, compared to body-fitting grids, the isotropy of Cartesian grids leads to a dramatic increase in the number of grids required, which in turn increases the time required for wall distance calculations. Therefore, large-scale parallelization is necessary. In this context, a global grid encoding method based on space-filling curves is used to partition the grid. By allowing the data within any single fork tree structure to be distributed across different processes, global grid numbering can be used to effectively control the difference in grid numbers between processes, achieving load balancing at the grid number level.

[0003] Before calculating wall distances, the object surface geometry model dataset must be processed. The most common approach is to sequentially store the object surface triangles and their associated data in an array and then use a traversal method to search for the wall distances and corresponding object surface triangles for each Cartesian grid. This approach is the most straightforward, but as the computational scale increases, its computational complexity and time consumption become unacceptable. The traditional ADT (Alternating Digital Tree) approach, which stores object surface triangles and their associated data in an AD tree, can significantly reduce computational time. However, AD trees are not necessarily balanced binary trees, and search efficiency is unstable. The KDT (K-Dimensional Tree) approach, which stores object surface triangles and their associated data in a balanced KD tree, significantly improves computational efficiency. However, the introduction of massively parallel technology means that when calculating wall distances, different spatial Cartesian grid cells correspond to different object surface triangles, resulting in different numbers of iterations in the KD tree and different computational loads. Although the mesh load is balanced across processes, the computational load is not, which can easily lead to significant differences in computational time between processes, thus affecting overall computational efficiency.

[0004] As the complexity of three-dimensional surface geometric models increases, the amount of shape data that needs to be processed increases, affecting the computational efficiency and scalability of large-scale parallel generation of adaptive Cartesian grids. Currently, there is no effective method to deal with the computational load imbalance problem when calculating Cartesian grid wall distances. Summary of the Invention

[0005] In view of the deficiencies in the prior art, the present invention provides a method, medium and device for calculating Cartesian grid wall distance with load balancing under a parallel framework.

[0006] To achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a load-balanced Cartesian grid wall distance calculation method in a parallel framework, comprising:

[0008] S1: Abstracting an object surface geometry model file from a complex real-world shape. The object surface geometry model is formed by connecting multiple object surface triangle units through shared vertices.

[0009] S2: Reading vertex information of all object plane triangle units in the object plane geometric model file, and constructing a spatial bounding box based on each object plane triangle unit;

[0010] S3: Based on the object plane triangulation unit and the spatial bounding box, establish an object plane data index structure based on a KD tree;

[0011] S4: placing the object surface geometric model in the flow field area required for calculation, and dividing the flow field area into Cartesian grids to obtain a series of isotropic cubic Cartesian grid units with grid surfaces parallel to the coordinate axes;

[0012] S5: Determine the Cartesian grid cell for which the wall distance needs to be calculated, search the KD tree for the object plane triangle cell corresponding to the wall distance of the Cartesian grid cell, calculate the distance from the Cartesian grid cell to the object plane triangle cell and determine it as the wall distance, and record the number of searches for the Cartesian grid cell in the KD tree;

[0013] S6: Perform intersection and inside-outside determination on all Cartesian grid cells, and encrypt the Cartesian grid cells that intersect with the object plane triangle cells, dividing them into finer grid cells. The newly generated fine grid cells inherit the search count of the coarse grid cells in the KD tree, and the search count of the remaining unencrypted grid cells in the KD tree is set to 0;

[0014] S7: Before the next wall distance calculation, a weight is set based on the number of searches for each Cartesian grid cell in the KD tree, and the grid is partitioned in parallel with the weight, and the Cartesian grid cells and related data are weighted and averaged to different cores for calculation;

[0015] S8: Repeat steps S5 to S7 until the set number of grid encryption times is reached; the obtained grid parameters of the Cartesian grid unit including the wall distance are used to numerically solve the object surface geometric model, and then obtain the outflow flow field of the complex real shape under the preset working conditions.

[0016] Optionally, in step S3, the KD tree is a balanced binary tree, and the data structure within its node includes: the object plane triangle unit corresponding to the node, the midpoint coordinate data of the object plane triangle unit, the bounding box data of the object plane triangle unit, the spatial range represented by the node, the dividing plane that divides the space represented by the node into two left and right subspaces, the coordinate axis perpendicular to the dividing plane, the left branch KD tree composed of all data located in the left subspace, the right branch KD tree composed of all data located in the right subspace, and the parent node of the node.

[0017] Optionally, step S3 specifically includes the following sub-steps:

[0018] S31: Enter the KD tree root node, select the x-axis as the coordinate axis stored in the node, and select the bounding box of the object surface geometric model as the spatial range represented by the node;

[0019] S32: For the spatial range represented by the node, obtain the midpoint coordinates of all object plane triangles in the space, retrieve the median of the midpoint coordinates on the coordinate axis stored in the node, and store the object plane triangle corresponding to the median and its related data in the node. The plane formed by all spatial points whose coordinates on the coordinate axis are equal to the median is the splitting plane stored in the node;

[0020] S33: Within the spatial range represented by the node, according to the coordinate axis stored in the node, the KD tree consisting of all object plane triangle units corresponding to the midpoint coordinates less than the median is the left branch KD tree of the node, and its bounding box is the left subspace of the node; the KD tree consisting of all object plane triangle units corresponding to the midpoint coordinates greater than the median is the right branch KD tree of the node, and its bounding box is the right subspace of the node;

[0021] S34: Enter the next layer of nodes, update the coordinate axes stored in the node in the order of x-axis, y-axis, and z-axis according to the number of layers of the node, and update the spatial range represented by the node according to the left and right subspaces divided by the parent node;

[0022] S35: Repeat steps S32 to S34 until all object plane triangle elements are stored in the node.

[0023] Optionally, step S5 specifically includes the following sub-steps:

[0024] S51: For the Cartesian grid cell for which the wall distance needs to be calculated, set its initial search times N=0 in the KD tree;

[0025] S52: For the Cartesian grid cell for which the wall distance needs to be calculated, set its initial wall distance to L: if the grid cell is an initial Cartesian grid cell, L is the distance from the grid cell to the object plane triangle cell stored in the root node; if the grid cell is a newly generated fine grid cell after grid encryption, L is the wall distance of the coarse grid cell before grid encryption;

[0026] S53, starting from the root node of the KD tree, obtaining the object plane triangle unit stored in the root node, and setting the number of searches for the Cartesian grid unit N=1;

[0027] S54: Calculate the distance L from the Cartesian grid unit to the object plane triangle unit new , compare L with L new If L>L new , then update L = L new ;

[0028] S55: Enter the subtree, obtain the object plane triangle unit stored in the child node, and set the number of searches for the Cartesian grid unit N=N+1;

[0029] S56: Repeat steps S54 to S55 until the KD tree search is completed.

[0030] Optionally, in step S7, the grid parallel partitioning is to distribute and store all Cartesian grid cells and related data in different cores when multiple cores participate in flow field calculation simultaneously, and each core only performs calculation tasks for the Cartesian grid cells stored therein.

[0031] Optionally, in step S7, the weight of the grid parallel partitioning is W=N+0.01, where N represents the number of searches of the Cartesian grid unit.

[0032] In a second aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the load-balanced Cartesian grid wall distance calculation method under a parallel framework as described in the first aspect.

[0033] In a third aspect, the present invention provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for calculating the wall distance of a Cartesian grid with load balance under a parallel framework as described in the first aspect is implemented.

[0034] The beneficial effects of the present invention are as follows: by combining the characteristics of newly generated Cartesian grid cells and old Cartesian grid cells before and after grid encryption, the present invention predicts that the new cells and old cells correspond to the same object plane triangle cell when calculating wall distance, so the number of iterations of the new cells in the KD tree is the same as that of the old cells. Based on the predicted number of iterations of each cell in the KD tree, its partition weight is set proportional to the number of iterations, and the weighted partition is performed before calculating the wall distance. This alleviates the imbalance in computational load between processes when calculating the wall distance, significantly shortens the time required to calculate the wall distance in the large-scale parallel generation of adaptive Cartesian grids, and improves the efficiency of adaptive Cartesian grid generation and parallel scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 This is a flow chart of a load-balanced Cartesian grid wall distance calculation method under a parallel framework of the present invention.

[0036] Figure 2 Schematic diagram of generating a KD tree based on the midpoints of object plane triangle units in one embodiment of the present invention.

[0037] Figure 3 Schematic diagram of mesh partitioning based on a Z-shaped space-filling curve before mesh encryption in one embodiment of the present invention.

[0038] Figure 4 This is a schematic diagram of initial mesh partitioning without considering weights based on a Z-shaped space-filling curve after mesh encryption in one embodiment of the present invention.

[0039] Figure 5 Schematic diagram of the number of iterations required to calculate the wall distance based on the KD tree before mesh encryption in one embodiment of the present invention.

[0040] Figure 6 Schematic diagram of the number of iterations required to calculate the wall distance based on the KD tree after mesh encryption in one embodiment of the present invention.

[0041] Figure 7 Schematic diagram of mesh partitioning with weights taken into account after mesh encryption and optimization based on a Z-shaped space-filling curve and the number of iterations in one embodiment of the present invention.

[0042] Figure 8 This is a comparison diagram of the mesh partitioning without considering weights initially after mesh encryption and the mesh partitioning with considering weights after optimization in one embodiment of the present invention.

[0043] Figure 9 Schematic diagram of an adaptive Cartesian grid constructed based on the ONERA-M6 wing model in one embodiment of the present invention.

[0044] Figure 10Schematic diagram of an adaptive Cartesian grid constructed based on a DLR-F6 wing-body assembly model in one embodiment of the present invention.

[0045] Figure 11 Schematic diagram of generating an adaptive Cartesian grid and missile details based on the SU-27 fighter model in one embodiment of the present invention. DETAILED DESCRIPTION

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

[0047] In one embodiment, if Figure 1 As shown, the present invention proposes a load-balanced Cartesian grid wall distance calculation method under a parallel framework, comprising the following steps:

[0048] S1: Based on the complex shape information present in 3D fluid dynamics problems, obtain a surface geometry model file. A surface geometry model file uses a certain number of triangular elements to approximate the complex shape, storing the triangular elements in a specified order to abstract the surface geometry model from the complex real-world shape. Triangular elements, also known as surface triangle elements, are the basic units that constitute the surface geometry model. They are connected by shared vertices to form the surface geometry model.

[0049] S2: Read the vertex information of all object surface triangle units in the object surface geometry model file and construct a spatial bounding box based on the dimensional range of each unit. The spatial bounding box refers to a simple cuboid that completely encloses the specified object and is as close to the object as possible.

[0050] S3: Based on the object surface triangulation unit and the spatial bounding box, establish the object surface data index structure, namely the KD tree.

[0051] S4: Place the object surface geometric model in the flow field area required for calculation, and divide the flow field area into a Cartesian grid to obtain a series of isotropic cubic units with grid surfaces parallel to the coordinate axes, namely Cartesian grid units.

[0052] S5: Identify the Cartesian grid cell for which the wall distance calculation is required. The wall distance is the shortest distance from the midpoint of the Cartesian grid cell to the object surface geometry model. The object surface geometry model is composed of a certain number of object surface triangles. Therefore, the wall distance is the minimum distance between the midpoint of the Cartesian grid cell and all object surface triangles. Enter the KD tree and search the KD tree to obtain the object surface triangle corresponding to the Cartesian grid cell's wall distance. Calculate the distance from the Cartesian grid cell to the object surface triangle and determine it as the wall distance L. Simultaneously, record the number of times the grid cell is searched in the KD tree, N.

[0053] S6: After performing intersection determination, inside-outside determination, and other grid generation-related calculations on all Cartesian grid cells, grid encryption is performed to divide the Cartesian grid cells into several finer grid cells. The newly generated fine grid cells inherit the number of searches N in the KD tree of the coarse grid cells, and the number of searches N in the KD tree of the remaining unencrypted grid cells is 0.

[0054] S7: Before the next wall distance calculation, weights are set based on the number of grid cell searches N in the KD tree, and weighted grid parallel partitioning is performed. Grid parallel partitioning means that when multiple cores are simultaneously involved in flow field calculations, all Cartesian grid cells and related data are distributed and stored in different cores, and each core only performs calculation tasks for the Cartesian grid cells stored within it. Distributed storage can directly distribute Cartesian grid cells and related data evenly to different cores based on the number of grid cells, that is, grid parallel partitioning without considering weights; or by setting grid parallel partitioning weights for each Cartesian grid cell, Cartesian grid cells and related data are weighted and evenly distributed to different cores, that is, grid parallel partitioning with weights considered.

[0055] S8: Repeat steps S5 to S7. The number of times the grid is refined depends on the required flow field resolution.

[0056] Using the above method, the grid parameters of the Cartesian grid cells, including the wall distance, can be obtained quickly and efficiently, so as to perform numerical solutions to the surface geometric model and obtain the outflow field of the complex real shape under the preset working conditions.

[0057] In step S3, the KD tree is a balanced binary tree, and the data structure in its node includes: the object plane triangle unit corresponding to the node, the midpoint coordinate data of the object plane triangle unit, the bounding box data of the object plane triangle unit, the spatial range represented by the node, the splitting plane that divides the space represented by the node into two left and right subspaces, the coordinate axis perpendicular to the splitting plane, the left branch KD tree composed of all data in the left subspace, the right branch KD tree composed of all data in the right subspace, and the parent node of the node.

[0058] It should be noted that the algorithm steps described in this embodiment are all given in a two-dimensional context, and the designated areas for mesh refinement are merely for the purpose of more clearly illustrating the principles and implementation methods. The specific units requiring mesh refinement during actual mesh generation depend on the specific application and design requirements of the technical solution. Professionals and technicians may implement the described functionality using different constraints for each specific geometric shape information, but such implementations should not be considered beyond the scope of this application.

[0059] In this embodiment, based on the midpoint coordinate information of all object plane triangle units in the object plane geometric model file, the left and right subtrees are divided by finding the median object plane triangle unit in the direction of the current split axis, and the split axis is changed as the number of layers increases, and the object plane triangle units and their related data are stored in the KD tree, such as Figure 2 shown.

[0060] In this embodiment, for a 4×4 Cartesian grid, Figure 3 After global grid encoding and parallel grid partitioning of the Z-shaped space filling curve shown in the figure, all Cartesian grid cells can be evenly divided into four processes according to their number. Figure 4 After mesh encryption (Cartesian grid cells in the dotted box area shown), the global grid code is updated using a Z-type space-filling curve, and the grid is initially partitioned in parallel without considering the weight. This can also ensure that the number of grids in each of the four processes is 7, achieving load balance at the level of the number of grids.

[0061] Take the surface geometry model and Cartesian grid as an example, Figure 5 and Figure 6 As shown in the figure, since the geometric model of the object surface remains unchanged after the mesh is encrypted, if the Cartesian mesh unit is not encrypted, that is, the mesh unit remains unchanged, there is no need to recalculate the wall distance, so the number of searches for the mesh unit in the KD tree N = 0; if the mesh unit is a newly generated mesh unit after the mesh is encrypted, the wall distance needs to be recalculated, so the number of searches for the mesh unit in the KD tree N > 0 (the number in the parentheses represents the actual number of searches for the corresponding mesh unit in the KD tree).

[0062] like Figure 7As shown, this embodiment provides a load-balanced Cartesian grid wall distance calculation method under a parallel framework. Combining the characteristics of the newly generated Cartesian grid cells and the old Cartesian grid cells before and after grid encryption, it is predicted that the new cells and the old cells correspond to the same object plane triangle cell when calculating the wall distance. Therefore, the number of iterations of the new cells in the KD tree is the same as that of the old cells, and the number of iterations of the remaining cells that have not undergone grid encryption in the KD tree should be 0 (the numbers in the square brackets represent the predicted number of searches for the corresponding grid cells in the KD tree). Based on the number of iterations of each cell in the KD tree after prediction, its partition weight is set proportional to the number of iterations, and global grid encoding is performed in combination with the Z-type space filling curve. The grid is partitioned in parallel with the weight after optimization before calculating the wall distance. At this time, the number of grids in the four processes are 4, 5, 11, and 8 respectively, and load balance is not achieved at the level of the number of grids.

[0063] Combining the two different grid partitioning methods and the actual number of searches for Cartesian grid cells in the KD tree after grid encryption in this embodiment, as shown in FIG. Figure 8 As shown in the figure, when using the initial grid parallel partitioning without considering weights, process 1 has the largest total number of iterations of the four processes, at 24; process 2 has the smallest total number of iterations, at 4. The maximum difference in the number of iterations between processes reaches 20. Although load balance is achieved at the level of the number of grids, the computational load between processes is extremely unbalanced. When using the optimized grid parallel partitioning with weights, process 1 has the largest total number of iterations of the four processes, at 16; processes 2 and 4 have the smallest total number of iterations, at 12. The maximum difference in the number of iterations between processes reaches 4. Although load balance is not achieved at the level of the number of grids, the imbalance in the computational load between processes when calculating wall distance is alleviated. The time required to calculate wall distance in the large-scale parallel generation of adaptive Cartesian grids is significantly reduced, improving the efficiency of adaptive Cartesian grid generation and parallel scalability.

[0064] The ONERA-M6 wing model, the DLR-F6 wing-body assembly model, and the SU-27 fighter model are given below to illustrate the specific application of the method of this embodiment. Figure 9 、 Figure 10 and Figure 11 As shown in the figure, each model performs mesh encryption operations for different times, and the other parameters remain unchanged, using 64-core parallel processing.

[0065] Table 1 Comparison of wall distance calculation runtime using different grid partitioning methods

[0066]

[0067] In another embodiment, the present invention provides a computer-readable storage medium storing a computer program, which enables a computer to execute the load-balanced Cartesian grid wall distance calculation method under a parallel framework as described in the above embodiment.

[0068] In another embodiment, the present invention proposes an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the load-balanced Cartesian grid wall distance calculation method under the parallel framework as described in the above embodiment is implemented.

[0069] In the embodiments disclosed herein, computer storage media can be tangible media that can contain or store programs for use by or in conjunction with an instruction execution system, device, or apparatus. Computer storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specific examples of computer storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0070] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can 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.

[0071] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions based on the principles of the present invention are within the scope of protection of the present invention. It should be noted that for those skilled in the art, various improvements and modifications that do not depart from the principles of the present invention should be considered within the scope of protection of the present invention.

Claims

1. A load-balanced Cartesian grid wall distance calculation method under a parallel framework, characterized in that: include: S1: Abstracting an object surface geometry model file from a complex real-world shape. The object surface geometry model is formed by connecting multiple object surface triangle units through shared vertices. S2: Reading vertex information of all object plane triangle units in the object plane geometric model file, and constructing a spatial bounding box based on each object plane triangle unit; S3: Based on the object plane triangulation unit and the spatial bounding box, establish an object plane data index structure based on a KD tree; In step S3, the KD tree is a balanced binary tree, and the data structure in its node includes: the object plane triangle unit corresponding to the node, the midpoint coordinate data of the object plane triangle unit, the bounding box data of the object plane triangle unit, the space range represented by the node, the splitting plane that splits the space represented by the node into two left and right subspaces, the coordinate axis perpendicular to the splitting plane, the left branch KD tree composed of all data in the left subspace, the right branch KD tree composed of all data in the right subspace, and the parent node of the node; Step S3 specifically includes the following sub-steps: S31: Enter the KD tree root node, select the x-axis as the coordinate axis stored in the node, and select the bounding box of the object surface geometric model as the spatial range represented by the node; S32: For the spatial range represented by the node, obtain the midpoint coordinates of all object plane triangles in the space, retrieve the median of the midpoint coordinates on the coordinate axis stored in the node, and store the object plane triangle corresponding to the median and its related data in the node. The plane formed by all spatial points whose coordinates on the coordinate axis are equal to the median is the splitting plane stored in the node; S33: Within the spatial range represented by the node, according to the coordinate axis stored in the node, the KD tree consisting of all object plane triangle units corresponding to the midpoint coordinates less than the median is the left branch KD tree of the node, and its bounding box is the left subspace of the node; the KD tree consisting of all object plane triangle units corresponding to the midpoint coordinates greater than the median is the right branch KD tree of the node, and its bounding box is the right subspace of the node; S34: Enter the next layer of nodes, update the coordinate axes stored in the node in the order of x-axis, y-axis, and z-axis according to the number of layers of the node, and update the spatial range represented by the node according to the left and right subspaces divided by the parent node; S35: Repeat steps S32 to S34 until all object plane triangle elements are stored in the node; S4: placing the object surface geometric model in the flow field area required for calculation, and dividing the flow field area into Cartesian grids to obtain a series of isotropic cubic Cartesian grid units with grid surfaces parallel to the coordinate axes; S5: Determine the Cartesian grid cell for which the wall distance needs to be calculated, search the KD tree for the object plane triangle cell corresponding to the wall distance of the Cartesian grid cell, calculate the distance from the Cartesian grid cell to the object plane triangle cell and determine it as the wall distance, and record the number of searches for the Cartesian grid cell in the KD tree; Step S5 specifically includes the following sub-steps: S51: For the Cartesian grid cell for which the wall distance needs to be calculated, set its initial search times N in the KD tree to 0; S52: For the Cartesian grid cell for which the wall distance needs to be calculated, set its initial wall distance to L: if the grid cell is an initial Cartesian grid cell, L is the distance from the grid cell to the object plane triangle cell stored in the root node; if the grid cell is a newly generated fine grid cell after grid encryption, L is the wall distance of the coarse grid cell before grid encryption; S53, starting from the root node of the KD tree, obtaining the object plane triangle unit stored in the root node, and setting the number of searches for the Cartesian grid unit N=1; S54: Calculate the distance L from the Cartesian grid unit to the object plane triangle unit new , compare L with L new The size of L>L new , then update L = L new ; S55: Enter the subtree, obtain the object plane triangle unit stored in the child node, and set the number of searches for the Cartesian grid unit N=N+1; S56: Repeat steps S54 to S55 until the KD tree search is completed; S6: Perform intersection and inside-outside determination on all Cartesian grid cells, and encrypt the Cartesian grid cells that intersect with the object plane triangle cells, dividing them into finer grid cells. The newly generated fine grid cells inherit the search count of the coarse grid cells in the KD tree, and the search count of the remaining unencrypted grid cells in the KD tree is set to 0; S7: Before the next wall distance calculation, a weight is set based on the number of searches for each Cartesian grid cell in the KD tree, and the grid is partitioned in parallel with the weight, and the Cartesian grid cells and related data are weighted and averaged to different cores for calculation; S8: Repeat steps S5 to S7 until the set number of grid encryption times is reached; the obtained grid parameters of the Cartesian grid unit including the wall distance are used to numerically solve the object surface geometric model, and then obtain the outflow flow field of the complex real shape under the preset working conditions.

2. The method for calculating Cartesian grid wall distance with load balancing in a parallel framework according to claim 1, characterized in that: In step S7, the grid parallel partitioning is to distribute and store all Cartesian grid cells and related data in different cores when multiple cores participate in flow field calculation at the same time, and each core only performs calculation tasks for the Cartesian grid cells stored therein.

3. The method for calculating Cartesian grid wall distance with load balancing in a parallel framework according to claim 2, characterized in that: In step S7, the weight of the grid parallel partitioning is W=N+0.01, where N represents the number of searches of the Cartesian grid cells.

4. A computer-readable storage medium storing a computer program, characterized in that: The computer program enables a computer to execute the load-balanced Cartesian grid wall distance calculation method under a parallel framework as described in any one of claims 1 to 3.

5. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for calculating the wall distance of a Cartesian grid with load balancing under a parallel framework according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Method and device for calculating wall distance under Cartesian grid

    CN115357849A

  • Obstacle detecting apparatus and method, and storage medium which stores program for implementing the method

    US20010018640A1