Hydrodynamic simulation method and device, electronic equipment and storage medium
By meshing and parallel computing the hydrodynamic model, the problem of low computational efficiency in hydrodynamic simulation in the existing technology is solved, rapid and accurate flood forecasting is achieved, and flood control decisions are supported.
Patent Information
- Application Number
- CN202410787843.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-15
AI Technical Summary
The calculation efficiency of existing hydrodynamic models is low and cannot meet the needs for rapid prediction of sudden flood disasters.
By meshing the geometric model of the area to be simulated, it is divided into multiple sub-domains, and multiple computing units are used for parallel calculations. Data is transferred and interpolated between each sub-domain, combined with the finite volume method and Runge-Kutta format. Hydrodynamic simulation.
It significantly improves the calculation efficiency of hydrodynamic simulation, enables rapid and accurate flood forecasting, and supports flood control decisions.
Smart Images

Figure CN118780199A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of hydrodynamics technology, and in particular to a hydrodynamics simulation method, device, electronic equipment and storage medium. Background Art
[0002] Flood disasters have a wide impact on the world, posing a threat to human survival and production safety, and are one of the most serious natural disasters. Therefore, rapid and accurate flood forecasting through numerical calculations is of great significance for supporting flood control decisions and further mitigating its adverse effects.
[0003] The hydrodynamic model can transform the complex phenomenon of flood evolution into a solvable mathematical equation, thereby simulating the entire flood process. However, the solution method of the hydrodynamic model in the relevant technology has low computational efficiency and cannot meet the needs of the suddenness of flood disasters. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a hydrodynamic simulation method, device, electronic device and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, a hydrodynamic simulation method is provided, which is applied to an electronic device, wherein the electronic device includes a plurality of computing units, and the method includes:
[0006] Meshing the geometric model of the area to be simulated to obtain a mesh model of the area to be simulated;
[0007] Dividing the grid model into a plurality of subdomains, each subdomain comprising a plurality of grids;
[0008] For each of the multiple subdomains, the grid topology data and the initial hydrodynamic data of the subdomain and the data input area of the subdomain are stored in the computing unit corresponding to the subdomain; wherein the grids directly contacting the subdomain and contained in the other subdomains of the multiple subdomains except the subdomain are the data input area of the subdomain;
[0009] Based on the calculation unit corresponding to each of the multiple subdomains, the hydrodynamic simulation result of each of the multiple subdomains is calculated in parallel; wherein each calculation unit is used to calculate the hydrodynamic simulation result of the target subdomain corresponding to the calculation unit, and when calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units, and the hydrodynamic simulation result of the target subdomain includes the hydrodynamic data of the target subdomain at the specified moment;
[0010] The hydrodynamic simulation results of each subdomain in the multiple subdomains are combined to obtain the hydrodynamic simulation result of the area to be simulated.
[0011] In some embodiments, the step of calculating the hydrodynamic simulation results of each of the multiple subdomains in parallel based on the calculation unit corresponding to each of the multiple subdomains includes:
[0012] Based on the computing unit corresponding to each sub-domain in the multiple sub-domains, repeatedly perform the following steps:
[0013] Interpolate the hydrodynamic data of each grid in the target subdomain corresponding to the calculation unit to the grid edge to obtain the subdomain interpolation data;
[0014] Obtaining interpolated data of the incoming area obtained by other calculation units, wherein the interpolated data of the incoming area is obtained by other calculation units interpolating the hydrodynamic data of each grid in the incoming area of the target data to the grid edge, and the other calculation units include: a calculation unit other than the calculation unit storing at least part of the hydrodynamic data of the incoming area of the target data;
[0015] Based on the subdomain interpolation data and the incoming zone interpolation data, calculating the flux and source term of the target subdomain according to a preset time step;
[0016] Obtaining the flux and source term of the target data input area calculated by the other computing units according to the preset time step;
[0017] Based on the flux and source term of the target subdomain and the flux and source term of the target data input area, updating the hydrodynamic data of each grid in the target subdomain and the target data input area;
[0018] When the updated hydrodynamic data of each grid is the hydrodynamic data at the specified time, the above steps are stopped and the hydrodynamic data of the target subdomain corresponding to each calculation unit is used as the hydrodynamic simulation result of the target subdomain.
[0019] In some embodiments, the calculating the flux and source term of the target subdomain according to a preset time step based on the subdomain interpolation data and the incoming zone interpolation data includes:
[0020] Based on the subdomain interpolation data and the incoming zone interpolation data, combined with the finite volume method, spatial discretization is performed in a center-upwind format, and time discretization is performed in a Runge-Kutta format, and the flux and source term of the target subdomain are calculated according to a preset time step.
[0021] In some embodiments, the preset time step is the smallest time step among the adaptive time steps corresponding to each sub-domain.
[0022] In some embodiments, the number of the plurality of sub-domains is the same as the number of the plurality of computing units.
[0023] In some embodiments, meshing the geometric model of the area to be simulated to obtain the mesh model of the area to be simulated includes:
[0024] Based on the unstructured triangular mesh, the geometric model of the area to be simulated is meshed to obtain the mesh model of the area to be simulated.
[0025] In some embodiments, the grid model includes an encrypted area and a non-encrypted area, the grid density of the encrypted area is greater than the grid density of the non-encrypted area, and the elevation corresponding to the encrypted area is less than the elevation corresponding to the non-encrypted area.
[0026] According to a second aspect of an embodiment of the present disclosure, there is provided a hydrodynamic simulation device, comprising:
[0027] A first division module is used to perform mesh division on the geometric model of the area to be simulated to obtain a mesh model of the area to be simulated;
[0028] A second division module is used to divide the grid model into a plurality of subdomains, each subdomain comprising a plurality of grids;
[0029] A storage module is used for storing, for each subdomain among the multiple subdomains, the grid topology data and the initial hydrodynamic data of the subdomain and the data input area of the subdomain in a computing unit corresponding to the subdomain; wherein the grids directly contacting the subdomain and contained in other subdomains among the multiple subdomains except the subdomain are the data input area of the subdomain;
[0030] A calculation module, used for calculating the hydrodynamic simulation result of each of the multiple subdomains in parallel based on the calculation unit corresponding to each of the multiple subdomains; wherein each calculation unit is used to calculate the hydrodynamic simulation result of the target subdomain corresponding to the calculation unit, and when calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units, and the hydrodynamic simulation result of the target subdomain includes the hydrodynamic data of the target subdomain at the specified moment;
[0031] The merging module is used to merge the hydrodynamic simulation results of each subdomain in the multiple subdomains to obtain the hydrodynamic simulation results of the area to be simulated.
[0032] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0033] Processor; and
[0034] A memory, configured to store executable instructions of the processor;
[0035] The processor is configured to execute the method described in the first aspect by executing the executable instructions.
[0036] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in the first aspect is implemented.
[0037] The scheme provided by the embodiment of the present disclosure can mesh the geometric model of the area to be simulated to obtain the mesh model of the area to be simulated. The mesh model can be further divided into multiple subdomains. Among them, for each subdomain in the multiple subdomains, the meshes contained in other subdomains other than the subdomain that are in direct contact with the subdomain are the data input area of the subdomain. Next, for each subdomain in the multiple subdomains, the mesh topology data and initial hydrodynamic data of the subdomain and the data input area of the subdomain can be stored in the calculation unit corresponding to the subdomain. Based on the calculation unit corresponding to each subdomain in the multiple subdomains, the hydrodynamic simulation results of each subdomain in the multiple subdomains can be calculated in parallel. In the process of parallel calculation, each calculation unit is used to calculate the hydrodynamic simulation results of the target subdomain corresponding to the calculation unit, and when calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units. By merging the hydrodynamic simulation results of each subdomain in the multiple subdomains, the hydrodynamic simulation results of the area to be simulated can be obtained.
[0038] Thus, the solution provided by the embodiment of the present disclosure can divide the grid model into multiple subdomains, and based on different computing units, calculate the hydrodynamic simulation results of different subdomains in parallel, which significantly improves the computing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic flow chart of a hydrodynamic simulation method in an embodiment of the present disclosure is shown.
[0040] Figure 2 A schematic diagram showing the relationship between a subdomain and a data input area in an embodiment of the present disclosure.
[0041] Figure 3 A flow chart of a method for parallel calculation of hydrodynamic data in an embodiment of the present disclosure is shown.
[0042] Figure 4 A method for interpolating hydrodynamic data in an embodiment of the present disclosure is shown.
[0043] Figure 5 A schematic diagram of a hydrological model in an embodiment of the present disclosure is shown.
[0044] Figure 6A schematic diagram of a grid division method in an embodiment of the present disclosure is shown.
[0045] Figure 7 A schematic diagram showing a sub-domain division method according to an embodiment of the present disclosure.
[0046] Figure 8 A schematic diagram showing a hydrodynamic simulation result according to an embodiment of the present disclosure.
[0047] Fig. 9 A schematic structural diagram of a hydrodynamic simulation device according to an embodiment of the present disclosure is shown.
[0048] Fig.10 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0049] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0050] First, a hydrodynamic simulation method is provided in an embodiment of the present disclosure, and the method can be executed by any electronic device.
[0051] Exemplarily, the electronic device for executing the method provided by the embodiment of the present disclosure may include multiple computing units. The computing unit may be hardware in the electronic device that can provide computing power for hydrodynamic simulation. For example, the computing unit may be a graphics card in the electronic device.
[0052] Figure 1 A schematic diagram of a hydrodynamic simulation method according to an embodiment of the present disclosure is shown. Figure 1 As shown, the hydrodynamic simulation method provided in the embodiment of the present disclosure includes the following steps S101 to S104.
[0053] S101, meshing the geometric model of the area to be simulated to obtain a mesh model of the area to be simulated.
[0054] It should be noted that the area to be simulated may include a hydrodynamic research area (eg, a river channel, a canal, etc.) By collecting topographic data of the area to be simulated, a geometric model of the area to be simulated may be established.
[0055] In some embodiments, the geometric model of the area to be simulated can be meshed based on an unstructured triangular mesh to obtain a mesh model of the area to be simulated. Among them, an unstructured mesh refers to a mesh without a regular topological relationship. In the process of hydrodynamic simulation, the unstructured mesh has higher flexibility and adaptability. The shape and size of each mesh unit in the unstructured mesh can be set arbitrarily, which can better simulate the process of water movement.
[0056] In some embodiments, the grid model includes an encrypted area and a non-encrypted area. The grid density of the encrypted area is greater than that of the non-encrypted area, and the elevation corresponding to the encrypted area is less than that corresponding to the non-encrypted area. Exemplarily, the encrypted area may be a river channel and its coastal houses where hydrodynamic research is conducted, and the non-encrypted area may be a ridge, highland or other area far from the river channel. That is to say, in the process of grid division, the area with a lower altitude and easily affected by the water body can be used as an encrypted area, and the grid division density of the encrypted area can be increased, and the area with a higher altitude and not easily affected by the water body can be used as a non-encrypted area, and the grid division density of the non-encrypted area can be reduced, thereby reducing the computational complexity of the hydrodynamic simulation to a certain extent, while taking into account the accuracy of the simulation results.
[0057] The elevation is the vertical height of a point in the geometric model relative to the sea level or other reference point.
[0058] S102, dividing the grid model into a plurality of subdomains, each subdomain comprising a plurality of grids.
[0059] In some embodiments, the number of subdomains may be the same as the number of computing units in the electronic device. In other words, each computing unit in the electronic device may be fully called upon to participate in the calculation process of the hydrodynamic simulation, thereby maximizing the efficiency of the hydrodynamic simulation.
[0060] In some embodiments, the subdomains may be divided in any manner, and the boundary lines of adjacent subdomains are the common edges of adjacent grids in the adjacent subdomains. For example, the subdomains may be divided along the flow direction of the river in the area to be simulated, so that each subdomain includes a section of the river.
[0061] In some embodiments, during the subdomain division process, the number of grids contained in each subdomain can be made approximately the same, so that the amount of calculation undertaken by each computing unit is approximately the same, so as to maximize the computing efficiency. For example, the computing power provided by each computing unit in the electronic device may be different. In this case, the computing unit can also be divided according to its computing power, so that the subdomain corresponding to the computing unit with higher computing power has a larger number of grids, and the subdomain corresponding to the computing unit with lower computing power has a smaller number of grids, so as to coordinate the computing efficiency of each grid.
[0062] In addition, the shape of each sub-domain may also be any shape, which is not limited in the embodiments of the present disclosure.
[0063] S103, for each subdomain among the multiple subdomains, storing the grid topology data and initial hydrodynamic data of the subdomain and the data transfer area of the subdomain in a computing unit corresponding to the subdomain.
[0064] For each subdomain among the multiple subdomains, the grids directly contacting the subdomain and contained in other subdomains among the multiple subdomains except the subdomain are the data transfer area of the subdomain.
[0065] Please refer to Figure 2 , Figure 2 FIG. 1 shows a schematic diagram of the relationship between a subdomain and a data input area in an embodiment of the present disclosure. It can be understood that although Figure 2 Not shown, but Figure 2 Both subdomain 1 and subdomain 2 in the data transmission diagram include multiple grids, and the data input area of subdomain 1 is composed of grids in subdomain 2 that directly contact the boundary of subdomain 1.
[0066] It should be noted that the grid topology data of each subdomain and its data input area is used to show the relative positions of the grids in the subdomain and its data input area, for example, it may include grid nodes and the connection relationship between the nodes. The initial hydrodynamic data of each subdomain and its data input area includes: the water depth and flow of the subdomain and its data input area in the initial state.
[0067] Exemplarily, the initial hydrodynamic data may be obtained by using a pre-established hydrological model of the area to be simulated.
[0068] Exemplarily, when the computing unit is a graphics card, the grid topology data and initial hydrodynamic data of each subdomain and its data input area can be stored in the video memory of the graphics card corresponding to the subdomain, so that the GPU in the graphics card can call these data in the video memory to calculate the hydrodynamic data.
[0069] S104, based on the calculation unit corresponding to each of the multiple subdomains, parallelly calculate the hydrodynamic simulation result of each of the multiple subdomains.
[0070] It should be noted that each calculation unit involved in the hydrodynamic simulation calculation is used to calculate the hydrodynamic simulation results of the target subdomain corresponding to the calculation unit. When calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units. Among them, the target subdomain is the data input area of the target subdomain corresponding to the calculation unit.
[0071] It should be noted that, similar to the aforementioned initial hydrodynamic data, the hydrodynamic data here also include water depth and flow rate, which can be obtained by solving the two-dimensional shallow water wave equation.
[0072] Exemplarily, the hydrodynamic simulation result of the target subdomain includes hydrodynamic data of the target subdomain at a specified time.
[0073] S105, merging the hydrodynamic simulation results of each subdomain in the multiple subdomains to obtain the hydrodynamic simulation results of the area to be simulated.
[0074] It should be noted that by merging the hydrodynamic simulation results of each subdomain, the complete hydrodynamic simulation results of the area to be simulated can be obtained.
[0075] Combination of the above Figure 1 and Figure 2 The overall inventive concept is introduced in the embodiments of the present disclosure. By dividing the grid model into multiple subdomains and using multiple computing units to perform parallel calculations on the hydrodynamic data of the multiple subdomains, the efficiency of the hydrodynamic simulation can be significantly improved.
[0076] For ease of understanding, the following will combine Figure 3 , detailing the process of parallel computing by multiple computing units.
[0077] Figure 3 FIG. 2 is a flow chart of a method for parallel calculation of hydrodynamic data in an embodiment of the present disclosure. Figure 3 As shown, the following steps S301 to S306 may be repeatedly performed based on the computing unit corresponding to each sub-domain in the multiple sub-domains:
[0078] S301, interpolating the hydrodynamic data of each grid in the target subdomain corresponding to each calculation unit to the grid edge to obtain subdomain interpolation data.
[0079] It should be noted that since the hydrodynamic data (including initial hydrodynamic data) stored in the calculation unit are all hydrodynamic data describing the center position of each grid, in order to simulate the process of water movement, the hydrodynamic data of the center position of each grid can be interpolated to the grid edge to complete the data preparation.
[0080] In some embodiments, please refer to Figure 4 , Figure 4 FIG. 2 shows a method for interpolating hydrodynamic data in an embodiment of the present disclosure. Figure 4 As shown, the hydrodynamic data of each grid edge can be obtained by the difference of the hydrodynamic data of the two grid centers sharing the grid edge.
[0081] S302, obtaining interpolation data of the incoming area obtained by interpolation of other computing units, where the interpolation data of the incoming area is obtained by other computing units interpolating the hydrodynamic data of each grid in the incoming area of the target data to the grid edge.
[0082] It should be noted that the other calculation units include: calculation units other than the calculation unit that store at least part of the hydrodynamic data of the target data input area.
[0083] Since the target data input area is the data input area of the target subdomain, and the data input area of the target subdomain is the grid area in other subdomains that is directly in contact with the target subdomain, the other calculation units here can also be understood as calculation units for calculating the hydrodynamic data of the adjacent subdomains of the target subdomain.
[0084] That is, other computing units may execute S301 to obtain the incoming region interpolation data that the target sub-domain needs to obtain in S302.
[0085] S303, based on the subdomain interpolation data and the incoming zone interpolation data, the flux and source term of the target subdomain are calculated according to a preset time step.
[0086] In some embodiments, based on the subdomain interpolation data and the incoming zone interpolation data, the finite volume method can be combined to calculate the flux and source term of the target subdomain according to a preset time step.
[0087] Specifically, the two-dimensional shallow water wave equation can be solved by the finite volume method, and in the solution process, the spatial discretization is performed in the center-upwind format and the time discretization is performed in the Runge-Kutta format, so as to obtain the flux and source terms of each grid in the target subdomain.
[0088] The flux of each grid can be understood as the flow of water passing through the grid per unit time. The source term of each grid can be understood as the external physical quantity that can affect the flow of water in the grid.
[0089] Since a second-order accuracy solution is adopted in both space and time during the solution process of the flux and source terms, the disclosed embodiment can obtain stable and accurate calculation results.
[0090] For example, the preset time step may be the smallest time step among the adaptive time steps corresponding to each subdomain, thereby improving the calculation efficiency while ensuring the calculation accuracy. The adaptive step corresponding to each subdomain may be automatically generated by the hydrodynamic simulation software.
[0091] S304, obtaining the flux and source term of the target data input area calculated by other computing units according to the preset time step.
[0092] Exemplarily, other computing units may obtain the flux and source term of the target data input area corresponding to the computing unit by executing S303.
[0093] S305 , based on the flux and source items of the target subdomain and the flux and source items of the target data input area, the hydrodynamic data of each grid in the target subdomain and the target data input area are updated.
[0094] Exemplarily, after the calculation of the flux and source terms of the target subdomain and its target data input area is completed, the hydrodynamic data initially stored in the calculation unit can be updated according to the obtained flux and source terms.
[0095] S306, when the updated hydrodynamic data of each grid is the hydrodynamic data at the specified time, stop repeatedly executing the above steps, and use the hydrodynamic data of the target subdomain corresponding to each calculation unit as the hydrodynamic simulation result of the target subdomain.
[0096] At this point, the embodiment of the present disclosure can enable each computing unit to obtain data from its data input area in other computing units during the parallel computing process, thereby ensuring the continuity of hydrodynamic data calculation between adjacent subdomains during the parallel computing process, and thus obtaining accurate calculation results.
[0097] Next, we will combine Figures 5 to 8 , which introduces in detail the specific implementation process of the method provided by the present invention.
[0098] Specifically, the method provided in the embodiment of the present disclosure can be implemented according to the following steps:
[0099] Step 1: Use hydrological analysis tools to divide sub-basins and extract geometric parameters for the hydrodynamic study area and its upstream area to establish a hydrological model.
[0100] Step 2: Use data such as rainfall, evaporation, and upstream flow boundary (reservoir discharge flow) to drive the hydrological model and output the simulated flow of each node (each sub-basin watershed outlet) in the hydrological model.
[0101] For example, Figure 5 A schematic diagram of a hydrological model in an embodiment of the present disclosure is shown. Figure 5where P is rainfall, f is infiltration, W is the water storage capacity of the tension water layer, S is the water storage capacity of the bedrock weathering layer, G is the water storage capacity of the deep groundwater layer, I is the area ratio of the impermeable layer, Ew is the evaporation coefficient of the tension water layer, Es is the evaporation coefficient of the bedrock weathering layer, Eg is the evaporation coefficient of the deep groundwater layer, Ks is the outflow coefficient of the bedrock weathering layer, Ksg is the S layer-G layer recharge coefficient, Kg is the groundwater layer outflow coefficient, Ri is the runoff depth of the impermeable layer, Qi is the runoff volume of the impermeable layer, Rss is the saturated runoff depth, Qss is the saturated runoff volume, Rs is the runoff depth of the bedrock weathering layer, Qs is the runoff volume of the bedrock weathering layer, Rg is the runoff depth of the deep groundwater layer, Qg is the runoff volume of the deep groundwater layer, Css is the saturated runoff recession coefficient, Cs is the runoff recession coefficient of the bedrock weathering layer, Cg is the runoff recession coefficient of the deep groundwater layer, and Lag is the hysteresis coefficient.
[0102] based on Figure 5 The hydrological model solution process shown in the figure can calculate the flow of four types of runoff, Qi, Qss, Qs and Qg. Through the retreat curve and hysteresis algorithm, the simulated flow of the four types of runoff reaching the outlet of each sub-basin can be calculated. Among them, the process of runoff entering the river network can be calculated and simulated using the Muskingum method.
[0103] It is understandable that the solution provided in the embodiment of the present disclosure does not involve improvements to the hydrological model solution process, so the implementation of step 2 can refer to the implementation methods in the relevant technology, and the embodiment of the present disclosure will not elaborate on this.
[0104] Step 3: Set the hydrological-hydrodynamic coupler configuration file according to the simulation time range of the hydrodynamic model and the location of the inflow node. Then start the coupler to output the flow sequence of the inflow node in the study area for use by the hydrodynamic model.
[0105] In some embodiments, the inflow node of the hydrodynamic model can be determined based on the pre-collected digital elevation model and the actual river course. For example, the inflow node can be Figure 6 Point A and Point B, where Point A is located at the confluence of sub-channels 7 and 17, and Point B is located at sub-channel 11. If the inflow node (such as Point A) is at the confluence of multiple sub-channels, the sum of them can be used as the flow of the inflow node; if the inflow node (such as Point B) is in the middle of a sub-channel, the outlet flow of the sub-channel is scaled according to the catchment area ratio as the flow of the inflow node.
[0106] Step 4: For the study area, use unstructured triangular meshes to mesh the geometric model of the study area to obtain a mesh model.
[0107] For example, for the study area, areas such as rivers and houses along the coast can be designated as encrypted areas, while areas such as ridges far from rivers can be designated as non-encrypted areas.
[0108] Please refer to Figure 6 In the division process, unstructured triangular grids can also be used to discretize the study area, using high-precision grids in the encrypted area and low-precision grids in the non-encrypted area, so as to minimize the scale of grids involved in the calculation while ensuring the terrain accuracy.
[0109] Step 5: divide the grid model into multiple subdomains according to the number of computing units, wherein the number of subdomains is the same as the number of computing units.
[0110] Figure 7 A schematic diagram showing a sub-domain division method of an embodiment of the present disclosure is shown. Figure 7 , for ease of understanding, Figure 7 The grid model is divided into subdomain computing area, data input area and data output area. The subdomain computing area and data output area are used to form Figure 2 The subdomains are shown.
[0111] That is, subdomain computing area 1 and data outgoing area 1 together constitute subdomain 1, and data outgoing area 1 is the data outgoing area of subdomain 1. Subdomain computing area 2 and data outgoing area 2 together constitute subdomain 2, and data outgoing area 2 is the data outgoing area of subdomain 2.
[0112] Step 6, assign values to initial variables such as water depth and flow rate of each grid, and set the total duration of the hydrodynamic simulation calculation and the time when the results need to be output.
[0113] Step 7: Store the grid topology data, water depth, flow rate and other variables of each sub-domain into the computing unit corresponding to each sub-domain.
[0114] Step 8: Use multiple computing units to perform hydrodynamic simulation in parallel, where each computing unit is used to calculate the hydrodynamic data for its corresponding subdomain, and update the water depth, flow rate and other information corresponding to the grid of each subdomain by solving the two-dimensional shallow water wave equation.
[0115] Please continue to refer to Figure 7 , assuming Figure 7 The computing unit 1 is used to calculate the hydrodynamic data in the subdomain 1 (including the subdomain computing area 1 and the data transmission area 1), and the computing unit 2 is used to calculate the hydrodynamic data in the subdomain 2 (including the subdomain computing area 2 and the data transmission area 2).
[0116] During the hydrodynamic simulation, data can be transferred between different computing units by executing the cudaMemcpy function in cuda. Figure 7In the example, since the data outgoing area 1 of subdomain 1 is the data incoming area 2 of subdomain 2, the data in the data outgoing area 1 calculated by computing unit 1 can be transferred to computing unit 2. In other words, computing unit 2 can obtain the data in its data incoming area 2 from computing unit 1.
[0117] Similarly, computing unit 1 can obtain data in other data input area 1 from computing unit 2, which will not be elaborated in the embodiment of the present disclosure.
[0118] For example, during the hydrodynamic simulation, each computing unit can use the unit-centered finite volume method to solve the two-dimensional shallow water wave equation, and use the center-upwind format for spatial discretization and the Runge-Kutta format for time discretization, so that the solution has second-order accuracy.
[0119] The two-dimensional shallow water wave equation is as follows:
[0120]
[0121]
[0122]
[0123] Where U is the variable vector, h, hu, and hv are the water depth and the flow in the x and y directions, respectively; u and v are the flow velocities in the x and y directions, respectively; E and G are the flux vectors in the x and y directions, respectively; S is the source term vector, n is the Manning roughness coefficient, z is the terrain elevation, g is the gravitational acceleration, t is the time, and x and y are two perpendicular directions in a plane perpendicular to the depth direction of the river channel.
[0124] Step 9: Each calculation unit determines the adaptive time step corresponding to each sub-domain according to the current calculation result. The smallest time step among the adaptive time steps corresponding to each sub-domain is the preset time step for the next calculation.
[0125] Step 10: Depending on whether the hydrodynamic simulation results need to be output at the current moment, if so, the hydrodynamic simulation results of each subdomain obtained by parallel calculation of each calculation unit are merged as the hydrodynamic simulation result at the current moment (e.g. Figure 8 shown).
[0126] Step 11, when the calculation time reaches the preset total duration, the calculation process ends.
[0127] Based on the same inventive concept, the present disclosure also provides a hydrodynamic simulation device, such as the following embodiment. Figure 1The method embodiment shown is similar to that shown in FIG. 1 , so the implementation of the hydrodynamic simulation device embodiment can refer to the above Figure 1 The implementation of the illustrated method embodiment will not be described in detail in detail.
[0128] Fig. 9 A schematic diagram of the structure of a hydrodynamic simulation device in an embodiment of the present disclosure is shown. The hydrodynamic simulation device can be applied to electronic equipment, and the electronic equipment includes multiple computing units.
[0129] Specifically, Fig. 9 As shown, the hydrodynamic simulation device 900 includes: a first division module 901 , a second division module 902 , a storage module 903 , a calculation module 904 and a merging module 905 .
[0130] The first division module 901 is used to perform mesh division on the geometric model of the area to be simulated to obtain a mesh model of the area to be simulated.
[0131] The second division module 902 is used to divide the grid model into multiple sub-domains, each sub-domain contains multiple grids.
[0132] Storage module 903 is used to store, for each subdomain among the multiple subdomains, the grid topology data and initial hydrodynamic data of the subdomain and the data input area of the subdomain in the computing unit corresponding to the subdomain; wherein the grids directly in contact with the subdomain contained in other subdomains among the multiple subdomains except the subdomain are the data input area of the subdomain.
[0133] The calculation module 904 is used to calculate the hydrodynamic simulation results of each subdomain in the multiple subdomains in parallel based on the calculation units corresponding to each subdomain in the multiple subdomains; wherein each calculation unit is used to calculate the hydrodynamic simulation results of the target subdomain corresponding to the calculation unit, and when calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units, and the hydrodynamic simulation results of the target subdomain include the hydrodynamic data of the target subdomain at the specified moment.
[0134] The merging module 905 is used to merge the hydrodynamic simulation results of each subdomain in the multiple subdomains to obtain the hydrodynamic simulation results of the area to be simulated.
[0135] In some embodiments, the calculation module 904 is specifically configured to repeatedly perform the following steps based on a calculation unit corresponding to each sub-domain in the multiple sub-domains:
[0136] Interpolate the hydrodynamic data of each grid in the target subdomain corresponding to the calculation unit to the grid edge to obtain the subdomain interpolation data;
[0137] Obtaining interpolated data of the incoming area obtained by interpolation of other computing units, the interpolated data of the incoming area being obtained by other computing units interpolating the hydrodynamic data of each grid in the incoming area of the target data to the grid edge, the other computing units including: computing units storing at least part of the hydrodynamic data of the incoming area of the target data except the computing unit;
[0138] Based on the subdomain interpolation data and the incoming zone interpolation data, the flux and source items of the target subdomain are calculated according to the preset time step;
[0139] Obtain the flux and source items of the target data input area calculated by other computing units according to the preset time step;
[0140] Based on the flux and source items of the target subdomain and the flux and source items of the target data input area, the hydrodynamic data of each grid in the target subdomain and the target data input area are updated;
[0141] When the updated hydrodynamic data of each grid is the hydrodynamic data at the specified time, the above steps are stopped and the hydrodynamic data of the target subdomain corresponding to each calculation unit is used as the hydrodynamic simulation result of the target subdomain.
[0142] In some embodiments, the calculation module 904 is also used to, based on the subdomain interpolation data and the incoming zone interpolation data, in combination with the finite volume method, perform spatial discretization in the center-upwind format and perform time discretization in the Runge-Kutta format, and calculate the flux and source terms of the target subdomain according to a preset time step.
[0143] In some embodiments, the preset time step is the smallest time step among the adaptive time steps corresponding to each sub-domain.
[0144] In some embodiments, the number of the plurality of sub-domains is the same as the number of the plurality of computing units.
[0145] In some embodiments, the first division module 901 is specifically used to perform mesh division on the geometric model of the area to be simulated based on an unstructured triangular mesh to obtain a mesh model of the area to be simulated.
[0146] In some embodiments, the grid model includes an encrypted area and a non-encrypted area, the grid density of the encrypted area is greater than the grid density of the non-encrypted area, and the elevation corresponding to the encrypted area is less than the elevation corresponding to the non-encrypted area.
[0147] Refer to the following Fig.10 1000 capable of implementing the embodiments of the present disclosure is described. Fig.10 The electronic device 1000 shown is merely an example and should not bring any limitation to the functions and scope of application of the embodiments of the present disclosure.
[0148] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include but are not limited to: at least one processor 1010, at least one memory 1020, and a bus 1030 connecting different system components (including the memory 1020 and the processor 1010).
[0149] The memory stores program codes, which can be executed by the processor 1010, so that the processor 1010 executes the steps described in the above “exemplary method” section of the present disclosure according to various exemplary embodiments of the present disclosure.
[0150] In some embodiments, the processor 1010 may further perform the following steps of the above method embodiment:
[0151] Meshing the geometric model of the area to be simulated to obtain a mesh model of the area to be simulated;
[0152] Divide the grid model into multiple subdomains, each subdomain contains multiple grids;
[0153] For each of the multiple subdomains, the grid topology data and the initial hydrodynamic data of the subdomain and the data input area of the subdomain are stored in the computing unit corresponding to the subdomain; wherein the grids directly contacting the subdomain and contained in other subdomains of the multiple subdomains except the subdomain are the data input area of the subdomain;
[0154] Based on the calculation units corresponding to each of the multiple subdomains, the hydrodynamic simulation results of each of the multiple subdomains are calculated in parallel; wherein each calculation unit is used to calculate the hydrodynamic simulation results of the target subdomain corresponding to the calculation unit, and when calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units, and the hydrodynamic simulation results of the target subdomain include the hydrodynamic data of the target subdomain at the specified moment;
[0155] The hydrodynamic simulation results of each subdomain in multiple subdomains are combined to obtain the hydrodynamic simulation results of the area to be simulated.
[0156] The memory 1020 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 10201 and / or a cache memory 10202 , and may further include a read-only memory (ROM) 10203 .
[0157] Memory 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0158] The bus 1030 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures.
[0159] The electronic device 1000 may also communicate with one or more external devices 1040 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 1000, and / or any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 1060. Fig.10 As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via the bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0160] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0161] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the above-mentioned method of the present disclosure is stored thereon. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above-mentioned "Exemplary Method" section of the present disclosure.
[0162] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A hydrodynamic simulation method, It is characterized in that Applied to an electronic device, the electronic device includes a plurality of computing units, and the method includes: Meshing the geometric model of the area to be simulated to obtain a mesh model of the area to be simulated; Dividing the grid model into a plurality of subdomains, each subdomain comprising a plurality of grids; For each of the multiple subdomains, the grid topology data and the initial hydrodynamic data of the subdomain and the data input area of the subdomain are stored in the computing unit corresponding to the subdomain; wherein the grids directly contacting the subdomain and contained in the other subdomains of the multiple subdomains except the subdomain are the data input area of the subdomain; Based on the calculation unit corresponding to each of the multiple subdomains, the hydrodynamic simulation result of each of the multiple subdomains is calculated in parallel; wherein each calculation unit is used to calculate the hydrodynamic simulation result of the target subdomain corresponding to the calculation unit, and when calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units, and the hydrodynamic simulation result of the target subdomain includes the hydrodynamic data of the target subdomain at the specified moment; The hydrodynamic simulation results of each subdomain in the multiple subdomains are combined to obtain the hydrodynamic simulation result of the area to be simulated.
2. The method according to claim 1, It is characterized in that The step of calculating the hydrodynamic simulation results of each of the multiple subdomains in parallel based on the calculation unit corresponding to each of the multiple subdomains includes: Based on the computing unit corresponding to each sub-domain in the multiple sub-domains, repeatedly perform the following steps: Interpolate the hydrodynamic data of each grid in the target subdomain corresponding to the calculation unit to the grid edge to obtain the subdomain interpolation data; Obtaining interpolated data of the incoming area obtained by other calculation units, wherein the interpolated data of the incoming area is obtained by other calculation units interpolating the hydrodynamic data of each grid in the incoming area of the target data to the grid edge, and the other calculation units include: a calculation unit other than the calculation unit storing at least part of the hydrodynamic data of the incoming area of the target data; Calculating the flux and source term of the target subdomain according to a preset time step based on the subdomain interpolation data and the incoming zone interpolation data; Obtaining the flux and source term of the target data input area calculated by the other computing units according to the preset time step; Based on the flux and source term of the target subdomain and the flux and source term of the target data input area, updating the hydrodynamic data of each grid in the target subdomain and the target data input area; When the updated hydrodynamic data of each grid is the hydrodynamic data at the specified time, the above steps are stopped and the hydrodynamic data of the target subdomain corresponding to each calculation unit is used as the hydrodynamic simulation result of the target subdomain.
3. The method according to claim 2, It is characterized in that The calculating the flux and source term of the target subdomain according to a preset time step based on the subdomain interpolation data and the incoming zone interpolation data includes: Based on the subdomain interpolation data and the incoming zone interpolation data, combined with the finite volume method, spatial discretization is performed in a center-upwind format, and time discretization is performed in a Runge-Kutta format, and the flux and source term of the target subdomain are calculated according to a preset time step.
4. The method according to claim 2 or 3, It is characterized in that The preset time step is the smallest time step among the adaptive time steps corresponding to each subdomain.
5. The method according to claim 1, It is characterized in that The number of the plurality of sub-domains is the same as the number of the plurality of computing units.
6. The method according to claim 1, It is characterized in that The meshing of the geometric model of the area to be simulated to obtain the mesh model of the area to be simulated includes: Based on the unstructured triangular mesh, the geometric model of the area to be simulated is meshed to obtain the mesh model of the area to be simulated.
7. The method according to claim 1 or 6, It is characterized in that The grid model includes an encrypted area and a non-encrypted area, the grid density of the encrypted area is greater than the grid density of the non-encrypted area, and the elevation corresponding to the encrypted area is less than the elevation corresponding to the non-encrypted area.
8. A hydrodynamic simulation device, It is characterized in that Applied to an electronic device, the electronic device includes a plurality of computing units, and the device includes: A first division module is used to perform mesh division on the geometric model of the area to be simulated to obtain a mesh model of the area to be simulated; A second division module is used to divide the grid model into a plurality of subdomains, each subdomain comprising a plurality of grids; A storage module is used for storing, for each subdomain among the multiple subdomains, the grid topology data and the initial hydrodynamic data of the subdomain and the data input area of the subdomain in a computing unit corresponding to the subdomain; wherein the grids directly contacting the subdomain and contained in other subdomains among the multiple subdomains except the subdomain are the data input area of the subdomain; A calculation module, used for calculating the hydrodynamic simulation result of each of the multiple subdomains in parallel based on the calculation unit corresponding to each of the multiple subdomains; wherein each calculation unit is used to calculate the hydrodynamic simulation result of the target subdomain corresponding to the calculation unit, and when calculating the hydrodynamic data of the target subdomain at each moment, the hydrodynamic data of the target data input area of the target subdomain at the same moment can be obtained in other calculation units, and the hydrodynamic simulation result of the target subdomain includes the hydrodynamic data of the target subdomain at the specified moment; The merging module is used to merge the hydrodynamic simulation results of each subdomain in the multiple subdomains to obtain the hydrodynamic simulation results of the area to be simulated.
9. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Method and system for real-time rendering of hydrodynamic data
CN120931793A
