Non-structured grid cfd shared memory parallel processing method and system
Patent Information
- Application Number
- CN202310777952.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-28
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-06-28
AI Technical Summary
与结构网格CFD相比,基于非结构网格的CFD软件工具通常需要显式存储网格的拓扑信息,数据结构较为复杂,计算过程中需要间接索引,导致访存效率很低,同时由于循环内部的数据竞争,难以实现共享存储结点内高效的细粒度(如线程并行和向量化并行等)并行计算
上述非结构网格CFD共享存储并行处理方法和系统,通过调用网格剖分工具按照仅剖分物理分割区的剖分策略,对待求解的航行器非结构网格逐层进行递归剖分并对剖分后生成的各个子网格分区内的网格实体进行重排序,并将每次递归剖分和重排序后的各个子网格分区存储在树数据结构MeshTree中,在该仅剖分物理分割区的剖分策略下,普通分区不再分解,仅对物理分割区不断进行递归分解,直到非结构网格的分区网格数小于特定阈值,然后根据设计的基于MeshTree遍历的并行算法,对构建的树数据结构MeshTree进行递归遍历的并行计算,从而高效实现非结构网格CFD的并行计算,高效输出航行器的特性预测结果。
Smart Images

Figure CN116663369B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of unstructured grid CFD and high-performance computing technology, and relates to a method and system for parallel processing of unstructured grid CFD with shared memory. Background Technology
[0002] To address energy constraints and meet high-performance demands, many-core processors or heterogeneous accelerators are increasingly being used to build top-tier high-performance computing (HPC) systems capable of petaflops. Currently, shared-memory compute nodes may contain CPUs partitioned into multiple non-uniform memory access (NUMA) domains, totaling hundreds of CPU cores or hardware threads. Simultaneously, certain resources in current hardware designs (such as memory or per-core communication bandwidth) have not scaled up or have even decreased accordingly. This unbalanced hardware trend will persist for the foreseeable future, posing a significant challenge to developing efficient and scalable HPC applications. Besides squeezing sufficient parallelism from programs to utilize massive numbers of cores, careful handling is needed to address potential performance bottlenecks caused by contention for constrained resources such as caches, memory, communication, or coherent links. According to Amdahl's Law, any bottleneck is amplified by the increasing computing power of multi-core processors; parallel algorithms, compilers, runtimes, and other tools are striving to overcome this unbalanced trend.
[0003] With the development of high-performance computing technology, numerical simulation software, represented by Computational Fluid Dynamics (CFD), has become a powerful computing tool in numerous application fields, including aircraft and vehicle aerodynamics, ship hydrodynamics, internal combustion engines, gas turbines, environmental engineering, and biomedical engineering. Unstructured meshes can adapt to complex shapes and offer significantly higher computational accuracy than structured meshes, making them the most widely used type of mesh in CFD engineering applications. Compared to structured mesh CFD, unstructured mesh-based CFD software tools typically require explicit storage of the mesh's topology information, resulting in more complex data structures. Indirect indexing during computation leads to low memory access efficiency. Furthermore, due to data contention within loops, efficient fine-grained parallel computation (such as threaded parallelism and vectorized parallelism) within shared memory nodes is difficult to achieve. For example, in unstructured mesh CFD software tools, the solver's calculation process involves flux calculation. When calculating the flux of a face, the data of the two cells that the face contacts are taken into account. The data of the storage cell is accessed indirectly by the cell number. When using the shared memory parallelization strategy directly, multiple faces may access the memory of the same cell, resulting in data conflicts. Therefore, traditional unstructured mesh CFD still has the technical problem of low computational efficiency. Summary of the Invention
[0004] To address the problems existing in the traditional methods mentioned above, this invention proposes a parallel processing method for unstructured grid CFD with shared memory and a parallel processing system for unstructured grid CFD with shared memory, which can improve the parallel computing efficiency of unstructured grid CFD and realize large-scale parallel processing of large-scale simulation systems for unstructured grids.
[0005] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions: On the one hand, a method for parallel processing of unstructured grid CFD shared memory is provided, including the following steps: The mesh generation tool is invoked to recursively generate the unstructured mesh of the vehicle to be solved layer by layer according to the mesh generation strategy of only generating physical partitions. The mesh entities in each sub-mesh partition generated after generation are then reordered. The mesh entities include unstructured mesh cells, mesh surfaces, and mesh nodes. Each subgrid partition after each recursive partitioning and reordering is stored in a MeshTree data structure until the number of partitioned grids of the unstructured grid is less than a certain threshold. Based on the designed parallel algorithm based on MeshTree traversal, the constructed tree data structure MeshTree is recursively traversed in parallel to obtain the vehicle characteristic prediction results.
[0006] On the other hand, an unstructured grid CFD shared memory parallel processing system is also provided, including: The meshing and sorting module is used to call the meshing tool to recursively mesh the unstructured mesh of the aircraft to be solved layer by layer according to the meshing strategy of only meshing the physical partitions, and to reorder the mesh entities in each sub-mesh partition after meshing; the mesh entities include unstructured mesh cells, mesh surfaces and mesh nodes. The tree building module is used to store each subgrid partition after each recursive partitioning and reordering in the tree data structure MeshTree until the number of partitioned grids of the unstructured grid is less than a certain threshold. The tree execution module is used to perform parallel computation by recursively traversing the constructed tree data structure MeshTree according to the designed parallel algorithm based on MeshTree traversal, so as to obtain the characteristic prediction results of the aircraft.
[0007] In another aspect, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described unstructured grid CFD shared memory parallel processing method.
[0008] Furthermore, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the above-described unstructured grid CFD shared memory parallel processing method.
[0009] One of the above technical solutions has the following advantages and beneficial effects: The aforementioned unstructured mesh CFD shared-memory parallel processing method and system recursively divides the unstructured mesh of the aircraft to be solved layer by layer according to the meshing strategy of only dividing the physical partitions. The mesh entities in each sub-mesh partition generated after the division are reordered, and each sub-mesh partition after each recursive division and reordering is stored in the tree data structure MeshTree. Under the meshing strategy of only dividing the physical partitions, ordinary partitions are no longer decomposed. Only the physical partitions are continuously recursively decomposed until the number of partitions of the unstructured mesh is less than a certain threshold. Then, according to the designed parallel algorithm based on MeshTree traversal, the constructed tree data structure MeshTree is recursively traversed and parallelly computed, thereby efficiently realizing the parallel computing of unstructured mesh CFD and efficiently outputting the characteristic prediction results of the aircraft.
[0010] Compared to current mesh generation methods, the above scheme, by setting physical partitions, eliminates data conflicts between partitions, simultaneously eliminating multiple cyclic data dependencies. This enables large-scale parallel acceleration of the code, significantly improving the parallel computing efficiency of unstructured mesh CFD, and thus achieving large-scale parallelism in large-scale simulation systems of unstructured meshes. Furthermore, in terms of versatility, the above scheme can be integrated and encapsulated into a general-purpose parallel code library, which is well-compatible with the development of software in various application fields such as aerodynamics, hydrodynamics, reactor thermal-hydraulics, engine internal flow simulation, structural mechanics, and electromagnetics. On the other hand, this high-level abstraction increases the readability and maintainability of the corresponding software code; developers can easily find the interfaces that need to be maintained and developed at each level without needing a deep understanding of the specific application domain's computational methods. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology 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.
[0012] Figure 1 A schematic diagram of data dependencies in traditional unstructured mesh CFD software; Figure 2 This is a flowchart illustrating a method for parallel processing of unstructured grid CFD shared memory in one embodiment; Figure 3This is a schematic diagram comparing the original mesh and the recursively subdivided and reordered mesh in one embodiment, where (a) is the original mesh and (b) is the mesh after subdivision and reordering. Figure 4 This is a flowchart illustrating the recursive partitioning and reordering process in one embodiment. Figure 5 A schematic diagram of a MeshTree tree data structure constructed in one embodiment; Figure 6 This is a block diagram of an unstructured grid CFD shared memory parallel processing system in one embodiment. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0014] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
[0015] It should be noted that, in this document, the reference to "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The presentation of this phrase in various locations throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments.
[0016] Those skilled in the art will understand that the embodiments described herein can be combined with other embodiments. The term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items, and all possible combinations thereof.
[0017] Due to the limitations of traditional technologies, it is necessary to design a parallel CFD solution framework tailored to the characteristics of unstructured meshes in order to achieve fine-grained parallel computation of unstructured mesh CFD, improve the solution efficiency of CFD software tools, and save system resources.
[0018] To resolve data conflicts, traditional shared memory parallelization strategies typically employ mesh coloring based on the OpenMP parallel for thread model. This involves coloring mesh faces to ensure no data contention between faces of the same color, thus achieving cycle-level parallelism. The OpenMP parallel for thread model is a parallel computing model used to generate a parallel domain and distribute computational tasks across multiple threads, thereby accelerating computation. OpenMP, or Open Multi-Processing, is a parallel computing programming model for writing multi-threaded and multi-core shared memory parallel programs. It provides a set of instructions and library functions, allowing developers to leverage the advantages of parallel computing in programming languages such as C, C++, and Fortran.
[0019] While these strategies achieved a degree of scalability on older symmetric multiprocessing (SMP) systems or multi-core processors, they are increasingly plagued by problems such as load imbalance, poor data locality, and frequent global synchronization on emerging many-core processors. Furthermore, while face coloring can eliminate data dependencies during throughput computation, it cannot avoid large-area data dependencies in time-progression cycles (e.g., the LU-SGS method). The LU-SGS method is an iterative approach that combines LU decomposition and successive Gauss-Seidel iteration to solve numerical solutions to systems of linear equations. LU stands for LU decomposition of a matrix, and SGS stands for Successive Gauss-Seidel Iteration.
[0020] Therefore, in response to the high-performance requirements of unstructured grid computing, this invention proposes a new unstructured grid CFD shared memory parallel processing scheme to replace the traditional loop-level sharing strategy, thereby improving the parallel computing efficiency of unstructured grids and realizing large-scale parallelism of large-scale simulation systems for unstructured grids.
[0021] To more clearly and concisely illustrate the embodiments of this application, the following are some definitions: MeshTree: In computer science, a mesh tree is a tree-like data structure commonly used to represent and process 3D or multi-dimensional mesh data. A mesh is a data structure composed of discrete nodes (vertices) and edges or faces connecting these nodes, used to represent complex geometries and physical domains. Mesh trees are widely used in scientific computing, computer graphics, and computer-aided design to simulate, visualize, analyze, and process various objects.
[0022] MeshTree provides a hierarchical organizational structure by recursively dividing a mesh into smaller submeshes and connecting them in a tree-like manner. Each node represents a submesh and can contain vertices, edges, faces, and associated attributes and data. The construction process of a MeshTree typically involves the following steps: Mesh generation: The original mesh is progressively divided into smaller sub-meshes according to a specific meshing strategy. The meshing method can be regular (such as bipartite meshing) or based on specific geometric features (such as adaptive meshing).
[0023] Node connection: The resulting sub-mesh is connected in a tree structure to form a MeshTree. Each node contains the geometric information, attribute data, and connection relationships with parent and child nodes of the corresponding sub-mesh.
[0024] The advantage of MeshTree lies in its ability to provide an efficient parallel execution method. By hierarchically dividing the mesh, MeshTree can eliminate data dependencies between unstructured meshes and achieve parallelism at different granularities among sibling nodes. This makes computation and updates in large-scale meshes more efficient and convenient.
[0025] MeshTrees have wide applications in many fields, such as collision detection, volumetric rendering, and ray tracing in computer graphics, and finite element analysis and computational fluid dynamics in scientific computing. Through proper mesh generation and organization, MeshTrees can accelerate the processing and analysis of complex geometric objects, improving computational efficiency and visualization performance.
[0026] METIS (MeTiS) is a commonly used mesh generation tool for dividing large finite element meshes or graphics into smaller parts for tasks such as parallel computation, optimization, and visualization. METIS provides a suite of algorithms and tools for solving graph and mesh generation problems. It employs various partitioning algorithms, including spectral partitioning, recursive partitioning, multilevel partitioning, and k-way partitioning. METIS's main functions include: Graph partitioning: METIS can divide a given graph into multiple parts, such that each part contains a similar number of nodes and minimizes the number of edges across the partition. Graph partitioning can be used in areas such as task scheduling, load balancing, and parallel computing.
[0027] Meshing: METIS can divide 3D or 2D meshes into multiple parts to achieve parallel computing. Meshing can be used in fields such as finite element analysis, computational fluid dynamics, and structural optimization.
[0028] Optimization: METIS provides several optimization algorithms to improve the quality of the partitioning results. These algorithms can reduce the boundary area of the partition or minimize the communication overhead within the partition by readjusting the positions of nodes or meshes.
[0029] METIS is an open-source project available on multiple platforms, including Windows, Linux, and macOS. It provides interfaces for C and Fortran, allowing developers to easily integrate and use its functionality. METIS has wide-ranging applications, including scientific computing, computer graphics, network analysis, and data mining. Through appropriate grid or graph partitioning, METIS can improve the efficiency of parallel computing, reduce communication overhead, and enhance algorithm quality and scalability.
[0030] Unstructured mesh CFD contains a large number of irregular computational kernels caused by the unstructured mesh data structure. The inventors first conducted an in-depth analysis and summary of the characteristics of the computational kernels in unstructured mesh CFD software, mainly involving... Figure 1 Data dependencies shown: 1. Faces-to-Cells Dependency: For example, during throughput computation, different faces may update the same neighboring cells. Figure 1 Faces f11 and f9 in the middle will update cell c5 at the same time, so the two cannot be executed in parallel.
[0031] 2. Face-to-Node Dependency: For example, during boundary surface gradient reconstruction, different faces may update the same mesh nodes. Figure 1 Faces f18 and f17 in the grid will update mesh node n8 simultaneously, so they cannot be executed in parallel.
[0032] 3. Cell-to-Node Dependency: For example, during internal cell gradient reconstruction, different cells may need to update the same mesh nodes, such as... Figure 1 In the grid, cells c2 and c1 will update grid node n1 simultaneously, so they cannot be executed in parallel.
[0033] 4. Cell-to-Cell Dependency: For example, in implicit LU-SGS calculations, the current grid cell needs to use the updated values of its neighboring grid cells. Figure 1The update value of calculation unit c8 requires the update value of unit c3, while calculation unit c9 requires the update value of unit c8. Therefore, the three units cannot be executed simultaneously.
[0034] The aforementioned dependencies pose significant challenges to the development of fine-grained parallelism, such as shared-memory parallelism and vectorized parallelism, in unstructured grid CFD. These dependencies prevent the automatic implementation of OpenMP-based shared-memory thread parallelism simply by adding OpenMP (a parallel programming model used to write multithreaded parallel code in shared-memory systems) compiler directives. To eliminate data dependencies and achieve fine-grained parallel processing such as threaded parallelism and vectorized parallelism, adjustments to the computational kernel code and data structures of unstructured grid CFD are typically required. Therefore, this invention proposes a parallel computing scheme based on recursive partitioning and reordering.
[0035] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0036] Please see Figure 2 In one embodiment, a parallel processing method for shared memory in unstructured grid CFD is provided, including the following processing steps S12 to S16: S12, the mesh generation tool is invoked to recursively generate the unstructured mesh of the vehicle to be solved layer by layer according to the generation strategy of only generating physical partitions, and the mesh entities in each sub-mesh partition generated after generation are reordered; the mesh entities include unstructured mesh cells, mesh surfaces and mesh nodes.
[0037] It is understandable that mesh generation tools can employ various existing mesh generation tools in this field, such as, but not limited to, METIS (a software package for graph partitioning and multilevel graph analysis). METIS is a widely used tool for dividing large-scale graphs or networks into smaller parts for more efficient computation in fields such as parallel computing, optimization, and data mining. METIS's main functions include: 1. Graph partitioning: METIS can divide a graph into smaller subgraphs, allowing these subgraphs to be processed in parallel on different computing nodes, thus achieving high-performance computing. 2. Multilevel graph analysis: METIS can decompose large-scale graphs into multiple hierarchical structures, forming a multilevel graph model. This hierarchical structure can be used for solving optimization problems and for compressed representation of graphs. 3. Weighted graph partitioning: METIS can handle weighted graphs, partitioning them according to weight information to achieve a more balanced load distribution in the partitioned subgraphs.
[0038] METIS is widely used in many fields, such as computer network analysis, parallel computing, data mining, circuit layout and optimization, and provides a wealth of algorithms and tools that make the segmentation and analysis of large-scale graphics and networks more efficient and feasible.
[0039] In addition to METIS, other meshing tools can be used as alternatives, such as the following common alternatives: 1. Zoltan, a parallel computing library that provides meshing functions in various distributed and parallel environments. It supports multiple meshing algorithms and strategies and is suitable for high-performance computing and large-scale parallel computing environments. 2. Scotch, an open-source graph segmentation and graph mapping tool. It can be used in graph segmentation, meshing, and task mapping, with good performance and scalability. 3. Gmsh, in addition to being a finite element mesh generator, Gmsh also provides some meshing functions. It supports adaptive meshing and various meshing algorithms, and can generate high-quality unstructured meshes. 4. Triangle, although mainly used for generating two-dimensional triangular meshes, it can also be used for simple two-dimensional meshing tasks. 5. TetGen, in addition to generating tetrahedral meshes, it also provides some meshing functions. It supports constrained meshing and adaptive meshing, which can adapt to different needs. These meshing tools all have different characteristics and applicable scopes. Those skilled in the art can choose the appropriate tool according to the specific needs of the actual application. In addition, some commercial software also provides powerful mesh generation capabilities, such as Ansys Meshing (a mesh generation tool for numerical simulations such as finite element analysis (FEA) and computational fluid dynamics (CFD)) and HyperMesh (a professional finite element preprocessing software). They may be more suitable for certain specific fields or applications, so you can choose according to the actual application needs.
[0040] The partitioning strategy of only decomposing physical partitions means that ordinary submesh partitions are no longer decomposed; only physical partitions (isolators) are recursively decomposed until the number of partitioned grids is less than a specific threshold set by the system. Reordering involves re-numbering the unstructured grid cells, grid faces, and grid nodes within each submesh partition according to their partition location, ensuring that these grid entities have consecutive numbers within their respective partitions. Reordering ensures that physically located grid entities have similar logical numbers, improving the locality of access to irregular data while maintaining the original serial computation properties of LU-SGS. Through this partitioning process, all submesh partitions except for the partitioned areas can be processed in parallel after each partitioning.
[0041] The unstructured mesh of the aircraft to be solved refers to the unstructured mesh generated on the established geometric model after the geometry of the aircraft to be predicted and analyzed has been modeled using existing computer-aided design (such as CAD) tools or other geometric modeling tools. The generation of the unstructured mesh of the aircraft uses specialized CFD software tools and corresponding mesh generation tools, and can employ, but is not limited to, the following commonly used methods: Delaunay triangulation, which generates a triangular mesh by connecting points on the geometric surface; the Advancing Front method, which generates a mesh by expanding the boundary inward from the geometric boundary; and methods based on the Poisson equation, which generate the unstructured mesh by solving the Poisson equation. Then, appropriate boundary conditions can be set according to the actual needs of simulating the aircraft's hydrodynamic characteristics, such as inflow boundary conditions, outflow boundary conditions, and wall boundary conditions. These boundary conditions will be used in the solver to simulate the aerodynamic or hydrodynamic characteristics of the aircraft.
[0042] The vehicle can be any type of aircraft in this field, such as various manned or unmanned aircraft, or any type of watercraft, such as various ships. It can also be an aircraft, pipeline shuttle, or other device requiring consideration of fluid dynamics characteristics in environmental engineering or biomedical engineering. Using unstructured meshes, the fluid domain in which the vehicle resides can be divided into a series of small cells or elements. Each cell has a set of associated properties and characteristics, such as position, velocity, pressure, and temperature. These properties vary continuously within each cell and are calculated and transferred through interpolation or approximation methods with adjacent cells. Unstructured meshes can accommodate the complex geometry of the vehicle, thus describing realistic fluid domains including curves, surfaces, and irregular shapes. This allows for more accurate simulation of actual flow phenomena. Each cell in the unstructured mesh contains values for fluid parameters (such as velocity, pressure, and temperature). The distribution of these parameters may be non-uniform across different cells of the mesh, reflecting physical variations and gradients in the flow field. By solving the unstructured mesh, information about fluid flow behavior can be obtained from the simulation results, such as velocity distribution, pressure distribution, turbulence characteristics, fluid behavior, and interactions.
[0043] For example, in aircraft aerodynamics, unstructured meshes can be used to simulate aircraft aerodynamic characteristics such as lift, drag, and aerodynamic torque. They can also be used to predict aerodynamic effects, such as the aerodynamic performance of airfoils and wings, the interaction between wing-body combinations, and flap and flap gap effects. The flexibility of unstructured meshes allows them to simulate complex geometries, such as fuel tanks, engine intakes, and aerodynamic accessories. Similarly, in vehicle aerodynamics, unstructured meshes can be applied to the aerodynamic studies of vehicles such as cars, trains, and trucks. They can be used to predict vehicle drag coefficients, lift, and aerodynamic flow field distributions. The adaptability of unstructured meshes allows for the simulation of complex vehicle geometries, such as body panels, windows, and rearview mirrors. In ship hydrodynamics, unstructured meshes are used to predict ship drag, flow field distribution, and wave interactions. The flexibility of unstructured meshes allows for the simulation of complex ship geometries, such as hulls, propellers, rudders, and rotors. Unstructured meshes allow for mesh refinement in key areas to better capture the details and variations of the flow. Meanwhile, unstructured grids can also handle complex flow phenomena, such as boundary layer separation, turbulent flow, and multiphase flow.
[0044] S14 stores each subgrid partition after each recursive partitioning and reordering in the MeshTree tree data structure until the number of partitioned grids of the unstructured grid is less than a certain threshold.
[0045] It can be understood that in each recursive decomposition process of the unstructured mesh at each layer, the information of each sub-mesh partition obtained from each recursive decomposition is stored in a MeshTree data structure, and the recursive decomposition process continues layer by layer until the number of partitioned meshes for that unstructured mesh is less than a specific threshold. This specific threshold can be set according to the decomposition target requirements for the current unstructured mesh. After the decomposition is completed, a complete MeshTree data structure can be finally constructed. Each leaf node of this tree corresponds to a part of the original mesh, containing a continuous interval of mesh cells, mesh faces, and mesh nodes.
[0046] S16. Based on the designed parallel algorithm for MeshTree traversal, the constructed tree data structure MeshTree is recursively traversed in parallel to obtain the vehicle characteristic prediction results.
[0047] It can be understood that parallel algorithms based on MeshTree traversal refer to parallel computing methods for tree data structures (MeshTrees) constructed according to a partitioning strategy that only partitions physical regions, specifically for the architecture platform to which the unstructured mesh belongs, in order to achieve parallelism with shared memory. Parallel algorithms based on MeshTree traversal can be implemented using programming models that do not support recursion in this field. The predicted characteristics of aircraft include, but are not limited to, predictions of aircraft aerodynamic effects, such as aerodynamic performance parameters of airfoils and wings, interaction parameters of wing-body combinations, flap and flap gap effect parameters, or predicted data such as vehicle drag coefficients, lift, and aerodynamic flow field distribution, or predicted data such as ship drag, flow field distribution, and wave interaction.
[0048] Specifically, in the practical application of unstructured mesh CFD, after the unstructured mesh is read in during preprocessing, mesh partitioning, reordering, and MeshTree construction can be achieved through steps S12 and S14 mentioned above. During the solution iteration process, step S16 is executed for the specific computational kernel functions to automatically achieve shared memory parallelism. MeshTree controls the size of the mesh partitions through parameters. Users can set an appropriate partition size according to the processor cache size to improve memory access locality and control task concurrency. In addition, MeshTree supports different coarse-grained code encapsulations to achieve computational kernel fusion. Computational kernel fusion can increase computational density and reduce task scheduling overhead, and it is also beneficial to improve the temporal locality of data access in computational kernel memory.
[0049] like Figure 3 As shown, a comparison is made between the mesh after subdivision and reordering according to the method described above and the original mesh. Figure 3 (a) is the original mesh. Figure 3 (b) The mesh after subdivision and reordering according to the method described above in this application. It can be seen that, similar to MPI parallel subdivision, unstructured mesh subdivision can be performed using mesh subdivision tools such as METIS. However, unlike MPI, this subdivision is only performed logically (mesh cells are still uniformly numbered within the original region), without needing a ghost influence zone or outputting the subdivision results to a file. Through subdivision, physical isolators are constructed between the various submesh partitions of the unstructured mesh, ensuring that there are no common mesh cells, faces, or nodes between the partitions, thus eliminating data dependencies between submesh partitions.
[0050] The aforementioned unstructured mesh CFD shared-memory parallel processing method calls a mesh generation tool to recursively divide the unstructured mesh of the aircraft to be solved layer by layer according to a mesh generation strategy that only divides the physical partitions. The mesh entities within each sub-mesh partition generated after the division are reordered, and each sub-mesh partition after each recursive division and reordering is stored in a tree data structure MeshTree. Under this mesh generation strategy that only divides the physical partitions, ordinary partitions are no longer decomposed; only the physical partitions are continuously recursively decomposed until the number of partitioned meshes in the unstructured mesh is less than a certain threshold. Then, according to the designed parallel algorithm based on MeshTree traversal, the constructed tree data structure MeshTree is recursively traversed and parallelly computed, thereby efficiently realizing the parallel computation of unstructured mesh CFD and efficiently outputting the characteristic prediction results of the aircraft.
[0051] Compared to current mesh generation methods, the above scheme, by setting physical partitions, eliminates data conflicts between partitions, simultaneously eliminating multiple cyclic data dependencies. This enables large-scale parallel acceleration of the code, significantly improving the parallel computing efficiency of unstructured mesh CFD, and thus achieving large-scale parallelism in large-scale simulation systems of unstructured meshes. Furthermore, in terms of versatility, the above scheme can be integrated and encapsulated into a general-purpose parallel code library, which is well-compatible with the development of software in various application fields such as aerodynamics, hydrodynamics, reactor thermal-hydraulics, engine internal flow simulation, structural mechanics, and electromagnetics. On the other hand, this high-level abstraction increases the readability and maintainability of the corresponding software code; developers can easily find the interfaces that need to be maintained and developed at each level without needing a deep understanding of the specific application domain's computational methods.
[0052] The design of the aforementioned parallel computing method also separates user code from software code. User code interacts with software code through an interface, and can use parallel code blocks simply by calling the corresponding interface functions, thus parallelizing serial code. This software architecture ensures that modifications and extensions to specific algorithms or implementation code within the software do not affect other modules, thereby achieving a greater degree of scalability.
[0053] Furthermore, it supports multiple levels of scalability. Because of the separation between interfaces and implementations, new implementation code can be continuously added to the parallel codebase. For example, methods for mesh partitioning, reordering, and data dependency elimination can all be expanded to use new methods, and this code expansion does not affect the functionality or code of other modules at all.
[0054] In one embodiment, such as Figure 4 As shown, step S12 above can specifically include the following processing steps S121 to S129: S121, For each layer of the unstructured mesh of the vehicle to be solved, the meshing tool is called in the current decomposition to decompose the unstructured mesh into multiple sub-mesh partitions; the multiple sub-mesh partitions include physical isolators, that is, the submesh partitions are no longer decomposed, only the physical isolators are recursively decomposed. S123, For each sub-grid partition, traverse all grid cells within the sub-grid partition and check whether the grid cells have data dependencies on grid cells in other sub-grid partitions; S125 divides the data-dependent mesh cells and their corresponding mesh surfaces and mesh nodes into the physical partitioning region; S127, divides the non-dependent mesh elements and their corresponding mesh surfaces and mesh nodes into the corresponding ordinary sub-mesh partitions; S129 reorders the mesh entities within each subgrid partition according to their partition, making the mesh entity numbers within the partition consecutive; the physical partition participates in the next recursive decomposition.
[0055] Following a partitioning strategy that only decomposes physical partitions, the isolator of the physical partitions is recursively decomposed until the number of partitioned grids is less than a certain threshold. Ultimately, this can be constructed as follows: Figure 5 The MeshTree shown has each leaf node corresponding to a portion of the original mesh, containing a continuous interval of mesh cells, mesh faces, and mesh nodes. Here, root represents the root node, firstCell represents the first mesh cell, lastCell represents the last mesh cell, firstFace represents the first mesh face, lastFace represents the last mesh face, firstNode represents the first mesh node, and lastNode represents the last mesh node.
[0056] Furthermore, the designed parallel algorithm based on MeshTree traversal uses a programming model that does not support recursion, such as OpenMP parallel for or CUDA, to traverse the tree nodes of the MeshTree data structure and schedule the execution of each leaf node.
[0057] The OpenMP parallel for programming model is a parallel computing model based on the for loop. It divides the for loop into multiple segments and distributes the computation across multiple threads, thus speeding up the execution. The system can allocate the number of threads by default, or the `num_threads` clause can be used to specify the number of threads. The computation task is divided into multiple subtasks, and the results are aggregated at the end. It is suitable for solving parallel computing problems that require recursively dividing the problem, executing subtasks in parallel, and then combining the results. In the fork-join programming model, a main task is executed at the beginning of the program, which is responsible for dividing the problem into smaller subtasks.
[0058] CUDA (Compute Unified Device Architecture) is a programming model and platform provided by NVIDIA for parallel computing. It allows developers to leverage the powerful parallel computing capabilities of NVIDIA GPUs to accelerate computationally intensive tasks. Developers can use the CUDA programming model to utilize the GPU's parallel computing capabilities. By dividing computational tasks into multiple parallel threads and optimizing memory access patterns, high-performance parallel computing can be achieved. In CUDA programming, CUDA libraries can also be used to accelerate common mathematical, graphics, and signal processing tasks. The aforementioned traversal strategy allows these methods to run on the GPU as well.
[0059] In one embodiment, further, during the recursive traversal of the tree nodes of the MeshTree tree data structure, the traversal order used includes the forward traversal order.
[0060] It is understandable that the above parallel algorithm can choose different traversal orders depending on the actual data dependencies of the computational kernel. In this embodiment, a forward traversal order is adopted, that is, during the traversal process, each ordinary submesh partition is traversed in parallel first, and after all ordinary submesh partitions are executed, the physical partition isolator is traversed. In this way, it can be effectively applied to most computational kernels with data dependencies, such as CFD throughput computation.
[0061] In one embodiment, further, during the recursive traversal of the tree nodes of the MeshTree tree data structure, the traversal order used includes backward traversal order.
[0062] It is understood that in this embodiment, a backward traversal order is adopted, that is, the physical partition isolator is traversed first during the traversal process, and after the physical partition isolator is completed, each ordinary submesh partition is traversed in parallel. This is suitable for some data-dependent computational kernels that require backward traversal, such as LU-SGS computation in CFD.
[0063] In one embodiment, further, during the recursive traversal of the tree nodes of the MeshTree tree data structure, the traversal order used includes the noDependence order.
[0064] It is understood that in this embodiment, a no-dependence order is adopted, meaning that all sub-partitions (including all ordinary submesh partitions and physical partition isolators) can be executed in parallel simultaneously. This is suitable for computational kernels without data dependencies. The above three different traversal methods correspond to different task parallelism methods and data dependency situations, ensuring the operational efficiency and accuracy of the system software.
[0065] Furthermore, during the recursive traversal of the tree nodes in the MeshTree data structure, the input parameter is the function pointer of the actual computation kernel. It can be understood that during the execution of parallel computing, users can call the execution function of the MeshTree data structure as needed, and input the function pointer of the actual computation kernel as the parameter into the corresponding module. This module can then achieve shared memory parallelism. For example, taking the shared memory parallelism of the sticky flux computation process (InviscidFlux) as an example, the internal code of InviscidFlux remains unchanged; simply calling the MeshTree interface is sufficient to achieve kernel fusion within InviscidFlux and automatically implement shared memory parallelism.
[0066] It should be understood that, although Figure 2 and Figure 4 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order requirement for the execution of these steps; they can be executed in other orders. Figure 2 and Figure 4At least some of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0067] Please see Figure 6 In one embodiment, an unstructured mesh CFD shared-memory parallel processing system 100 is provided, including a partitioning and sorting module 11, a tree construction module 13, and a tree execution module 15. The partitioning and sorting module 11 is used to invoke a mesh partitioning tool to recursively partition the unstructured mesh of the aircraft to be solved layer by layer according to a partitioning strategy that only partitions physical segments, and to reorder the mesh entities within each sub-mesh partition generated after partitioning; mesh entities include unstructured mesh cells, mesh surfaces, and mesh nodes. The tree construction module 13 is used to store each sub-mesh partition after each recursive partitioning and reordering in a tree data structure MeshTree until the number of partitioned meshes of the unstructured mesh is less than a specific threshold. The tree execution module 15 is used to perform parallel computation by recursively traversing the constructed tree data structure MeshTree according to a designed parallel algorithm based on MeshTree traversal, to obtain the characteristic prediction results of the aircraft.
[0068] The aforementioned unstructured mesh CFD shared-memory parallel processing system 100, by calling a meshing tool and following a meshing strategy that only meshes the physical partitions, recursively meshes the unstructured mesh of the aircraft to be solved layer by layer. It then reorders the mesh entities within each sub-mesh partition after meshing and stores each recursively meshed and reordered sub-mesh partition in a tree data structure, MeshTree. Under this meshing strategy that only meshes the physical partitions, ordinary partitions are no longer decomposed; only the physical partitions are recursively decomposed until the number of partitioned meshes in the unstructured mesh is less than a specific threshold. Then, according to the designed parallel algorithm based on MeshTree traversal, the constructed tree data structure, MeshTree, is recursively traversed and parallelly computed, thereby efficiently realizing parallel computation of unstructured mesh CFD and efficiently outputting the aircraft's characteristic prediction results.
[0069] Compared to current mesh generation methods, the above scheme, by setting physical partitions, eliminates data conflicts between partitions, simultaneously eliminating multiple cyclic data dependencies. This enables large-scale parallel acceleration of the code, significantly improving the parallel computing efficiency of unstructured mesh CFD, and thus achieving large-scale parallelism in large-scale simulation systems of unstructured meshes. Furthermore, in terms of versatility, the above scheme can be integrated and encapsulated into a general-purpose parallel code library, which is well-compatible with the development of software in various application fields such as aerodynamics, hydrodynamics, reactor thermal-hydraulics, engine internal flow simulation, structural mechanics, and electromagnetics. On the other hand, this high-level abstraction increases the readability and maintainability of the corresponding software code; developers can easily find the interfaces that need to be maintained and developed at each level without needing a deep understanding of the specific application domain's computational methods.
[0070] In one embodiment, the above-mentioned subdivision and sorting module 11 can also be used to: for each layer of the unstructured mesh of the aircraft to be solved, in the current decomposition, call the mesh subdivision tool to decompose the unstructured mesh into multiple sub-mesh partitions; the multiple sub-mesh partitions include physical partitions; for each sub-mesh partition, traverse all mesh cells in the sub-mesh partition and check whether the mesh cells have data dependencies with mesh cells in other sub-mesh partitions; assign mesh cells with data dependencies and their corresponding mesh surfaces and mesh nodes to the physical partitions; assign mesh cells without dependencies and their corresponding mesh surfaces and mesh nodes to the corresponding ordinary sub-mesh partitions; reorder the mesh entities in each sub-mesh partition according to their partitions so that the mesh entity numbers in the partitions are consecutive; the physical partitions participate in the next recursive decomposition.
[0071] In one embodiment, the designed parallel algorithm based on MeshTree traversal uses OpenMP parallelfor or CUDA programming model to traverse the tree nodes of the MeshTree data structure and schedules the execution of each leaf node.
[0072] In one embodiment, during the recursive traversal of the tree nodes of the MeshTree tree data structure, the traversal order used includes the forward traversal order.
[0073] In one embodiment, during the recursive traversal of the tree nodes of the MeshTree tree data structure, the traversal order used includes backward traversal order.
[0074] In one embodiment, during the recursive traversal of the tree nodes of the MeshTree tree data structure, the traversal order used includes the noDependence order.
[0075] In one embodiment, during the recursive traversal of the tree nodes of the MeshTree tree data structure, the input parameter is a function pointer to the actual computation kernel.
[0076] For specific limitations regarding the unstructured grid CFD shared memory parallel processing system 100, please refer to the corresponding limitations of the unstructured grid CFD shared memory parallel processing method above, which will not be repeated here. Each module in the aforementioned unstructured grid CFD shared memory parallel processing system 100 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of a device with data processing capabilities, or stored in software within the memory of the aforementioned device, so that the processor can call and execute the operations corresponding to each module. The aforementioned device can be, but is not limited to, various types of data computing and processing devices already existing in the art.
[0077] In one embodiment, a computer device is also provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following processing steps: calling a mesh generation tool to recursively mesh the unstructured mesh of the vehicle to be solved layer by layer according to a meshing strategy that only meshes the physical partitions, and reordering the mesh entities within each sub-mesh partition generated after meshing; the mesh entities include unstructured mesh cells, mesh surfaces, and mesh nodes; storing each sub-mesh partition after each recursive meshing and reordering in a tree data structure MeshTree until the number of partitions of the unstructured mesh is less than a specific threshold; and performing parallel computation of recursive traversal on the constructed tree data structure MeshTree according to a designed parallel algorithm based on MeshTree traversal to obtain the characteristic prediction results of the vehicle.
[0078] It is understood that, in addition to the memory and processor mentioned above, the computer equipment described above also includes other hardware and software components not listed in this specification. The specific components can be determined according to the model of the computer equipment in different application scenarios, and will not be listed and described in detail in this specification.
[0079] In one embodiment, when the processor executes the computer program, it can also implement the steps or sub-steps added in the various embodiments of the above-described unstructured grid CFD shared memory parallel processing method.
[0080] In one embodiment, a computer-readable storage medium is also provided, on which a computer program is stored. When executed by a processor, the computer program performs the following processing steps: calling a meshing tool to recursively mesh the unstructured mesh of the vehicle to be solved layer by layer according to a meshing strategy that only meshes the physical partitions, and reordering the mesh entities within each sub-mesh partition generated after meshing; the mesh entities include unstructured mesh cells, mesh surfaces, and mesh nodes; storing each sub-mesh partition after each recursive meshing and reordering in a tree data structure MeshTree until the number of partitions of the unstructured mesh is less than a specific threshold; and performing parallel computation of recursive traversal on the constructed tree data structure MeshTree according to a designed parallel algorithm based on MeshTree traversal to obtain the characteristic prediction results of the vehicle.
[0081] In one embodiment, when the computer program is executed by the processor, it can also implement the steps or sub-steps added in the various embodiments of the above-described unstructured grid CFD shared memory parallel processing method.
[0082] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus DRAM (RDRAM), and interface DRAM (DRDRAM), etc.
[0083] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0084] The above embodiments merely illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, all of which fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for parallel processing of unstructured grid CFD with shared memory, characterized in that, Including the following steps: The meshing tool is invoked to recursively mesh the unstructured mesh of the aircraft to be solved, layer by layer, according to the meshing strategy of only meshing the physical partitions. The mesh entities within each sub-mesh partition generated after meshing are then reordered. The mesh entities include unstructured mesh cells, mesh surfaces, and mesh nodes. For each layer of the unstructured mesh of the aircraft to be solved, the meshing tool is invoked in the current decomposition to decompose the unstructured mesh into multiple sub-mesh partitions, each of which includes a physical partition. For each sub-mesh partition, all mesh cells within the sub-mesh partition are traversed, and it is checked whether the mesh cells have data dependencies with mesh cells in other sub-mesh partitions. Mesh cells with data dependencies, along with their corresponding mesh surfaces and mesh nodes, are assigned to the physical partition. Mesh cells without data dependencies, along with their corresponding mesh surfaces and mesh nodes, are assigned to the corresponding ordinary sub-mesh partition. The meshing strategy of only meshing the physical partitions means that ordinary sub-mesh partitions are no longer decomposed, and only the physical partitions are recursively decomposed until the number of partition meshes is less than a specific threshold set by the system. Each subgrid partition after each recursive partitioning and reordering is stored in a MeshTree data structure until the number of partitioned grids of the unstructured grid is less than a certain threshold. The specific threshold is set based on the decomposition target requirements for the current unstructured mesh; Based on the designed parallel algorithm for MeshTree traversal, the constructed tree data structure MeshTree is recursively traversed in parallel to obtain the vehicle characteristic prediction results.
2. The unstructured mesh CFD shared memory parallel processing method according to claim 1, characterized in that, The steps include: using a mesh generation tool to recursively mesh the unstructured mesh of the aircraft to be solved layer by layer according to a meshing strategy that only meshes physically partitioned regions; and reordering the mesh entities within each sub-mesh partition after meshing. The grid entities within each sub-grid partition are reordered according to their respective partitions, so that the grid entity numbers within each partition are consecutive; the physical partitions participate in the next recursive decomposition.
3. The unstructured mesh CFD shared memory parallel processing method according to claim 2, characterized in that, The designed parallel algorithm based on MeshTree traversal uses OpenMP parallel for or CUDA programming model to traverse the tree nodes of the MeshTree data structure and schedules the execution of each leaf node.
4. The unstructured mesh CFD shared memory parallel processing method according to claim 3, characterized in that, During the recursive traversal of the tree nodes of the MeshTree tree data structure, the traversal order used includes the forward traversal order.
5. The unstructured mesh CFD shared memory parallel processing method according to claim 3, characterized in that, During the recursive traversal of the tree nodes of the MeshTree data structure, the traversal order used includes backward traversal order.
6. The unstructured mesh CFD shared memory parallel processing method according to claim 3, characterized in that, During the recursive traversal of the tree nodes of the MeshTree data structure, the traversal order used includes the noDependence order.
7. The unstructured mesh CFD shared memory parallel processing method according to any one of claims 4 to 6, characterized in that, During the recursive traversal of the tree nodes of the MeshTree tree data structure, the input parameter is the function pointer of the actual computation kernel.
8. A parallel processing system for unstructured grid CFD with shared memory, characterized in that, include: The meshing and sorting module is used to invoke the meshing tool to recursively mesh the unstructured mesh of the aircraft to be solved layer by layer according to the meshing strategy of only meshing the physical partitions, and to reorder the mesh entities within each sub-mesh partition after meshing. The mesh entities include unstructured mesh cells, mesh surfaces, and mesh nodes. For each layer of the unstructured mesh of the aircraft to be solved, the meshing tool is invoked in the current decomposition to decompose the unstructured mesh into multiple sub-mesh partitions, which include physical partitions. For each sub-mesh partition, all mesh cells within the sub-mesh partition are traversed and it is checked whether the mesh cells have data dependencies with mesh cells in other sub-mesh partitions. Mesh cells with data dependencies, along with their corresponding mesh surfaces and mesh nodes, are assigned to the physical partitions. Mesh cells without data dependencies, along with their corresponding mesh surfaces and mesh nodes, are assigned to the corresponding ordinary sub-mesh partitions. The meshing strategy of only meshing the physical partitions means that ordinary sub-mesh partitions are no longer decomposed, and only the physical partitions are recursively decomposed until the number of partition meshes is less than a specific threshold set by the system. The tree building module is used to store each sub-grid partition after each recursive partitioning and reordering in the tree data structure MeshTree until the number of partitioned grids of the unstructured grid is less than a certain threshold. The specific threshold is set based on the decomposition target requirements for the current unstructured mesh; The tree execution module is used to perform parallel computation by recursively traversing the constructed tree data structure MeshTree according to the designed parallel algorithm based on MeshTree traversal, so as to obtain the characteristic prediction results of the aircraft.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the unstructured grid CFD shared memory parallel processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the unstructured grid CFD shared memory parallel processing method according to any one of claims 1 to 7.