Grid optimization generation method and device for one-two-dimensional coupling hydrodynamic model, medium and product

The method optimizes 1D-2D hydrodynamic model grid generation through automated Python scripts, addressing inefficiencies in commercial software by enhancing accuracy and reducing computational time in flood simulations.

CN120197544APending Publication Date: 2025-06-24CHINA THREE GORGES UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510258243.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

Current one-dimensional (1D) and two-dimensional (2D) coupled hydrodynamic models rely heavily on commercial software for coupling point generation, which is inefficient and prone to errors, especially in complex river networks, leading to inaccuracies and increased computational time due to manual adjustments and lack of adaptive meshing mechanisms.

Method used

A method for optimizing the generation of 1D-2D coupled hydrodynamic model grids using Python scripts and geometric relationships to automate the process, eliminating the need for third-party software, by generating non-structured grid elements and validating coupling points with cross-product functions and orthogonal conditions.

Benefits of technology

This approach significantly reduces human error, enhances the accuracy and efficiency of coupling point generation, shortening the overall computational time by 50% and improving the reliability of flood simulation models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120197544A_ABST
    Figure CN120197544A_ABST
Patent Text Reader

Abstract

The invention discloses a grid optimization generation method and device of a one-dimensional and two-dimensional coupling hydrodynamic model, a medium and a product, and relates to the field of data processing.The method comprises the steps that after a grid river network digital elevation model is generated based on original terrain data, a river channel center line and boundary lines of the two banks of a river channel are determined; a hydrodynamic simulation system is used for obtaining an unstructured grid unit information file based on a riverway center line and riverway two-bank boundary lines, a coupling point processing module is written through a python language, and unstructured grid unit information is received and preprocessed; and a python script is operated, a cross product function and a straddling condition are utilized, the verification model is calibrated based on the preprocessed unstructured grid unit information, and grid optimization of the one-two-dimensional coupling hydrodynamic model is completed. According to the method and the device, the grid optimization of the one-two-dimensional coupled hydrodynamic model can be completed under the condition of not depending on third-party hydrodynamic modeling software, so that the accuracy of generating the coupling point of the one-two-dimensional coupled hydrodynamic model and the grid optimization generation speed are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular, to a method, device, medium, and product for optimizing the generation of grids of a one- and two-dimensional coupled hydrodynamic model. Background Art

[0002] Numerical simulation of flood evolution is to establish a mathematical model and use a computer to simulate the flood evolution process to predict the occurrence and evolution trend of flood disasters. Its main purpose is to improve flood control capabilities and reduce flood losses.

[0003] In the process of numerical simulation of flood evolution, how to perform accurate and effective simulation is a decisive factor in the numerical simulation of flood evolution, and the grids and coupling points of the one- and two-dimensional coupled hydrodynamic model are the dual pillars of the flood simulation progress and efficiency. Among them, the grid quality determines the model's ability to depict physical processes and requires a balance of resolution, orthogonality, and dynamic adaptability; coupling point optimization ensures the conservation and stability of interface data transfer and requires a combination of hydrodynamic mechanisms and computational mathematics constraints. The synergistic effect of the two directly affects the reliability of flood risk warning and the scientific nature of water conservancy project design. The coupling point is closely related to the accuracy of data transfer and whether the coordinated dynamic simulation of the one- and two-dimensional hydrodynamic model is accurate and reasonable. The grid of the one- and two-dimensional coupled hydrodynamic model is one of the key input data in the hydrological and hydrodynamic model, which has a crucial impact on the accuracy and reliability of the simulation results. Therefore, optimizing the grids and coupling points of the one- and two-dimensional coupled hydrodynamic model is a key link in accurately constructing the hydrological and hydrodynamic model. The evaluation and analysis of the simulation results will provide a scientific basis for flood control work and play an important role in flood warning, emergency response, etc.

[0004] In the current field of hydrological simulation and forecasting, common hydrological and hydrodynamic models mainly include the Hydrologic Engineering Center-River Analysis System (HEC-RAS), the one- and two-dimensional coupled hydrodynamic model (MIKE Flood), the Storm Water Management Model (SWMM), etc. These models have the characteristics of high accuracy, strong adaptability, and more vividness, and have been verified in the applications of many hydrological and hydraulic fields. The optimized grids of the one- and two-dimensional coupled hydrodynamic model can be directly input into the hydrological and hydrodynamic model to simulate the physical state under different hydrological conditions, which can not only help predict the future hydrological and hydrodynamic change trends and flood risks of rivers, but also help evaluate the effects of water resource utilization plans and water conservancy project construction, as well as provide decision-making support for ecological protection and pollution control, etc.

[0005] By inputting data, adjusting parameters, optimizing models, etc., the hydraulic response of rivers and the trend of hydrological changes under different scenarios can be simulated. For example, in the case of flood prediction, different meteorological and hydrological conditions such as rainfall data, temperature, and flow can be input to estimate the potential flood risk and possible impact range of rivers under different circumstances. The results of the model can also be used to evaluate different governance plans or water conservancy project construction plans, and select the optimal plan with the least impact on the basin and river.

[0006] At present, the commonly used one- and two-dimensional coupled hydrodynamic model grid coupling points mostly rely on the automatic generation of coupling points and manual experience adjustment of commercial software (such as MIKE FLOOD, HEC-RAS). The efficiency of calibrating coupling points is low, and the connection position of the one-dimensional section and the two-dimensional grid needs to be adjusted repeatedly. Especially at the junction of complex river networks and irregular floodplains, manual delineation can easily lead to spatial topological dislocation, causing mass and momentum transfer distortion, and even numerical oscillation. Existing studies have shown that when the coupling point coordinate deviation exceeds 10% of the grid scale, the head loss error can be magnified to more than 30%; grid heterogeneity causes waste of computing resources. One- and two-dimensional coupled hydrodynamic models usually use unstructured grid coupling, but the existing known methods lack an adaptive encryption mechanism for the coupling boundary. For example, if the two-dimensional triangular grid fails to coordinate with the one-dimensional section node density at the coupling interface, it will force the global time step to be limited to the finest grid, resulting in more than 80% redundant calculations. In addition, the closed grid engine of commercial software is difficult to embed parameterized constraints such as terrain curvature and flow gradient, resulting in local over-density or over-sparseness; dynamic coupling simulation is inefficient, and during the evolution of floods, events such as overtopping and breaches will trigger spatiotemporal changes in the coupling relationship. Traditional static coupling topology cannot respond in real time, and calculations need to be interrupted and interfaces manually reconstructed, which seriously damages the continuity of the simulation and increases the overall calculation time. Over-reliance on automatic generation on commercial platforms has major limitations and cannot be solved by grid heterogeneous optimization. Based on this, this field urgently needs to propose a more convenient, efficient and accurate grid optimization generation method for one- and two-dimensional coupled hydrodynamic models. Summary of the invention

[0007] The purpose of this application is to provide a mesh optimization generation method, equipment, medium and product for a one- and two-dimensional coupled hydrodynamic model, which can complete the mesh optimization of the one- and two-dimensional coupled hydrodynamic model without relying on third-party hydrodynamic modeling software, thereby improving the accuracy of coupling point generation and the speed of mesh optimization generation of the one- and two-dimensional coupled hydrodynamic model.

[0008] To achieve the above objectives, this application provides the following solutions:

[0009] In a first aspect, the present application provides a method for optimizing and generating a grid of a one- and two-dimensional coupled hydrodynamic model, comprising:

[0010] Obtain various original terrain data of the target area, and generate a raster river network digital elevation model based on the original terrain data;

[0011] Determine the center line of the river channel and the boundary lines on both sides of the river channel based on the original terrain data and the raster river network digital elevation model;

[0012] Use the hydrodynamic simulation system to generate the unstructured grid cell information on both sides of the river channel based on the center line of the river channel and the boundary lines on both sides of the river channel, and generate an unstructured grid cell information file;

[0013] Based on the unstructured grid cell information file, write a coupling point processing module in Python language to receive and preprocess the unstructured grid cell information;

[0014] Run the Python script, use the cross product function and the straddle condition to calibrate and verify the model based on the preprocessed unstructured grid cell information and complete the grid optimization of the one-dimensional and two-dimensional coupled hydrodynamic model.

[0015] In a second aspect, the present application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the steps of the method for generating grid optimization of the one-dimensional and two-dimensional coupled hydrodynamic model provided above.

[0016] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for generating grid optimization of the one-dimensional and two-dimensional coupled hydrodynamic model provided above are implemented.

[0017] In a fourth aspect, the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the method for generating grid optimization of the one-dimensional and two-dimensional coupled hydrodynamic model provided above are implemented.

[0018] According to the specific embodiments provided by the present application, the present application has the following technical effects:

[0019] The present application provides a method, device, medium and product for optimizing the generation of grids of a two-dimensional coupled hydrodynamic model. After generating a raster river network digital elevation model based on the original terrain data, the center line of the river channel and the boundary lines on both sides of the river channel are determined, and the unstructured grid cell information on both sides of the river channel is generated by using a hydrodynamic simulation system based on the center line of the river channel and the boundary lines on both sides of the river channel. A coupling point processing module is written in the Python language to receive and preprocess the unstructured grid cell information. Under limited data conditions, coupling points are generated through the geometric relationship between the unstructured grid cell information on both sides of the river channel and the central nodes of the center line of the river channel, overcoming the disadvantages of uneven distribution and excessive position deviation of automatically generated coupling points in common hydrodynamic model software, avoiding the repetition of coupling points due to the overly long river channel in the target area in the hydrodynamic model, realizing the rapid layout of coupling points of the two-dimensional coupled hydrodynamic model, reducing the errors caused by the subjectivity of researchers, and thus greatly improving the accuracy of the generation of coupling points of the two-dimensional coupled hydrodynamic model. By using the cross product function and the straddle condition, the model is calibrated and verified based on the preprocessed unstructured grid cell information, and the grid optimization of the two-dimensional coupled hydrodynamic model is completed. Without relying on third-party hydrodynamic modeling software, the grid optimization of the two-dimensional coupled hydrodynamic model can be completed, and at the same time, the batch calibration of the coupling points of the two-dimensional coupled hydrodynamic model is realized, greatly reducing the workload, significantly improving the working efficiency of the grid optimization generation of the two-dimensional coupled hydrodynamic model, and further improving the construction efficiency and effect of the two-dimensional coupled hydrodynamic mathematical model in flood routing simulation analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required to be used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0021] Figure 1 It is a schematic flowchart of a method for optimizing the generation of grids of a two-dimensional coupled hydrodynamic model provided by an embodiment of the present application;

[0022] Figure 2 It is a schematic flowchart of preprocessing the positions of coupling points of a two-dimensional coupled hydrodynamic model provided by an embodiment of the present application;

[0023] Figure 3 It is a schematic flowchart of calibrating the coupling points of a two-dimensional coupled hydrodynamic model provided by an embodiment of the present application;

[0024] Figure 4 It is a schematic diagram of the arrangement of coupling points of a two-dimensional coupled hydrodynamic model automatically generated by using commercial software such as the MIKE hydrodynamic model;

[0025] Figure 5 Schematic diagram of the optimized coupling point arrangement after optimizing the grid generation method of the one - two - dimensional coupled hydrodynamic model provided by this application. Specific implementation mode

[0026] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present application.

[0027] To make the above - mentioned objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation modes.

[0028] In an exemplary embodiment, the present application provides a grid optimization generation method for a one - two - dimensional coupled hydrodynamic model. This method is executed by a computer device, which can be specifically executed alone by a computer device such as a terminal or a server, or jointly executed by a terminal and a server. In the embodiments of the present application, this method is described by taking its application to a server as an example. As Figure 1 shown, this method includes:

[0029] Step 100: Obtain various original terrain data of the target area, and generate a raster river network digital elevation model based on the original terrain data.

[0030] Step 101: Determine the centerline of the river channel and the boundary lines on both sides of the river channel based on the original terrain data and the raster river network digital elevation model. Among them, if there is no centerline data of the river channel in the original terrain data, the thalweg is extracted from the raster river network digital elevation model to replace it.

[0031] Step 102: Use the hydrodynamic simulation system to generate unstructured grid cell information on both sides of the river channel based on the centerline of the river channel and the boundary lines on both sides of the river channel, and generate an unstructured grid cell information file.

[0032] Step 103: Based on the unstructured grid cell information file, write a coupling point processing module in the Python language to receive and pre - process the unstructured grid cell information.

[0033] Step 104: Run the Python script, and use the cross - product function and the straddle condition to calibrate and verify the model based on the pre - processed unstructured grid cell information and complete the grid optimization of the one - two - dimensional coupled hydrodynamic model.

[0034] In another exemplary embodiment of the present application, in order to improve the construction efficiency of the grid river network digital elevation model, in this embodiment, the implementation process of step 100 can be replaced by the following steps 200-step 203.

[0035] Step 200: Use the multi-source data fusion technology to convert the original terrain data into a unified data format to obtain integrated data. Among them, the multi-source data fusion technology can be used to convert each original terrain data, unify it into the same data format and integrate it into the Geographic Information System (GIS).

[0036] Step 201: Perform duplicate data removal and abnormal data processing on the integrated data to obtain accurate terrain data.

[0037] For example: Open the layer attribute tables of the point features, line features, and surface features of the integrated data in GIS. Add field X and field Y to store the XY coordinate values of the point features, and calculate the XY coordinate values through geometric calculations. Add the length field to store the length information of the line features, and calculate the length value through geometric calculations. Add the area field to store the area of the surface features, and obtain the area value through calculations. Call the "Data Management Tools-General-Remove Identical Items" tool, input the layers of the point features, line features, and surface features for which duplicate data needs to be removed and select the corresponding fields to complete the removal of duplicate data.

[0038] Generate a relatively rough grid model using the point and line data, color it and overlay it with the point and line layers. Place the point and line layers above the grid model layer, and find and delete the abnormal point and line data within the mutation area of the grid image.

[0039] Step 202: Use the accurate terrain data as the input element of the Triangulated Irregular Network (TIN) model to construct a Triangulated Irregular Network (TIN).

[0040] For example, select the "Create TIN" tool in the 3D Analysis Toolbox, use the accurate terrain data as the input element, set the type, height field, and coordinate system of the input element to generate a TIN that can accurately represent the complex terrain change characteristics. Among them, considering that different types of terrain data form the TIN surface in different forms, set the form in which it forms the TIN surface in the model while inputting the accurate terrain data to ensure that the constructed TIN model can accurately express and simulate the actual terrain. During the creation of the TIN, input the point data with elevation information in the form of discrete multi-points (Mass_Points), input the line data in the form of soft break lines (Soft_Line), and input the contour lines without elevation information in the form of hard break lines (Hard_Line).

[0041] Step 203: Convert the triangulated irregular network (TIN) into a raster form, and convert the digital elevation model of the triangulated irregular network into a raster form to obtain a raster river network digital elevation model.

[0042] Among them, considering that the data structure form of the TIN model is relatively complex and is not conducive to the drawing of the river centerline and the boundary lines on both sides of the river required by the one-dimensional and two-dimensional coupled hydrodynamic model, the triangulated irregular network (TIN) model is converted into a raster river network digital elevation model with a regular data format arrangement to ensure the efficiency and accuracy of the layout of the river cross-section and data extraction. Based on this, in Step 203, select the "TIN to Raster" tool in the 3D Analysis Toolbox, input the constructed triangulated irregular network (TIN), set parameters such as the data type, interpolation method, cell size, and height factor variable of the output raster, and convert the triangulated irregular network (TIN) into a raster river network digital elevation model.

[0043] In another exemplary embodiment of the present application, in order to effectively avoid the spatial topological misalignment caused by manual delineation, in this embodiment, the implementation process of the above Step 102 can be replaced by the following Steps 300 - 303.

[0044] Step 300: Starting from the upstream of the boundary lines on both sides of the river and ending at the downstream of the boundary lines on both sides of the river, use the unstructured grid technology to define the geometric shape of the computational domain along the trend of the boundary lines on both sides of the river. The outside of the boundary lines on both sides of the river refers to the riverbank area within a set range from the boundary lines on both sides of the river.

[0045] Step 301: Redistribute the nodes of the lines of the geometric shape of the computational domain and set the node density, which can effectively optimize the grid quality and is conducive to improving the calculation efficiency of the coupling points of the one-dimensional and two-dimensional coupled hydrodynamic model.

[0046] Step 302: Set the grid geometric parameters and use the discretized Delaunay triangulation of the boundary lines on both sides of the river, generate and store them as a spatial grid data file (.dfsu), which can ensure the grid quality. The spatial grid data file is used to store the node coordinates of the unstructured grid on both sides of the river and the grid element node index table corresponding to the node coordinates of the unstructured grid on both sides of the river.

[0047] Step 302: Redistribute the nodes of the river centerline and output the redistributed river centerline file. Store the redistributed river centerline file as a three-dimensional coordinate format file (.xyz). The three-dimensional coordinate format file is used to store the node coordinates and values of the river centerline. Both the spatial grid data file and the three-dimensional coordinate format file are used as unstructured grid element information files.

[0048] Furthermore, the implementation process of the above steps 300 - 302 can be described as follows:

[0049] In the MIKE Zero mesh generator, open the Data in the property editing bar. Import the river centerline and the boundary lines on both banks determined based on the original terrain data and the raster river network digital elevation model through ImportBoundary. Select the upstream and downstream endpoints on both banks of the river, and convert the vertices to nodes through the conversion tool. Use the Add Line tool to generate a relatively rough geometric calculation area outside the river banks, and call the Node Redistribution tool to redistribute the nodes by setting the adjacent node distance. Among them, when redistributing the nodes of the river centerline, the assignment of the adjacent node distance should be less than or equal to the assignment of the node redistribution of the geometric calculation area outside the river banks.

[0050] Use the mesh generator in the property editing bar to reasonably assign values to the maximum element area and the maximum number of meshes and generate unstructured mesh elements.

[0051] Use the Exportmesh tool in the property editing bar to export in the DFSU Data_File spatial sequence format.

[0052] Through the Edit Line tool, select the river centerline. Call the Node Redistribution tool to redistribute the nodes of the river centerline by setting the adjacent node distance. Export the redistributed river centerline as a three-dimensional coordinate format file (.xyz) through the Line Export tool.

[0053] Furthermore, the process of establishing the basic control equations of the river model can be described as follows:

[0054] (1) For the one-dimensional model (river flow, Saint-Venant equations), expressed in the form of the continuity equation and the momentum equation in conservation form:

[0055]

[0056] In the formula, A represents the cross-sectional area of flow, Q represents the flow rate. x is the spatial coordinate, representing the position along the river. t is the time coordinate, representing the time point of the model calculation simulation. h represents the water level, S f represents the friction slope, ql represents the lateral inflow, g represents the acceleration due to gravity, is the partial derivative symbol.

[0057] (2) For the two-dimensional model (floodplain flow, shallow water equations), the mass conservation and momentum conservation equations are expressed as:

[0058]

[0059] where u and v represent velocity components, and z b represents the riverbed elevation, v represents the eddy viscosity coefficient, and τ x and τ y represent the wind stress or the bottom shear stress, and Δ 2 represents the Laplace operator, representing the diffusion term.

[0060] Furthermore, the mathematical framework for mesh generation includes:

[0061] 1) For one-dimensional mesh generation, let the centerline of the river channel be the curve C(s i ), and s i represents the i-th value of the parameter s parameterized as the coordinates of the one-dimensional mesh nodes, and there is:

[0062] x1(s i ) = C(s i ), i = 1, 2,..., N1.

[0063] In the formula, x1(s i ) represents the coordinates of the parameter point s i on the curve C(s i ). Each node corresponds to cross-section geometric parameters, such as the width Bi and the riverbed elevation z b (x i , y j ). The discrete space step Δx = s i+1 - s i .

[0064] 2) For two-dimensional mesh generation, unstructured triangular meshes (Delaunay triangulation) are adopted, and the node coordinates (x i , y j ) satisfy the terrain constraints, and there is:

[0065] z b (x i , y j ) = DEM(x i , y j ).

[0066] In the formula, DEM(x i , y j ) is the digital elevation model function.

[0067] The mesh size function h(x, y) is adaptively adjusted according to the velocity gradient, and there is:

[0068] h(x, y) = h0·(1 + α|Δu| + β|Δh|).

[0069] In the formula, h0 represents the base resolution, α and β represent adjustment coefficients, Δu represents the spatial change rate of the flow velocity, and Δh represents the spatial change rate of the water level.

[0070] In another exemplary embodiment of the present application, the implementation process of step 103 can be replaced by steps 400 - 407.

[0071] Step 400, configure the program running environment, install the third - party function libraries provided by the program, read the spatial grid data file through a python script, obtain the coordinates of the unstructured grid nodes on both sides of the river channel and the grid cell node index table corresponding to the coordinates of the unstructured grid nodes on both sides of the river channel, and create a first list. The first list is used to store the center point coordinates and values of the unstructured grid on both sides of the river channel.

[0072] Step 401, traverse each unstructured grid cell on both sides of the river channel, and determine the average value of the x - coordinate and the average value of the y - coordinate in each unstructured grid cell based on the center point coordinates and values stored in the list.

[0073] Read the three - dimensional coordinate format file through a python script, obtain the node coordinates and values of the river channel centerline, and create a second list. The second list is used to store the center node coordinates and values of the river channel centerline.

[0074] Step 402, traverse each center node of the river channel centerline through a loop function. During the traversal process, skip the center nodes that do not contain two coordinate values, and after converting the coordinate values of the center nodes that contain two coordinate values to floating - point numbers, add them to the second list.

[0075] Step 403, create an empty list, use the Euclidean distance formula to determine the distance between each center node of the river channel centerline and the center point of each grid cell in the raster river network digital elevation model, and obtain the position and distance of the center point of the grid cell closest to each center node of the river channel centerline. In this process, use the if judgment function to determine whether the current distance is the known minimum distance and update the minimum distance and the center point, and add the final result back to the list.

[0076] Among them, the Euclidean distance formula is expressed as:

[0077]

[0078] In the formula, d(t j , c k ) is the distance between the center node (x j , y j ) of the river channel centerline and the center point (c k,x , c k,y ) of each grid cell in the raster river network digital elevation model.

[0079] Step 404: Assign the coordinates of the center point of the grid cell closest to each center node of the river channel center line as None, and assign the distance between the center point of the grid cell closest to each center node of the river channel center line and each center node of the river channel center line as infinity, and then store them in an empty list to generate a result list.

[0080] Step 405: Store the result list as a plain text file.

[0081] Step 406: Read the plain text file through a python script. Based on the coordinates of the center point of the grid cell closest to each center node of the river channel center line, delete the duplicate lines in the plain text file, retain the unique valid data, and return the plain text file to replace the stored data to obtain an optimized plain text file.

[0082] Step 407: Open the optimized plain text file through Excel, and process and calculate the stored data through functions to determine the river mileage corresponding to the center point of the unstructured grid cell in the closed area on both sides of the river closest to the center node of the river channel center line, initially complete the preliminary optimization generation of the coupling points of the one-dimensional and two-dimensional coupled hydrodynamic model, and obtain the preprocessed unstructured grid cell information.

[0083] Furthermore, based on the descriptions of the above steps 400 - 407, in the actual application process, in step 103, based on the unstructured grid cell information file of the river channel center line and the river banks, the implementation process of writing a coupling point processing module in the python language to receive and preprocess the unstructured grid cell information can include:

[0084] (1). Define the input data.

[0085] The set of grid node coordinates is:

[0086] N = {n i =(x i , y i , z i ) | i = 1, 2,..., N}.

[0087] In the formula, N represents the total number of grid nodes, and each grid node n i contains three-dimensional coordinates (x i , y i , z i ).

[0088] The grid cell index table is:

[0089] ε = {e k =[n k1 , n k2 ,..., nkm |i = 1, 2, ..., N}.

[0090] In the formula, ε represents the total number of grid cells, and each grid cell e k contains m node indices, indicating which nodes the cell consists of.

[0091] The set of central nodes of the river channel centerline is:

[0092] T = {t j = (x j , y j ) | j = 1, 2, ..., M}.

[0093] In the formula, T represents the set of central nodes, and each central node t of the river channel centerline j contains M node indices.

[0094] (2) The two-dimensional coordinates of the central nodes of the river channel centerline read from the.xyz file.

[0095] (3) Calculate the center points of unstructured grid cells:

[0096] For each grid cell e k ∈ ε, its center point coordinate c k is defined as the arithmetic mean of all node coordinates of the grid cell, and there is:

[0097]

[0098] In the formula, (x n , y n ) represents the grid cell coordinates.

[0099] For each central node t of the river channel centerline j ∈ T, find the nearest grid cell center point c k .

[0100] (4) Obtain unstructured grid cell information and perform data preprocessing by running a python script, including:

[0101] (4-1) Import the mikeio library for processing hydrodynamic model data (mike) and read unstructured grid cell data. Import the numpy library for performing operations on array-structured data. Import the pandas library for reading data in csv plain text files, flexibly querying and filtering data, and writing the results to a new csv file. Import the csv library for creating a new csv plain text file to store data. Import library functions within math.

[0102] (4-2) Open the unstructured grid file (.dfsu) on both sides of the river channel through the mikeio.DfsuFile() function. The unstructured grid file (.dfsu) on both sides of the river channel and the following unstructured grid cell node index table on both sides of the river channel both belong to the data of the unstructured grid cell information file on both sides of the river channel.

[0103] (4-3) Obtain the unstructured grid data on both sides of the river channel through the mesh attribute. The node_coordinates attribute returns the coordinates of the grid nodes and obtains the unstructured grid node coordinates on both sides of the river channel. The element_table attribute returns the connection information of the grid elements and obtains the unstructured grid cell node index table on both sides of the river channel.

[0104] (4-4) Initialize the list element_coordinates for storing the center coordinates of the cells. Traverse the element_table through the for loop function and for each cell, obtain the coordinates of the nodes from node_coordinates through the node index. The output result coords is an array with a shape of (n_nodes_per_element, 2), representing the coordinates of all nodes of the grid cell.

[0105] (4-5) Extract the first coordinate value of all nodes, that is, the x coordinate, through the coords[:,0] function, and calculate the average value of these x coordinates through the np.mean() function.

[0106] (4-6) Extract the second coordinate value of all nodes, that is, the y coordinate, through the coords[:,1] function, and calculate the average value of these y coordinates through the np.mean() function.

[0107] (4-7) Add the position (center_x, center_y) of the center point of the unstructured grid cell in the current closed area on both sides of the river channel to the first list through the append() function.

[0108] (4-8) Read the three-dimensional coordinate format file (.xyz) of the river channel centerline through the read_xyz_file() function, initialize the coordinate list coordinates, and traverse each line through the for loop function.

[0109] (4-9) Clean and split the line data through the line.strip() function and the split() function.

[0110] (4-10) Ensure that the current line contains at least two values (x and y) through the if judgment function. If the data is incomplete, skip this line.

[0111] (4-11) Divide the coordinate values (x, y) through parts[0] and parts[1], convert them to floating-point numbers (float), and add them back to the second list.

[0112] (4-12) Create an empty list results to store the center points of the spatial unstructured grid cells of the closed areas on both sides of the nearest river channel for each center node of the river channel centerline and their distances.

[0113] (4-13) Traverse each center node of the river channel centerline through a for loop function, and initialize the minimum distance and the center point position between the current center node of the river channel centerline and the center point of the spatial unstructured grid cell of the closed area on the nearest river channel banks.

[0114] (4-14) Traverse the center point positions of the spatial unstructured grid cells of the closed areas on both sides of the river channel through a for loop function.

[0115] (4-15) Use the np.sqrt() function to calculate the distance between the target point (x1, y1) and the center point (x2, y2) using the Euclidean distance formula.

[0116] (4-16) Use an if judgment function to determine whether the current distance is less than the known minimum distance. If so, update the minimum distance and the center point of the nearest grid cell.

[0117] (4-17) Add the coordinates of the center point of the spatial unstructured grid cell of the closed area on both sides of the river channel closest to the center point on the current river channel centerline as a tuple (target_coordinate, closest_center) to the results list and store it as a plain text file (.csv format).

[0118] (4-18) Use the drop_duplicates() function to delete duplicate rows according to the center point position of the spatial unstructured grid cell of the closed area on both sides of the river channel closest to the center point of the river channel centerline, retain the unique valid data, and return a plain text file (.csv format) to replace the stored data.

[0119] (5) Process the data generated by the python script and generate one- and two-dimensional hydrodynamic model coupling points, including:

[0120] (5-1) Open the plain text file (.csv format) through Execl, use the sum function and the Euclidean distance formula to process and calculate the data, and obtain the river channel mileage corresponding to the center point of the spatial unstructured grid cell of the closed area on both sides of the river channel closest to the center point of the river channel centerline.

[0121] (5-2) Import the processed data into the hydrodynamic model software (Mike flood) to generate the one-dimensional and two-dimensional coupled hydrodynamic model coupling points for the corresponding target area.

[0122] Furthermore, the definition and data transfer method of the one-dimensional and two-dimensional coupled hydrodynamic model coupling points are as follows:

[0123] Set the coupling point position. The intersection of the one-dimensional river channel end point and the two-dimensional grid boundary is the coupling interface Γ, and the mapping relationship is defined as:

[0124]

[0125] In the formula, (x k , y k ) represents the coordinates of the coupling interface point, R 2 represents the two-dimensional real number space, C(s k ) represents the parametric equation of the river channel center line, B(s k ) represents the width of the river channel at position s k , and s k represents the parameter along the river channel center line.

[0126] Establish the flux conservation condition. At the one-dimensional and two-dimensional interface, the mass and momentum fluxes need to be conserved, and there is:

[0127] Q 1D = ∫∫ Γ (hu·n x + hv·n y )dΓ.

[0128] In the formula, Q 1D represents the flow rate of the one-dimensional model, and n x and n y represent the interface normal vector components.

[0129] Based on the above description, the deduction steps for generating the one-dimensional and two-dimensional coupled hydrodynamic model grid are as follows:

[0130] 1) Generation of one-dimensional river channel discretization:

[0131] Input the river channel center line C(s) and cross-section parameters {B i , z b,i}.

[0132] Generate one-dimensional grid nodes x1(s i ), and the step size satisfies the CFL condition, and there is:

[0133]

[0134] In the formula, △t represents the time step size, and △x represents the space step size.

[0135] 2) Two-dimensional floodplain grid meshing:

[0136] Generate an initial triangular grid based on DEM (Digital Elevation Model) data, where the nodes satisfy:

[0137] z b (x i ,y j ) = DEM(x i ,y j ).

[0138] Dynamically refine the grid according to the velocity gradient. If the velocity gradient is greater than the threshold or the water level gradient is greater than the threshold, halve the local grid size to improve the resolution of this area, so as to more accurately capture the changes in velocity and water depth. That is, if |△u| > ∈ u or |△h| > ∈ h , then △u represents the spatial rate of change of velocity, △h represents the spatial rate of change of water depth, and ∈ u represents the threshold of the velocity gradient, and ∈ h represents the threshold of the water depth gradient.

[0139] 3) Coupling point matching and interpolation:

[0140] Generate a two-dimensional coupling boundary Γ k at the one-dimensional endpoint s k .

[0141] Use linear interpolation to transfer the interface flux, and there is:

[0142]

[0143] In the formula, Q 1D (s k ) represents the one-dimensional flow rate at the position s k , that is, the total flow rate transferred from the one-dimensional model to the two-dimensional model through the coupling interface. u j and v j represent the water flow components, and △x j , △y j represent the interface microelement length.

[0144] 4) Dynamic grid adaptation for dam-break scenarios:

[0145] Monitor the hydraulic state, such as Trigger local grid reconstruction. For example, refine the grid to h’(x, y) = 0.3h(x, y), update the coupling point position and synchronize the time step. In the formula, Fr represents the Froude constant, and h(x, y) represents the grid height at the point (x, y).

[0146] As an alternative implementation, the process of writing a coupling point processing module in Python to receive and preprocess unstructured grid cell information in step 103 can be as follows Figure 2 as shown, and its software implementation process is described as follows:

[0147] (1) The software implementation process of importing relevant modules is as follows:

[0148] import mikeio

[0149] import numpy as np

[0150] import pandas as pd

[0151] import csv

[0152] import math

[0153] Among them, the first line of code imports the mikeio library, which is used to process hydrodynamic model data (mike) and read unstructured grid cell data. The second line of code imports the numpy library, which is used to perform operations on array-structured data. The third line of code imports the pandas library, which is used to read data from a csv plain text file, flexibly query and filter data, and write the results to a new csv file. The fourth line of code imports the csv library, which is used to create a new csv file to store data. The fifth line of code imports the library functions in math.

[0154] (2) Read the unstructured grid cell information on both sides of the river channel to obtain the node positions of the unstructured grid cells and the element node index table. The software implementation process is as follows:

[0155] mesh = mikeio.Dfsu(dfsu_path)

[0156] node_coordinates = mesh.geometry.node_coordinates

[0157] element_table = mesh.geometry.element_table

[0158] (3) Calculate the center coordinates of the unstructured grid cells. Create a list to store the calculated center coordinates of the grid cells. The software implementation process is as follows:

[0159]

[0160] Among them, the second to fifth lines of code calculate the central node coordinates of each unstructured grid cell by using the np.mean() function within the for loop function. The sixth line of code inserts the generated grid center point coordinates into the list through append().

[0161] (4) Read the three-dimensional coordinate information of the river channel center line and perform preliminary processing on the coordinate information values. The software implementation process is as follows:

[0162]

[0163] Among them, the first line of code defines a function read_xyz_flie to read the.xyz file. The second to third lines of code use file.readlines() to read all lines of the central point coordinates of the river channel center line after opening the three-dimensional coordinate file with open, and store them as a list lines. The fourth line of code creates an empty list to store the (x, y) coordinates extracted from the file. The fifth to eighth lines of code use line.strip() and split() within the for loop function to remove the leading and trailing whitespace characters, and then split the line into multiple parts by whitespace characters. Then, use the if judgment function to check if the current line contains at least two values (x and y), and convert the processed line data from a string to a floating point number. The ninth line of code adds the current central point coordinates of the river channel center line to the list through append(). The tenth line of code returns the list containing all point coordinates through return.

[0164] (5) Create a result list to store the positions of the central points of the nearest grid cells. Traverse each central node of the river channel center line through the for loop function, and calculate the position and distance of the central point of the nearest unstructured grid cell for each central node of the river channel center line. The software implementation process is as follows:

[0165]

[0166] Among them, the second to sixth lines of code traverse the central points of the unstructured grid cells through the for loop function, and use the np.sqrt function to calculate the minimum distance and the nearest central point using the Euclidean distance formula. The seventh to ninth lines of code use the if judgment function to determine whether the current distance is less than the known minimum distance, and update the minimum distance and the nearest central point. The tenth line of code adds the coordinates of the current central node of the river channel center line and its nearest unstructured grid cell central point as a tuple back to the list through the append() function.

[0167] (6) Store the processed data into a csv file. The software implementation process is as follows:

[0168]

[0169]

[0170] Among them, the first line of code defines the save_results_to_csv() function and defines the storage path to save the results to a CSV file. The code from the second line to the seventeenth line converts the list of dictionaries to a Pandas DataFrame by creating a DataFrame within try and writes the DataFrame directly to the CSV file, outputting a success message.

[0171] The dictionary generation of the code from the fourth line to the tenth line includes:

[0172] "Node X" and "NodeY": directly extract the coordinates from coord.

[0173] "CenterX" and "CenterY": extract the coordinates if center exists, otherwise fill with None.

[0174] "Status": mark as Matched or Not Found according to whether center exists.

[0175] The code in the thirteenth line compares the values of all columns through the drop_duplicates() function. If there are duplicate rows, only the first row of data is retained.

[0176] The code from the fourteenth line to the seventeenth line performs exception handling through the except() function, catches exceptions such as file permission errors, invalid paths, and insufficient memory, and prints a friendly prompt. Finally, the coupling point location data table as shown in Table 1 is obtained, realizing the preliminary generation of the coupling points of the one- and two-dimensional coupled hydrodynamic model.

[0177] Table 1 Coupling Point Data Table

[0178]

[0179]

[0180] (7) Open the CSV file through the Excel table, extract the data in columns C, D, and F after calculation through the built-in function, and import it into Mike Flood couple to generate the corresponding coupling points. The implementation process is as follows:

[0181] Delete the row name of the first row and the invalid data in column E.

[0182] Assign 0 to cells E1 and F1.

[0183] Enter =((A2 - A1)^ in cell E2 2+(B2 - B1)^ 2 )^ 0.5 , and sequentially fill the remaining cells in column E through the drop-down handle.

[0184] Output = E2 + F1 in cell F2, and sequentially fill the remaining cells in column F through the drop-down handle to calculate the river channel mileage corresponding to the nearest grid center point, as shown in Table 2, which can be directly imported into the MIKE one-two dimensional coupling model to generate coupling points.

[0185] Table 2 River Channel Mileage Data Table

[0186]

[0187]

[0188] In another exemplary embodiment of the present application, the implementation process of step 104 can be replaced by the following steps 500 - step 504.

[0189] Step 500: Generalize the position of the coupling point of the calibration and verification model into a problem of judging whether there is an intersection part between two three-dimensional line segments (i.e., the intersection position inspection problem), define the three-dimensional vector cross product function, and establish the straddle condition. Among them, the three-dimensional vector cross product function is defined as:

[0190] v3·(v1×v2) = 0.

[0191] In the formula, v1×v2 is the cross product of the direction vectors of the two line segments, representing the normal vector. v3·(v1×v2) is the mixed product.

[0192] Step 501: Take the two shorelines of the river channel as a polyline and generate a three-dimensional coordinate format file of the river channel center line.

[0193] Step 502: Based on the center point position data of the non-structured grid cells in the closed area on both sides of the river channel closest to the center point of the river channel center line, form another polyline and generate a three-dimensional coordinate format file of the center point of the nearest grid cell.

[0194] Step 503: Configure the program running environment and install the third-party function library provided by the program. Read the three-dimensional coordinate format file of the river channel center line and the three-dimensional coordinate format file of the center point of the nearest grid cell through a python script, traverse all the line segments in the three-dimensional coordinate format file of the river channel center line and the three-dimensional coordinate format file of the center point of the nearest grid cell, and use the three-dimensional vector cross product function to determine the cross product of the three-dimensional vectors for judging whether the line segments are coplanar. Among them, if the value of the three-dimensional vector cross product function is 0, it means that the four points are coplanar; if the value of the three-dimensional vector cross product function is not 0, it means that the line segments are not coplanar and are directly determined not to intersect.

[0195] For example, suppose there are two line segments in three-dimensional space, namely, line segment 1 and line segment 2.

[0196] (1) The endpoints P1 and P2 of line segment 1, the parametric equation of line segment 1 is:

[0197] L1:P=P1+m′(P2-P1),m′∈[0,1].

[0198] Wherein, L1 represents line segment 1.

[0199] (2) The endpoints Q1 and Q2 of line segment 2, the parametric equation of line segment 2 is:

[0200] L2: Q=Q1+n′(Q2-Q1),n′∈[0,1].

[0201] Wherein, L2 represents line segment 2.

[0202] To determine whether line segment 1 and line segment 2 are coplanar, we have:

[0203] P1+m′v1=Q1+n′v2.

[0204] Where v1 represents the direction vector of line segment 1, and v2 represents the direction vector of line segment 2.

[0205] If two line segments are not coplanar, they cannot intersect. Coplanarity is verified by vector cross product and dot product, defining the vector as:

[0206] v1=P2-P1, v2=Q2-Q1, v3=Q1-P1

[0207] Based on the above description, the result of the coplanarity judgment is: if the mixed product is non-zero, the line segments are not coplanar, and it is directly determined that they do not intersect. If the line segments are coplanar, the simultaneous parametric equations are used to find m' and n', and expanded into component equations, we have:

[0208]

[0209] Since the coplanarity is satisfied, the component equation is actually a two-dimensional problem. Using the two-dimensional projection method, ignoring the z coordinate, it is organized into a matrix form, and we have:

[0210]

[0211] Noted as: Ax=b.

[0212] In the formula, (x1, y1, z1) represents the coordinates of the endpoint P1, (x2, y2, z2) represents the coordinates of the endpoint P2, (x3, y3, z3) represents the coordinates of the endpoint Q1, and (x4, y4, z4) represents the coordinates of the endpoint Q2.

[0213] If det(A)≠0, the solution is:

[0214]

[0215] In the formula, A, b, A1, and A2 all represent the matrices after replacing columns.

[0216] If the solution satisfies m' ∈ [0, 1] and n' ∈ [0, 1], then the z - coordinate consistency needs to be further verified:

[0217] z1 + m'(z2 - z1) = z3 + n'(z4 - z3).

[0218] If it holds, the line segments intersect; otherwise, they do not intersect.

[0219] Step 504: Use the straddle condition and the cross - product of three - dimensional vectors to determine whether the line segments in the three - dimensional coordinate format file of the river channel centerline and the three - dimensional coordinate format file of the center points of the nearest grid cells are coplanar, so as to complete the grid optimization of the one - two - dimensional coupled hydrodynamic model.

[0220] Based on the descriptions of the above steps 500 - 504, in the actual application process, the specific steps of writing the calibration and verification module in Python are as follows:

[0221] (1). Import the Numpy library for operating on array - structured data.

[0222] (2). Create an empty list to store three - dimensional coordinates. Read the three - dimensional coordinate data of the center points of the nearest grid cells and the three - dimensional coordinate data format file (.xyz) of the two banks of the river channel through read_xyz_file(). Initialize the coordinate list coordinates, and traverse each line through a for loop function.

[0223] (3). Clean and split the line data through the line.strip() function and the split() function.

[0224] (4). Use the if judgment function to ensure that the current line contains at least two values (x and y). If the data is incomplete, skip this line.

[0225] (5). Split the coordinate values (x, y) through parts[0] and parts[1], and convert them to floating - point numbers float and add them back to the list.

[0226] (6). Define a three - dimensional vector cross - product function by defining the vector_cross() function to judge whether the line segments are coplanar.

[0227] (7). Define a line segment intersection judgment function by defining the line_segement_intersection() function.

[0228] (8) Use the if judgment function to determine whether the line segments are coplanar. If they are not coplanar, return None.

[0229] (9) Calculate the parameters m' and n' using the np.linalg.norm() function and the np.dot() function. Call the if judgment function to ensure that m' and n' are within [0, 1], and the intersection point is within the line segment.

[0230] (10) Define the function find_intersections() to define the function for finding all intersection points. Use the for loop function to traverse all line segments and check each line segment of the first polyline and each line segment of the second polyline.

[0231] (11) Call the line_segement_intersection() function to determine whether the line segments intersect. Use the if judgment function. If they intersect, add the intersection point coordinates to the list.

[0232] (12) Define the main() function to define the main function. Call the read_xyz_file() function to load the polyline data and call the find_intersections() function to find the intersection points.

[0233] (13) Output and print all intersection point coordinates.

[0234] (14) Set the program entry point. When the script is run directly, execute the main() function.

[0235] As an alternative implementation, in step 104, by running a Python script, using the cross product function and the straddle condition, the process of calibrating and verifying the position of the coupling points of the model and completing the grid optimization of the one - two - dimensional coupled hydrodynamic model in the target area can be as Figure 3 shown, and its software implementation process can be described as:

[0236] (1) The three - dimensional coordinate format file (.xyz) converted from the position data of the nearest grid center point is called line segment 1, and the three - dimensional coordinate format file (.xyz) converted from the original river bank line file is called line segment 2.

[0237] (2) Import relevant modules. The software implementation process is as follows:

[0238] import numpy as np # Import the numpy library for operating on array - structured data.

[0239] (3) Read the three - dimensional coordinates of the nearest grid center point and the three - dimensional coordinates of the river bank line. The software implementation process is as follows:

[0240] def read_xyz_file(file_path):

[0241] with open(file_path, 'r') as file:

[0242] lines = file.readlines()

[0243] coordinates = []

[0244] for line in lines:

[0245] parts = line.strip().split()

[0246] if len(parts) >= 3:

[0247] x = float(parts[0])

[0248] y = float(parts[1])

[0249] z = float(parts[2])

[0250] coordinates.append((x, y, z))

[0251] elif len(parts) == 2:

[0252] x = float(parts[0])

[0253] y = float(parts[1])

[0254] coordinates.append((x, y, 0.0))

[0255] return coordinates

[0256] Among them, the first line of code defines the read_xyz_file() function. The second to third lines of code open the file through with open() and then call file.readlines() to read all lines of the file, returning a list of strings. The fourth line of code initializes an empty list to store 3D coordinates. From the fifth to the fourteenth lines of code, after using line.strip() and split() within the for loop function to remove the leading and trailing whitespace characters of the line and split the line into multiple parts by whitespace characters, the if judgment function is used to check that the current line contains at least two values (x and y), and the processed line data is converted from a string to a floating-point number. The fifteenth line of code adds the coordinates of the center point of the current river centerline to the list through append(). The sixteenth line of code returns the list containing all point coordinates through return.

[0257] (4) Define the cross product function of three-dimensional vectors. The vector_cross() function calculates the cross product of two three-dimensional vectors and is used to determine whether line segments are coplanar. The software implementation process is as follows:

[0258] def vector_cross(a, b):

[0259] return np.array(

[0260] a[1] * b[2] - a[2] * b[1],

[0261] a[2] * b[0] - a[0] * b[2],

[0262] a[0] * b[1] - a[1] * b[0] )

[0264] (5) Define the function to judge the intersection of line segments. The line_segment_intersection() function judges whether two three-dimensional line segments intersect and returns the intersection point coordinates. The vector cross product method is used to judge coplanarity. If the line segments are not coplanar (the dot product of the cross product is non-zero), directly return None, and calculate the parameters m' and n' to determine whether the intersection point is within the line segment range. Ensure that m' and n' are between [0, 1] for the intersection point to be within the line segment. The software implementation process is as follows:

[0265] def line_segment_intersection(p1, p2, p3, p4):

[0266] p1 = np.array(p1)

[0267] p2 = np.array(p2)

[0268] p3 = np.array(p3)

[0269] p4 = np.array(p4)

[0270] v1 = p2 - p1

[0271] v2 = p4 - p3

[0272] v3 = p3 - p1

[0273] cross_v1_v2 = vector_cross(v1, v2)

[0274] if np.dot(cross_v1_v2, v3) != 0:

[0275] return None

[0276] denominator = np.dot(cross_v1_v2, cross_v1_v2)

[0277] if denominator == 0:

[0278] return None

[0279] cross_v3_v2 = vector_cross(v3, v2)

[0280] cross_v3_v1 = vector_cross(v3, v1)

[0281] m = np.dot(cross_v3_v2, cross_v1_v2) / denominator

[0282] n = np.dot(cross_v3_v1, cross_v1_v2) / denominator

[0283] if 0 <= m <= 1 and 0 <= n <= 1:

[0284] return p1 + t * v1

[0285] else:

[0286] return None

[0287] (6) Define the function to find all intersection points. By using find_intersections() to traverse all line segment pairs within a for loop function, call line_sedment_intersection to determine whether they intersect. If they intersect, add the intersection point coordinates to the list. The software implementation process is as follows:

[0288]

[0289] (7) Define the main function main(), call read_xyz_file to load the polyline data and find the intersections through find_intersections, and format and print the coordinates of all intersection points. The software implementation process is as follows:

[0290]

[0291] (8) Program entry. When the script is run directly, execute the main() function:

[0292] if __name__ == "__main__":

[0293] main()

[0294] As an alternative implementation, use commercial software such as the MIKE hydrodynamic model to independently generate one-dimensional and two-dimensional coupled hydrodynamic model coupling points as Figure 4 shown. The time taken to generate the coupling points for evaluation is 0.02 h, and the time taken to perform manual empirical calibration and verification of the coupling point evaluation is 1 h. The total estimated time is 1.002 h. The results of the coupling point optimization and calibration verification of a certain river in this application are as Figure 5 shown. The evaluation time is 0.3 h, the working hours are shortened by 70.06%, and the model calculation time is shortened by 50%, greatly improving the work efficiency. In addition, this application can effectively avoid the spatial topological misalignment caused by manual delineation, avoid repeatedly adjusting the connection position between the one-dimensional section and the two-dimensional grid, and effectively improve the accuracy and reliability of the simulation results of the one-dimensional and two-dimensional coupled model.

[0295] In summary, the present application first generates a raster river network digital elevation model based on the original terrain data of the target area, thereby determining the centerline of the river channel and the boundary lines on both sides of the river channel, and using a hydrodynamic simulation system to generate the information of unstructured grid cells on both sides of the river channel. Based on the centerline of the river channel and the information file of the unstructured grid cells on both sides of the river channel, the information of the unstructured grid cells is received and preprocessed for the coupling point positions through the Python language. By running a Python script, using the cross product function and the straddle condition, the coupling point positions of the model are calibrated and verified, and finally the generation of coupling points and grid optimization of the one-dimensional and two-dimensional coupled hydrodynamic model of the target area are completed. Under limited data conditions, coupling points are generated based on the geometric relationship between the unstructured grid cells on both sides of the river channel and the central nodes of the centerline of the river channel, overcoming the disadvantages of uneven distribution and excessive position deviation of automatically generated coupling points in common hydrodynamic model software, avoiding the repetition of coupling points due to the overly long river channel in the target area in the hydrodynamic model, realizing the rapid layout of coupling points of the one-dimensional and two-dimensional coupled hydrodynamic model, and reducing the errors caused by the subjectivity of researchers. At the same time, the batch calibration of the coupling points of the one-dimensional and two-dimensional coupled hydrodynamic model is realized, greatly reducing the workload, significantly improving the working efficiency of grid optimization of the one-dimensional and two-dimensional coupled hydrodynamic model, and improving the construction efficiency and effect of the one-dimensional and two-dimensional coupled hydrodynamic mathematical model in flood routing simulation analysis.

[0296] Furthermore, based on the grid optimization generation method of the one-dimensional and two-dimensional coupled hydrodynamic model provided above in the present application, it is possible to effectively avoid the spatial topological misalignment caused by manual delineation, avoid repeatedly adjusting the connection position between the one-dimensional cross-section and the two-dimensional grid, effectively improve the accuracy and reliability of the simulation results of the one-dimensional and two-dimensional coupled model, and reduce the time for effectively and accurately generating grid files by more than 3 days compared with the existing model.

[0297] In an exemplary embodiment, a computer device is provided, which may be a server or a terminal. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store grid optimization generation data of a one-two dimensional coupled hydrodynamic model. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a method for optimizing the generation of the grid of a one-two dimensional coupled hydrodynamic model.

[0298] In one exemplary embodiment, the above-provided processing may include:

[0299] A grid river network digital elevation model determination module, configured to obtain various original terrain data of a target area and generate a grid river network digital elevation model based on the original terrain data.

[0300] An unstructured grid cell information generation module for the two banks of the river channel, configured to generate unstructured grid cell information for the two banks of the river channel through a hydrodynamic simulation system based on the boundary lines of the two banks of the river channel generated from the original terrain data and the grid river network digital elevation model.

[0301] A one-two dimensional coupled hydrodynamic model coupling point generation module, configured to, based on the unstructured grid cell information of the closed area on the two banks of the river channel, use a python automation script and a third-party function library to obtain the positions of the central points of the unstructured grid cells in the closed area on the two banks of the river channel closest to the center line of the river channel and generate the corresponding river channel mileage through the function tool of an Excel table, and preliminarily complete the optimization generation of the coupling points of the one-two dimensional coupled hydrodynamic model.

[0302] A calibration verification model coupling point module, configured to calibrate whether the positions of the coupling points of the one-two dimensional coupled hydrodynamic model are reasonable based on the cross product function and the straddle condition.

[0303] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0304] In an exemplary embodiment, a computer program product is provided, including a computer program which, when executed by a processor, implements the steps in the above method embodiments.

[0305] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0306] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0307] The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0308] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0309] Specific examples are used in this article to elaborate on the principles and implementation manners of the present application. The descriptions of the above embodiments are only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A method for optimizing the generation of a mesh for a one- and two-dimensional coupled hydrodynamic model, characterized in that: The grid optimization generation method of the one- and two-dimensional coupled hydrodynamic model comprises: Obtain various original terrain data of the target area, and generate a raster river network digital elevation model based on the original terrain data; Determine the centerline of the river and the boundary lines on both sides of the river based on the original terrain data and the grid river network digital elevation model; Using the hydrodynamic simulation system to generate the unstructured grid unit information on both sides of the river based on the center line of the river and the boundary lines on both sides of the river, and generate the unstructured grid unit information file; Based on the unstructured grid unit information file, a coupling point processing module is written in Python language to receive and pre-process the unstructured grid unit information; Run the python script, use the cross product function and straddle condition, calibrate and verify the model based on the preprocessed unstructured grid unit information, and complete the grid optimization of the one- and two-dimensional coupled hydrodynamic model.

2. The grid optimization generation method of the one- and two-dimensional coupled hydrodynamic model according to claim 1 is characterized in that: Generate a raster river network digital elevation model based on the original terrain data, including: The original terrain data is converted into a unified data format by using multi-source data fusion technology to obtain integrated data; Performing deduplication processing and abnormal data processing on the integrated data to obtain accurate terrain data; Using the accurate terrain data as input elements, constructing an irregular triangulated network; The irregular triangulated network is converted into a grid form to generate the grid river network digital elevation model.

3. The grid optimization generation method of the one- and two-dimensional coupled hydrodynamic model according to claim 1 is characterized in that: The hydrodynamic simulation system is used to generate the unstructured grid cell information on both sides of the river based on the center line of the river and the boundary lines on both sides of the river, and to generate the unstructured grid cell information file, including: Taking the upstream of the boundary line on both sides of the river channel as the starting point and the downstream of the boundary line on both sides of the river channel as the end point, the geometric shape of the calculation domain is defined outside the boundary line on both sides of the river channel along the direction of the boundary line on both sides of the river channel by using unstructured grid technology; the outside of the boundary line on both sides of the river channel refers to the river bank area within the set range from the boundary line on both sides of the river channel; Redistribute the nodes of the geometric lines of the computational domain, set the node density and mesh geometry parameters, and use discretized Delaunay triangulation to divide the boundary lines on both sides of the river channel, and generate and store them as a spatial mesh data file; the spatial mesh data file is used to store the coordinates of the unstructured mesh nodes on both sides of the river channel and the mesh unit node index table corresponding to the coordinates of the unstructured mesh nodes on both sides of the river channel; Redistributing nodes of the channel centerline and outputting a redistributed channel centerline file; storing the redistributed channel centerline file as a three-dimensional coordinate format file; the three-dimensional coordinate format file is used to store node coordinates and values ​​of the channel centerline; The spatial grid data file and the three-dimensional coordinate format file are both used as the unstructured grid unit information file.

4. The grid optimization generation method of the one- and two-dimensional coupled hydrodynamic model according to claim 3 is characterized in that: Based on the unstructured grid unit information file, a coupling point processing module is written in Python language to receive and pre-process the unstructured grid unit information, including: Read the spatial grid data file through a python script, obtain the coordinates of the unstructured grid nodes on both sides of the river channel and the grid unit node index table corresponding to the coordinates of the unstructured grid nodes on both sides of the river channel, and create a first list; the first list is used to store the center point coordinates and values ​​of the unstructured grids on both sides of the river channel; Traverse each unstructured grid cell on both sides of the river channel, and determine the average value of the x-coordinate and the average value of the y-coordinate in each unstructured grid cell based on the coordinates and values ​​of the center point of the grid stored in the list; Read the three-dimensional coordinate format file through a python script, obtain the node coordinates and values ​​of the center line of the river channel, and create a second list; the second list is used to store the center node coordinates and values ​​of the center line of the river channel; Traversing each central node of the center line of the river channel, during the traversal process, skipping the central nodes that do not contain two coordinate values, and converting the coordinate values ​​of the central nodes that contain two coordinate values ​​into floating point numbers, and adding them to the second list; Create an empty list, use the Euclidean distance formula to determine the distance between each center node of the river centerline and the center point of each grid cell in the grid river network digital elevation model, and obtain the position and distance of the center point of the grid cell closest to each center node of the river centerline; Assigning the coordinates of the center point of the grid unit closest to each center node of the center line of the river channel to None, assigning the distance between the center point of the grid unit closest to each center node of the center line of the river channel to infinity, and storing them in the empty list to generate a result list; Store the result list as a plain text file; Read the plain text file through a python script, and delete duplicate lines in the plain text file based on the coordinates of the center point of the grid unit closest to each center node of the river centerline to obtain an optimized plain text file; Based on the optimized plain text file, the river mileage corresponding to the center point of the unstructured grid unit in the closed area on both sides of the river closest to the central node of the center line of the river is determined, and the preliminary optimization generation of the coupling point of the one- and two-dimensional coupled hydrodynamic model is preliminarily completed to obtain the preprocessed unstructured grid unit information.

5. The grid optimization generation method of the one- and two-dimensional coupled hydrodynamic model according to claim 1 is characterized in that: Run the python script, use the cross product function and straddle condition to calibrate and verify the model based on the preprocessed unstructured grid cell information and complete the grid optimization of the one- and two-dimensional coupled hydrodynamic model, including: The coupling point position of the calibration verification model is generalized into a cross position check problem, a three-dimensional vector cross product function is defined, and the straddling condition is established; Taking the two bank lines of the river channel as a polyline, a three-dimensional coordinate format file of the river channel center line is generated; Another polyline is formed based on the center point position data of the non-structured grid cells in the closed area on both sides of the river channel closest to the center point of the river channel centerline, and a three-dimensional coordinate format file of the center point of the nearest grid cell is generated; Using a python script to read the three-dimensional coordinate format file of the center line of the river channel and the three-dimensional coordinate format file of the center point of the nearest grid unit, traverse all line segments in the three-dimensional coordinate format file of the center line of the river channel and the three-dimensional coordinate format file of the center point of the nearest grid unit, and use a three-dimensional vector cross product function to determine the cross product of the three-dimensional vector; The straddling condition and the cross product of the three-dimensional vector are used to determine whether the line segments in the three-dimensional coordinate format file of the river centerline and the three-dimensional coordinate format file of the center point of the nearest grid unit are coplanar, so as to complete the grid optimization of the one-dimensional coupled hydrodynamic model.

6. The method for optimizing the mesh generation of a one- and two-dimensional coupled hydrodynamic model according to claim 2, characterized in that: In the process of determining the center line of the river channel and the boundary lines on both sides of the river channel based on the original terrain data and the grid river network digital elevation model, if there is no center line of the river channel in the original terrain data, the river channel depth line extracted from the grid river network digital elevation model will be used as the center line of the river channel.

7. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the grid optimization generation method for a one- and two-dimensional coupled hydrodynamic model according to any one of claims 1 to 6.

8. The computer device according to claim 7, characterized in that The processor comprises: A grid river network digital elevation model determination module is used to obtain a variety of original terrain data of the target area and generate a grid river network digital elevation model based on the original terrain data; The module for generating information of unstructured grid cells on both sides of the river is used to determine the center line of the river and the boundary lines on both sides of the river based on the original terrain data and the grid river network digital elevation model, and is also used to generate the unstructured grid cell information on both sides of the river based on the center line of the river and the boundary lines on both sides of the river using the hydrodynamic simulation system, and generate the unstructured grid cell information file; A coupling point generation module for a one- and two-dimensional coupled hydrodynamic model is used to write a coupling point processing module in Python language based on the unstructured grid unit information file to receive and pre-process the unstructured grid unit information; The module for coupling points of calibration and verification models is used to run Python scripts, use the cross product function and straddle conditions, calibrate and verify the model based on the preprocessed unstructured grid cell information, and complete the grid optimization of the one- and two-dimensional coupled hydrodynamic model.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the grid optimization generation method of the one-two-dimensional coupled hydrodynamic model described in any one of claims 1-6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the grid optimization generation method of the one-two-dimensional coupled hydrodynamic model described in any one of claims 1-6 is implemented.

Citation Information

Cited By

  • Method for rapidly extracting dfsu file point data

    CN120560727A