Dynamic parallel balancing method, device and storage medium for solving large-scale wall distance
By performing parallel tiling and weight coefficient management of the calculation grid in CFD, and dynamically adjusting the spatial unit allocation, the problem of uneven kernel search time in parallel calculation is solved, and the efficiency of wall distance solving is significantly improved.
Patent Information
- Application Number
- CN202411246209.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-09-06
AI Technical Summary
In large-scale parallel calculation, the parallel efficiency is low due to the uneven search time of different cores during the wall distance solution. Especially in the dynamic numerical simulation, the efficiency differences caused by repeated searches are more prominent, and it is necessary to develop efficient and high uniformity Parallel method.
By dicing the original large-scale computing grid in parallel, recording the search time of each spatial unit, performing weight averages, creating weight coefficients, and dynamically adjusting the spatial unit allocation according to the weight coefficients during dynamic iteration to ensure the search time of each core Basically equal, the balance weight difference value is sent through the information until the iteration is completed.
It effectively improves parallel efficiency, ensures that the time for each core to complete wall distance solution is basically equal, solves the problem of uneven kernel search time in traditional methods, and significantly improves the wall distance solution efficiency in CFD dynamic process.
Smart Images

Figure CN118761357B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of fluid simulation technology, and in particular to a large-scale wall distance solution dynamic parallel balancing method, device and storage medium. Background Art
[0002] At present, the application of computational fluid dynamics (CFD) numerical simulation in aerospace is increasing, and its role is gradually increasing. Since CFD has the characteristics of short cycle and low cost, the industrial sector has an increasingly prominent demand for the development of CFD simulation technology. Since most aircraft are in turbulent flow fields, the numerical simulation of turbulent problems has also become a research focus of CFD. With the rapid development of turbulence models and good engineering applications, the accuracy of turbulent flow simulation for complex problems has been significantly improved, and the application scope of CFD turbulence simulation has also been greatly expanded.
[0003] Before numerical simulation of turbulence, a pre-processing is required: solving the distance from the center point of all spatial grid units to the nearest surface unit, hereinafter referred to as wall distance solution. This problem requires finding the nearest surface to a certain spatial point from a set of surface units and obtaining the distance between the spatial point and the surface. Figure 1 A schematic diagram of the wall distance solution problem is given. The main time-consuming operation is to find the closest one to the spatial point P from a large number of surface elements of a certain shape. A variety of relatively mature algorithms have been developed for this problem in the serial era.
[0004] With the rapid improvement of computer capabilities, the scale of CFD calculations has developed from tens of thousands of grid cells in the early days to tens of millions of grid cells in the mainstream in recent years, and the calculation mode has also completely changed from serial calculation to parallel calculation. However, the current parallel algorithm research is mainly focused on parallel calculation of flow fields. There are not many mature methods for pre-processing methods such as wall distance solution, and most of them are not well adapted to large-scale parallel calculation. When the number of computing cores exceeds a thousand cores, due to the non-uniformity of the parallel search calculation amount of different cores, the search process of individual computing cores will be very slow, and the solution time of different cores may differ by more than several times. Since the parallel calculation time depends on the time consumption of the slowest computing core, this non-uniformity will seriously affect the global parallel efficiency. Especially when performing dynamic numerical simulation, since the wall distance must be solved at every time step during the motion process, and it often takes hundreds of time steps to complete the simulation of a dynamic process, in repeated and large-scale searches, this problem of uneven parallel solution speed and large differences in efficiency of each core will become more prominent. It is necessary to develop an efficient and highly uniform parallel method to curb the pathological time distribution of different computing cores. Summary of the invention
[0005] In view of this, the present invention provides a large-scale wall distance solution dynamic parallel balancing method, device and storage medium to solve the above problems.
[0006] In order to solve the above technical problems, the present invention provides a large-scale wall distance solution dynamic parallel balancing method, comprising:
[0007] S1: Parallel slicing of the original large-scale computing grid is performed, and all its grid space units are evenly distributed to all computing cores;
[0008] S2: Perform constant static calculation on the original large-scale computational grid, divide the original grid after parallel slicing, complete the nearest wall unit search for each spatial unit and record its consumption time; after completing the global search, use the total search time of all spatial units for weighted average, and create an array to save the weight coefficient of each unit;
[0009] S3: Automatically update the displaced object surface and slice it according to the original parallel slicing scheme, and perform unsteady dynamic iteration on the original large-scale computational grid; during the dynamic iteration, when re-searching the wall distance, the spatial grid units allocated to each core are no longer allocated according to the original grid division, but are allocated according to the unit weights after weighting in the previous step, and ensure that the difference in the sum of the spatial unit weight coefficients obtained on each computational core is less than the preset value;
[0010] S4: Repeat the information sending to all computing cores, and continuously send the excess unit information on the computing cores with an average weight greater than the preset value to the computing cores with an average weight less than the preset value; after the sending is completed, the nearest unit search is carried out for the spatial unit of the core, and the nearest wall distance is solved;
[0011] S5: In subsequent iteration steps, the above S4 and S5 are repeated; wherein any calculation core always uses the weight coefficient obtained in the previous step as the allocation basis until the iteration is completed.
[0012] As an optional method, the weight coefficient is determined based on the average search time of all spatial units.
[0013] As an optional manner, in the above S4, continuously sending the excess unit information on the computing cores whose average weight is greater than the preset value to the computing cores whose average weight is less than the preset value includes:
[0014] If the spatial grid block on any computing core is close to the wall and its search time is short, its time average weight is smaller than that of another computing core that is relatively not close to the wall; then, the computing core that is relatively not close to the wall sends part of the spatial units to the computing core that is relatively close to the wall until the remaining unit average weight of the computing core that is relatively not close to the wall is equal to the weight of the computing core that is relatively close to the wall or the difference is smaller than the preset value.
[0015] As an optional method, in the above S4, the information sent is the xyz coordinates of the center point of each spatial unit; after the sending is completed, the nearest unit search is carried out for the core spatial unit, and the nearest wall distance is solved.
[0016] An electronic device is also provided, comprising: a memory for storing a computer program; and a processor for implementing the steps of the above-mentioned large-scale wall distance solution dynamic parallel balancing method when executing the computer program.
[0017] A computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned large-scale wall distance solution dynamic parallel balancing method are implemented.
[0018] The beneficial effects of the present invention are:
[0019] The traditional method is to determine the number of spatial grid units on each core according to the initial allocation result during parallel slicing during the wall distance solution process. Since the search time of spatial units at different positions is not the same, the search time of each core is seriously uneven, affecting the parallel efficiency. The present invention uniformly allocates spatial units through global management, and introduces the search time of each unit in the previous iteration step in the dynamic process for weighting, so as to ensure that the time for each core to complete the wall distance solution is basically equal, thereby greatly improving the parallel efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A schematic diagram of wall distance solution provided by an embodiment of the present invention;
[0021] Figure 2 A schematic diagram of a parallel processing flow provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods.
[0023] See also Figure 1At present, in the parallel calculation of CFD dynamic processes, it is necessary to perform multi-time step calculations on the moving surface. In order to ensure the calculation accuracy of the turbulence model, the wall distance of the turbulence model needs to be re-solved at each time step as the surface moves, that is, the distance from the center point of all spatial units on the current calculation core to the nearest wall unit on the entire surface is solved. In the process of solving the wall distance after parallel slicing, although the number of spatial units to be solved allocated to each calculation core is basically the same, the speed of searching the nearest wall by spatial units at different positions on each calculation core is very different. The spatial units close to the wall can quickly eliminate the wall units that are obviously not the nearest, thereby greatly reducing the number of wall units to be searched, while the spatial units far away cannot quickly eliminate the non-nearest units, and are even forced to traverse almost all wall units during the solution process to search for the nearest wall, which will lead to obvious differences in the search time of each core and seriously reduce the parallel efficiency.
[0024] To solve this problem, this embodiment proposes the following technical solution:
[0025] First, the original large-scale CFD calculation grid is uniformly sliced by the parallel slicing program to ensure that the number of spatial units on different computing cores is basically the same; then, the slicing scheme is used to complete the steady-state static calculation before the dynamic calculation, and the static calculation flow field is used as the initial flow field for the dynamic calculation to carry out multi-time step iteration of the moving surface. The steady-state calculation also needs to solve the wall distance. In the steady-state calculation, that is, the first wall distance solution, each computing core is divided according to the original grid after parallel slicing. The traditional method, including BOX filtering or ADT binary tree algorithm, is used to search each spatial unit and record its consumption time. After completing the global search, the total search time of all spatial units is used for weighted average. In the subsequent dynamic process calculation, the nearest wall search must be performed before each step of the calculation. However, at this time, each computing core no longer searches the spatial unit according to the original grid division of the parallel slicing, but redistributes the spatial units of each computing core according to the weighted unit weight. The weight coefficient of each spatial unit is constantly changing dynamically with the change of the object surface position and the advancement of the flow field calculation, and the search time of each core is always kept as similar as possible.
[0026] The specific process of implementing this technical solution is as follows:
[0027] S1: Parallel slicing of the original large-scale computing grid is performed, and all its grid space units are evenly distributed to all computing cores;
[0028] S2: Perform steady-state calculation on the original grid. In the process of solving the wall distance before the flow field calculation, according to the original grid division after parallel slicing, complete the nearest wall unit search for each space unit and record its consumption time;
[0029] After completing the global search, the total search time of all spatial units is used for weighted averaging, and an array is created to store the weight coefficients of each unit. If the search time of a spatial unit is twice the average search time of all global units, its weight coefficient is 2; if the search time of a spatial unit is 1 / 2 of the global average time, its weight coefficient is 0.5.
[0030] S3: When starting the dynamic calculation, the calculation grid is automatically updated for the object surface after displacement, and the blocks are cut according to the original parallel block cutting scheme. This ensures that the number of spatial grid units in each block at different positions is completely consistent with that in static calculation, and the spatial positions of each grid unit are relatively close before and after displacement.
[0031] Then, the unsteady iterative time step solution is carried out. When re-searching the wall distance, the spatial grid units allocated to each core are no longer allocated according to the original grid division, but according to the unit weight after weighting in the previous step, and the sum of the spatial unit weight coefficients obtained on each computing core is guaranteed to be as equal as possible. For example, if the spatial grid block on a computing core A is very close to the wall, the search time is short, and the average weight is 0.5; while the spatial grid block on a computing core B is far from the wall, the search time is long, and the average weight is 1.5, then computing core B will send some spatial units to computing core A; until the average weight of the remaining units on computing core B is 1 or the average weight of the accumulated units on computing core A is 1, then stop sending;
[0032] S4: 5. Repeat the sending process for all computing cores, and continuously send the excess unit information on the computing cores with an average weight greater than 1 to the computing cores with an average weight less than 1. The sent information is the xyz coordinates of the center point of each spatial unit, and ensure that the average weight of the remaining units on each computing core is about 1, and the positive and negative errors do not exceed 0.02; after completing the sending, search for the nearest unit for the spatial unit of this core, and solve the nearest wall distance;
[0033] S5: In each subsequent iteration time step, steps 3 to 5 are repeated. Each core always uses the weight coefficient obtained in the previous step as the basis for allocation, and ensures that the weight coefficients on all cores are basically the same until the iteration is completed.
[0034] Since the time and displacement intervals between each two time steps in CFD dynamic calculations are very small, the unit weights of two adjacent time steps are not much different. It is reasonable and feasible to use the weight coefficient of the previous time step to replace the current time step. This method of allocating spatial units by using search time weights instead of unit numbers has better uniformity and can ensure that the search time of each core is as similar as possible.
[0035] The above process uses a dynamic allocation method during the motion of the object surface to send spatial units between the computing cores in real time, ensuring that the time for the spatial units on each computing core to search for the nearest wall is basically the same. This solves the problem of uneven computing time caused by inconsistent search time of spatial units of each core in the traditional solution method, and can greatly improve the efficiency of wall distance solution in the CFD dynamic process.
[0036] In this way, the traditional method is to determine the number of spatial grid units on each core according to the initial allocation result during parallel slicing during the wall distance solution process. Since the search time of spatial units at different positions is not the same, the search time of each core is seriously uneven, affecting the parallel efficiency. This embodiment uniformly allocates spatial units through global management, and introduces the search time of each unit in the previous iteration step in the dynamic process for weighting, ensuring that the time for each core to complete the wall distance solution is basically equal, thereby greatly improving the parallel efficiency.
[0037] On the other hand, this embodiment also provides an electronic device, which can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.) or other types of mobile devices, or a stationary computing device such as a desktop computer or a PC. The electronic device can also be a mobile or stationary server.
[0038] As an optional method, it includes: a memory for storing a computer program; a processor for implementing a large-scale wall distance solution dynamic parallel balancing method when executing the computer program, including:
[0039] S1: Parallel slicing of the original large-scale computing grid is performed, and all its grid space units are evenly distributed to all computing cores;
[0040] S2: Perform constant static calculation on the original large-scale computational grid, divide the original grid after parallel slicing, complete the nearest wall unit search for each spatial unit and record its consumption time; after completing the global search, use the total search time of all spatial units for weighted average, and create an array to save the weight coefficient of each unit;
[0041] S3: Automatically update the displaced object surface and slice it according to the original parallel slicing scheme, and perform unsteady dynamic iteration on the original large-scale computational grid; during the dynamic iteration, when re-searching the wall distance, the spatial grid units allocated to each core are no longer allocated according to the original grid division, but are allocated according to the unit weights after weighting in the previous step, and ensure that the difference in the sum of the spatial unit weight coefficients obtained on each computational core is less than the preset value;
[0042] S4: Repeat the information sending to all computing cores, and continuously send the excess unit information on the computing cores with an average weight greater than the preset value to the computing cores with an average weight less than the preset value; after the sending is completed, the nearest unit search is carried out for the spatial unit of the core, and the nearest wall distance is solved;
[0043] S5: In subsequent iteration steps, the above S4 and S5 are repeated; wherein any calculation core always uses the weight coefficient obtained in the previous step as the allocation basis until the iteration is completed.
[0044] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the large-scale wall distance solution dynamic parallel balancing method are of the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the large-scale wall distance solution dynamic parallel balancing method.
[0045] On the other hand, this embodiment further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, a large-scale wall distance solution dynamic parallel balancing method is implemented, including:
[0046] S1: Parallel slicing of the original large-scale computing grid is performed, and all its grid space units are evenly distributed to all computing cores;
[0047] S2: Perform constant static calculation on the original large-scale computational grid, divide the original grid after parallel slicing, complete the nearest wall unit search for each spatial unit and record its consumption time; after completing the global search, use the total search time of all spatial units for weighted average, and create an array to save the weight coefficient of each unit;
[0048] S3: Automatically update the displaced object surface and slice it according to the original parallel slicing scheme, and perform unsteady dynamic iteration on the original large-scale computational grid; during the dynamic iteration, when re-searching the wall distance, the spatial grid units allocated to each core are no longer allocated according to the original grid division, but are allocated according to the unit weights after weighting in the previous step, and ensure that the difference in the sum of the spatial unit weight coefficients obtained on each computational core is less than the preset value;
[0049] S4: Repeat the information sending to all computing cores, and continuously send the excess unit information on the computing cores with an average weight greater than the preset value to the computing cores with an average weight less than the preset value; after the sending is completed, the nearest unit search is carried out for the spatial unit of the core, and the nearest wall distance is solved;
[0050] S5: In subsequent iteration steps, the above S4 and S5 are repeated; wherein any calculation core always uses the weight coefficient obtained in the previous step as the allocation basis until the iteration is completed.
[0051] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the large-scale wall distance solution dynamic parallel balancing method are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the large-scale wall distance solution dynamic parallel balancing method.
[0052] An embodiment of the present application further provides a chip storing a computer program, which, when executed by the chip, implements the steps of the large-scale wall distance solution dynamic parallel balancing method.
[0053] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0054] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0055] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0056] The above are only preferred embodiments of the present invention. It should be noted that the above preferred embodiments should not be regarded as limiting the present invention, and the protection scope of the present invention should be based on the scope defined by the claims. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the spirit and scope of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A dynamic parallel balancing method for solving large-scale wall distance, characterized in that: include: S1: Parallel slicing of the original large-scale computing grid is performed, and all its grid space units are evenly distributed to all computing cores; S2: Perform constant static calculation on the original large-scale computational grid, divide the original grid after parallel slicing, complete the nearest wall unit search for each spatial unit and record its consumption time; After completing the global search, the total search time of all spatial units is used for weighted averaging, and an array is created to store the weight coefficients of each unit; S3: Automatically update the displaced object surface and slice it according to the original parallel slicing scheme, and perform unsteady dynamic iteration on the original large-scale computational grid; during the dynamic iteration, when re-searching the wall distance, the spatial grid units allocated to each core are no longer allocated according to the original grid division, but are allocated according to the unit weights after weighting in the previous step, and ensure that the difference in the sum of the spatial unit weight coefficients obtained on each computational core is less than the preset value; S4: Repeat the information sending to all computing cores, and continuously send the excess unit information on the computing cores with an average weight greater than the preset value to the computing cores with an average weight less than the preset value; after the sending is completed, the nearest unit search is carried out for the spatial unit of the core, and the nearest wall distance is solved; S5: In subsequent iteration steps, the above S4 and S5 are repeated; wherein any calculation core always uses the weight coefficient obtained in the previous step as the allocation basis until the iteration is completed.
2. A large-scale wall distance solution dynamic parallel balancing method according to claim 1, characterized in that: The weight coefficient is determined based on the average search time of all spatial units.
3. A large-scale wall distance solution dynamic parallel balancing method according to claim 1, characterized in that: In the above S4, continuously sending the excess unit information on the computing cores whose average weight is greater than the preset value to the computing cores whose average weight is less than the preset value includes: If the spatial grid block on any computing core is close to the wall and its search time is short, its time-averaged weight is smaller than that of another computing core that is relatively not close to the wall; thereafter, the computing core that is relatively not close to the wall sends part of the spatial units to the computing core that is relatively close to the wall until the remaining unit average weight of the computing core that is relatively not close to the wall is equal to the weight of the computing core that is relatively close to the wall or the difference is smaller than a preset value.
4. A large-scale wall distance solution dynamic parallel balancing method according to claim 1, characterized in that: In the above S4, the information sent is the xyz coordinates of the center point of each space unit; after the sending is completed, the nearest unit search is carried out for the core space unit, and the nearest wall distance is solved.
5. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the large-scale wall distance solution dynamic parallel balancing method as described in any one of claims 1 to 4 when executing the computer program.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the large-scale wall distance solution dynamic parallel balancing method as claimed in any one of claims 1 to 4 are implemented.
