A method for quickly removing isolated water points in a marine numerical model grid
The greedy algorithm is used to quickly locate and eliminate isolated water points, which solves the problem of long calculation time in traditional methods, achieves efficient grid quality control, and improves the accuracy and stability of numerical simulations.
Patent Information
- Application Number
- CN202411004884.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-07-25
AI Technical Summary
Traditional methods take too long to calculate when locating and eliminating isolated water points in high-resolution grids, resulting in low work efficiency for researchers and affecting the accuracy and stability of numerical simulations.
A greedy algorithm is used to find the optimal adjacent non-isolated water point as the search end point before computing the connectivity test of the unit. Combined with the core idea of the greedy algorithm, isolated water points can be quickly located and eliminated, thus reducing the computing time.
The calculation time is significantly reduced, the mesh quality control is improved, and the accuracy and stability of the numerical simulation are ensured.
Smart Images

Figure QLYQS_1 
Figure QLYQS_2 
Figure QLYQS_3
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a method for positioning and removing isolated water points in a marine numerical model, belonging to the field of marine numerical simulation. BACKGROUND
[0002] Ocean numerical simulation methods are of great significance in marine scientific research. Numerical simulation can complement and verify observational data, especially in remote or inaccessible sea areas, improving the reliability of marine data. Secondly, ocean numerical simulation helps to understand the dynamics of the ocean, such as ocean currents, tides, and sea water temperature and salinity distribution, revealing the mechanisms and interactions of these processes. In terms of disaster warning, simulating the occurrence and propagation of natural disasters such as tsunamis and storm surges helps to provide early warning and reduce losses. Finally, simulation results provide scientific basis for government and decision-makers to support the formulation of scientific ocean policies and management measures.
[0003] With the continuous development of ocean numerical simulation, the requirements for simulation content and simulation accuracy are gradually increasing, which requires high-resolution grids to support the simulation of content and phenomena. For traditional ocean dynamics analysis, high-resolution grids can depict mesoscale and submesoscale ocean processes, while for nearshore tidal waves and estuarine sediment transport dynamics, high-resolution grids can distinguish more accurate coastlines, making the simulation results closer to the real ocean. During the process of topographic interpolation of the grid, isolated water points refer to water cells that are not connected to the surrounding grid. They may be caused by interpolation errors or the presence of "inland lakes" in the original data. Removing isolated water points is a key step to ensure the stability and accuracy of numerical simulation.
[0004] Traditional methods for removing isolated water points include manual removal of "visual inspection method" and automatic removal of "breadth-first search algorithm (BFS)" and "depth-first search algorithm (DFS)". However, with the increase in grid resolution, the number of grid calculation units can reach millions, and the manual removal process will consume a lot of scientific research personnel's energy, while the traditional BFS algorithm will consume a lot of computing time. Therefore, developing an algorithm that can quickly locate and remove isolated water points will greatly reduce the effort and time spent in numerical simulation preparation, improving the work efficiency of scientific researchers. SUMMARY
[0005] To make up for the problem of long computing time in traditional isolated water point removal methods when searching for grids with many calculation units, the purpose of the present application is to provide a method for quickly and accurately positioning isolated water points in a marine numerical model grid and automatically removing the positioned isolated water points, to realize quality control of the topographically interpolated grid, and to ensure the accuracy and stability of numerical simulation.
[0006] The method of the application greatly reduces the search time by finding the nearest connective calculation area of the starting calculation unit before calculating the connectivity of the starting calculation unit and the final calculation unit, and completing the connectivity test based on the core idea of the greedy algorithm.
[0007] The specific technical solutions of the application are as follows:
[0008] (1) The production of the numerical model calculation grid is completed by any form of grid production method, and the original terrain data is interpolated to the model grid to form the initial terrain grid matrix Depto ori ;
[0009] (2) The terrain data in Depto ori is normalized to make the water point data and land point data in it become 1 and 0, and the normalized data matrix Mask ori is obtained.
[0010] (3) A zero matrix Mask0 with the same dimension as Mask ori is defined to store the position of the updated isolated water point, and 0 represents the isolated water point.
[0011] (4) The first level loop is entered, and the entire Depto ori is searched according to the row priority principle, and the starting point of each loop is defined as The column position set of the non-isolated water point in the last row is calculated The set of the non-isolated water point in the last row is calculated The position of the minimum value is defined as
[0012] (5) It is judged whether is a land point, and if it is a land point, the next first level loop point is performed.
[0013] (6) The search index value set search_id is defined, and the initial value is
[0014] (7) The secondary while loop is entered, and it is judged whether the set search_id is empty, and if it is empty, the isolated water point is located.
[0015] (8) Enter the tertiary circulation, search all points in the set search_id set, search in four directions, define the search relay value set search_id_mid, the initial value is empty set, find out whether the points in four directions are water points, and get the water point set valid_neighbors, if the set valid_neighbors is empty set, then set search_id=search_id_mid, return to step (7);
[0016] (9) Determine whether there is a point in the set valid_neighbors equal to If there is, exit the secondary while loop, define as a non-isolated water point; if the set valid_neighbors does not contain , then define the set search_id_mid equal to the set valid_neighbors.
[0017] (10) Define the set search_id equal to the set search_id_mid, return to step (7).
[0018] The grid making method in step (1) is MATLAB, Python or Gmsh, etc., and the model grid type is rectangular grid, orthogonal grid or curved grid, etc.
[0019] In step (4), if there are two minimum values, take the first point as
[0020] In step (8), if the set search_id contains the points of the boundary position, boundary correction is performed, that is, the points beyond the boundary are defined as an empty set.
[0021] In step (9), if there is a point in the set valid_neighbors, define the search point as a connectable point, and exit the search process, and perform the connectivity inspection of the next search point until the inspection of all search points is completed.
[0022] The present application adopts the core idea of the greedy algorithm, can quickly locate all isolated water points in the terrain data matrix, finds the optimal adjacent non-isolated water point as the search end point before the search calculation unit connectivity, avoids the defect that the calculation amount and calculation time are too large caused by the fixed search end point in the traditional search algorithm, and tests the algorithm applicable to all ocean numerical model grids, and the calculation time is reduced by leaps and bounds. Moreover, the method of the present application realizes the quality control of the terrain interpolated grid, thereby ensuring the accuracy and stability of numerical simulation. BRIEF DESCRIPTION OF DRAWINGS
[0023] Figure 1 It is a flow chart of the present invention.
[0024] Figure 2 It is the original terrain data grid of the ocean numerical model and the terrain data grid map after removing isolated water points.
[0025] Among them, (a) represents the terrain data grid before processing, and the black boxes represent the locations of some isolated water points; (b) represents the terrain data results after processing; the different colors in the figure represent water depth.
[0026] Figure 3 It is a schematic diagram of the locally enlarged normalized terrain matrix.
[0027] Among them, (a, b), (c, d), and (e, f) represent the results before and after processing in three different cases, respectively, and (g) is the result of the entire local area after processing. DETAILED DESCRIPTION
[0028] In order to facilitate understanding of the overall content, implementation process and technical effects of the invention, the present invention is further analyzed and explained below in conjunction with the accompanying drawings and specific implementation cases.
[0029] Example 1:
[0030] The following specific implementation case is the process of constructing an ocean numerical model grid covering the entire South China Sea. The process is as follows: Figure 1 shown.
[0031] (1) Create the original terrain grid using MATLAB, interpolate the original terrain data onto the model grid, the grid type is a regular rectangular grid, the grid contains 1056*1156 calculation units, and form the initial terrain grid matrix Depto ori The original terrain data used is from the GEBCO_2023 (https: / / www.gebco.net / ) ocean relief dataset. Figure 2 (a) shows the locations of some isolated water spots.
[0032] (2) Normalization processing Depto ori The terrain data in the normalized data matrix Mask is obtained ori :The following is based on Figure 3 The screening process of isolated water points is described in detail. Figure 3 is a locally magnified normalized terrain matrix. The gray box represents the search starting point (i, j) in the first-level loop. The * represents a land point, i.e., an inaccessible path; ○ represents a connected point that has been searched; and 1 represents a water point that has not been searched. Figure 3 As shown in (a), the water points in the gray box are located.
[0033] (3) Define Mask ori A zero matrix Mask0 with the same dimension is defined to store the position of the updated isolated water point, and 0 represents the isolated water point.
[0034] (4) Define the search starting point (i, j) as Start_loc, and calculate the column position set of the last row of non-isolated water points Get the search end point The point (i-1, j+2) is obtained.
[0035] (5) Start search point The point is a water point, not a land point.
[0036] (6) Define the search index value set search_id, and the initial value is
[0037] (7) Determine the case of search_id, and search_id is a non-empty set.
[0038] (8) Perform four-direction search on Start_loc, and only one adjacent connectable point (i+1, j) is included in the set search_id_mid.
[0039] (9) Since search_id_mid does not contain the search end point, set search_id=search_id_mid, and continue to perform four-direction search on search_id.
[0040] The search result contains three adjacent connectable regions, and after removing the duplicate processing, the set search_id_mid is updated to points (i+2, j) and (i+1, j+1), and the set search_id_mid does not contain the search end point.
[0041] (10) Set search_id=search_id_mid, and continue to perform four-direction search on search_id, and after removing the duplicate processing, there is no adjacent connectable region, so the value of Start_loc is 0, i.e. the point is an isolated water point, and the position information of the point is updated, and the result is shown in Figure 3 (b).
[0042] Example 2:
[0043] Steps (1)-(2) are the same as those in Example 1, and the water points in the gray box are located as shown in Figure 3 (c).
[0044] Step (3) is the same as that in Example 1.
[0045] (4) Define the search starting point (i, j) as Start_loc, and calculate the column position set of the last row of non-isolated water points The search ending point is obtained from The search ending point is obtained from The search ending point is obtained from
[0046] Steps (5)-(7) are the same as in Example 1.
[0047] (8) Four-directional search is performed on the search starting point. If there are two adjacent connectable regions, the set search_id_mid contains the points (i-1, j) and (i+1, j).
[0048] (9) Since the search ending point is contained in the set search_id_mid, the value of Start_loc is 1, indicating that the point is a connectable point. The position information of the point is updated, and the result is as shown in Figure 3 (d).
[0049] Example 3:
[0050] Steps (1)-(2) are the same as in Example 1, as shown in Figure 3 (e), the water points in the gray box are located.
[0051] Step (3) is the same as in Example 1.
[0052] (4) Define the search starting point (i, j) as Start_loc, and calculate the column position set of the last row of non-isolated water points The search ending point is obtained from The search ending point is obtained from The search ending point is obtained from
[0053] Steps (5)-(7) are the same as in Example 1.
[0054] (8) Four-directional search is performed on the search starting point. If there are two adjacent connectable regions, the set search_id_mid contains the points (i-1, j) and (i+1, j). Figure 3 (f).
[0055] After searching all the points in the local area, the position information of all points is updated to only contain connectable points, as shown in Figure 3 (g). After the entire terrain data matrix is searched, the positions of isolated water points and the terrain data after removing isolated water points are obtained, as shown in Figure 2 (b). The terrain data obtained by removing isolated water points can be directly used as the calculation grid for numerical models, ensuring the stability and accuracy of the numerical calculation process.
[0056] In order to highlight the advantages of the present application, the time for positioning and eliminating isolated water points by Dijkstra algorithm in the depth-first algorithm is compared. The comparison results are shown in Table 1.
[0057] Table 1 Comparison of time consumed by the present application and Dijkstra algorithm in processing Example 1
[0058]
[0059] Note: The parallel mode is Matlab Parallel Toolbox accelerated calculation, and the number of logical processor cores of the parallel CPU is 10 cores.
[0060] By comparing the present application with the traditional screening method, it can be seen that the method of the present application can greatly reduce the time for processing the terrain data matrix, quickly position the position of the isolated water point and process it as a land point. After obtaining the processed terrain data matrix, the connectivity of all grid points is further tested by the method of the present application, and all water points except the land points are connected water points, which ensures the accuracy of the present application.
Claims
1. A method for rapidly removing isolated water points in an ocean numerical model grid, characterized in that: The following steps are involved: (1) Through any form of grid making method, the numerical model calculation grid is made, and the original terrain data is interpolated onto the model grid to form the initial terrain grid matrix Detpto ori ; (2) Normalization processing Depto ori The terrain data in the data is converted into 1 and 0, and the normalized data matrix Mask is obtained. ori ; (3) Definition and Mask ori A zero matrix Mask0 with the same dimension is used to store the updated positions of isolated water points, where 0 represents an isolated water point; (4) Enter the first-level loop and search the entire Depto according to the row priority principle. ori , the starting point of each cycle is defined as Calculate the column position set of non-isolated water points in the previous row Calculated The minimum value is defined as (5)Judgment Is it a land point? If it is a land point, proceed to the next first-level loop point; (6) Define the search index value set search_id, the initial value is (7) Enter the secondary while loop to determine whether the set search_id is an empty set. If it is empty, locate it. It is an isolated water point; (8) Enter the third-level loop, search all points in the set search_id, search in the four directions up, down, left, and right, define the search relay value set search_id_mid, whose initial value is an empty set, find out whether the points in the four directions are water points, and obtain the water point set valid_neighbors. If the set valid_neighbors is an empty set, set search_id = set search_id_mid, and return to step (7); (9) Determine whether there is a point equal to in the set valid_neighbors If it exists, exit the secondary while loop and define Is a non-isolated water point; if the set valid_neightbors does not contain Then define the set search_id_mid to be equal to the set valid_neighbors; (10) Define the set search_id to be equal to the set search_id_mid, and return to step (7).
2. The rapid elimination method according to claim 1, wherein: The mesh production method described in step (1) is MATLAB, Python or Gmsh.
3. The rapid elimination method according to claim 1, wherein: The model grid type described in step (1) is a rectangular grid, an orthogonal grid or a curved grid.
4. The rapid elimination method according to claim 1, wherein: If there are two minimum values in step (4), take the first point as 5. The rapid elimination method according to claim 1, wherein: In step (8), if the set search_id contains points at the boundary position, boundary correction is performed, that is, the points beyond the boundary are defined as an empty set.
6. The rapid elimination method according to claim 1, wherein: In step (9), if there is a point in the set valid_neighbors The search point is defined as a connected point, and the search process is exited, and the connectivity check of the next search point is performed until the check of all search points is completed.
Citation Information
Patent Citations
Image processing device and image processing method
CN104081159A
Method for searching isolated zone when casting solidification
CN1845092A