An Adaptive Mesh Generation Method for Hydrodynamic Models
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-15
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]水动力模型计算中的四叉树网格生成算法大多是自上而下的拆分计算,因此需要提前布置属性有差异的点坐标位置,随着遥感与地理信息技术的发展,虽然模型获取的地形数据精度显著提升,但为了贴合地形与流场变化,传统方法需要在计算前预先扫描并提取所有关键点坐标以进行网格划分,从而使得预处理数据提取点坐标消耗的计算资源不断增大,预处理数据所需的时间甚至可能超过网格生成时间,严重制约了模型整体的计算效率
[0007]本发明的技术方案,通过采用自下而上的合并策略与十进制莫顿编码技术,有效解决了传统方法在处理高精度地形数据时预处理耗时长、计算资源消耗大的瓶颈问题。该技术实现了地形预处理与网格生成的同步进行,显著降低了内存占用并提升了计算效率,同时通过动态的网格合并与拆分机制,能够在捕捉局部剧烈流场变化细节的同时,兼顾计算区域的整体模拟精度,达到了高效、低耗且高精度的水动力模型模拟效果。
Smart Images

Figure CN122572024A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of hydrodynamic model calculation technology, and in particular to an adaptive mesh generation method for hydrodynamic models. Background Technology
[0002] Hydrodynamic models are an effective means of simulating flood movement and assessing flood impacts. Two-dimensional hydrodynamic models can simulate the evolution of floods over planar areas, providing information such as water level and flow velocity at various points in the inundated area, and are a commonly used method for assessing flood hazards. The grid is the basic unit for discretizing the computational domain; its discretization format and quantity directly affect the efficiency and accuracy of hydrodynamic model calculations, making it a key area of research in this field. Thanks to advancements in remote sensing, geographic information technology, and other related technologies, the accuracy of topographic data acquired by current hydrodynamic models has significantly improved. To accurately reflect topographic trends, a reasonable grid partitioning method will have a significant impact on the computational results.
[0003] Adaptive meshes can accommodate mesh distributions of different scales, adjusting mesh size according to changes in flow field or terrain, balancing computational efficiency and accuracy. Mesh generated by the quadtree algorithm can be well integrated and converted with structured meshes, has a simple storage structure and satisfactory computational accuracy, making it a mature and efficient data structure and a research hotspot in fields such as spatial retrieval, data compression, and numerical computation.
[0004] In hydrodynamic model calculations, quadtree mesh generation algorithms are mostly top-down split calculations, which require the pre-arrangement of point coordinates with different attributes. With the development of remote sensing and geographic information technology, although the accuracy of terrain data acquired by the model has been significantly improved, in order to conform to the changes in terrain and flow field, traditional methods need to scan and extract the coordinates of all key points in advance for mesh generation before calculation. This results in a continuous increase in the computational resources consumed by extracting point coordinates from the preprocessed data. The time required for preprocessing data may even exceed the mesh generation time, which seriously restricts the overall computational efficiency of the model. Summary of the Invention
[0005] This invention provides a method for generating adaptive meshes for hydrodynamic models, so as to achieve accurate generation of adaptive meshes for hydrodynamic models.
[0006] According to a first aspect of the present invention, an adaptive mesh generation method for a hydrodynamic model is provided, the method comprising: Obtain the grid cells of the original terrain in the hydrodynamic model calculation area, convert the grid cells into an initial calculation grid, and encode the initial calculation grid to obtain a linear quadtree code; Define the multidimensional attribute parameters of the encoded initial computational grid, wherein the multidimensional attribute parameters include grid level, quadrant assignment, and merging determination parameters; The initial computational grid is traversed, and a stack structure is used to perform bottom-up merging determination on adjacent grids. Based on the merging determination result, a preliminary quadtree grid structure is obtained. An adaptive split check is performed on the initial quadtree mesh structure, and the meshes that meet the split conditions are downgraded and split to obtain the final unstructured quadtree mesh.
[0007] The technical solution of this invention effectively solves the bottleneck problems of long preprocessing time and high computational resource consumption in traditional methods when processing high-precision terrain data by adopting a bottom-up merging strategy and decimal Morton coding technology. This technology enables simultaneous terrain preprocessing and mesh generation, significantly reducing memory usage and improving computational efficiency. At the same time, through a dynamic mesh merging and splitting mechanism, it can capture details of local drastic flow field changes while taking into account the overall simulation accuracy of the computational area, achieving efficient, low-consumption, and high-precision hydrodynamic model simulation results.
[0008] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a flowchart of an adaptive mesh generation method for hydrodynamic models provided in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of a linear quadtree encoding table provided according to Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of the multidimensional attribute parameters of a mesh provided in Embodiment 1 of the present invention; Figure 4 This is a schematic diagram of the window detection process provided in Embodiment 1 of the present invention; Figure 5 This is a schematic diagram of the mesh merging process provided in Embodiment 1 of the present invention; Figure 6 This is a schematic diagram of the mesh splitting process provided in Embodiment 1 of the present invention; Figure 7 This is a flowchart of an adaptive mesh generation method for hydrodynamic models provided in Embodiment 2 of the present invention; Figure 8 This is a schematic diagram of the grid interpolation calculation process provided in Embodiment 2 of the present invention. Detailed Implementation
[0011] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0012] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, apparatus, product, or terminal device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or terminal devices.
[0013] Example 1 Figure 1 This is a flowchart of an adaptive mesh generation method for hydrodynamic models provided in Embodiment 1 of the present invention. This embodiment is applicable to the adaptive generation of meshes for hydrodynamic models. The method can be executed by an adaptive mesh generation device for hydrodynamic models. This device can be implemented in hardware and / or software, and can be integrated into an electronic device with data processing capabilities. Figure 1 As shown, the method includes: S101: Obtain the raster cells of the original terrain in the hydrodynamic model calculation area, convert the raster cells into the initial calculation grid, and encode the initial calculation grid to obtain the linear quadtree code.
[0014] Optionally, the initial computational grid is encoded to obtain a linear quadtree code, including: obtaining the initial row number and initial column number of the raster cell corresponding to the initial computational grid, wherein the initial row number and initial column number of the raster are in decimal; converting the initial row number of the raster into a decimal row number pseudocode and the initial column number of the raster into a decimal column number pseudocode through iterative operations; and generating a decimal raster linear quadtree code based on the raster row number pseudocode and the raster column number pseudocode.
[0015] Specifically, in this embodiment, after obtaining the map information of the target calculation area corresponding to the hydrodynamic model, the grid cells are converted into initial calculation grids, and the initial calculation grids are encoded to obtain linear quadtree codes. When encoding each initial calculation grid, the original position of the grid cell corresponding to the initial calculation grid on the map is obtained. The original position includes the initial row number (I) and the initial column number (J), for example (5, 7). Then, the initial row number and column number of the raster are converted into binary row number and binary column number respectively. 5 is converted into 101 and 7 into 111. The converted binary row number and column number are then interlaced like a zipper in the order of "one row, one column" to form a new long binary number 110111. This new number is the binary combination number. The raster binary combination number is converted into decimal 55 and 55 is used as the obtained linear quadtree code. Of course, this implementation is only illustrated using (5, 7) as an example. The method for obtaining the linear quadtree code of other initial computation grids is roughly the same and will not be described in detail in this implementation.
[0016] Optionally, the initial computation grid is encoded to obtain a linear quadtree code, including: obtaining the initial row number and initial column number of the raster cell corresponding to the initial computation grid, and converting the initial row number and initial column number of the raster into binary row number and binary column number respectively, wherein the initial row number and initial column number of the raster are in decimal; cross-sorting the binary row number and binary column number of the raster to obtain a binary combination number, and converting the binary combination number of the raster into decimal to obtain the raster linear quadtree code, i.e., Morton code.
[0017] In this embodiment, after obtaining the initial row number (I) and initial column number (J), such as (5, 7), it is not necessary to convert them to binary. Instead, a specific set of mathematical iteration formulas is used to convert the initial decimal row number and initial column number into row number pseudocode and column number pseudocode, respectively. For example, the row number pseudocode is obtained using the following formula (1): (1) in, Indicates the highest digit. Indicates positional order. , This indicates the initial row number, and mod() is the modulo function. As an intermediate variable, the initial decimal row number is converted into decimal pseudocode through iterative operations. Similarly, the column pseudocode can be obtained by calculating the initial column number J using the same method. The decimal raster linear quadtree code is generated using the following formula (2): (2) in, Represents a linear quadtree encoding. Indicates line number pseudocode This represents the column number pseudocode. In this implementation, after obtaining the code of each grid unit, the codes can be sorted in ascending order to obtain a linear quadtree coding table, such as... Figure 2 As shown, the encoding is arranged in a Z-shape. Scanning in ascending numerical order ensures that the entire region is scanned, and from the perspective of quadtree generation, it also ensures that the encoding scan of sub-regions is completed in ascending order. This implementation uses linear quadtree encoding as an index and foundation to transform the original two-dimensional raster data into basic grid cells that the hydrodynamic model can recognize and perform calculations on, thereby constructing the initial computational grid.
[0018] S102 defines the multidimensional attribute parameters of the initial calculated grid after encoding.
[0019] Optionally, the grid level is the same as the number of times the grid is merged, the grid quadrant assignment is used to indicate the spatial location of the grid, and the grid merging determination parameter is used to identify whether the grid is the final display unit.
[0020] Specifically, the most basic idea of quadtree mesh generation is based on 4 n The algorithm checks the grid attributes within a range (n=0,1,2...). Each time, it determines whether grids within the checked area have the same attributes and merges them. After the entire area is checked, it checks if there are any grids to merge in this round. If so, it proceeds to the next round, doubling the check window size (n=n+1). If there are no more grids to merge in this round, the loop ends, yielding the final grid distribution. Before calculation, the parameters for each grid need to be defined. One type is the hydrological and hydraulic parameters obtained from the raster, and the other type is the multi-dimensional attribute parameters involved in generating the quadtree grid structure, including grid level L, quadrant assignment Q4, and merging decision parameter MR.
[0021] Here, the grid level (L=0,1,2...) refers to the level of each initial grid within the quadtree grid. If the initial grid size is defined as 1, then the size of the quadtree grid at different levels is equal to 4. LThe initial grid level is 0. Each merge increments the level by one. After merging, only the first displayed code (the top-left grid code) is retained and recorded in the final quadtree coding table. Quadrant assignment (Q4=0,1,2,3) corresponds to the four sub-regions within any given area: NW-0, NE-1, SW-2, SE-3. Each quadtree grid has a unique sub-region quadrant. The merge decision parameter (MR=0,1) determines whether the initial grid code is displayed after a merge. During grid merging, the grids with displayed codes have MR=1, therefore, all ultimately calculated quadtree grids have MR=1, and the remaining grids have MR=0. The correspondence between grid code M, level L, and quadrant Q4 is as follows: mod() means modulo. When When MR is an integer, it indicates that the grid is in the final quadtree coding table; MR=1 when... If it's not an integer, it means the mesh has been merged; MR=0. For example... Figure 3 The diagram shown illustrates the multidimensional attribute parameters of the grid. Figure 3 This explanation uses a specific grid code M as an example to illustrate the multidimensional attribute parameters. The specific content of the multidimensional attribute parameters is not limited in this embodiment.
[0022] S103: Traverse the initial calculation grid of the raster, use a stack structure to perform bottom-up merging judgment on adjacent grids, and obtain the preliminary quadtree grid structure based on the merging judgment result.
[0023] Optionally, a stack structure is used to perform bottom-up merging determination on adjacent grids, and a preliminary quadtree grid structure is obtained based on the merging determination result. This includes: establishing a multidimensional temporary array containing grid levels and grid quadrant affiliations, and using the grid multidimensional temporary array as a stack; establishing an inspection window based on the linear quadtree encoding of the current grid, and reading the accumulated result of the merging determination parameters of the grids within the grid inspection window; writing the specified grids within the grid inspection window to the grid stack based on the accumulated result of the grid merging determination parameters, performing bottom-up merging determination on the grid stack, and obtaining the preliminary quadtree grid structure based on the merging determination result.
[0024] Specifically, in this implementation, a multidimensional temporary array (A, B) is pre-established, and the raster multidimensional temporary array is used as a stack. A corresponds to level L, and B corresponds to quadrant Q4. A check window [M, M+4) is established based on the current grid's linear quadtree encoding. This involves selecting four adjacent small grids in space to form the check window. The merging decision parameter MR of the grids within the check window is read, and the four merging decision parameters are added together to obtain the cumulative result. This cumulative result determines whether the four grids within the check window are initially eligible for merging. If the cumulative result meets specific conditions, it means that the four small grids are preliminarily determined to be merging due to consistent attributes. The grids are then stored in the stack and merged into a larger new grid. The newly generated large grid is then placed back into a higher-level stack to await the next round of merging. This process is repeated continuously, starting from the smallest grid and merging layer by layer until merging is no longer possible. Finally, a preliminary quadtree grid structure is formed. The biggest advantage of this bottom-up merging method using a stack is its extremely high efficiency. It does not need to repeatedly traverse the entire map; it only needs to scan the data once to complete the grid merging in the dynamic process, which greatly saves computer memory and processing time.
[0025] Optionally, the specified grids within the grid inspection window are written to the grid stack based on the accumulated result of the grid merging determination parameters, including: when the accumulated result of the grid merging determination parameters is determined to be 1, it is determined that there are grids with a grid level greater than 1 within the grid inspection window, and the grids with a grid level greater than 1 are stored into the grid stack according to the attribute parameters; when the accumulated result of the grid merging determination parameters is determined to be 2, it is determined that the grid inspection window is located at an irregular boundary and cannot be merged, and the grids within the grid inspection window are recorded in the linear quadtree encoding table according to the encoding; when the accumulated result of the grid merging determination parameters is determined to be 4, it is determined that all grids within the grid inspection window are grids with a grid level of 0, and the grids located within the grid inspection window are stored into the grid stack according to the attribute parameters.
[0026] Among them, such as Figure 4The diagram illustrates the window detection process. The accumulated results mainly include three cases: 1, 2, and 4. When the accumulated result is 1, it indicates that there are grids with a grid level greater than 1 within the grid inspection window. In this case, the grids with a grid level greater than 1 are stored unchanged into the stack according to the attribute parameters, i.e., the unprocessed area, to be processed in subsequent higher-level logic. When the accumulated result is 2, it means that this inspection window is stuck on the irregular edge of the research area, belonging to an edge zone that cannot be merged. Therefore, merging can be completely abandoned, and the small grids are directly recorded as the final detail units in the linear quadtree encoding table. This means that they are the smallest grids and do not need to participate in the subsequent merging process. When the accumulated result is 4, it means that these 4 grids are all the most basic bottom-level small grids (level 0), occupying the four quadrants of space and satisfying the initial conditions for merging. Therefore, these 4 small grids are stored as a whole into the stack according to the attribute parameters, pending subsequent judgment on whether they can be merged into a slightly larger new grid at the next higher level.
[0027] Optionally, a bottom-up merging determination is performed on the grid stack, and a preliminary quadtree grid structure is obtained based on the merging determination result. This includes: determining the water level gradient and wet / dry state of the grid stack from bottom to top; generating a merged grid when the merging condition is met; pushing the merged grid into the corresponding position of the higher-level array and recursively moving upwards; wherein the merging condition is that the wet / dry state of four adjacent grids is consistent, and the maximum water level gradient in the calculation area is less than the set merging threshold; when the grid stack traversal is completed, a preliminary quadtree grid structure is obtained based on the merging result.
[0028] Among them, such as Figure 5The diagram illustrates the mesh merging process. This implementation utilizes a stack, starting with the smallest mesh and working upwards layer by layer to determine which adjacent meshes can be merged into a larger mesh. Strict criteria are established. When deciding whether to merge four adjacent small meshes into one large mesh, the system cannot only consider their spatial proximity; it must also simultaneously meet certain hard indicators, including but not limited to consistent wet / dry conditions and a water level gradient less than a set merging threshold. Consistent wet / dry conditions mean that all four meshes must be either water bodies or land bodies; a situation where half is water and half is land cannot be observed. A water level gradient less than the set merging threshold means that the water level changes in the areas where the four meshes are located must be sufficiently gradual. If the water level difference is too large (e.g., at a steep dam or hydrojump), they cannot be merged into a coarse large mesh to preserve computational accuracy. Once four adjacent meshes meet the merging conditions, the system merges them to generate a new, higher-level merged mesh. This newly generated large mesh is then pushed back into a higher-level array, essentially placing it in the next round of the merging decision process to determine whether it can be merged again with other surrounding large meshes of the same level, becoming even larger. After the entire stack has been traversed from bottom to top, all mergeable meshes have been upgraded and packaged, while those that cannot be merged retain their original fineness, thus forming a preliminary quadtree mesh structure. In this implementation, by setting thresholds for water level gradient and wet / dry conditions, the algorithm can automatically identify where the terrain is flat and requires a large mesh (saving computation), and where the water flow is complex and requires a small mesh (ensuring computational accuracy), thereby generating a preliminary quadtree mesh structure that is both efficient and accurate.
[0029] S104 performs an adaptive split check on the initial quadtree mesh structure, and downgrades the meshes that meet the split conditions to obtain unstructured quadtree meshes.
[0030] Optional, such as Figure 6The diagram illustrates the mesh splitting process. An adaptive splitting check is performed on the initial quadtree mesh structure. Mesh that meet the splitting conditions are downgraded and split to obtain the final unstructured quadtree mesh. This includes: grouping the meshes in the initial quadtree mesh structure into groups according to their hierarchical levels from smallest to largest to obtain a mesh sequence; traversing and checking the mesh sequence, and if the current mesh meets at least one splitting condition, splitting it into four new sub-meshes and storing them in the downgraded mesh group. The mesh splitting conditions include, but are not limited to, a water level gradient greater than a set splitting threshold, being located at a wet-dry boundary, or a hierarchical difference between adjacent meshes greater than 1; identifying and marking the higher-level meshes adjacent to the split current mesh, i.e., the "ripple effect" caused by mesh changes; if the marked higher-level meshes are affected and need to be split, downgraded splitting is performed on the higher-level meshes; when the traversal reaches the highest level, the split initial quadtree mesh structure is used as the final unstructured quadtree mesh.
[0031] Specifically, the bottom-up merging described above aims to improve efficiency by merging the original fine meshes as much as possible. However, in this implementation, to identify omissions and ensure mesh quality meets the requirements of the hydrodynamic model calculation, adaptive splitting is performed. Large meshes, after hydrodynamic simulation of flow field changes, are re-split into smaller meshes to ensure simulation accuracy. The system records all initially generated meshes in ascending order of hierarchy and then checks them layer by layer. During the check, if the current mesh triggers any of the following splitting conditions, it will be split into four smaller sub-meshes (i.e., downgraded splitting). Splitting conditions include, but are not limited to: water level gradient greater than a set splitting threshold, located at a wet-dry boundary, or adjacent mesh hierarchy difference greater than 1. A water level gradient greater than the set splitting threshold indicates a drastic water level drop in this area, which the large mesh cannot accurately reflect. Being located at a wet-dry boundary means the mesh is situated at the land-water interface and must be split smaller to accurately fit the shoreline. An adjacent mesh hierarchy difference greater than 1 ensures computational stability (the "2:1 balance constraint" in quadtrees) and avoids directly adjacent meshes of vastly different sizes. Furthermore, when a grid is split into smaller units, its neighboring, originally larger grids may face the problem of a "level difference greater than 1". Therefore, the algorithm automatically marks these affected high-level neighbors and forces them to be split as well. This mechanism ensures that the entire grid system maintains overall coordination and stability while achieving local refinement. After the system has checked and trimmed all levels of grids, it finally obtains an unstructured quadtree grid that conforms to hydrodynamic calculation standards. This implementation method compensates for the accuracy loss caused by simple merging in the early stages, ensuring that the model can use large grids to save computing power in large, flat areas, while automatically refining the grid in key local areas such as breaches, steep slopes, and water-land boundaries, thus truly achieving a perfect balance between computational efficiency and simulation accuracy.
[0032] The technical solution of this invention effectively solves the bottleneck problems of long preprocessing time and high computational resource consumption in traditional methods when processing high-precision terrain data by adopting a bottom-up merging strategy and decimal Morton coding technology. This technology enables simultaneous terrain preprocessing and mesh generation, significantly reducing memory usage and improving computational efficiency. At the same time, through a dynamic mesh merging and splitting mechanism, it can capture details of local drastic flow field changes while taking into account the overall simulation accuracy of the computational area, achieving efficient, low-consumption, and high-precision hydrodynamic model simulation results.
[0033] Example 2 Figure 7 This is a flowchart of another adaptive mesh generation method for hydrodynamic models provided by an embodiment of the present invention. Based on the above embodiment, after downgrading and splitting the mesh that meets the splitting requirements to obtain an unstructured quadtree mesh, it further includes: performing hydrodynamic model calculations based on the unstructured mesh; for meshes at adjacent different levels, using an interpolation algorithm to obtain the hydrodynamic variables at the interface for flux calculation, such as... Figure 7 As shown, the method includes: S201: Obtain the raster cells of the original terrain in the hydrodynamic model calculation area, convert the raster cells into the initial calculation grid, and encode the initial calculation grid to obtain the linear quadtree code.
[0034] Optionally, the initial computational grid is encoded to obtain a linear quadtree code, including: obtaining the initial row number and initial column number of the grid cell corresponding to the initial computational grid, wherein the initial row number and initial column number are in decimal; converting the initial row number into a decimal row number pseudocode and the initial column number into a decimal column number pseudocode through iterative operations; and generating a decimal linear quadtree code based on the row number pseudocode and column number pseudocode.
[0035] Optionally, the initial computational grid is encoded to obtain a linear quadtree code, including: obtaining the initial row number and initial column number of the grid cell corresponding to the initial computational grid, and converting the initial row number and initial column number into binary row number and binary column number respectively, wherein the initial row number and initial column number are in decimal; cross-sorting the binary row number and binary column number to obtain a binary combination number, and converting the binary combination number into decimal to obtain a linear quadtree code, i.e., Morton code.
[0036] S202 defines the multidimensional attribute parameters of the encoded initial computational grid.
[0037] Optionally, the grid level is the same as the number of times the grid is merged, quadrant assignment is used to indicate the spatial location of the grid, and the merging determination parameter is used to identify whether the grid is the final display unit.
[0038] S203: Traverse the initial computation grid, use a stack structure to perform bottom-up merging judgment on adjacent grids, and obtain the preliminary quadtree grid structure based on the merging judgment result.
[0039] Optionally, a stack structure is used to perform bottom-up merging determination on adjacent grids, and a preliminary quadtree grid structure is obtained based on the merging determination result. This includes: establishing a multidimensional temporary array containing grid level and quadrant affiliation, and using the multidimensional temporary array as a stack; establishing an inspection window based on the linear quadtree encoding of the current grid, and reading the accumulated result of the merging determination parameters of the grids within the inspection window; writing the specified grids within the inspection window to the grid stack based on the accumulated result of the merging determination parameters, performing bottom-up merging determination on the stack, and obtaining the preliminary quadtree grid structure based on the merging determination result.
[0040] Optionally, the specified grids within the inspection window are written to the stack based on the accumulated result of the merging decision parameters, including: when the accumulated result of the merging decision parameters is 1, it is determined that there are grids with a grid level greater than 1 within the inspection window, and the grids with a grid level greater than 1 are stored in the stack according to the attribute parameters; when the accumulated result of the merging decision parameters is 2, it is determined that the inspection window is located at an irregular boundary and cannot be merged, and the grids within the inspection window are recorded in the linear quadtree coding table according to the coding; when the accumulated result of the merging decision parameters is 4, it is determined that all grids within the raster inspection window are grids with a grid level of 0, and the raster grids located within the raster inspection window are stored in the raster stack according to the attribute parameters.
[0041] Optionally, a bottom-up merging determination is performed on the stack, and a preliminary quadtree mesh structure is obtained based on the merging determination result. This includes: determining the water level gradient and wet / dry state of the stack from bottom to top; generating a merged mesh when the merging conditions are met; pushing the merged mesh into the corresponding position of the higher-level array and recursively moving upwards; wherein the merging conditions include, but are not limited to, the wet / dry state of four adjacent meshes being consistent, and the maximum water level gradient within the calculation area being less than a set merging threshold; when the stack traversal is completed, a preliminary quadtree mesh structure is obtained based on the merging result.
[0042] S204 performs an adaptive split check on the initial quadtree mesh structure, and downgrades the meshes that meet the split conditions to obtain unstructured quadtree meshes.
[0043] Optionally, an adaptive splitting check is performed on the initial quadtree mesh structure. Mesh that meet the splitting conditions are downgraded and split to obtain the final unstructured quadtree mesh. This includes: grouping the meshes in the initial quadtree mesh structure into groups according to their hierarchical levels from smallest to largest to obtain a mesh sequence; traversing and checking the mesh sequence; when it is determined that the current mesh meets at least one splitting condition, the current mesh is split into four new sub-meshes, and the sub-meshes are stored in the downgraded mesh group. The mesh splitting conditions include, but are not limited to, a water level gradient greater than a set splitting threshold, being located at a wet-dry boundary, or a hierarchical difference between adjacent meshes greater than 1; identifying the higher-level meshes adjacent to the split current mesh; when it is checked that the identified higher-level meshes are affected and need to be split, the higher-level meshes are downgraded and split; when the traversal check reaches the highest level, the split initial quadtree mesh structure is used as the final unstructured quadtree mesh.
[0044] S205 uses an unstructured quadtree mesh for hydrodynamic model calculations. For meshes at different adjacent levels, an interpolation algorithm is used to obtain the hydrodynamic variables of the suspension point for flux calculation.
[0045] In this embodiment, after obtaining the unstructured quadtree mesh, hydrodynamic model calculations can be performed based on it. Since the previous splitting and checking steps have ensured that the level difference between adjacent meshes does not exceed one level, the mesh size transitions smoothly throughout the computational domain, avoiding the extreme case of a tiny mesh adjacent to a very large mesh, thus simplifying subsequent calculations. Meshes at the same adjacent level are calculated directly, while for meshes at different adjacent levels, interpolation algorithms are used to obtain the hydrodynamic variables of the suspension point for flux calculation. For example... Figure 8 The diagram illustrates the mesh interpolation calculation process. When a large mesh (level L+1) is adjacent to four smaller meshes (level L), two typical geometric configurations will be generated depending on their relative positions. Figure 8 These are the two most basic connection methods shown in the drawing, for example: Figure 8 Align the corner points of the large grid with the midpoints of the edges of the small grid, or Figure 8 b. The midpoint of the edge of the large grid is aligned with the corner point of the small grid, etc., when the hydrodynamic model calculates the water level at the interface of these grids of different sizes. q p When calculating ( ), one cannot simply take the average; instead, the distribution must be based on the weights of the geometric areas. For example, for ( ), Figure 8 a adopt Calculate water level, coefficient Represents in Figure 8 Given a specific geometric arrangement, the influence weights of the surrounding three grids (q1, q2, q3) on the current calculation point (p). Figure 8 b adopts Similarly, to calculate the water level, the coefficient... Represents in Figure 8 b. Under a specific geometric arrangement, the influence weights of the surrounding three grids (q1, q2, q3) on the current calculation point (p). Optionally, after obtaining the hydrodynamic variables of the suspension point through the interpolation algorithm and calculating the flux, the method further includes: checking the flux calculation results and obtaining the check results; when it is determined that the check result is a failure, obtaining the optimization strategy and adjusting the unstructured quadtree grid of the grid according to the grid optimization strategy.
[0046] It should be noted that in this embodiment, after obtaining the flux calculation result, a second check is performed to obtain the check result. If it is determined that the flux calculation result significantly exceeds the normal range or is obviously erroneous, the check will be deemed a failure. For example, a negative water depth is calculated (which is physically impossible). Excessive sudden changes in water flow velocity can cause numerical oscillations or serious deviations in flux conservation. Once a check is determined to be a failure, the system will obtain a preset optimization strategy to locally adjust the current unstructured quadtree mesh. For example, it may further densify the mesh, making the mesh that caused the calculation instability even finer, or smooth the mesh by adjusting the level difference between adjacent meshes to avoid abrupt changes.
[0047] The technical solution of this invention effectively solves the bottleneck problems of long preprocessing time and high computational resource consumption in traditional methods when processing high-precision terrain data by adopting a bottom-up merging strategy and decimal Morton coding technology. This technology enables simultaneous terrain preprocessing and mesh generation, significantly reducing memory usage and improving computational efficiency. At the same time, through a dynamic mesh merging and splitting mechanism, it can capture details of local drastic flow field changes while taking into account the overall simulation accuracy of the computational area, achieving efficient, low-consumption, and high-precision hydrodynamic model simulation results.
[0048] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0049] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. An adaptive mesh generation method for hydrodynamic models, characterized in that, The method includes: Obtain the grid cells of the original terrain in the hydrodynamic model calculation area, convert the grid cells into an initial calculation grid, and encode the initial calculation grid to obtain a linear quadtree code; Define the multidimensional attribute parameters of the encoded initial computational grid, wherein the multidimensional attribute parameters include grid level, quadrant assignment, and merging determination parameters; The initial computational grid is traversed, and a stack structure is used to perform bottom-up merging determination on adjacent grids. Based on the merging determination result, a preliminary quadtree grid structure is obtained. An adaptive split check is performed on the initial quadtree mesh structure, and the meshes that meet the split conditions are downgraded and split to obtain the final unstructured quadtree mesh.
2. The method according to claim 1, characterized in that, The step of encoding the initial computation grid to obtain a linear quadtree code includes: Obtain the initial row number and initial column number of the grid cell corresponding to the initial computation grid, wherein the initial row number and the initial column number are in decimal; The initial row number is converted into a decimal row number pseudocode through iterative calculation, and the initial column number is converted into a decimal column number pseudocode. The decimal linear quadtree code is generated based on the row number pseudocode and the column number pseudocode.
3. The method according to claim 1, characterized in that, The grid level is the same as the number of times the grid is merged, the quadrant assignment is used to indicate the spatial location of the grid, and the merging determination parameter is used to identify whether the grid is the final display unit.
4. The method according to claim 3, characterized in that, The process of using a stack structure to perform bottom-up merging decisions on adjacent grids and obtaining a preliminary quadtree grid structure based on the merging results includes: A multidimensional temporary array containing the grid hierarchy and the quadrant affiliation is created, and the multidimensional temporary array is used as a stack. Establish an inspection window based on the linear quadtree encoding of the current grid, and read the accumulated result of the merging judgment parameters of the grids within the inspection window; Based on the accumulated result of the merging determination parameters, the specified grid in the inspection window is written to the stack, the stack is merged from bottom to top, and the preliminary quadtree grid structure is obtained based on the merging determination result.
5. The method according to claim 4, characterized in that, The step of writing the specified grid within the inspection window to the stack based on the accumulated result of the merging determination parameters includes: When the cumulative result of the merging determination parameter is determined to be 1, it is determined that there is a grid with a grid level greater than 1 in the inspection window, and the grid with a grid level greater than 1 is stored into the stack according to the attribute parameter. When the cumulative result of the merging determination parameter is determined to be 2, it is determined that the inspection window is located at an irregular boundary and cannot be merged. The grid in the inspection window is recorded in the linear quadtree coding table according to the code. When the cumulative result of the merging determination parameter is determined to be 4, it is determined that all the grids in the inspection window are grids with a grid level of 0, and the grids located in the inspection window are stored into the stack according to the attribute parameters.
6. The method according to claim 4, characterized in that, The step of performing a bottom-up merging decision on the stack and obtaining a preliminary quadtree mesh structure based on the merging decision result includes: The stack is evaluated from bottom to top for water level gradient and wet / dry state. When the merging condition is met, a merged grid is generated. The merged grid is pushed into the corresponding position of the higher-level array and recursively moved upwards. The merging condition is that the wet / dry state of four adjacent grids is consistent and the maximum water level gradient in the calculation area is less than the set merging threshold. When the initial grid traversal is completed, the preliminary quadtree grid structure is obtained based on the merging result.
7. The method according to claim 1, characterized in that, The adaptive splitting check of the initial quadtree mesh structure, which involves downgrading and splitting meshes that meet the splitting conditions to obtain the final unstructured quadtree mesh, includes: The grids in the initial quadtree grid structure are grouped and arranged in ascending order of hierarchy to obtain the grid sequence; The grid sequence is grouped and traversed for inspection. When it is determined that the current grid meets at least one splitting condition, the current grid is split into four new sub-grids and the sub-grids are stored in the downgraded grid group. The splitting conditions include water level gradient greater than a set splitting threshold, being located at the dry-wet boundary, or the difference between adjacent grid levels being greater than 1. Identify and mark the higher-level meshes adjacent to the current mesh being split. If the marked higher-level meshes are affected and need to be split, then the higher-level meshes are downgraded and split. When the traversal reaches the highest level, the initial quadtree mesh structure after splitting is used as the final unstructured quadtree mesh.
8. The method according to claim 1, characterized in that, After degrading the mesh that meets the splitting requirements to obtain an unstructured quadtree mesh, the process further includes: Hydrodynamic model calculations are performed based on the aforementioned unstructured quadtree mesh; For grids at adjacent different levels, the hydrodynamic variables of the suspension point are obtained through an interpolation algorithm for flux calculation, wherein the hydrodynamic variables include water level or flow rate.
9. The method according to claim 8, characterized in that, After obtaining the hydrodynamic variables of the suspension point through an interpolation algorithm and calculating the flux, the method further includes: The flux calculation results are checked and the results are obtained. When the inspection result is determined to be an inspection failure, an optimization strategy is obtained, and the unstructured quadtree mesh is adjusted according to the optimization strategy.