An adaptive mesh generation method and device, electronic equipment and storage medium

By using a neural operator model to deduce the water depth prediction field in two-dimensional flood calculation, combining multi-source information to calculate densification index, identifying and densifying key areas, and performing water depth fusion and correction at the boundary between coarse and fine grids, the problems of unstable grid densification and discontinuous boundary in existing technologies are solved, and the stability and reusability of adaptive grids are achieved.

CN121962533BActive Publication Date: 2026-07-21ZHEJIANG YUANSUAN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG YUANSUAN TECH CO LTD
Filing Date
2026-04-03
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing mesh refinement methods are susceptible to numerical noise, causing the refined region to change frequently over time. Furthermore, discontinuities and water conservation issues arise at the boundaries between coarse and fine meshes, making it difficult to output reusable mesh structures for engineering projects.

Method used

A neural operator model is used to extrapolate the water depth prediction field on a coarse grid. A comprehensive densification index is calculated by combining the water depth gradient, the distance to the dike, and the model prediction uncertainty. This index is used to identify the areas to be densified. Water depth fusion and area-weighted averaging are performed at the boundary between coarse and fine grids to ensure physical consistency and water conservation.

Benefits of technology

A stable adaptive densification grid was generated, which reduced the instability of the densification area and ensured the physical consistency and water conservation at the boundary between coarse and fine grids. It can be used for arbitrary flood condition calculations in the target geographical area and solves the problems of instability in the densification area and complex boundary processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962533B_ABST
    Figure CN121962533B_ABST
Patent Text Reader

Abstract

The application provides a self-adaptive grid generation method and device, electronic equipment and storage medium, the method is: obtaining a water depth prediction field through model deduction on a coarse grid; calculating the water depth gradient of the coarse grid, combining the distance to the dike and the prediction uncertainty of the model to weight out the encryption index; generating a subunit by locally encrypting the parent unit to be encrypted according to the encryption index; transferring the water depth on the parent unit to the subunit as the initial water depth, and obtaining a local fine water depth through model deduction on the subunit; at the junction, the local fine water depth is fused with the water depth of the coarse grid; the water depth of the fused subunit is transferred back to the parent unit by area weighted average, and the water depth of the subunit is corrected according to the water depth of the parent unit itself; when the parent unit no longer changes, the grid structure at this time is output. Through the above method, the application embodiment solves the problems of unstable grid encryption area and difficulty in outputting engineering reusable grid.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computational grid generation technology in hydrological and hydrodynamic numerical simulation, and more specifically, to an adaptive grid generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] In two-dimensional flood calculations, the computational grid is the basic carrier for discretizing elements such as topography, river channels, and levees. The fineness of the grid directly determines the simulation accuracy of physical quantities such as flood depth and flow velocity. In order to obtain high-precision results in key areas (such as river channels, levees, and low-lying urban areas) while controlling the overall computational scale, it is necessary to refine the grid.

[0003] Research revealed that existing encryption methods rely on local physical quantities of the water depth gradient for encryption determination. When the physical quantity of a certain unit exceeds a preset threshold, the region is refined. This encryption method is susceptible to numerical noise, causing the refined region to change frequently over time. Summary of the Invention

[0004] In view of this, embodiments of this application provide an adaptive mesh generation method, apparatus, electronic device, and storage medium to solve the technical problems of unstable mesh encryption regions, complex handling of the boundary between coarse and fine meshes, and difficulty in outputting reusable meshes for engineering.

[0005] In a first aspect, embodiments of this application provide an adaptive mesh generation method, the method comprising: On an irregular triangular coarse grid covering the target geographic area, the water depth prediction field for the next moment of the target geographic area is obtained by deducing through a neural operator model. The water depth gradient of each coarse grid cell is calculated based on the water depth prediction field. The comprehensive encryption index is obtained by combining the distance from the coarse grid cell to the dike and the prediction uncertainty of the neural operator model on the coarse grid cell. The coarse grid cells whose comprehensive encryption index exceeds a preset threshold are used as the parent cells to be encrypted. The parent unit to be encrypted is partially encrypted to generate several sub-units, and a correspondence between each sub-unit and its parent unit is established. According to the correspondence, the water depth value of each parent unit is passed to its corresponding child unit as the initial water depth, and the local fine water depth is obtained by deducing through the neural operator model on the child unit. At the junction of the coarse grid cell and the sub-cell, the local fine water depth is merged with the water depth on the coarse grid cell to obtain the merged water depth; According to the correspondence, the portion of the merged water depth located in the sub-unit is transferred back to the parent unit to which the sub-unit belongs by means of area weighted average, and is corrected according to the water depth of all sub-units corresponding to the water depth of the parent unit itself, so that the sum of the water volume of all sub-units corresponding to each parent unit is equal to its own water volume. Repeat the above steps until the parent cell to be encrypted no longer changes, and output the grid structure at this time to perform calculations for any flood condition in the target geographical area based on the grid structure.

[0006] In one feasible implementation, the prediction uncertainty is determined by the following steps: Use the basic information of each coarse grid cell at the current moment as the input to the neural operator model; The neural operator model inference is repeatedly performed on the input, and the random deactivation layer in the model is kept on during the inference process, and random sampling is performed with a preset fixed probability. The variance of the water depth prediction results obtained from multiple inferences on each coarse grid cell is calculated, and the variance is used as the prediction uncertainty of that coarse grid cell.

[0007] In one feasible implementation, the preset threshold includes an entry threshold and an exit threshold that is less than the entry threshold; Using coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells to be encrypted includes: The entry threshold and exit threshold are determined based on the numerical distribution of the comprehensive encryption index of all coarse grid cells at the current moment, and the entry threshold is not less than the preset absolute lower limit threshold. For coarse grid cells whose overall encryption index at the current moment is greater than the entry threshold, their status is marked as the parent cell to be encrypted; For coarse grid cells whose overall encryption index at the current moment is less than the exit threshold, their status is marked as coarse grid cells that do not require encryption. For the coarse grid cells of the comprehensive encryption index at the current moment that are between the entry threshold and the exit threshold, retain the state of the previous moment.

[0008] In one feasible implementation, the step of locally encrypting the parent unit to be encrypted to generate several child units includes: The parent unit to be encrypted is divided into four sub-units of equal area; The method further includes: If the difference in the number of encryptions between any coarse grid cell adjacent to the parent cell to be encrypted and the parent cell is greater than 1, then the adjacent coarse grid cell is encrypted so that the difference in the number of encryptions is less than or equal to 1.

[0009] In one feasible implementation, establishing the correspondence between each sub-unit and its parent unit includes: Establish an interpolation relationship between each sub-unit and its parent unit, which is used to distribute the water depth values ​​at the three vertices of the parent unit to its corresponding sub-units according to the position weight of the sub-unit within the parent unit; Establish a convergence relationship between each parent cell and its child cells, which is used to return the water depth values ​​on the child cells to the parent cells after weighted averaging according to the ratio of the area of ​​the child cell to the area of ​​the parent cell.

[0010] In one feasible implementation, the step of fusing the local fine water depth with the water depth on the coarse grid cell at the boundary between the coarse grid cell and the sub-cell to obtain the fused water depth includes: An overlapping region is defined at the boundary; the overlapping region comprises a portion of coarse grid cells and a portion of sub-cells. For each location to be merged within the overlapping region, a first weight is determined based on a first distance from the location to be merged to its adjacent target sub-cell, and the first weight is negatively correlated with the first distance; a second weight is determined based on a second distance from the location to be merged to its adjacent target coarse grid cell, and the second weight is negatively correlated with the second distance, and the sum of the weights of the first weight and the second weight is 1. The local fine water depth of the target sub-unit, the first weight, and the water depth and second weight of the target coarse grid unit are weighted and summed to obtain the fused water depth of the location to be fused.

[0011] In one feasible implementation, at the boundary between the coarse grid cell and the sub-cell, the local fine water depth is merged with the water depth on the coarse grid cell to obtain the merged water depth. The method further includes: The merged water depth is then subjected to physical consistency correction, which includes at least one of the following: Correct the negative water depth to zero; For units where the water depth is less than the preset wet threshold, set their velocity to zero; At the inflow boundary, the boundary velocity is assigned according to the given flow rate; at the outflow boundary, the water level is fixed; and at the solid wall boundary, the normal velocity is set to zero.

[0012] Secondly, embodiments of this application also provide an adaptive mesh generation apparatus, the apparatus comprising: The extrapolation module is used to extrapolate the water depth prediction field of the target geographic area at the next moment on an irregular triangular coarse grid covering the target geographic area through a neural operator model. The first calculation module is used to calculate the water depth gradient of each coarse grid cell based on the water depth prediction field, and to obtain a comprehensive encryption index by combining the distance from the coarse grid cell to the dike and the prediction uncertainty of the neural operator model on the coarse grid cell. The determination module is used to identify coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells to be encrypted. The encryption module is used to partially encrypt the parent unit to be encrypted, generate several sub-units, and establish the correspondence between each sub-unit and its parent unit. The second calculation module is used to pass the water depth value of each parent unit to its corresponding child unit as the initial water depth according to the correspondence, and to obtain the local fine water depth by deducing through the neural operator model on the child unit. The fusion module is used to fuse the local fine water depth with the water depth on the coarse grid cell at the junction of the coarse grid cell and the sub-cell to obtain the fused water depth. The feedback correction module is used to transmit the portion of the fused water depth located in the sub-unit back to the parent unit to which the sub-unit belongs by means of the area weighted average according to the correspondence relationship, and to correct the water depth of all sub-units corresponding to the water depth of the parent unit itself, so that the sum of the water volume of all sub-units corresponding to each parent unit is equal to its own water volume. The output module is used to repeat the above steps until the parent unit to be encrypted no longer changes, and output the grid structure at this time, so as to perform calculations for any flood condition in the target geographical area based on the grid structure.

[0013] In one feasible implementation, the prediction uncertainty is determined by the following steps: Use the basic information of each coarse grid cell at the current moment as the input to the neural operator model; The neural operator model inference is repeatedly performed on the input, and the random deactivation layer in the model is kept on during the inference process, and random sampling is performed with a preset fixed probability. The variance of the water depth prediction results obtained from multiple inferences on each coarse grid cell is calculated, and the variance is used as the prediction uncertainty of that coarse grid cell.

[0014] In one feasible implementation, the preset threshold includes an entry threshold and an exit threshold that is less than the entry threshold; The determining module is used to select coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells to be encrypted, including: The entry threshold and exit threshold are determined based on the numerical distribution of the comprehensive encryption index of all coarse grid cells at the current moment, and the entry threshold is not less than the preset absolute lower limit threshold. For coarse grid cells whose overall encryption index at the current moment is greater than the entry threshold, their status is marked as the parent cell to be encrypted; For coarse grid cells whose overall encryption index at the current moment is less than the exit threshold, their status is marked as coarse grid cells that do not require encryption. For the coarse grid cells of the comprehensive encryption index at the current moment that are between the entry threshold and the exit threshold, retain the state of the previous moment.

[0015] In one feasible implementation, the encryption module is used to perform partial encryption on the parent unit to be encrypted, generating several child units, including: The parent unit to be encrypted is divided into four sub-units of equal area; The device further includes: An extended encryption module is used to encrypt the adjacent coarse grid cell if the difference in the number of encryptions between any adjacent coarse grid cell and the parent cell is greater than 1, so that the difference in the number of encryptions is less than or equal to 1.

[0016] In one feasible implementation, the encryption module is used to establish the correspondence between each sub-unit and its parent unit, including: Establish an interpolation relationship between each sub-unit and its parent unit, which is used to distribute the water depth values ​​at the three vertices of the parent unit to its corresponding sub-units according to the position weight of the sub-unit within the parent unit; Establish a convergence relationship between each parent cell and its child cells, which is used to return the water depth values ​​on the child cells to the parent cells after weighted averaging according to the ratio of the area of ​​the child cell to the area of ​​the parent cell.

[0017] In one feasible implementation, the fusion module is used to fuse the local fine water depth with the water depth on the coarse grid cell at the boundary between the coarse grid cell and the sub-cell to obtain a fused water depth, including: An overlapping region is defined at the boundary; the overlapping region comprises a portion of coarse grid cells and a portion of sub-cells. For each location to be merged within the overlapping region, a first weight is determined based on a first distance from the location to be merged to its adjacent target sub-cell, and the first weight is negatively correlated with the first distance; a second weight is determined based on a second distance from the location to be merged to its adjacent target coarse grid cell, and the second weight is negatively correlated with the second distance, and the sum of the weights of the first weight and the second weight is 1. The local fine water depth of the target sub-unit, the first weight, and the water depth and second weight of the target coarse grid unit are weighted and summed to obtain the fused water depth of the location to be fused.

[0018] In one feasible implementation, the device further includes: The correction module is used to merge the local fine water depth with the water depth on the coarse grid cell at the boundary between the coarse grid cell and the sub-cell, and then perform physical consistency correction on the merged water depth to obtain the merged water depth. The physical consistency correction includes at least one of the following: Correct the negative water depth to zero; For units where the water depth is less than the preset wet threshold, set their velocity to zero; At the inflow boundary, the boundary velocity is assigned according to the given flow rate; at the outflow boundary, the water level is fixed; and at the solid wall boundary, the normal velocity is set to zero.

[0019] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the adaptive mesh generation method as described in any one of the first aspects.

[0020] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the adaptive mesh generation method as described in any one of the first aspects.

[0021] This application provides an adaptive mesh generation method, apparatus, electronic device, and storage medium. This application uses a neural operator model to deduce a water depth prediction field on a coarse mesh, and calculates a comprehensive encryption index that integrates water depth gradient, dike distance, and model prediction uncertainty based on the prediction field. The encryption index is used to identify the area to be encrypted and perform local encryption. Compared with the encryption method in the prior art that relies on a single physical quantity threshold, it can more stably identify key areas and reduce the problem of frequent changes in the encrypted area caused by numerical noise.

[0022] By performing water depth fusion at the junction of coarse and sub-cells, and then transferring the fused sub-cell water depth back to the parent cell for water volume correction using an area-weighted average, the sum of the water volumes of all sub-cells corresponding to each parent cell is equal to the water volume of the parent cell itself. Compared with the numerical discontinuity and water volume non-conservation problems that easily occur at the junction of coarse and fine grids in the prior art, the embodiments of this application can ensure the physical consistency and water volume conservation at the junction of coarse and fine grids.

[0023] By repeating the above steps until the parent unit to be encrypted no longer changes, the mesh structure at this time is output. Compared with the existing technology where the mesh structure changes dynamically with the current working conditions and is difficult to reuse, the embodiments of this application can generate a stable adaptive encrypted mesh. This mesh can be directly used for calculation of any flood working conditions in the target geographical area, solving the technical problems of unstable mesh encryption area, complex handling of the boundary between coarse and fine meshes, and difficulty in outputting reusable meshes in the existing technology.

[0024] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0025] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 A flowchart of an adaptive mesh generation method provided in an embodiment of this application is shown.

[0027] Figure 2 A flowchart of another adaptive mesh generation method provided in an embodiment of this application is shown.

[0028] Figure 3 A schematic diagram of the structure of an adaptive mesh generation device provided in an embodiment of this application is shown.

[0029] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0031] In two-dimensional flood simulation, the computational grid serves as the fundamental carrier for discretizing elements such as topography, river channels, and levees. The grid's fineness directly determines the simulation accuracy of physical quantities like flood depth and flow velocity. In scenarios involving watershed flood evolution, urban flooding, and levee breaches, key areas (such as river channels, levees, and low-lying urban areas) often require higher spatial resolution to accurately depict the flood evolution process. However, using a uniform high-resolution grid across the entire computational domain would result in excessively large grid sizes and high computational costs, making it difficult to meet the needs of practical engineering applications. Therefore, it is necessary to control the overall grid size while ensuring accuracy in key areas, which necessitates adaptive grid refinement methods.

[0032] In the design of adaptive mesh refinement methods, accurately identifying the key areas requiring refinement is a primary concern. Since water depth changes during flood evolution are influenced by multiple factors such as topography, roughness, and boundary conditions, relying solely on local physical quantities like the current water depth gradient for determination can lead to frequent changes in the refinement area over time when local fluctuations occur in the flood's evolution. This instability not only increases the computational burden but also causes discontinuities and water conservation issues at the boundaries between coarse and fine meshes. Therefore, a refinement determination mechanism capable of integrating multi-source information and stably identifying key areas is needed.

[0033] After determining the encryption region, another problem to be solved is how to achieve a smooth transition between coarse and fine meshes under irregular triangular mesh conditions. Due to the complex topological structure of irregular triangular meshes, directly refining the encryption region can easily lead to geometric nonconformity and numerical oscillations at the boundary between coarse and fine meshes. At the same time, the transfer of physical quantities between coarse and fine meshes must also ensure conservation and consistency; otherwise, long-term calculations will result in accumulated errors. Therefore, a complete coarse-fine mesh coupling mechanism needs to be established to achieve bidirectional transfer of physical quantities and smooth fusion at the boundary.

[0034] Furthermore, if the final grid structure is highly dependent on the current flood conditions, then when different flood scenarios (such as floods of different frequencies or different upstream flow conditions) need to be evaluated, the grid usually needs to be refined and recalculated again, increasing modeling and computational costs. Therefore, a stable and reusable grid structure is needed, which can be directly used for calculations of any flood conditions in the target geographic area.

[0035] Based on this, embodiments of this application provide an adaptive mesh generation method, apparatus, electronic device, and storage medium, which can fuse multi-source information to stably identify encrypted regions, achieve conformal coupling and conservation correction of coarse and fine meshes, and ultimately output a reusable mesh structure. The following is a description through embodiments.

[0036] To facilitate understanding of this embodiment, a detailed description of the adaptive mesh generation method disclosed in this application embodiment will be provided first. For example... Figure 1 As shown, it includes the following steps: Step 101: On the irregular triangular coarse grid covering the target geographic area, the water depth prediction field for the next moment of the target geographic area is obtained by deducing through a neural operator model.

[0037] This step first constructs an irregular triangular coarse grid covering the target geographical area, and then uses a neural operator model to deduce the water depth prediction field of the area at the next moment, providing global background information for the subsequent identification of encrypted areas.

[0038] The target geographic area refers to the specific spatial range within which flood calculations need to be performed. Its delineation is typically based on practical engineering needs, such as a watershed prone to flooding, an urban area requiring risk assessment, or a levee protection zone requiring monitoring. The determination of the regional boundary can comprehensively consider factors such as river network distribution, administrative divisions, topographic watersheds, or the scope of engineering concern. From a data perspective, the region needs complete spatial information including topographic elevation, land use or roughness zoning, river centerlines, and levee lines, as well as boundary forcing data such as upstream inflow and downstream water levels. From a computational perspective, the selection of the regional scope should, while ensuring coverage of key areas, control the overall calculation scale as much as possible to improve computational efficiency.

[0039] The acquired basic data includes: topographic elevation data to form a topographic elevation field; land use or roughness zoning data to form a roughness field; vector data of river centerlines, levee lines, and water-blocking or diverting elements such as roads and buildings; and external forcing data as boundary input, consisting of upstream inflow processes and downstream water level processes. After completing data coordinate unification, temporal alignment, and spatial clipping, the two-dimensional computational domain and its boundaries are determined based on river network distribution, administrative divisions, or topographic boundaries, and the boundary types are labeled, including inflow boundaries, outflow boundaries, and solid wall boundaries. Initial states are also set, with the initial water depth calculated from the difference between the initial water level and topographic elevation, and the initial velocity set to zero.

[0040] The coarse mesh serves as the basic framework for the entire calculation process. Its cell size is relatively large, and it is mainly used to quickly obtain the hydrodynamic background field of the entire area. The coarse mesh can be generated using methods such as constrained Delaunay triangulation, incorporating features such as topography, river channels, and levees as constraint lines into the mesh to ensure that the geometric boundaries and engineering features are strictly aligned on the mesh.

[0041] The neural operator model is a surrogate model that can directly run on irregular triangular mesh topologies. It uses the irregular triangular mesh as the computational carrier, treating each mesh cell as a node in a graph structure, and adjacent cells sharing common edges as interconnected adjacency nodes, thus constructing a computational graph structure consistent with the computational domain topology. The state vector of each mesh cell includes water depth and velocity components, and static parameters include topographic elevation, roughness, and cell centroid coordinates. The neural operator model is obtained through offline training, with parameters remaining fixed and unupdated during the online inference phase. Offline training data is constructed from a historical flood event database, including at least observation sequences from hydrological and rainfall stations and inundation information retrieved from remote sensing. Spatial fusion and assimilation interpolation are used to reconstruct the time-series labels of water depth and velocity at the mesh cell scale. The training process uses the current cell state, static parameters, and boundary forcing information as input, and the next cell state as output for supervised learning. Mass and momentum conservation constraints can be introduced to improve physical consistency and rolling stability.

[0042] After the coarse grid is generated, time-progressive inference is performed using a pre-trained neural operator model. During the inference phase, the neural operator model receives the current physical field as input and uses its learned evolutionary operators to generate the predicted physical field for the next time step. Through this process, this step quickly obtains the predicted water depth field for the target geographic area at the next time step on the coarse grid. This predicted field reflects the flood evolution trend of the entire area, providing global background information for the subsequent identification of denser areas.

[0043] Step 102: Calculate the water depth gradient of each coarse grid cell based on the water depth prediction field, and combine the distance from the coarse grid cell to the dike and the prediction uncertainty of the neural operator model on the coarse grid cell to obtain a weighted comprehensive encryption index.

[0044] This step, based on the generated coarse grid, calculates a comprehensive densification index for each coarse grid cell according to the water depth prediction field. This index quantifies the degree of densification required for that cell. It integrates three aspects of information: the physical sensitivity during flood evolution, the specific requirements of the engineering focus area, and the surrogate model's own understanding of the prediction results.

[0045] First, a coarse global grid is constructed within the defined two-dimensional computational domain using a constrained irregular triangular mesh generation method. This method incorporates domain boundary lines, river channel lines, levee lines, and water-blocking lines as constraint elements into the grid to ensure strict alignment of geometric boundaries and engineering line elements on the grid. During grid generation, the geometric information, adjacency relationships, and boundary markers of each grid cell are recorded for subsequent calculations of gradients, fluxes, or adjacent propagation relationships. The target side length of the coarse grid can be differentiated according to the characteristics of different sub-regions. For example, for areas requiring higher precision, such as river buffer zones, the target side length can be scaled proportionally to improve the geometric representation accuracy of the main channel. This partitioning approach allows for control of the overall grid size while maintaining resolution in key areas. After grid generation, parameters such as terrain elevation and roughness are projected onto the nodes of the coarse grid cells, forming parameter representations on the coarse grid. Through this process, each coarse grid cell contains complete parameter data and topological attributes, and all subsequent calculations of encryption indicators, neural operator inference, and coarse-fine grid fusion operations are based on this data structure.

[0046] After obtaining the water depth prediction field on the coarse grid, this step begins by calculating the comprehensive refinement index for each coarse grid cell. The first is the water depth gradient, which reflects the degree of spatial variation in water depth near the cell. Areas with large water depth gradients typically correspond to key locations such as flood fronts, steep river slopes, or inundation boundaries. On a triangular grid, the water depth gradient can be obtained by least-squares fitting of the water depth values ​​of the cell and its neighboring cells. When a cell has a large water depth gradient, it means that the hydraulic changes in that area are more drastic, requiring a higher spatial resolution for accurate characterization.

[0047] Assume the water depth gradient of the e-th unit is: It includes the rate of change of water depth in two spatial directions (usually east and north).

[0048] Therefore, the magnitude (modulus) of the water depth gradient can be represented by the L2 norm of the vector, that is, the magnitude of the water depth gradient can be expressed as:

[0049] Secondly, the distance from the unit to the dike is considered. Dikes are critical facilities in flood control projects, and the evolution of floodwaters near them directly affects the safety and risk assessment of the project. Regardless of the magnitude of the water depth gradient, the area near the dike usually requires high calculation accuracy. Therefore, this step uses the distance from the unit's centroid to the nearest dike line as an indicator. When the unit is within the preset dike buffer distance range, this indicator is given a higher weight, forcing that area into the high-precision calculation range.

[0050] Here, with This represents the engineering risk component, whose value is expressed as the distance from the unit centroid to the nearest levee. Decision, when ≤ When (at the preset levee buffer distance), Set it to 1 otherwise set it to 0, thereby encrypting the units that are close to the defense to enable high-precision calculations.

[0051] The third term is the prediction uncertainty of the neural operator model. Prediction uncertainty refers to the confidence level of a neural operator model in its predictions at a specific spatial unit location, used to measure the reliability and stability of the predicted values. While surrogate models can generally fit physical laws well, they may exhibit low prediction confidence in certain areas, such as regions with complex terrain, sparse training data, or drastically changing boundary conditions. This step measures this uncertainty by statistically analyzing the variance of the prediction results through multiple randomized forward inferences. When the model's prediction results fluctuate significantly in a certain region, it indicates that the model's judgment of the hydrodynamic state in that region is unstable or lacks sufficient training samples, suggesting a high prediction risk in that region. Incorporating this uncertainty into the encryption index can trigger local refinement in regions where the physical gradient is not significant but the model's prediction reliability is low, thereby improving the overall robustness and engineering safety of the simulation.

[0052] Comprehensive encryption indicators It is formed by weighted fusion of three components, as shown in the following formula:

[0053] in, , , These are pre-set constant weights used to measure the influence of different components on the refinement decision; the sum of the three is 1. It can be seen that: the first term is the water depth gradient modulus. The first term, obtained through neighborhood least squares fitting, reflects the degree of spatial variation of the physical quantity; the second term is the engineering risk component. The value is determined by the distance from the unit's centroid to the nearest levee line. This value is 1 when the unit is within the preset levee buffer distance, and 0 otherwise. The third term is the prediction uncertainty component. It is obtained by repeatedly performing neural operator inference on the same input and statistically analyzing the variance of the water depth prediction results.

[0054] The reason for obtaining the comprehensive densification index by weighted summation of these three components is as follows: (1) According to the basic principles of hydrodynamics, the water depth gradient modulus is a classical physical quantity that characterizes the degree of drastic change in the spatial flow of water. The larger the gradient, the more complex the flow field, the more significant the topographic changes, and the more obvious the flood front or wet-dry alternation. For areas with drastic changes in physical quantities, it is obvious that the calculation accuracy and numerical stability can be guaranteed by increasing the grid resolution. (2) According to the safety control principle of flood control projects, the dike is the core safety facility of flood control projects. The simulation accuracy of the area near the dike is directly related to the judgment of flood control risk and the safety of the project. According to the general requirements of water conservancy engineering design and numerical simulation, the grid should be densified in key sensitive areas of the project to ensure the accuracy of the calculation in key areas. Therefore, including the engineering risk component related to the distance of the dike in the densification index is in line with the basic requirements of engineering safety and has clear engineering significance. (3) According to the theory of uncertainty analysis of numerical simulation, the model prediction uncertainty reflects the degree of dispersion and confidence level of the model prediction results. The higher the prediction uncertainty, the lower the reliability of the prediction in the area, and the more necessary it is to improve the local resolution by densifying the grid to compensate for the accuracy. Therefore, using prediction uncertainty as a encryption factor can improve the reliability and robustness of the overall simulation.

[0055] It is evident that a larger water depth gradient modulus indicates more drastic spatial variations in water flow, necessitating finer mesh refinement to ensure simulation accuracy. A value of 1 for the engineering risk component indicates that the cell is located near a dike, belonging to a critical flood control safety area, requiring further refinement to meet engineering requirements. A higher model prediction uncertainty indicates less reliable predictions in that area, necessitating finer mesh refinement to improve computational reliability. An increase in the value of each of these three components signifies a greater need for mesh refinement in that cell.

[0056] Therefore, the comprehensive encryption index, obtained by weighted summing of the three components, can comprehensively assess the necessity of encryption for a grid cell from three dimensions: physical change, engineering risk, and model reliability. An increase in the value of each component will correspondingly increase the comprehensive encryption index, collectively reflecting the degree of encryption requirement for that grid cell. A higher index indicates a more urgent encryption need. When the comprehensive encryption index exceeds a preset threshold, the coarse grid cell is encrypted. This design logic is reasonable and conforms to the basic principles and engineering practices of hydrodynamic simulation and adaptive grid encryption. Technical personnel in the relevant field can implement it based on the above explanation.

[0057] The weighting coefficients can be adjusted according to actual engineering needs. For example, the weight of engineering risk items can be appropriately increased in areas with dense dikes, and the weight of uncertainty items can be increased in areas with complex terrain. Compared with judging by a single physical quantity threshold, this multi-indicator fusion method can more comprehensively and stably identify key areas that need to be encrypted.

[0058] Step 103: Use the coarse grid cells whose comprehensive encryption index exceeds the preset threshold as the parent cells to be encrypted.

[0059] This step uses the coarse-grid water depth prediction field obtained in step 101 as input, calculates the comprehensive densification index for each coarse-grid cell, and determines the parent cell to be densified by threshold comparison.

[0060] After obtaining the comprehensive encryption index of each coarse grid cell, this step determines the parent cell to be encrypted through threshold comparison. Several strategies can be used to determine the preset threshold: one is to use a fixed threshold, that is, to set a uniform value based on experience or engineering requirements. Cells with comprehensive encryption indices exceeding this value are marked as parent cells to be encrypted. This method is suitable for scenarios with clear requirements on the encryption area, such as unconditionally encrypting cells within a specified range around a dike. Another approach is to use an adaptive threshold, that is, to dynamically determine the threshold based on the statistical distribution of the comprehensive encryption indices of all coarse grid cells at the current moment. For example, cells with the highest index values ​​are selected as the objects to be encrypted. This method can automatically adjust the encryption range according to the overall index distribution, avoiding over-refinement when the overall index is generally low.

[0061] In practical applications, multiple strategies can be combined for comprehensive judgment. For example, for critical areas of engineering projects such as dikes, a forced encryption strategy can be adopted, using all areas as parent units to be encrypted regardless of their index levels; for other areas, an adaptive threshold is used for filtering. This hierarchical processing method can effectively control the overall grid size while ensuring engineering safety.

[0062] It should be noted that the parent unit to be encrypted in this step is a dynamic set, and the units in this set may change as the flood evolves and the comprehensive encryption indicators change.

[0063] Step 104: Perform local encryption on the parent unit to be encrypted to generate several sub-units, and establish the correspondence between each sub-unit and its parent unit.

[0064] After determining the parent units to be encrypted, this step performs local encryption on these parent units, subdividing them into smaller sub-units, and establishing the correspondence between them, laying the foundation for subsequent physical quantity transfer and conservation correction.

[0065] The specific implementation method of local encryption can be selected according to the mesh type and application requirements. In an irregular triangular mesh, a typical encryption method is to divide the parent cell to be encrypted into four child cells of equal area.

[0066] In other words, each parent unit to be encrypted is subdivided in a 1:4 ratio. Specifically, the midpoints of the three sides of the parent unit can be taken, and the three midpoints can be connected sequentially to divide the original triangle into four sub-triangles of equal area. This subdivision method can preserve the geometry of the original unit while generating a regular sub-unit structure, which facilitates subsequent numerical calculations and data processing.

[0067] Furthermore, during the refinement process, special attention needs to be paid to the geometric consistency at the boundary between coarse and fine meshes. If only the parent cell to be refined is subdivided, while the adjacent coarse mesh cells remain unchanged, dangling nodes may appear at the boundary, meaning there are nodes on the edges of fine cells but no corresponding nodes on the edges of adjacent coarse cells, resulting in non-conformal meshes. To address this issue, the method further includes: If the difference in the number of encryptions between any coarse grid cell adjacent to the parent cell to be encrypted and the parent cell is greater than 1, then the adjacent coarse grid cell is encrypted so that the difference in the number of encryptions is less than or equal to 1.

[0068] In other words, this step introduces a refinement level constraint for adjacent cells: the difference in refinement level between adjacent cells must not exceed one level. When a parent cell needs refinement, the refinement count of its adjacent coarse-grid cells is checked. If the difference between the two is greater than 1, the adjacent cells are also refined until the refinement level of all adjacent cells meets the requirement. This constraint ensures that coarse and fine grids share nodes at the boundary, forming a continuous computational grid and avoiding numerical problems caused by non-conformal grids.

[0069] After encryption, this step establishes the correspondence between each sub-cell and its parent cell. This correspondence is bidirectional: on the one hand, it records the parent cell of each sub-cell, meaning each fine cell knows which coarse cell it was subdivided from; on the other hand, it records the sub-cells contained in each parent cell, meaning each coarse cell knows which fine cells it has been subdivided into. This bidirectional indexing mechanism provides a clear path for subsequent physical quantity transfer: when physical quantities need to be transferred from the coarse mesh to the fine mesh, the corresponding sub-cell can be found through the parent-child relationship; when physical quantities need to be aggregated from the fine mesh back to the coarse mesh, an area-weighted average can be performed through the parent-child relationship.

[0070] It should be noted that a 1:4 subdivision ratio is only a preferred encryption method. In practical applications, other subdivision strategies can be used, or multi-level encryption can be implemented according to specific needs. Regardless of the encryption method used, establishing a clear parent-child relationship is crucial to ensuring the correctness of subsequent calculations. This relationship is similar to a "grid household registration book," recording the genealogical information of grid evolution, enabling physical quantities to be accurately transferred between different grid levels.

[0071] Step 105: According to the correspondence, the water depth value of each parent unit is passed to its corresponding child unit as the initial water depth, and the local fine water depth is obtained by deducing through the neural operator model on the child unit.

[0072] After establishing the correspondence between parent and child cells, this step first uses this relationship to transfer the physical information on the coarse grid to the newly generated child cell (also known as the fine grid), providing initial conditions for local calculations on the fine grid. Then, high-resolution time advancement is performed on the fine grid using a neural operator model to obtain the local hydrodynamic field with higher spatial resolution within the area covered by the child cell.

[0073] The core of transferring physical quantities from parent to child cells lies in how to rationally distribute the known water depth values ​​on the coarse mesh to the various child cells of the fine mesh. Since the child cells are generated within the parent cell through subdivision, they are spatially entirely within the parent cell's coverage area. Therefore, the initial state of the child cells should maintain spatial consistency with the current state of the parent cell. A typical method to achieve this transfer is position-based interpolation. Specifically, each child cell can obtain water depth information from the three vertices of the parent cell by interpolating its barycentric coordinates based on the relative position of its geometric center within the parent cell. Each of the three vertices of the parent cell stores a water depth value; the closer the child cell is to a particular vertex, the greater the contribution of that vertex's water depth value to the child cell's initial value. This interpolation method ensures that the initial water depth inherited by the child cells transitions smoothly within the parent cell, avoiding artificial jumps caused by mesh refinement.

[0074] After assigning the initial water depth, the newly generated sub-cells possess the initial conditions for independent computation. Subsequently, this step again invokes the neural operator model for time advancement on these fine-mesh cells. It is worth noting that the neural operator model used here has the same structure and parameters as the model used on the coarse mesh in step 101. On the coarse mesh, the neural operator directly acts on the global coarse-resolution triangular mesh to obtain the global background hydrodynamic field for the next time step; within the fine-mesh region generated in step 104, the neural operator with the same structure and parameters acts on the locally refined subdivided triangular mesh, thereby obtaining a high-resolution locally enhanced hydrodynamic field. By sharing operator parameters across different resolution meshes, the surrogate model maintains consistency and transferability between coarse and fine scales. Inference within the fine-mesh region uses the same operator structure and the same set of shared parameters as the coarse mesh, and reconstructs the computation graph using the adjacency topology of the fine mesh, thus ensuring consistency in dynamic mapping between the coarse and fine scales; simultaneously, boundary forcing information is input using a unified encoding method, ensuring that inference at different resolutions remains homogeneous in terms of external driving forces.

[0075] This means that the same set of learned physical evolution laws can be used to quickly extrapolate the global background field on a coarse grid, and also to finely characterize local hydrodynamic features on a fine grid. The model is applicable to grids of different resolutions because its core mechanism is based on information aggregation through the adjacency relationships between cells, rather than relying on a fixed grid scale. In the fine-grid region, the model reconstructs the computational graph using the adjacency topology of sub-cells. The state vectors, static parameters, and unified boundary forcing information of the sub-cells are used as inputs. Through neighborhood information aggregation and message passing, the model ultimately outputs physical quantities such as water depth and flow velocity of the sub-cell at the next moment, thus obtaining a local fine-grained water depth field.

[0076] Through the above process, this step achieves a division of labor between using a coarse grid to extrapolate background trends and a fine grid to depict local details. The calculation speed on the coarse grid is fast, enabling rapid capture of the flood evolution trend across the entire region; while the calculation on the fine grid, although covering only key areas, provides higher spatial resolution, ensuring the calculation accuracy of sensitive locations such as river channels, levees, and towns. This coarse-fine collaborative calculation mechanism effectively improves the ability to depict hydrodynamic processes in key areas while maintaining overall computational efficiency.

[0077] Step 106: At the junction of the coarse grid cell and the sub-cell, the local fine water depth is merged with the water depth on the coarse grid cell to obtain the merged water depth.

[0078] At the boundary between coarse and sub-grid cells, the calculated water depth values ​​may differ due to the different grid resolutions on both sides. Direct use of these values ​​could lead to discontinuities in the physical field. This step performs a fusion process at the boundary to ensure a smooth transition of the water depth values ​​on both sides, avoiding numerical oscillations caused by abrupt grid changes.

[0079] For example, this can be achieved through the following steps: First, an overlapping region is defined at the boundary; the overlapping region contains some coarse grid cells and some sub-cells.

[0080] These units together constitute the transition zone for the fusion operation. The specific range of this zone can be determined according to actual needs. For example, units within a certain range near the boundary of the sub-unit region can be selected as the overlapping area.

[0081] Secondly, for each position to be merged within the overlapping area, a first weight is determined based on the first distance from the position to be merged to its adjacent target sub-unit, and the first weight is negatively correlated with the first distance; a second weight is determined based on the second distance from the position to be merged to its adjacent target coarse grid unit, and the second weight is negatively correlated with the second distance, and the sum of the weights of the first weight and the second weight is 1.

[0082] The location to be merged here can be the cell center, node, or other location where water depth needs to be calculated. For each location to be merged, its neighboring target sub-cells and target coarse mesh cells are identified, and the distance from that location to these neighboring cells is calculated respectively.

[0083] Based on this, weights are determined according to distance. For each target sub-cell, a first weight is determined based on the first distance from the location to be merged to that sub-cell; this weight is negatively correlated with distance, meaning the closer the distance, the greater the weight. For each target coarse grid cell, a second weight is determined based on the second distance from the location to be merged to that coarse grid cell; this weight is also negatively correlated with distance. Simultaneously, the sum of the weights of all sub-cells participating in the fusion and the weight of the coarse grid cell is 1, ensuring that the weighted average water depth value is within a reasonable range.

[0084] Finally, the local fine water depth of the target sub-unit and the first weight, as well as the water depth and the second weight of the target coarse grid unit, are weighted and summed to obtain the water depth of the fused position.

[0085] That is, after obtaining the weights, the local fine water depths on each target sub-cell adjacent to the fusion location are weighted and summed with the corresponding first weight, and the water depths on each target coarse mesh cell are weighted and summed with the corresponding second weight to obtain the fused water depth at that location. This calculation process can be expressed as: The fused water depth = Σ(sub-unit water depth × sub-unit weight) + Σ(coarse unit water depth × coarse unit weight).

[0086] Taking the example of a location to be merged being adjacent to a sub-cell and a coarse mesh cell, the merging process can be understood more intuitively.

[0087] Assumptions: The local fine water depth on sub-cell 1 is 5.2 meters, the water depth on coarse grid cell 1 is 4.8 meters, the distance from the location to be merged to sub-cell 1 is 2 meters, and the distance from the location to be merged to coarse grid cell 1 is 8 meters.

[0088] Weights are determined based on distance (the closer the distance, the greater the weight). The total distance is 10 meters, therefore: The weight of sub-cell 1 is 8 ÷ 10 = 0.8 (small distance, large weight), and the weight of coarse grid cell 1 is 2 ÷ 10 = 0.2 (large distance, small weight).

[0089] The water depth after merging at the location to be merged is 5.2 × 0.8 + 4.8 × 0.2 = 4.16 + 0.96 = 5.12 meters.

[0090] As can be seen, since the location to be merged is closer to sub-unit one, the fusion result adopts more of the detailed calculation results of the sub-unit (5.2 meters). The final water depth of 5.12 meters is between the two and biased towards one side of the sub-unit, achieving a smooth transition at the boundary.

[0091] This weighted averaging method achieves a smooth transition in water depth at the boundary. By employing this approach, the water depth at each location within the overlapping region comprehensively considers the contributions of its surrounding sub-cells and coarse-grid cells. Locations closer to the sub-cell region have a greater weight, resulting in a fusion result that more closely resembles the refined calculations of the fine-grid area; conversely, locations farther from the sub-cell region have a greater weight for the coarse-grid cells, leading to a fusion result that more closely resembles the background field of the coarse-grid area. This distance-based weighted fusion mechanism ensures a smooth and continuous change in water depth from the fine-grid region to the coarse-grid region, effectively suppressing numerical artifacts and computational instability that may be caused by differences in grid resolution.

[0092] It should be noted that there are several ways to determine the fusion weights. One typical approach is to use a linear transition, where the weights change linearly with distance; another approach is to use smooth curves such as cosine functions to make the weight changes more gradually at the boundary. Regardless of the form used, the core idea is to ensure that the fused water depth is spatially continuous and smooth, thereby maintaining the stability of the numerical calculation.

[0093] Step 107: According to the correspondence, the portion of the merged water depth located in the sub-unit is transferred back to the parent unit to which the sub-unit belongs by area-weighted average, and the water depth of all sub-units corresponding to the parent unit is corrected so that the sum of the water volume of all sub-units corresponding to each parent unit is equal to its own water volume.

[0094] After completing the water depth fusion at the interface, the fused water depth values ​​have been obtained on the sub-cells. This step first transfers these fusion results from the sub-cells back to their parent cells, and then corrects the water depth of all sub-cells according to the principle of water conservation to ensure water consistency between coarse and fine meshes.

[0095] Based on the previously established parent-child correspondence, each child cell knows which parent cell it belongs to, and each parent cell knows which child cells it contains. Using this relationship, the merged water depths across all child cells corresponding to each parent cell are averaged using area weighting to obtain the updated water depth for that parent cell. Specifically, for each parent cell, the water depths of all its child cells are multiplied by their respective areas, summed, and then divided by the total area of ​​the parent cell to obtain the new water depth for that parent cell. This area-weighted averaging method ensures that the spatial distribution characteristics of physical quantities are preserved when merging from a fine mesh to a coarse mesh.

[0096] After merging, the water depth of the sub-cells needs to be corrected for water conservation. This step aims to ensure that, from a coarse-grid scale, the total water volume corresponding to each parent cell is consistent with the total water volume accumulated from the fine-grid scale. In actual calculations, due to numerical errors or the merging operation, the water volume accumulated from the sub-cells may deviate slightly from the water volume of the parent cell itself. Without correction, this deviation will gradually accumulate over long-term calculations, eventually leading to a lack of water conservation.

[0097] The specific correction method is as follows: For each parent unit, firstly, calculate the target water volume of the parent unit based on its current water depth, which is the parent unit's water depth multiplied by its area. Then, calculate the sum of the actual water volumes of all child units of the parent unit, which is the sum of the water depths of each child unit multiplied by its respective area. Use the ratio of the target water volume to the actual water volume as a uniform scaling factor to scale the water depths of all child units of the parent unit proportionally. After scaling, the sum of the water volumes of all child units is exactly equal to the target water volume of the parent unit, thus satisfying the requirement of water conservation.

[0098] It should be noted that this correction operation does not change the relative proportions between sub-cells; that is, sub-cells with greater water depth remain larger after correction, and sub-cells with less water depth remain smaller after correction. It only fine-tunes the overall water depth of the sub-cells to keep their total amount consistent with that of the parent cell. In this way, both local water volume conservation and spatial distribution characteristics obtained from fine-mesh calculations are preserved.

[0099] Step 108: Repeat the above steps until the parent cell to be encrypted no longer changes, and output the grid structure at this time to perform calculations for any flood condition in the target geographical area based on the grid structure.

[0100] After completing a full cycle from coarse mesh derivation, densification region identification, local densification, coarse-fine coupled calculation to water volume correction, this step determines whether further iteration is needed and outputs the final mesh structure when the conditions are met.

[0101] The above steps need to be repeated because flood evolution is a dynamic process, and critical regions may change over time. For example, as the flood wave front advances, areas that were previously unimportant may become critical locations requiring fine characterization; or the physical quantity gradients in certain regions may flatten, making it no longer necessary to maintain a high-resolution mesh. By continuously repeating the above process, the mesh structure can dynamically evolve with the flood evolution, always maintaining a high resolution in the critical regions at the current moment, while maintaining a coarser mesh in non-critical regions, thereby controlling the overall computational scale while ensuring computational accuracy.

[0102] In each iteration, based on the refinement determination result of step 103, local refinement, preservation, or de-refinement operations are performed on the current mesh to generate an updated adaptive mesh for subsequent criterion evaluation, and the coarse-to-fine parent-child mapping relationship and overlapping zone structure are updated simultaneously. The hydrodynamic state obtained in step 107 is written back to the updated mesh cells through coarse-to-fine and fine-to-coarse mappings as the input state for the next round of refinement determination calculation.

[0103] It should be noted that grid updates are not required to be performed at every time step, but can be performed at a preset update frequency or when a criterion trigger condition is met. This flexible update strategy can ensure grid adaptability while avoiding unnecessary computational overhead.

[0104] During repeated execution, it is necessary to monitor changes in the set of parent cells to be encrypted. At each time step or every few time steps, the comprehensive encryption index is recalculated and the parent cells to be encrypted are identified. If a cell is determined to require encryption for multiple consecutive rounds, its encryption state is maintained; if a cell's encryption index remains below the exit threshold, it may be removed from the encryption set, and the corresponding child cells are merged back into the parent cell. This dynamic adjustment mechanism allows the grid structure to adapt to changes in the flood evolution process.

[0105] When the refined region set remains unchanged in several consecutive update rounds or the mesh resolution reaches the preset target, further refinement stops and the final adaptive refined mesh is output. The output mesh structure includes nodes, cells, hierarchical distribution, refined region boundaries and parent-child mappings, overlap zone information, and the corresponding hydrodynamic state can be output for verification.

[0106] When the parent cells to be encrypted no longer change, it means that the current mesh structure has stabilized. "No longer changing" can be interpreted in several ways: one is that the set of parent cells to be encrypted is exactly the same across multiple consecutive time steps; another is that the change in the encrypted region is less than a preset tolerance range, or the mesh resolution has reached the preset target requirement. At this point, the mesh evolution process terminates.

[0107] The final output mesh structure contains complete mesh information, including node coordinates, cell topology, parent-child relationships, and the distribution of densified regions. Unlike existing technologies that only output the hydrodynamic calculation results at the current moment, this step outputs the reusable mesh structure itself. Because this mesh structure has stabilized through multiple iterations, it reflects the topographic features, engineering element distribution, and general laws of flood evolution in the target geographical area, and therefore can exist independently of specific flood conditions.

[0108] When calculations for other flood conditions are required, this mesh structure can be directly loaded without the need for re-identifying and generating new meshes. New flood conditions only require the provision of corresponding boundary conditions to be calculated on the pre-defined coarse and fine meshes. This "generate once, use many times" approach significantly reduces the modeling and preprocessing costs for multi-condition simulations, improving the efficiency of engineering applications.

[0109] This application provides an adaptive mesh generation method, apparatus, electronic device, and storage medium. This application uses a neural operator model to deduce a water depth prediction field on a coarse mesh, and calculates a comprehensive encryption index that integrates water depth gradient, dike distance, and model prediction uncertainty based on the prediction field. The encryption index is used to identify the area to be encrypted and perform local encryption. Compared with the encryption method in the prior art that relies on a single physical quantity threshold, it can more stably identify key areas and reduce the problem of frequent changes in the encrypted area caused by numerical noise.

[0110] By performing water depth fusion at the junction of coarse and sub-cells, and then transferring the fused sub-cell water depth back to the parent cell for water volume correction using an area-weighted average, the sum of the water volumes of all sub-cells corresponding to each parent cell is equal to the water volume of the parent cell itself. Compared with the numerical discontinuity and water volume non-conservation problems that easily occur at the junction of coarse and fine grids in the prior art, the embodiments of this application can ensure the physical consistency and water volume conservation at the junction of coarse and fine grids.

[0111] By repeating the above steps until the parent unit to be encrypted no longer changes, the mesh structure at this time is output. Compared with the existing technology where the mesh structure changes dynamically with the current working conditions and is difficult to reuse, the embodiments of this application can generate a stable adaptive encrypted mesh. This mesh can be directly used for calculation of any flood working conditions in the target geographical area, solving the technical problems of unstable mesh encryption area, complex handling of the boundary between coarse and fine meshes, and difficulty in outputting reusable meshes in the existing technology.

[0112] In a feasible implementation plan, such as Figure 2 As shown, the prediction uncertainty is determined through the following steps: Step 201: Use the basic information of each coarse grid cell at the current time as the input to the neural operator model.

[0113] This step first determines the input information required for the neural operator model's inference. For each coarse grid cell, its basic information includes dynamic state parameters such as current water depth and flow velocity, as well as static parameters such as terrain elevation, roughness, and cell centroid coordinates. In addition, boundary forcing information such as upstream flow rate and downstream water level are also included as input. This information together constitutes the complete input data required for the neural operator model to perform time-progressive inference.

[0114] In practice, basic information can be obtained in various ways. For example, topographic elevation and roughness can be projected from DEM data and land use data, while the current water depth and flow velocity can be initial setpoints or calculation results from the previous time step. Boundary forcing information is given according to the specific flood conditions and can be measured data or design flood hydrographs. All of this information needs to undergo coordinate unification and time-series alignment to ensure the consistency and validity of the input data.

[0115] Step 202: Repeatedly perform neural operator model inference on the input multiple times, keeping the random deactivation layer in the model on during the inference process, and performing random sampling with a preset fixed probability.

[0116] After determining the input information, this step obtains the statistical distribution of the prediction results by repeatedly performing neural operator model inference multiple times on the same input. To achieve this, the random deactivation layer in the model is kept on during inference, and random sampling is performed with a preset fixed probability. This technique is commonly known as Monte Carlo random deactivation sampling.

[0117] Specifically, conventional neural network inference typically disables the random deactivation layer to obtain deterministic output. However, in this step, the random deactivation layer is intentionally kept on, so that during each forward inference process, some neurons in the network are randomly dropped with a certain probability, resulting in slightly different inference results. By repeating this randomized forward inference multiple times on the same input, a set of water depth prediction results can be obtained. The differences between these results reflect the model's prediction uncertainty under that input condition.

[0118] It should be noted that the probability of random deactivation can be adjusted based on the specific structure of the model and the training conditions. A probability that is too low will result in inconsistencies in multiple inferences, making it difficult to effectively measure uncertainty; a probability that is too high may cause the inference results to deviate from the true physical laws. In practical applications, an appropriate random deactivation probability can be selected based on the performance on the validation set.

[0119] Step 203: Calculate the variance of the water depth prediction results obtained from multiple inferences on each coarse grid cell, and use the variance as the prediction uncertainty of that coarse grid cell.

[0120] After obtaining the water depth prediction results from multiple inferences, this step performs statistical analysis on the results obtained from multiple inferences on each coarse grid cell. Specifically, it calculates the variance of these results in the time dimension, that is, the degree of dispersion of the predicted water depth values ​​on each cell. The larger the variance, the greater the fluctuation of the model's prediction results on that cell, and the lower the model's confidence; the smaller the variance, the more consistent the multiple prediction results tend to be, and the higher the model's confidence.

[0121] The variance is used as the prediction uncertainty of the coarse grid cell for subsequent calculation of the overall densification index. This uncertainty measurement method based on the stability of the model's own output can effectively identify areas where the physical gradient is not obvious but the model training data is sparse or the terrain is complex, providing a basis for decision-making on grid densification in these areas, thereby improving the robustness of the overall simulation and the engineering safety.

[0122] In one feasible implementation, the preset threshold includes an entry threshold and an exit threshold that is less than the entry threshold.

[0123] The step of using coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells to be encrypted includes: The entry threshold and exit threshold are determined based on the numerical distribution of the comprehensive encryption index of all coarse grid cells at the current moment, and the entry threshold is not less than the preset absolute lower limit threshold.

[0124] Thus, for coarse grid cells whose comprehensive encryption index at the current moment is greater than the entry threshold, their state is marked as the parent cell to be encrypted; for coarse grid cells whose comprehensive encryption index at the current moment is less than the exit threshold, their state is marked as a coarse grid cell that does not need encryption; for coarse grid cells whose comprehensive encryption index at the current moment is between the entry threshold and the exit threshold, their state at the previous moment is retained.

[0125] In a feasible implementation, the preset threshold can adopt a dual threshold mechanism, that is, setting a higher entry threshold and a lower exit threshold, with a hysteresis interval between the two.

[0126] Specifically, the entry threshold is first determined based on the numerical distribution of the comprehensive encryption index of all coarse grid cells at the current moment. The entry threshold can be determined by taking a high quantile of the index distribution, such as the index value corresponding to the top 15% of cells. Simultaneously, the entry threshold must not be less than a preset absolute lower limit threshold to avoid over-refinement when the overall index is generally low. The exit threshold is then determined based on the entry threshold, typically taking a certain proportion of the entry threshold, such as 0.3 to 0.5 times, to ensure that the exit threshold is significantly lower than the entry threshold.

[0127] After the threshold is determined, the following state determination is performed on each coarse grid cell: If the overall encryption index at the current moment is greater than the entry threshold, then the unit is determined as the parent unit to be encrypted, regardless of its state at the previous moment.

[0128] If the overall encryption index at the current moment is less than the exit threshold, then the cell is determined as a coarse grid cell that does not require encryption, regardless of its state at the previous moment.

[0129] If the current comprehensive encryption index is between the entry threshold and the exit threshold, the cell retains the judgment result from the previous moment. That is, if it was the parent cell to be encrypted in the previous moment, it continues to be encrypted; if it was a coarse grid cell that did not require encryption in the previous moment, it continues to be unencrypted.

[0130] The advantage of this dual-threshold mechanism lies in the formation of a hysteresis interval. When the encryption index of a cell fluctuates around the entry threshold, it will not repeatedly enter and exit the encryption state due to small fluctuations, thus maintaining the stability of the mesh structure. The cell only enters the encryption state when the index is significantly higher than the entry threshold, or exits the encryption state when it is significantly lower than the exit threshold. Cells in the intermediate region remain unchanged, effectively avoiding the problem of frequent changes in the encryption region caused by numerical noise.

[0131] In one feasible implementation, establishing the correspondence between each sub-unit and its parent unit includes: Establish an interpolation relationship between each sub-unit and its parent unit, which is used to distribute the water depth values ​​at the three vertices of the parent unit to its corresponding sub-units according to the position weight of the sub-unit within the parent unit; establish a convergence relationship between each parent unit and its sub-units, which is used to return the water depth values ​​on the sub-units to the parent unit after weighted averaging according to the ratio of the sub-unit area to the parent unit area.

[0132] In this embodiment of the application, the correspondence between each sub-unit and its parent unit is established, specifically including two directions of relationship: the interpolation relationship from the parent unit to the sub-unit, and the convergence relationship from the sub-unit to the parent unit.

[0133] The interpolation relationship from parent to child cells is mainly used to transfer physical quantities from a coarse mesh to a newly generated fine mesh. Since the child cell is located inside the parent cell, its initial water depth value should be reasonably allocated based on the current water depth information of the parent cell. A typical implementation is to use barycentric coordinate interpolation. Each parent cell has three vertices, and each vertex stores a water depth value. For any child cell within the parent cell, the weight coefficients corresponding to the three vertices can be calculated based on the relative position of its geometric center within the parent cell. These coefficients are negatively correlated with the distance from the child cell to each vertex. The initial water depth of the child cell is obtained by multiplying the water depth values ​​of the three vertices by their corresponding weights and then summing them. This interpolation method ensures that the water depth inherited by the child cell is smoothly transitioned within the parent cell, avoiding artificial jumps caused by mesh refinement.

[0134] The convergence relationship from child cells to parent cells is mainly used to transfer the calculation results from the fine mesh back to the coarse mesh, so as to update the state of the parent cell and use it for the next round of refinement judgment. Since a parent cell may correspond to multiple child cells, it is necessary to reasonably summarize the water depth values ​​on the child cells. A typical implementation method is to use area-weighted averaging. Each child cell has its own geometric area, and the larger the area of ​​the child cell, the greater its contribution to the overall state of the parent cell should be. Specifically, for each parent cell, the water depth values ​​of all its child cells are multiplied by their respective areas, summed, and then divided by the total area of ​​the parent cell to obtain the updated water depth of the parent cell. This area-weighted averaging method can ensure that the spatial distribution characteristics of physical quantities are preserved when converging from the fine mesh to the coarse mesh, while satisfying the basic requirement of water conservation.

[0135] By establishing the correspondence between these two directions, a complete bidirectional data path is formed between the coarse and fine meshes. When it is necessary to transfer initial values ​​from coarse to fine, the interpolation relationship is used; when it is necessary to update the parent cell state from fine to coarse, the convergence relationship is used. This bidirectional mapping mechanism lays the foundation for subsequent coupled calculations and conservation corrections.

[0136] In a feasible implementation plan, after completing the water depth fusion at the boundary, it is also necessary to perform physical consistency corrections on the fusion results to ensure the rationality of the calculation results and their engineering usability. These corrections mainly target non-physical phenomena that may occur in numerical calculations, including negative water depths, thin water layer anomalies, and deviations from boundary conditions.

[0137] That is, the method further includes: The merged water depth is then subjected to physical consistency correction, which includes at least one of the following: Negative water depths are corrected to zero. First, non-negative water depth correction is performed by taking the maximum value of the unit water depth, directly correcting negative water depths to zero. During numerical calculations, due to interpolation, fusion, or correction operations, negative water depth values ​​may occur, which is physically impossible. Therefore, it is necessary to eliminate negative water depths to ensure that water depth values ​​always remain within a physically reasonable range and avoid calculation anomalies caused by negative water depths.

[0138] For cells with water depths less than a preset wet threshold, their velocity is set to zero. Next, a wet-to-dry conversion rule is executed, setting a wet threshold to determine dry cells. The wet threshold is a preset stability parameter, calibrated and fixed based on a historical flood event validation set using the criterion of "controlled wet-to-dry fluctuations without deteriorating station water level / flow fitting." When a cell's water depth is less than the wet threshold, its velocity is set to zero to avoid abnormally high speeds in thin water layers; when a cell's water depth is greater than or equal to the wet threshold, its velocity is retained, but a rate-of-change upper limit is applied to the velocity increment in adjacent time steps. This rate-of-change upper limit is also a preset stability parameter, calibrated and fixed based on a historical validation set velocity change rate statistical threshold, ensuring that each update satisfies the velocity increment constraint and suppresses numerical oscillations.

[0139] At the inflow boundary, a boundary velocity is allocated according to a given flow rate; at the outflow boundary, the water level is fixed; and at the solid wall boundary, the normal velocity is set to zero. Finally, hard boundary constraints are applied. At the inflow boundary, the total flow rate is converted into a unit width flux for each boundary segment according to its proportion of length, and the normal velocity is calculated by dividing the unit width flux by the water depth and then fixed, thus ensuring that the inflow boundary flux is consistent with the input. At the outflow boundary, the boundary water level is fixed according to a given water level, ensuring that the downstream water level conditions are accurately applied. At the solid wall boundary, the normal velocity is fixed to zero while retaining the tangential component, thus ensuring that the boundary meets the preset physical conditions and preventing non-physical reflections or leaks from the boundary due to proxy inference.

[0140] The aforementioned physical consistency corrections effectively suppress the propagation of non-physical values ​​that may occur during surrogate inference and numerical computation, ensuring the engineering usability and long-term stability of the calculation results. These corrections are equivalent to adding a safety net to the outer layer of the numerical model, ensuring that the output results always conform to basic physical laws and engineering constraints.

[0141] In one optional implementation, this embodiment uses a rapid two-dimensional flood simulation of a watershed as the application scenario. It employs a method of "coarse-grid neural operator global advancement + locally adaptive fine-grid refinement to enhance the simulation," which improves spatial analytical accuracy for easily flooded key areas while ensuring overall computational efficiency. The following implementation steps strictly correspond to the aforementioned technical solution.

[0142] In this embodiment, a study area with a drainage area of ​​approximately 692 km² is selected as the target geographical region. First, spatial data such as the DEM, river network, levee lines, and bridge locations are subjected to unified coordinate projection and topological consistency checks to construct a two-dimensional flood calculation domain. The upstream boundary is input with the inflow process corresponding to historical flood events, the downstream water level boundary is input with the water level process corresponding to historical events, and the remaining boundaries are treated as solid walls or natural boundaries. The initial water depth is calculated from the difference between the water level and the topographic elevation at the start of the calculation, and the initial velocity is set to zero.

[0143] To address the challenges of varying terrain resolution and the need for higher precision in flood-prone areas within the study area, the target geographic region is divided into several sub-regions. Triangular meshes are generated for each sub-region and then stitched together to obtain an irregular triangular coarse mesh covering the entire target geographic region. In this embodiment, the preferred sub-regions are: Neimeng Village and surrounding urban area, main river channel and floodplain buffer zone, farmland flat area, and mountain edge area. The target edge length for each sub-region is determined based on terrain resolution and level of interest: 10 meters for urban areas, 20 meters for river floodplains, 60 meters for farmland areas, and 150 meters for mountain areas. Within each sub-region, a constrained irregular triangular mesh generation method is used to generate sub-meshes, and common edge stitching is performed at the boundaries of the sub-regions to form a global coarse-resolution triangular mesh. Terrain elevation and roughness parameters are then projected onto the coarse mesh cell nodes.

[0144] At each time step, the neural operator model is first invoked on the coarse grid to infer the water depth prediction field for the next time step based on the cell state at the previous time step. Using this water depth prediction field as input, a comprehensive densification index is calculated for each coarse grid cell. This index is weighted by the water depth gradient, the distance from the coarse grid cell to the dike, and the prediction uncertainty of the neural operator model on the coarse grid cell. The water depth gradient is calculated using the least squares method, and the prediction uncertainty is obtained by repeatedly performing neural operator inference on the same input and calculating the variance. A fixed quantile rule with hysteresis is used for the threshold. When the comprehensive densification index reaches the 0.85 quantile of the current time step's global distribution, it is determined as a parent cell to be densified; when it is below the 0.75 quantile, it is determined as a coarse grid cell that does not require densification.

[0145] Local encryption is performed on the parent unit to be encrypted, and sub-units are generated using a 1:4 triangular subdivision rule. The difference in refinement levels between adjacent units is constrained to not exceed 1 to ensure conformal refining at the coarse-to-fine boundary. A correspondence is established between each sub-unit and its parent unit: for coarse-to-fine mapping, the depth value on the parent unit is transferred to the sub-unit as the initial depth using barycentric coordinate interpolation; for fine-to-coarse mapping, the sub-unit state is converged back to the parent unit using a weighted average of sub-unit areas. Simultaneously, a fixed number of overlapping bands are generated at the coarse-to-fine boundary for subsequent continuous fusion.

[0146] The neural operator parameters are obtained through offline training before online computation and remain fixed during the online inference phase. The offline training data is constructed from a historical flood event database, and the water depth and flow velocity time series labels at the grid cell scale are reconstructed through spatial fusion and assimilation interpolation. During the online inference phase, the neural operator first rapidly advances on the global coarse grid to obtain the background prediction field, and then obtains the local fine water depth through neural operator model deduction on the sub-cells.

[0147] An overlapping zone is set at the boundary between coarse grid cells and sub-cells to merge the local fine water depth with the water depth on the coarse grid cells. The merging rule is: the local fine water depth on the sub-cell is multiplied by the merging weight (let's say x), plus the water depth on the adjacent coarse grid cell multiplied by one minus the merging weight (1-x), where the merging weight changes monotonically and smoothly with the relative position of the cell to the sub-cell region. In this embodiment, the overlapping zone has 3 layers, and the weighting function uses a cosine smooth transition. After merging, the portion of the merged water depth located in the sub-cell is transferred back to the parent cell of the sub-cell using an area-weighted average. The water depth of all sub-cells of the parent cell is then corrected according to the parent cell's own water depth, so that the sum of the water volume of all sub-cells corresponding to each parent cell equals the water volume of the parent cell.

[0148] Physical consistency correction is performed on the merged water depth, including: correcting negative water depth to zero; setting the velocity of units with water depth less than the preset wet threshold of 0.03 meters to zero; allocating boundary velocity at the inflow boundary according to the given flow rate, fixing the water level at the outflow boundary, and setting the normal velocity to zero at the solid wall boundary.

[0149] Based on the refinement criteria, local refinement, preservation, or de-refinement operations are performed on the current mesh, while simultaneously updating the parent-child correspondence and overlapping band structure. Mesh updates are only performed when the refinement criteria change or when a preset update cycle is reached. When the parent element to be refined no longer changes after several consecutive update cycles or the mesh resolution meets the preset accuracy requirements, further refinement evolution stops, and the final adaptive refined mesh result is output, including mesh nodes, triangular elements, element resolution and hierarchy distribution, the boundary of the refined region, and the parent-child correspondence and overlapping band structure.

[0150] In summary, the preferred embodiment provided in this application has the following effects: Significantly reduce global mesh size and improve computational efficiency: By using a neural operator-driven encryption criterion, local mesh encryption is performed only in areas prone to flooding or high risk, avoiding the problems of relying on global fine mesh or excessive manual encryption in traditional methods. While ensuring the accuracy of key areas, the overall mesh size and computational cost are significantly reduced.

[0151] Improving the stability and rationality of encrypted region identification: The encryption criterion, which integrates flood dynamic characteristics, engineering risk information and proxy uncertainty, can more stably identify regions that need high-resolution characterization compared to the single physical quantity threshold method, and reduce the problem of frequent changes in encrypted regions caused by numerical noise or local fluctuations.

[0152] Ensuring geometric and physical consistency at the interface between coarse and fine meshes: By employing mechanisms such as conformal constraints, continuous fusion of overlapping zones, and volume conservation correction, the discontinuities, conservation violations, and numerical oscillations that easily occur at the interface between coarse and fine meshes under irregular triangular mesh conditions are effectively addressed, thereby improving the stability and reliability of the generated mesh in subsequent calculations.

[0153] Generating a directly reusable engineering-grade adaptive densified mesh: The final output of this application is a stable adaptive densified mesh structure, rather than relying on the instantaneous calculation results of a specific flood condition. The generated mesh can be reused as a unified computational mesh for subsequent multi-condition flood calculations, scenario analysis, or risk assessment, significantly reducing modeling and preprocessing costs.

[0154] Balancing computational accuracy, stability, and engineering feasibility: While ensuring spatial analytical accuracy in key areas, this application uses explicit grid evolution rules and consistency constraints to enable the generated adaptive densified grid to meet the requirements of engineering applications for stability, interpretability, and maintainability. It is suitable for practical application scenarios such as watershed-scale two-dimensional flood simulation and flood control engineering analysis.

[0155] Based on the same technical concept, embodiments of this application also provide an adaptive mesh generation device, such as... Figure 3 As shown, the device includes: The deduction module 301 is used to deduce the water depth prediction field of the target geographical area at the next moment on an irregular triangular coarse grid covering the target geographical area through a neural operator model.

[0156] The first calculation module 302 is used to calculate the water depth gradient of each coarse grid cell based on the water depth prediction field, and to obtain a comprehensive encryption index by combining the distance from the coarse grid cell to the dike and the prediction uncertainty of the neural operator model on the coarse grid cell.

[0157] The determination module 303 is used to identify coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells to be encrypted.

[0158] The encryption module 304 is used to perform partial encryption on the parent unit to be encrypted, generate several sub-units, and establish a correspondence between each sub-unit and its parent unit.

[0159] The second calculation module 305 is used to transfer the water depth value of each parent unit to its corresponding child unit as the initial water depth according to the correspondence, and to obtain the local fine water depth by deducing through the neural operator model on the child unit.

[0160] The fusion module 306 is used to fuse the local fine water depth with the water depth on the coarse grid unit at the junction of the coarse grid unit and the sub-unit to obtain the fused water depth.

[0161] The feedback correction module 307 is used to transmit the portion of the fused water depth located in the sub-unit back to the parent unit to which the sub-unit belongs by means of area weighted average according to the correspondence, and to correct the water depth of all sub-units corresponding to the water depth of the parent unit itself, so that the sum of the water volume of all sub-units corresponding to each parent unit is equal to its own water volume.

[0162] Output module 308 is used to repeatedly execute the above steps until the parent unit to be encrypted no longer changes, and output the grid structure at this time, so as to perform calculations for any flood conditions in the target geographical area based on the grid structure.

[0163] In one feasible implementation, the prediction uncertainty is determined by the following steps: The basic information of each coarse grid cell at the current moment is used as the input to the neural operator model.

[0164] The neural operator model inference is repeatedly executed multiple times on the input, and the random deactivation layer in the model is kept on during the inference process, and random sampling is performed with a preset fixed probability.

[0165] The variance of the water depth prediction results obtained from multiple inferences on each coarse grid cell is calculated, and the variance is used as the prediction uncertainty of that coarse grid cell.

[0166] In one feasible implementation, the preset threshold includes an entry threshold and an exit threshold that is less than the entry threshold.

[0167] The determining module is used to select coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells to be encrypted, including: The entry threshold and exit threshold are determined based on the numerical distribution of the comprehensive encryption index of all coarse grid cells at the current moment, and the entry threshold is not less than the preset absolute lower limit threshold.

[0168] For coarse grid cells whose overall encryption index at the current moment is greater than the entry threshold, their state is marked as the parent cell to be encrypted.

[0169] For coarse grid cells whose overall encryption index at the current moment is less than the exit threshold, their status is marked as coarse grid cells that do not require encryption.

[0170] For the coarse grid cells of the comprehensive encryption index at the current moment that are between the entry threshold and the exit threshold, retain the state of the previous moment.

[0171] In one feasible implementation, the encryption module is used to perform partial encryption on the parent unit to be encrypted, generating several child units, including: The parent unit to be encrypted is divided into four sub-units of equal area.

[0172] The device further includes: An extended encryption module is used to encrypt the adjacent coarse grid cell if the difference in the number of encryptions between any adjacent coarse grid cell and the parent cell is greater than 1, so that the difference in the number of encryptions is less than or equal to 1.

[0173] In one feasible implementation, the encryption module is used to establish the correspondence between each sub-unit and its parent unit, including: Establish an interpolation relationship between each sub-unit and its parent unit, which is used to distribute the water depth values ​​at the three vertices of the parent unit to its corresponding sub-units according to the position weight of the sub-unit within the parent unit.

[0174] Establish a convergence relationship between each parent cell and its child cells, which is used to return the water depth values ​​on the child cells to the parent cells after weighted averaging according to the ratio of the area of ​​the child cell to the area of ​​the parent cell.

[0175] In one feasible implementation, the fusion module is used to fuse the local fine water depth with the water depth on the coarse grid cell at the boundary between the coarse grid cell and the sub-cell to obtain a fused water depth, including: An overlapping region is defined at the boundary; the overlapping region contains a portion of coarse grid cells and a portion of sub-cells.

[0176] For each position to be merged within the overlapping region, a first weight is determined based on a first distance from the position to be merged to its adjacent target sub-unit, and the first weight is negatively correlated with the first distance; a second weight is determined based on a second distance from the position to be merged to its adjacent target coarse grid unit, and the second weight is negatively correlated with the second distance, and the sum of the weights of the first weight and the second weight is 1.

[0177] The local fine water depth of the target sub-unit, the first weight, and the water depth and second weight of the target coarse grid unit are weighted and summed to obtain the fused water depth of the location to be fused.

[0178] In one feasible implementation, the device further includes: The correction module is used to merge the local fine water depth with the water depth on the coarse grid cell at the boundary between the coarse grid cell and the sub-cell, and then perform physical consistency correction on the merged water depth to obtain the merged water depth. The physical consistency correction includes at least one of the following: Correct the negative water depth to zero.

[0179] For units where the water depth is less than the preset wet threshold, their velocity is set to zero.

[0180] At the inflow boundary, the boundary velocity is assigned according to the given flow rate; at the outflow boundary, the water level is fixed; and at the solid wall boundary, the normal velocity is set to zero.

[0181] This application provides an adaptive mesh generation method, apparatus, electronic device, and storage medium. This application uses a neural operator model to deduce a water depth prediction field on a coarse mesh, and calculates a comprehensive encryption index that integrates water depth gradient, dike distance, and model prediction uncertainty based on the prediction field. The encryption index is used to identify the area to be encrypted and perform local encryption. Compared with the encryption method in the prior art that relies on a single physical quantity threshold, it can more stably identify key areas and reduce the problem of frequent changes in the encrypted area caused by numerical noise.

[0182] By performing water depth fusion at the junction of coarse and sub-cells, and then transferring the fused sub-cell water depth back to the parent cell for water volume correction using an area-weighted average, the sum of the water volumes of all sub-cells corresponding to each parent cell is equal to the water volume of the parent cell itself. Compared with the numerical discontinuity and water volume non-conservation problems that easily occur at the junction of coarse and fine grids in the prior art, the embodiments of this application can ensure the physical consistency and water volume conservation at the junction of coarse and fine grids.

[0183] By repeating the above steps until the parent unit to be encrypted no longer changes, the mesh structure at this time is output. Compared with the existing technology where the mesh structure changes dynamically with the current working conditions and is difficult to reuse, the embodiments of this application can generate a stable adaptive encrypted mesh. This mesh can be directly used for calculation of any flood working conditions in the target geographical area, solving the technical problems of unstable mesh encryption area, complex handling of the boundary between coarse and fine meshes, and difficulty in outputting reusable meshes in the existing technology.

[0184] Figure 4 A schematic diagram of an electronic device provided in this application embodiment includes: a processor 401, a storage medium 402, and a bus 403. The storage medium 402 stores machine-readable instructions executable by the processor 401. When the electronic device runs the adaptive mesh generation method as described in the embodiment, the processor 401 communicates with the storage medium 402 via the bus 403, and the processor 401 executes the machine-readable instructions to perform the steps as described in the embodiment.

[0185] In this embodiment, the storage medium 402 may also execute other machine-readable instructions to perform other methods as described in the embodiment. For details on the specific execution steps and principles, please refer to the description of the embodiment, which will not be repeated here.

[0186] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor to perform the steps as described in the embodiments.

[0187] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.

[0188] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0189] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0190] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0191] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0192] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An adaptive mesh generation method, characterized in that, The method includes: Step 101: On the irregular triangular coarse grid covering the target geographic area, the water depth prediction field for the next moment of the target geographic area is obtained by deducing through a neural operator model. Step 102: Calculate the water depth gradient of each coarse grid cell based on the water depth prediction field, and combine the distance from the coarse grid cell to the dike and the prediction uncertainty of the neural operator model on the coarse grid cell to obtain a weighted comprehensive encryption index. Step 103: Use the coarse grid cells whose comprehensive encryption index exceeds a preset threshold as the parent cells to be encrypted; Step 104: Perform local encryption on the parent unit to be encrypted to generate several sub-units, and establish the correspondence between each sub-unit and its parent unit. Step 105: According to the correspondence, the water depth value of each parent unit is passed to its corresponding child unit as the initial water depth, and the local fine water depth is obtained by deducing through the neural operator model on the child unit. Step 106: At the junction of the coarse grid cell and the sub-cell, the local fine water depth is merged with the water depth on the coarse grid cell to obtain the merged water depth; Step 107: According to the correspondence, the portion of the merged water depth located in the sub-unit is transferred back to the parent unit to which the sub-unit belongs by the area-weighted average, and the water depth of all sub-units corresponding to the parent unit is corrected so that the sum of the water volume of all sub-units corresponding to each parent unit is equal to its own water volume. Step 108: Repeat steps 104-107 above until the parent cell to be encrypted no longer changes or the grid resolution reaches the preset target. Output the grid structure at this time to perform calculations for any flood condition in the target geographical area based on the grid structure. Step 106 includes: An overlapping region is defined at the boundary; the overlapping region comprises a portion of coarse grid cells and a portion of sub-cells. For each location to be merged within the overlapping region, a first weight is determined based on a first distance from the location to be merged to its adjacent target sub-cell, and the first weight is negatively correlated with the first distance; a second weight is determined based on a second distance from the location to be merged to its adjacent target coarse grid cell, and the second weight is negatively correlated with the second distance, and the sum of the weights of the first weight and the second weight is 1. The local fine water depth of the target sub-unit, the first weight, and the water depth and second weight of the target coarse grid unit are weighted and summed to obtain the fused water depth of the location to be fused.

2. The method according to claim 1, characterized in that, The prediction uncertainty is determined through the following steps: Use the basic information of each coarse grid cell at the current moment as the input to the neural operator model; The neural operator model inference is repeatedly performed on the input, and the random deactivation layer in the model is kept on during the inference process, and random sampling is performed with a preset fixed probability. The variance of the water depth prediction results obtained from multiple inferences on each coarse grid cell is calculated, and the variance is used as the prediction uncertainty of that coarse grid cell.

3. The method according to claim 1, characterized in that, The preset threshold includes an entry threshold and an exit threshold that is less than the entry threshold; The step of using coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells to be encrypted includes: The entry threshold and exit threshold are determined based on the numerical distribution of the comprehensive encryption index of all coarse grid cells at the current moment, and the entry threshold is not less than the preset absolute lower limit threshold. For coarse grid cells whose overall encryption index at the current moment is greater than the entry threshold, their status is marked as the parent cell to be encrypted; For coarse grid cells whose overall encryption index at the current moment is less than the exit threshold, their status is marked as coarse grid cells that do not require encryption. For the coarse grid cells of the comprehensive encryption index at the current moment that are between the entry threshold and the exit threshold, retain the state of the previous moment.

4. The method according to claim 1, characterized in that, The step of locally encrypting the parent unit to be encrypted to generate several child units includes: The parent unit to be encrypted is divided into four sub-units of equal area; The method further includes: If the difference in the number of encryptions between any coarse grid cell adjacent to the parent cell to be encrypted and the parent cell is greater than 1, then the adjacent coarse grid cell is encrypted so that the difference in the number of encryptions is less than or equal to 1.

5. The method according to claim 1, characterized in that, The process of establishing the correspondence between each sub-unit and its parent unit includes: Establish an interpolation relationship between each sub-unit and its parent unit, which is used to distribute the water depth values ​​at the three vertices of the parent unit to its corresponding sub-units according to the position weight of the sub-unit within the parent unit; Establish a convergence relationship between each parent cell and its child cells, which is used to return the water depth values ​​on the child cells to the parent cells after weighted averaging according to the ratio of the area of ​​the child cell to the area of ​​the parent cell.

6. The method according to claim 1, characterized in that, At the boundary between the coarse grid cell and the sub-cell, the local fine water depth is merged with the water depth on the coarse grid cell to obtain the merged water depth. The method further includes: The merged water depth is then subjected to physical consistency correction, which includes at least one of the following: Correct the negative water depth to zero; For units where the water depth is less than the preset wet threshold, set their velocity to zero; At the inflow boundary, the boundary velocity is assigned according to the given flow rate; at the outflow boundary, the water level is fixed; and at the solid wall boundary, the normal velocity is set to zero.

7. An adaptive mesh generation device, characterized in that, The device includes: The deduction module is used to deduce the water depth prediction field on an irregular triangular coarse grid using a neural operator model; The first calculation module is used to calculate the water depth gradient of the coarse grid cell based on the water depth prediction field, and to obtain a comprehensive encryption index by weighting the distance from the coarse grid cell to the dike and the prediction uncertainty of the neural operator model. The determination module is used to identify coarse grid cells whose comprehensive encryption index exceeds a preset threshold as parent cells. An encryption module is used to locally encrypt the parent unit, generate several sub-units, and establish a correspondence between each sub-unit and the parent unit; The second calculation module is used to pass the water depth value of each parent unit to its corresponding child unit as the initial water depth according to the correspondence, and to obtain the local fine water depth by deducing through the neural operator model on the child unit. A fusion module is used to fuse the local fine water depth with the water depth on the coarse grid cell at the boundary between the coarse grid cell and the sub-cell to obtain a fused water depth; the process of fusing the local fine water depth with the water depth on the coarse grid cell at the boundary between the coarse grid cell and the sub-cell to obtain a fused water depth includes: An overlapping region is defined at the boundary; the overlapping region comprises a portion of coarse grid cells and a portion of sub-cells. For each location to be merged within the overlapping region, a first weight is determined based on a first distance from the location to be merged to its adjacent target sub-cell, and the first weight is negatively correlated with the first distance; a second weight is determined based on a second distance from the location to be merged to its adjacent target coarse grid cell, and the second weight is negatively correlated with the second distance, and the sum of the weights of the first weight and the second weight is 1. The local fine water depth of the target sub-unit and the first weight, as well as the water depth and the second weight of the target coarse grid unit, are weighted and summed to obtain the fused water depth at the location to be fused. The feedback correction module is used to transmit the portion of the fused water depth located in the sub-unit back to the parent unit to which the sub-unit belongs by area weighted average according to the correspondence, and to correct it according to the water depth of all sub-units corresponding to the water depth of the parent unit itself. The output module is used to output the current mesh structure when the parent unit no longer changes.

8. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the adaptive mesh generation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the adaptive mesh generation method as described in any one of claims 1 to 6.