Method and System for Constructing River Network Hydrodynamic Model Based on Large Language Model Inference

Through the combination of large language model and GIS, the river network hydrodynamic model is automatically constructed, which solves the problem of low efficiency in traditional methods, and realizes the full process automation from DEM data to river network hydrodynamic model, improving modeling efficiency and adaptability.

CN119918469BActive Publication Date: 2025-07-04NANJING HYDRAULIC RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510413230.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-07-04
Estimated Expiration
2045-04-03

AI Technical Summary

Technical Problem

The construction of traditional river network hydrodynamic model relies on manual extraction of river network topology, which is inefficient and cannot automatically generate topological relationships, resulting in long modeling cycles and poor adaptability.

Method used

The large language model is integrated with the GIS program for DEM data processing, the water flow direction matrix is ​​generated through the D8 algorithm, the river network raster is automatically extracted, and the river channel spatial distribution and water conservancy projects are used to analyze the river channel space and identify water conservancy projects, generate a topological relationship diagram containing nodes and directed edges, and finally the river network hydrodynamic model is automatically generated.

Benefits of technology

The automated construction of the river network hydrodynamic model has been realized, the modeling efficiency has been improved, manual intervention has been reduced, and the adaptability and automation of modeling has been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918469B_ABST
    Figure CN119918469B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for constructing a river network hydrodynamic model based on large language model reasoning, belonging to the cross - technical field of hydrological modeling and artificial intelligence, including: filling depressions in the original DEM data and calculating the water flow direction matrix; iteratively calculating and analyzing the optimal flow accumulation to extract river network grids; outputting river network grids at a specified level by specifying an instruction for the output river network level; encoding the river network grids into a format described in natural language to train a large language model; parsing the channel spatial distribution through the large language model to generate a topological structure diagram containing nodes and directed edges; identifying hydraulic engineering through the large language model to generate hydraulic engineering objects and their location information; this method and system for constructing a river network hydrodynamic model based on large language model reasoning solve the problems of dependence on manual intervention and low modeling efficiency in traditional methods, and have high technological innovation and practical application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the cross - technical field of hydrological modeling and artificial intelligence, and particularly relates to a method and system for constructing a river network hydrodynamic model based on large language model reasoning. Background Art

[0002] The construction of traditional river network hydrodynamic models relies on manual extraction of river network topological structures, resulting in low efficiency. In existing methods, the extraction of river networks based on DEM data usually requires manual setting of the threshold of flow accumulation, and the topological relationship cannot be automatically generated, leading to a long modeling cycle and poor adaptability. In addition, the generation of river network hydrodynamic model files depends on manual configuration, making the modeling work cumbersome. Therefore, it is necessary to develop a new method and system for constructing a river network hydrodynamic model based on large language model reasoning to solve the existing problems. Summary of the Invention

[0003] The purpose of the present invention is to provide a method and system for constructing a river network hydrodynamic model based on large language model reasoning to solve the above problems.

[0004] To achieve the above purpose, the present invention provides the following technical solution: A method for inferring the water system topology structure and automatically constructing a river network hydrodynamic model based on a large language model, comprising the following steps:

[0005] Step S1: Integrate the GIS program through the large language model, perform pit filling on the original DEM data, generate a water flow direction matrix based on the D8 algorithm, perform the best flow accumulation analysis through the large language model, and extract river network grids; specify the level of the output river network through instructions, and output the river network grids at the specified level;

[0006] Step S2: Encode the river network grids into a natural language description structure and train the large language model;

[0007] Step S3: Parse the river channel spatial distribution through the trained large language model to generate a topological relationship graph containing nodes and directed edges;

[0008] Step S4: Integrate the image recognition function through the large language model, identify water conservancy projects, and generate water conservancy project objects such as reservoirs and sluices and the location information of water conservancy project objects;

[0009] Step S5: Use the large language model to superimpose the topological relationship graph in Step S3 and the water conservancy project objects and the location information of water conservancy project objects in Step S4 to infer the final river network topology structure;

[0010] Step S6: Convert the final river network topology structure into a structured configuration file according to the target river network hydrodynamic model specification and output it;

[0011] Step S7: Convert the data into the model input format according to the target river network hydrodynamic model specification;

[0012] Step S8: Automatically generate the final river network hydrodynamic model based on the configuration file and the model input format.

[0013] Preferably, the encoding method for encoding the river network grid into a natural language description structure in step S2 is: convert the position (x, y), flow direction, and catchment accumulation of each river channel unit into key-value pair text, and the flow direction is encoded in 8 directions; specific format example: {"ID":1, "x":1024,"y":768,"direction":NE,"accumulation":150,"neighbors": [{"ID": 2,"relative_position":"E"},{"ID": 6, "relative_position":"SE"},{"ID": 7, "relative_position": "NE"}]}.

[0014] Preferably, in step S3, the large language model is used to analyze the river network spatial distribution and generate a topological relationship graph including nodes and directed edges, including: identifying river network intersection points as topological nodes, and judging the upstream and downstream connection relationships of river channel segments through the flow direction matrix; performing logical verification on isolated river channel segments, and if they are not connected to the main river channel, mark the abnormal path and trigger an artificial review reminder.

[0015] Preferably, the image recognition in step S4 includes: through the input high-resolution satellite image, the large language model automatically recognizes the water conservancy projects therein, such as reservoirs, sluices, etc. For each recognized facility, classify it and output the corresponding water conservancy object and its specific geographical location. For example, the types of water conservancy facilities include reservoirs and sluices.

[0016] Preferably, the result obtained by superimposing step S3 and step S4 using the large language model in step S5 includes: the large language model superimposes the water conservancy object and its specific geographical location on the original river network topological relationship to reflect how facilities such as reservoirs and gates affect the water flow path, and generates the final river network topological structure.

[0017] Preferably, the conversion into a structured configuration file in step S6 includes: generating a river network structure file according to the topological relationship; automatically generating a section distribution according to the river channel length and the preset section spacing; converting the section shape parameters into a model section file; the section shape parameters include bottom width and slope coefficient.

[0018] Preferably, in step S7, converting the data into the model input format includes: generating a boundary condition time series file based on historical hydrological data, such as water level data, flow rate data, water level-flow rate relationship curves, etc.

[0019] Preferably, in step S8, automatically generating the final river network hydrodynamic model includes: based on the configuration file and the target river network hydrodynamic model input file, calling the target river network hydrodynamic model execution program to automatically generate the final river network hydrodynamic model.

[0020] Preferably, generating the river network structure file according to the topological relationship includes: a dat file composed of node numbers of the river network, including river reach numbers, upstream node numbers, downstream node numbers, and the large language model outputs it as a text file according to the deduced topological structure;

[0021] Automatically generating the cross-section distribution according to the river channel length and the preset cross-section spacing includes:

[0022] According to the river channel length and the set cross-section spacing, the large language model calculates the number of cross-sections and forms a dat file, including cross-section numbers and cross-section spacings;

[0023] Converting the cross-section shape parameters into the model cross-section file includes; the original cross-section parameters are in excel format and are converted into the dat format that can be read by the river network hydrodynamic model;

[0024] Automatically generating the input file for the boundary condition parameters includes: using the large language model to convert table files such as excel and csv into the dat format, and the boundary condition parameters include time series such as water level and flow rate data.

[0025] Preferably, in step S6, according to the target river network hydrodynamic model specification, converting the final river network topological structure into a structured configuration file and outputting it, wherein, setting a rule engine according to the format requirements of the target river network hydrodynamic model, automatically assigning the upstream and downstream boundary identifiers of the river network hydrodynamic model according to the node connection order in the topological relationship, and generating a configuration file that conforms to the format of the target river network hydrodynamic model; the specific method includes: generating and converting the file through the large language model to generate a text file in txt or dat format, only need to give the format requirement instruction for conversion by the large language model, wherein, the rule engine refers to the requirements and descriptions of the target file format; the conversion code is the commonly used python file generation code, which is automatically generated by the large language model, and currently mainstream large language models can directly implement it;

[0026] The present invention further provides a river network hydrodynamic model construction system based on large language model reasoning, including the following modules:

[0027] DEM processing module: performs depression filling on the original digital elevation model data, calculates the water flow direction matrix based on the D8 algorithm, and generates river network grids according to the dynamically optimized threshold of the cumulative catchment area.

[0028] Topological inference module: receives river network data, analyzes the spatial distribution of river channels through a pre-trained large language model, receives high-definition satellite images, identifies water conservancy projects such as reservoirs and sluices through the integrated image recognition function, generates a topological relationship graph containing nodes and edges, and outputs a visualized topological structure; among them, the nodes include: source, confluence point, water conservancy project; the edges are river channel segments.

[0029] River network hydrodynamic model generation module: converts the topological relationship into a structured configuration file according to the target river network hydrodynamic model specification, including river channel parameters, boundary conditions, and cross-section distribution files.

[0030] Preferably, the DEM processing module optimizes parameters through a dynamic feedback mechanism, specifically: based on the digital elevation model resolution, terrain type, and historical experience, the large language model generates an initial range of the cumulative catchment area threshold; the threshold is iteratively adjusted using the trial-and-error method, and the mean change point analysis method is used for intelligent iterative calculation of the threshold.

[0031] The mean change point method specifically includes:

[0032] Calculate the river network density: ,

[0033] In the formula, y is the digital river network density, km / km 2 ; L is the river network length, km; A is the catchment area, km 2 ;

[0034] Calculate multiple threshold fittings: , in the formula, x is the threshold, y is the digital river network density; represents the power of the fitting function, that is, the power of the power function of the fitting function, which is calculated by scatter fitting of the threshold and the river network density, referring to Figure 4 , k represents the coefficient of the fitting function;

[0035] Trial-calculate each threshold and the river network density formed by it to form a sequence format.

[0036] The difference between the sum of squared deviations S of the total sample and the sum of squared deviations on both sides of the change point shows a trend of rising first and then falling as the threshold increases, so there is a peak point on each curve, that is, the optimal cumulative catchment area threshold point. For n ( n ≥2) sequence, the change point ( = 1, 2, …, n) divides the sequence into two segments, calculates the sum of squared deviations of the two segments of the sequence and superimposes them to obtain the sum of squared deviations on both sides of the change point. , the maximum value point of the difference between the total sample sum of squared deviations S and the sum of squared deviations on both sides of the change point is the optimal confluence accumulation threshold point. The calculation formula is:

[0037] ;

[0038] ;

[0039] In the formula, represents the sample value corresponding to the th sequence, that is, the river network density value; , , are the average value on the left side of the change point, the average value on the right side of the change point and the overall sample average value respectively; is the sum of squared deviations on both sides of the change point; the subscript = 1, 2, …, - 1; = , + 1, …, n ; n represents the serial number, and the threshold will be calculated iteratively multiple times. For example, from 500 - 50000, each trial value is a sequence; S is the total sample sum of squared deviations;

[0040] By calculating multiple thresholds to fit , the difference between the sum of squared deviations S of the total sample and the sum of squared deviations on both sides of the change point shows a trend of rising first and then falling as the threshold increases. Therefore, each curve has a peak point, that is, the optimal catchment area threshold point.

[0041] Generate river network grids according to the optimal confluence accumulation threshold, set the specified river network classification level, and output the corresponding level river network.

[0042] Preferably, the training of the topological reasoning module includes: automatically realizing the conversion from raster data to natural language description, converting river network grids into coordinate sequences; identifying its starting point, turning points, end points and intersection points; identifying the types of intersection points. Receive high-definition satellite images, and automatically identify water conservancy projects such as reservoirs and sluices through the integrated image recognition function and convert them into nodes.

[0043] Preferably, the target river network hydrodynamic model specification includes: setting a rule engine according to the format requirements of the target river network hydrodynamic model, and performing the following operations: automatically assigning upstream and downstream boundary identifiers according to the topological node connection order; automatically generating a river network structure file, a cross-section morphology file, and a boundary condition time series file according to the format requirements of the target river network hydrodynamic model.

[0044] Preferably, the topological reasoning module includes: converting river network raster data into a natural language description or structured JSON data containing a sequence of spatial coordinates; that is, encoding the river network raster into a natural language description format, specifically by reading the attributes of the raster through a GIS program, and the attributes include coordinate, flow accumulation amount and other attribute values, etc.; the large language model is mainly an integrated program. The specific converted format is: {"ID":1, "x":1024, "y":768, "direction":NE, "accumulation":150, "neighbors": [{ "ID": 2, "relative_position": "E"},{ "ID": 6, "relative_position": "SE"},{ "ID": 7, "relative_position": "NE"}];

[0045] Infer the starting point of the river course, that is, the source, confluence point, flow direction relationship, and main and tributary confluence relationship through the large language model;

[0046] Identify water conservancy projects such as reservoirs and sluices. The large language model will integrally call a computer vision model, such as the YOLO model, to identify reservoirs and sluice dams on satellite images and realize the function of image recognition.

[0047] The method and system for constructing a river network hydrodynamic model based on large language model inference realizes the intelligence of river network topological structure analysis and river network hydrodynamic model configuration by integrating the data processing of geographic information system (GIS) and the inference ability of the large language model; realizes the intelligence of river network topological structure analysis and river network hydrodynamic model configuration through the technology of automatically generating a river network hydrodynamic model by topological structure; realizes the full-process automation from DEM data to the construction of a river network hydrodynamic model by integrating the spatial inference ability of the large language model and hydrological analysis technology, solves the problems of traditional methods relying on manual intervention and low modeling efficiency, and has high technological innovation and practical application value. Brief Description of the Drawings

[0048] Figure 1 It is a schematic diagram of the system architecture of the present invention;

[0049] Figure 2 It is a schematic diagram of the DEM data of the present invention;

[0050] Figure 3 Schematic diagram of the dynamic threshold optimization process of the present invention;

[0051] Figure 4 Schematic diagram of the fitting of river network density and catchment area threshold of the present invention;

[0052] Figure 5 Schematic diagram of the change in the difference between the total sum of squared deviations S of the total samples of the present invention and the sum Si of the sum of squared deviations on both sides of the change point;

[0053] Figure 6 Schematic diagram of the river network grid of the present invention;

[0054] Figure 7 Schematic diagram of the river network topological structure of the present invention;

[0055] Figure 8 Schematic diagram of the river network grid with added water conservancy projects of the present invention;

[0056] Figure 9 Schematic diagram of the topological structure of the added water conservancy projects of the present invention. Detailed implementation manners

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

[0058] The present invention provides a system for inferring the river network topological structure and automatically constructing a river network hydrodynamic model based on large language model reasoning as shown in Figure 1 , which includes the following modules:

[0059] DEM processing module: performing depression filling on the original digital elevation model data, calculating the water flow direction matrix based on the D8 algorithm, and generating river network grids according to the dynamically optimized threshold of the flow accumulation; the DEM processing module in this embodiment is a large language model-driven DEM processing module:

[0060] Topological reasoning module: receiving the initial river network data, parsing the spatial distribution of the river channels through a pre-trained large language model, receiving high-definition satellite images, identifying water conservancy projects such as reservoirs and sluices through the integrated image recognition function, generating a topological relationship graph including nodes and edges, and outputting a visualized topological structure; among them, the nodes include: the source, the confluence point, and the water conservancy projects; the edges are the river channel segments;

[0061] River network hydrodynamic model generation module: According to the target model specifications, convert the topological relationship into a structured configuration file, including river channel parameters, boundary conditions, and cross-section distribution files. In this embodiment, the river network hydrodynamic model generation module is a large language model-driven river network hydrodynamic model generation module.

[0062] The DEM processing module optimizes parameters through a dynamic feedback mechanism. The digital elevation model is abbreviated as DEM in English, specifically: based on the digital elevation model resolution, terrain type, and historical experience, the large language model generates an initial threshold range of the cumulative flow accumulation; as Figure 3 shown, the trial-and-error method is used to iteratively adjust the threshold, and the mean change point analysis method is used for intelligent iterative calculation of the threshold;

[0063] The mean change point method specifically includes:

[0064] Calculate the river network density: ,

[0065] In the formula, y is the digital river network density, km / km 2 ; L is the river network length, km; A is the basin area, km 2 ;

[0066] Calculate multiple threshold fittings: , in the formula, x is the threshold, y is the digital river network density; represents the power of the fitting function, that is, the power of the power function of the fitting function, which is calculated by scatter fitting of the threshold and the river network density, refer to Figure 4 , k represents the coefficient of the fitting function;

[0067] Trial-calculate each threshold and the river network density formed by it, and form a sequence format, as shown in Table 1:

[0068] Table 1: River network density sequence format

[0069] Sequence Threshold River network density 1 2000 1.12 2 5000 1.00 …… …… …… 10 100000 0.2

[0070] As Figure 5 shown, the difference between the sum of squared deviations S of the total sample and the sum of squared deviations on both sides of the change point shows a trend of rising first and then falling with the increase of the threshold, so there is a peak point in each curve, that is, the optimal cumulative flow accumulation threshold point. For n ( n ≥2) sequence, the change point ( (where \(i = 1, 2, \ldots, n\)) divides the sequence into two segments, calculates the sum of squared deviations of the two segments of the sequence and superimposes them to obtain , the maximum value point of the difference between the total sample sum of squared deviations \(S\) and is the optimal threshold point of the cumulative flow concentration. The calculation formula is:

[0071] ;

[0072] ;

[0073] In the formula, represents the sample value corresponding to the th sequence, that is, the river network density value; , , are the average value on the left side of the change point, the average value on the right side of the change point and the overall sample average value respectively; is the sum of the sum of squared deviations on both sides of the change point; the subscript = 1, 2, \ldots, - 1; = , + 1, \ldots, n ; n represents the serial number, and the threshold will be calculated iteratively multiple times. For example, from 500 to 50000, each trial value is a sequence; \(S\) is the total sample sum of squared deviations;

[0074] By calculating multiple thresholds to fit , the difference between the total sample sum of squared deviations \(S\) and the sum of the sum of squared deviations on both sides of the change point shows a trend of rising first and then falling with the increase of the threshold. Therefore, each curve has a peak point, that is, the optimal catchment area threshold point.

[0075] Generate river network grids according to the optimal cumulative flow concentration threshold, set the specified river network classification number, and output the corresponding level river network.

[0076] The training of the topological reasoning module includes: automatically realizing the conversion from raster data to natural language description, converting river network grids into coordinate sequences; identifying its starting point, turning points, ending point and intersection points; identifying the types of intersection points. Receive high-definition satellite images, and automatically identify water conservancy projects such as reservoirs and sluices through the integrated image recognition function and convert them into nodes.

[0077] The specification of the target river network hydrodynamic model includes: setting a rule engine according to the format requirements of the target river network hydrodynamic model, and performing the following operations: automatically assigning upstream and downstream boundary identifiers according to the connection order of topological nodes; automatically generating a river network structure file, a cross-section morphology file and a boundary condition time series file according to the format requirements of the target river network hydrodynamic model.

[0078] Preferably, the topological reasoning module includes: converting river network raster data into a natural language description or structured JSON containing a sequence of spatial coordinates; specifically, reading the attributes of the raster through a GIS program, including attribute values such as coordinates and flow accumulation; the large language model is mainly an integrated program. The specific format after conversion: {"ID":1,"x":1024,"y":768,"direction":NE,"accumulation":150,"neighbors":[{"ID":2,"relative_position":"E"},{"ID": 6,"relative_position":"SE"},{"ID": 7,"relative_position": "NE"}]}.

[0079] Infer the starting point of the river course, i.e., the source, confluence points, flow direction relationship, and main-branch confluence relationship through the large language model;

[0080] Identify water conservancy projects such as reservoirs and sluices through the image recognition function. The large language model will integrate and call computer vision models, such as the YOLO model, to identify reservoir sluices on satellite images.

[0081] System construction and environment configuration

[0082] Hardware environment: Select appropriate hardware devices according to the data volume and computational complexity. For example, for large-scale DEM data processing, it is recommended to use a server with a multi-core CPU, high memory capacity, and high-performance GPU to accelerate the inference of the large language model and complex data calculation processes. At the same time, ensure that the storage device has sufficient space and read / write speed to store the original data, intermediate results, and the finally generated model files.

[0083] Software environment: Build a Python programming environment and install various required libraries, including but not limited to the GDAL library for geospatial information processing, the PyTorch or TensorFlow framework for deep learning, and libraries such as NumPy and Pandas for data processing and analysis. At the same time, configure the environment required for the operation of the large language model (LLM), and install relevant model dependency packages and tools.

[0084] Data preparation and preprocessing:

[0085] Collect raw data: Obtain high-precision raw digital elevation model (DEM) data from authoritative data sources to ensure that the data covers the target study area and the resolution and accuracy of the data meet the modeling requirements. At the same time, collect other auxiliary data related to the study area, such as land use type data, meteorological data, etc., for subsequent use in model construction and analysis.

[0086] Data quality inspection: Conduct quality inspection on the collected DEM data, including checking the integrity of the data, the existence of missing values or outliers. View the overall distribution of the data through visualization tools to ensure that there are no obvious errors or biases in the data. For data with problems, repair or re-acquire it.

[0087] The system module runs and the method steps are executed as follows:

[0088] Large language model-driven DEM processing module: First, perform depression filling on the original DEM data to eliminate small depressions in the data;

[0089] Calculate the flow direction matrix based on the D8 algorithm to determine the flow direction of each grid cell. The specific calculation process follows the principle of the D8 algorithm, and the flow direction is determined according to the elevation difference of adjacent grids;

[0090] Specify the river network classification standard and the expected number of river network levels. Use the large language model through a dynamic feedback mechanism and adopt the mean change point method to determine the optimal threshold of the cumulative catchment area and generate river network grid data.

[0091] Large language model topological structure inference module:

[0092] Input the generated river network data into this module, and the pre-trained large language model analyzes the spatial distribution of the river channels;

[0093] The model identifies the river channel intersection points in the river network grid as topological nodes, judges the upstream and downstream connection relationships of the river channel segments according to the flow direction matrix, and generates directed edges;

[0094] Automatically assign upstream and downstream identifiers according to the node connection order. The rule examples are as follows:

[0095] If a node has only one downstream connection point, mark it as the upstream boundary;

[0096] If a node is a confluence point of multiple river channels, mark it as an internal node;

[0097] If a node has no downstream connection point, mark it as the downstream boundary;

[0098] Conduct logical verification on isolated river channel segments. By analyzing their spatial relationship and flow direction with the surrounding river channels, judge whether they can be connected to the main river channel. If they cannot be connected, mark them as abnormal paths;

[0099] The node numbers are numbered sequentially from upstream to downstream, starting with the main stream and then the tributaries. The same requirement applies to the river channel numbers;

[0100] Receive high-definition satellite images, automatically identify water conservancy projects such as reservoirs and sluices through the integrated image recognition function, output the corresponding types of water conservancy projects and their specific geographical locations, and convert them into nodes;

[0101] Infer and generate the topological structure relationship between nodes and edges, and output topological structure data and visualized topological pictures.

[0102] Large language model-driven river network hydrodynamic model generation module:

[0103] According to the topological relationship output by the large language model topological reasoning module, automatically assign upstream and downstream boundary identifiers;

[0104] According to the river channel length in the topological relationship and the preset cross-section spacing setting, automatically generate the cross-section distribution;

[0105] Using the built-in rule engine, according to the input specifications of the target river network hydrodynamic model, automatically convert the cross-section shape data, such as the width and depth of the river channel, etc., into model cross-section files. At the same time, for the boundary condition parameters, such as time series of water level and flow data, etc., automatically generate input files according to the format requirements of the target model.

[0106] The specific technical process in this embodiment is as follows:

[0107] Module 1: Large language model-driven DEM processing

[0108] Input data: DEM raster data, such as Figure 2 shown;

[0109] Task instructions:

[0110] 1. Call the GIS hydrological analysis function to perform depression filling processing; calculate the D8 flow direction matrix; generate the flow accumulation matrix;

[0111] 2. Based on the DEM resolution, terrain type and historical experience, generate the initial flow accumulation threshold range by the large language model; use the iterative trial calculation of the mean change point method to find the optimal flow accumulation threshold point;

[0112] 3. Use the Gravelius grading method, the main river channel is level 1, the tributaries that flow into the level 1 river channel are level 2, and so on. In this case, the required output river network is level 2.

[0113] 4. Output the river network raster containing level 1 and level 2 river channels, such as Figure 6 shown;

[0114] Output data:

[0115] 1. Large language model adjustment record:

[0116] Pre-judgment: The threshold range is 2000 - 20000;

[0117] Iteration 1: Threshold = 2000, River network density = 1.11, S - S i = 0.9;

[0118] Iteration 2: Threshold = 5000, River network density = 0.72, S - S i = 1.4;

[0119] Iteration 3: Threshold = 10000, River network density = 0.52, S - S i = 1.67

[0120] Iteration 4: Threshold = 20000, River network density = 0.38, S - S i = 1.6

[0121] The optimal threshold of flow accumulation is 10000.

[0122] 2. River network raster file

[0123] Module 2: Topological structure reasoning

[0124] This module utilizes the reasoning ability of the large language model. The prompts for the large language model are designed as follows:

[0125] Input data: River network raster; Satellite image data.

[0126] Task instructions:

[0127] 1. Convert the river network raster into a natural language format understandable by the large language model:

[0128] List of cells, each cell containing serial number (ID), coordinates (x, y), flow direction (direction, 8 directions), flow accumulation (accumulation), adjacent cells (neighbors);

[0129] Specific format example:

[0130] {"ID":1,

[0131] "x":1024, "y":768,

[0132] "direction":NE,

[0133] "accumulation":150,

[0134] "neighbors": [{"ID": 2, "relative_position": "E"},

[0135] { "ID": 6, "relative_position": "SE"},

[0136] { "ID": 7, "relative_position": "NE"}

[0137] 2. Upstream node determination: The accumulation is the smallest and there is no upstream unit. Downstream node determination: The accumulation is the largest and there is no downstream unit.

[0138] 3. Path tracing: Starting from the upstream boundary, connect the downstream units in sequence according to the flow direction of D8, ignoring the areas with conflicting flow directions, and ending at the downstream boundary.

[0139] 4. Confluence point: When ≥2 independent river channels converge, all the inflowing edges need to be marked.

[0140] 5. Hydraulic engineering identification: Through the input high-resolution satellite images, the large language model automatically identifies the hydraulic engineering facilities therein. If there is no hydraulic engineering, directly output the river network topological structure diagram, as Figure 7 shown; if a hydraulic engineering is identified, output the corresponding type of hydraulic engineering and its specific geographical location, and overlay the location of the hydraulic engineering on the original river network raster, as Figure 8 shown.

[0141] 6. Hydraulic engineering setting: Generate a node both upstream and downstream of the gate, and the river channel between the two nodes normally participates in the river channel numbering; Generate a node of the reservoir type separately for the reservoir, and the connection between the reservoir and the node does not participate in the river channel numbering, as Figure 9 shown.

[0142] 7. Exception handling: Mark the isolated units that cannot be connected.

[0143] 8. Output the final topological structure file and the visualized topological structure picture.

[0144] Output requirements:

[0145] Output the information of nodes, river channels, and hydraulic engineering in the following natural language format:

[0146] "nodes":

[0147] {

[0148] "id": "N1", / / Node 1 (upstream boundary)

[0149] "type": "source", / / The type is the source

[0150] "x": 100, / / Abscissa 100

[0151] "y": 100, / / Ordinate 100

[0152] "accumulation": 1, / / Confluence accumulation = 1

[0153] "inflows": [], / / No inflow edges (source)

[0154] "outflow": "E1" / / Outflow edge is E1

[0155] },

[0156] {

[0157] "id": "N2", / / Node 2 (confluence point)

[0158] "type": "confluence", / / Type is confluence point

[0159] "x": 150, / / Abscissa 150

[0160] "y": 250, / / Ordinate 250

[0161] "inflows": ["E1"], / / Inflow edges include E1

[0162] "outflow": "E2" / / Outflow edge is E2

[0163] }

[0164] ……

[0165] {

[0166] "id": "N7", / / Node 7 (downstream boundary)

[0167] "type": "outlet", / / Type is outlet

[0168] "x": 300, / / Abscissa 300

[0169] "y": 300, / / Ordinate 300

[0170] "inflows": ["E2"], / / Inflow edges include E2

[0171] "outflow": [] / / No outflow edges (outlet)

[0172] }

[0173] ,

[0174] "edges":

[0175] {

[0176] "id": "E1", / / Edge 1

[0177] "from": "N1", / / Starting node N1

[0178] "to": "N2", / / Target node N2

[0179] "length": 75.3, / / Length 100 units

[0180] }

[0181] {

[0182] "id": "E7", / / Edge 7

[0183] "from": "N1", / / Starting node N8

[0184] "to": "N2", / / Target node N2

[0185] "length": 75.3, / / Length 100 units

[0186] }

[0187] "reservoir":

[0188] {

[0189] "id": "R1", / / Reservoir 1

[0190] "from": "[]", / / No starting node

[0191] "to": "N2", / / Target node N10

[0192] "type": "reservoir", / / Reservoir

[0193] }

[0194] "gate":

[0195] {

[0196] "id": "G1", / / Gate 1

[0197] "from": "N5", / / Starting node N5

[0198] "to": "N6", / / Target node N6

[0199] "type": "gate", / / Sluice

[0200] };

[0201] Module 3: Large language model-driven river network hydrodynamic model generation module, which processes the modeling process of the river network hydrodynamic model, including river network generation, cross-section generation, boundary file generation, etc., and integrates the core codes and instruction sets of these modules to form a complete process.

[0202] River network generation: Parse the topological structure, analyze the upstream and downstream boundaries, and generate a river network structure file that meets the format requirements.

[0203] Cross-section generation: Generate cross-section distribution and cross-section shape files that meet the format requirements according to the spacing rules (equidistant or dynamically adjusted) and morphological data input in the user instructions.

[0204] Boundary file generation: Process time series data, including reading different formats (txt, Excel), data cleaning, unit conversion, and generating a time series file that meets the format requirements.

[0205] Input data description:

[0206] 1. Topological structure files: network.gml, network.json (including node, river, and water conservancy project connection relationships); as Figure 8 shown;

[0207] 2. Cross-section generation instructions: xs_rules.yml (defining spacing rules and morphological templates);

[0208] 3. Original cross-section data: survey_data.xlsx (measured cross-section point cloud);

[0209] 4. Boundary time series data: tides_2023.csv (time format: YYYYMMDDHHMM);

[0210] 5. River network hydrodynamic model execution program: 1D.exe;

[0211] LLM instructions are as follows:

[0212] 1 Generate a river network hydrodynamic model file package;

[0213] 2 The cross-section spacing is distributed at 500m intervals;

[0214] 3 The river channel parameters are automatically derived using the Manning formula / or specified values for each river reach;

[0215] Interpolate the 4 boundary time series to a 1-hour interval;

[0216] 5 Calculate a time step of 1 s for 72 hours, starting from January 1, 2025.

[0217] Output data in the following format:

[0218] River network file: network.dat; contains the section numbers, starting node numbers, and upstream and downstream boundary node numbers of the model;

[0219] Cross-section distribution file: sections.dat; contains cross-section numbers, cross-section spacings, and cross-section roughnesses;

[0220] Cross-section shape file: sections_001.dat; contains cross-section numbers and their corresponding shapes: X distance from the left bank, Z elevation at the corresponding point;

[0221] Boundary input file: input.dat; contains time series data such as flow rate and water level;

[0222] Model control file: control.dat; contains the model calculation time step and calculation time;

[0223] Model package file: 1D.zip.

[0224] The method and system for constructing a river network hydrodynamic model based on large language model reasoning realizes the intelligence of river network topology structure analysis and river network hydrodynamic model configuration by integrating geographic information system (GIS) data processing and the reasoning ability of large language models; realizes the intelligence of river network topology structure analysis and river network hydrodynamic model configuration through the technology of automatically generating river network hydrodynamic model interfaces by topology structure; realizes the full-process automation from DEM data to river network hydrodynamic model construction by integrating the spatial reasoning ability of large language models and hydrological analysis technology, solves the problems of traditional methods relying on manual intervention and low modeling efficiency, and has high technological innovation and practical application value.

[0225] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for constructing a river network hydrodynamic model based on large language model reasoning, characterized in that: Including: Filling depressions in the original DEM data and calculating the flow direction matrix; The large language model automatically calculates and analyzes the optimal flow accumulation and extracts the river network raster; By specifying the output river network level instruction, output the river network raster of the specified level; Encoding the river network raster into a format described in natural language to train the large language model; Parsing the river channel spatial distribution through the large language model to generate a topological relationship graph containing nodes and directed edges; Identifying hydraulic engineering through the large language model to generate hydraulic engineering objects and their location information; Overlaying the topological relationship graph and the hydraulic engineering objects and their location information, and the large language model infers to obtain the final river network topological structure; According to the target river network hydrodynamic model specification, converting the final river network topological structure into a structured configuration file and inputting it into the target river network hydrodynamic model to generate the final river network hydrodynamic model; The said according to the target river network hydrodynamic model specification includes: setting a rule engine according to the format requirements of the target river network hydrodynamic model, automatically assigning the upstream and downstream boundary identifiers of the target river network hydrodynamic model according to the node connection order in the topological relationship, and generating a configuration file that conforms to the format of the target river network hydrodynamic model; The said rules include: Each river channel segment has one and only one upstream node and one downstream node. Among them, the method for determining the upstream node includes: the accumulation is the smallest and there is no upstream unit, and the method for determining the downstream node includes: the accumulation is the largest and there is no downstream unit; The confluence point needs to connect ≥2 river channels, and the classification method is the Gravelius classification method; The node numbers are from upstream to downstream, with the main stream first and the tributaries later; One node is generated upstream and downstream of the gate, and the river channel between the two nodes normally participates in the river channel numbering; The reservoir generates a reservoir type node separately, and the connection between the reservoir and the node does not participate in the river channel numbering; The said generating a topological relationship graph containing nodes and directed edges includes: identifying the river channel intersection points in the river network raster as topological nodes; judging the upstream and downstream connection relationships of the river channel segments according to the flow direction to generate directed edges; performing logical verification on the isolated river channel segments, and if they are not connected to the main river channel, marking the abnormal path and triggering a reminder for manual review; The said converting the final river network topological structure into a structured configuration file includes: generating a river network structure file according to the topological relationship; Generating a cross-section distribution file according to the river channel length and the preset cross-section spacing; Automatically converting the cross-section shape data into a model cross-section file; Generating an input file for the boundary condition parameters.

2. The method for constructing a river network hydrodynamic model based on large language model reasoning according to claim 1, characterized in that: The said encoding the river network raster into a format described in natural language includes: converting the position, flow direction, and flow accumulation of each river channel unit into key-value pair text.

3. The method for constructing a river network hydrodynamic model based on large language model reasoning according to claim 2, wherein: The said flow direction is encoded in 8 directions.

4. A method for constructing a river network hydrodynamic model based on large language model reasoning according to claim 1, characterized in that: The said identifying hydraulic engineering through the large language model includes: through the input high-resolution satellite image, the large language model identifies the hydraulic engineering facilities in the satellite image. If there is no hydraulic engineering, output the river network topological structure diagram. If a hydraulic engineering is identified, output the corresponding type of hydraulic engineering and the geographical location of the hydraulic engineering, and overlay the geographical location of the hydraulic engineering on the original river network raster.

5. A method for constructing a river network hydrodynamic model based on large language model reasoning according to claim 1, characterized in that: The calculation and analysis of the optimal cumulative runoff includes: calculating the river network density: ; where: y represents the digital river network density, with the unit of km / km 2 ; L represents the river network length, with the unit of km; A represents the basin area, with the unit of km 2 ; Calculating multiple threshold fittings wherein: x represents the threshold,[[]] y represents the digital river network density,[[]] represents the power of the fitting function, and k represents the coefficient of the fitting function; For n ( n ≥2) sequences, the change point ( =1,2,…,n)divides the sequence into two segments, calculates the sum of squared deviations of the two segments and adds them up to obtain the sum of squared deviations on both sides of the change point , the total sum of squared deviations of the sample S and the sum of squared deviations on both sides of the change point The maximum point of the difference is the optimal threshold of the confluence accumulation; the formula is as follows: ; ; In the formula, represents the sample value corresponding to the th sequence, i.e., the river network density value; , , represent the average value on the left side of the change point, the average value on the right side of the change point, and the overall sample average value respectively; is the sum of the sum of squared deviations on both sides of the change point; = 1, 2, …, - 1; = , + 1, …, n ; S represents the total sum of squared deviations of the sample; n represents the serial number.

6. A system for a method of constructing a river network hydrodynamic model based on large language model reasoning according to claim 1, characterized in that: Including: The DEM processing module is used to perform depression filling on the original digital elevation model data, calculate the water flow direction matrix, and optimize the calculation of the best accumulation threshold using a large language model to generate river network grids at the specified number of levels specified by the user. The topology inference module is used to receive the data from the DEM processing module, parse the river channel spatial distribution through a pre-trained large language model; receive high-definition satellite images to identify water conservancy projects; infer and generate a topological relationship graph containing nodes and directed edges, and output topological structure data and visual topological pictures. The river network hydrodynamic model generation module is used to assign upstream and downstream boundary identifiers for the river network hydrodynamic model according to the node connection order in the topological relationship; convert the topological relationship into a structured configuration file according to the structural requirements and input specifications of the target river network hydrodynamic model, generate a model file including model parameters, river channel parameters, and boundary conditions, and construct a river network hydrodynamic model.

Citation Information

Patent Citations

  • Fast coding method for a large quantity of sub-basins on basis of digital river network

    CN108804804A

  • Method for automatically dividing and encoding one-dimensional model calculation unit of river network area

    CN112163322A