Runoff simulation method and system based on coupled WRF-Hydro and Transform mechanism
By combining the runoff simulation method with WRF-Hydro and Transformer mechanisms, the runoff data is corrected using the TBLformer model, which solves the problem of insufficient spatiotemporal and dynamic relationship characterization of existing models in complex environments, and achieves high-precision and high-reliability runoff prediction.
Patent Information
- Application Number
- CN202510523759.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-15
AI Technical Summary
The existing runoff simulation model is insufficient in-depth representation of spatiotemporal and dynamic relationships under complex geographical environments and extreme climate events, which makes it difficult to generalize the simulation results and lack of accuracy in data scarce scenarios.
Combining the WRF-Hydro and Transformer mechanisms, the runoff data is corrected through the TBLformer model composed of the multi-head attention mechanism layer, the Bi-LSTM layer and the normalization layer. The multi-level feature interaction and dynamic weight allocation mechanism are used to dynamically correct the missing values to optimize the performance of the WRF-Hydro model.
The accuracy and completeness of runoff data are improved, the robustness of the model is enhanced, and the runoff prediction with high accuracy and high reliability is achieved.
Smart Images

Figure CN120493698A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of runoff simulation, and in particular to a runoff simulation method and system based on a coupled WRF-Hydro and Transformer mechanism. Background Art
[0002] Runoff simulation is an important branch of hydrology, which aims to solve the problem that the hydrological cycle and water resources distribution cannot be accurately estimated under different meteorological and geological conditions. With the continuous improvement of computer technology and data processing capabilities, runoff simulation research has also made significant progress. For a long time, runoff simulation has played a vital role in water resources management and flood prevention and disaster reduction. In the past few decades, with the cross-integration of disciplines, a large number of runoff simulation models have emerged. As research continues to deepen, new theories and technologies need to be continuously introduced to meet the current higher requirements for runoff simulation accuracy and intelligence. Current hydrological models can be roughly divided into three categories:
[0003] 1) Traditional Hydrological Models: In the history of hydrological model development, the Stanford Basin Model, the first lumped conceptual hydrological modeling system, was developed in the United States in 1959. Its core advantage lies in its clear physical foundation, enabling highly accurate reproduction of hydrological processes. However, this model employed a holistic modeling strategy for small watersheds and a zonal calculation scheme for large-scale basins. This was hampered by the complexity of its parameter system and the cumbersome computational process. Two years later, Japanese scholar Sugawara developed the tank model. This model, based on the principle of water level regulation, mathematically represents the flow generation, confluence, and infiltration processes in a watershed. It dynamically simulates hydrological elements through the physical structure of a series of tanks. While the model's parameters have certain physical meaning, their determination is cumbersome, often requiring repeated trial and error to determine the optimal parameters. From the mid- to late 20th century, a number of classic lumped hydrological models emerged, including the Sacramento model, the SCS model, and the ARNO model. These models are based on simplified modeling ideas and achieve effective representation of basin hydrological processes through concise structural design. They have both clear physical mechanisms and simple model architectures, are highly practical, and have made important contributions to the development of hydrological models and the solution of practical problems.
[0004] 2) Distributed Hydrological Models: The study of distributed hydrological models originated from the theoretical paradigm of spatial discretization modeling proposed by Freeze and Harlan in 1969. In the late 1970s, TOPMODE, developed by Beven's team, leverages the dynamic source-area runoff theory and the terrain index of digital elevation models to analyze the spatial variability of the underlying surface. While it boasts advantages such as a simple structure and reduced parameters, it does not fully meet the strict definition of distributed modeling because it does not account for spatial variations in meteorological factors. Around the same time, the SHE model, jointly developed by European research institutions, utilizes a gridded computational unit coupled with physical equations, marking a breakthrough in distributed hydrological simulation methods. This model constructs a complete system of hydrological physical processes, encompassing key mechanisms such as infiltration and evapotranspiration. Regarding spatial discretization, it employs a three-dimensional modeling framework that couples planar grids with vertical soil layers. Numerical analysis methods establish hydrological connections between grids, enabling detailed simulation of watershed hydrological processes. While its distinguishing feature is its clear physical mechanisms, it also faces application challenges such as a large number of parameters, high grid computational intensity, and complex data requirements. The SWAT model, developed by Jeff Arnold in 1994, pioneered a semi-distributed modeling paradigm. This model integrates explicit physical mechanisms, enabling simulation of complex hydrological processes in large watersheds. It supports multiple spatial discretization methods, effectively characterizing the impact of human activities on the hydrological cycle and accurately reflecting the spatial variability of underlying surface and climate factors. Furthermore, Shen et al. improved the VIC model by integrating a mixed runoff generation mechanism, enhancing simulation accuracy in complex mountainous areas and sub-humid watersheds while accounting for vertical and horizontal heterogeneity.
[0005] 3) Artificial Intelligence Models: With the innovation of computing technology and the deep integration of artificial intelligence, statistical modeling methods have gradually evolved from linear regression to a machine learning paradigm. Machine learning technology relies on a data mining framework to construct predictive models by learning data features. Data-driven models (such as support vector machines and artificial neural networks) have been widely used in the field of runoff prediction. Typical studies include: Razavi constructed a methodological framework for model parameter optimization and uncertainty analysis, systematically exploring the applicability, limitations, and development direction of this technology in watershed runoff prediction; Li Daihua et al. used an improved cuckoo search algorithm to optimize the support vector machine model to achieve high-precision prediction of monthly runoff in the Gulao River Basin in Yunnan during the dry season; Wang Wensheng et al. used a two-case empirical analysis to verify the predictive superiority of the NNBR model compared to autoregressive models, genetic algorithm-optimized regression models, and empirical correlation graphs. Mao et al. conducted a comparative study on the hydrological simulation performance of artificial neural networks and long-short-term memory networks based on daily meteorological and hydrological data from the upper Heihe River from 1957 to 2015. Since its introduction by Hochreiter and Schmidhuber, the Long-Short Term Memory (LSTM) network has provided a new modeling paradigm for runoff simulation. This model captures the long-term dependencies of time series data through a gating mechanism, demonstrating unique advantages in rainfall-runoff sequence analysis. Typical applications include: Xu et al. constructed an LSTM-based extreme rainfall-runoff response model based on the Lai Chi Wo watershed in Hong Kong, China, to mine the temporal characteristics of extreme events; Kratzert et al. integrated meteorological time series with watershed attribute data and used a single LSTM model to conduct regional training on 531 watersheds in the CAMELS dataset. The results showed that the model had significantly improved accuracy compared to traditional benchmark models; Xiang et al. proposed an LSTM sequence-to-sequence (LSTM-seq2seq) rainfall-runoff model, which enhanced the predictive ability of short-term flood processes through a bidirectional temporal encoding mechanism and verified the model's effectiveness in high-precision flood forecasting scenarios. The non-equal weight parameter fusion method proposed by Li Xin et al.
[20] achieves collaborative optimization of multi-time scale prediction accuracy by weighted integration of the Xinanjiang model parameter calibration results and BP prediction values. The PI-LSTM model proposed by Singh et al. embeds basic hydrological equations such as Darcy's law as regularization terms into the LSTM framework, improving the generalization ability by 25%-40% in scarce data scenarios.
[0006] While these models can simulate runoff processes, provide hydrological information, and assist in water resource management decisions to a certain extent, they still lack a deep representation of spatiotemporal dynamic relationships and exhibit certain biases, making it difficult to generalize the simulation results in complex geographical environments, extreme climate events, or data-scarce scenarios. Therefore, to improve the spatiotemporal adaptability and physical consistency of runoff simulation, it is necessary to leverage the advantages of deep learning models in processing complex spatiotemporal data while combining them with the ability of physical hydrological models to capture the physical laws of hydrological processes, thereby breaking through the simulation bottlenecks of traditional hydrological models in complex environments. Summary of the Invention
[0007] In order to improve the model's adaptability to baseflow processes and flood peak dynamics and enhance the model's robustness, the present invention aims to provide a runoff simulation method and system based on the coupled WRF-Hydro and Transformer mechanisms. The technical solutions adopted are as follows:
[0008] In a first aspect, the present application discloses a runoff simulation method based on a coupled WRF-Hydro and Transformer mechanism, the method comprising:
[0009] S1. Obtain the target runoff dataset of the study area;
[0010] S2. Inputting the target runoff dataset into the initial WRF-Hydro model to perform preliminary runoff simulation and obtain preliminary simulation results;
[0011] S3. Inputting the preliminary simulation results into a TBLformer model that incorporates a Transformer mechanism for correction to obtain corrected runoff data, wherein the encoder of the TBLformer model is composed of a multi-head attention mechanism layer for extracting spatiotemporal features, a Bi-LSTM layer for extracting local bidirectional temporal patterns and global dependencies, and a normalization layer for normalizing feature distribution, which are connected in sequence. The decoder incorporates a masked self-attention and weight fusion mechanism, enabling dynamic correction of missing values in the runoff data through multi-level feature interaction and dynamic weight allocation;
[0012] S4, dividing the training set and the validation set based on the corrected runoff data, and inputting the obtained divided data into the initial WRF-Hydro model for model training;
[0013] S5. Perform the final runoff simulation based on the trained target WRF-Hydro model.
[0014] Furthermore, in step S1, the target runoff dataset includes at least one of site observation data, static geographic data, DEM data, and meteorological driven data.
[0015] Furthermore, before inputting the preliminary simulation results into the TBLformer model, the method further includes: using sine-cosine position encoding to determine the absolute position information and relative position information of the data in each sequence, so that the subsequent model can distinguish elements in different positions.
[0016] Furthermore, for the data to be processed corresponding to the odd index 2i+1, the first encoding information related to the position is generated by the cosine function:
[0017]
[0018] Among them, pos represents each position in the data, i represents the dimension index, and d model Represents the dimension of the TBLformer model;
[0019] For the data to be processed corresponding to the even index 2i, the second encoding information related to the position is generated by the sine function:
[0020]
[0021] Furthermore, in step S3, the multi-head attention mechanism layer allocates attention to the input sequence data through multiple heads to enhance the feature extraction capability of the sequence data, wherein the sequence data consists of a dimension of d K The query vector Q, key vector K, and dimension d V The query vector Q, key vector K, and value vector V are mapped to multiple subspaces through linear transformation. For the head h in each subspace, there are:
[0022]
[0023] Among them, Q h , K h 、V h It is the representation mapped from the original Q, K, V to the h-th head through linear transformation, Represents the scaling factor used to stabilize the gradient. The final output of all heads is: MultiHead(Q,K,V)=Concat(head1,...,head H )W O , where H represents the total number of heads, head i represents the output result of the i-th head, i={1,2,...,H}, W O Represents the preset linear transformation matrix, and Concat represents the concatenation operation.
[0024] Furthermore, in step S3, the Bi-LSTM layer includes an input gate, a forget gate, a state update unit, and an output gate. When extracting the local bidirectional temporal pattern and the global dependency relationship based on the Bi-LSTM layer, the method includes calculating the forward output of the Bi-LSTM layer based on the following steps: And backward output
[0025] S31, the output h of the previous layer t-1 , and the current input p t Input to the input gate, forget gate, state update unit, and output gate to obtain the corresponding output result i t 、f t 、 o t ;
[0026] S32, based on the output result i t 、f t 、 Update the status and get the status update result c t ;
[0027] S33, based on the tanh activation function, the state update result c t Perform nonlinear transformation and based on the obtained transformation result and the output result o of the output gate t Perform element-by-element multiplication to obtain the final output h t ,in,
[0028] Furthermore, in step S3, the decoder performs weight fusion based on the Bi-LSTM layer, and the Bi-LSTM layer performs forward propagation and backward propagation feature fusion based on multiple LSTM layers connected by bidirectional rules to obtain better sequence representation.
[0029] Furthermore, in step S3, the decoder includes E decoding layers, and the implementation process of each decoding layer is shown in the following formula:
[0030]
[0031] in, Represents the output of the e-th decoding layer. When e=1, Indicates embedded i∈{1,2,3} represents the feature information extracted after the i-th R-Norm layer in the e-th decoding layer, where Linear(·) and Norm(·) represent the linear projection layer and the normalization layer, respectively.
[0032] Furthermore, in step S4, before model training, the method further includes: calibrating the parameters of the WRF-Hydro model based on key parameters sensitive to runoff, thereby determining the optimal parameter combination of the WRF-Hydro model, and setting training parameters for the TBLfommer model for training, wherein the parameters used for calibration are pre-calibrated based on the successive approximation method and include at least one of infiltration coefficient, slope coefficient, pore size distribution index, saturated soil water content, soil saturated hydraulic conductivity, surface water holding depth, surface roughness, and Manning roughness.
[0033] In a second aspect, the present application discloses a runoff simulation system based on a coupled WRF-Hydro and Transformer mechanism, the system comprising a runoff data acquisition module, a preliminary runoff simulation module, a missing correction module, a WRF-Hydro model training module, and a final runoff simulation module, wherein:
[0034] The runoff data acquisition module is used to acquire the target runoff dataset of the study area;
[0035] The preliminary runoff simulation module is used to input the target runoff dataset into the initial WRF-Hydro model to perform preliminary runoff simulation and obtain preliminary simulation results;
[0036] The missing value correction module is used to input the preliminary simulation results into a TBLformer model that incorporates a Transformer mechanism for correction to obtain corrected runoff data, wherein the encoder of the TBLformer model is composed of a multi-head attention mechanism layer for extracting spatiotemporal features, a Bi-LSTM layer for extracting local bidirectional temporal patterns and global dependencies, and a normalization layer for normalizing feature distribution, which are connected in sequence. The decoder incorporates a masked self-attention and weight fusion mechanism, enabling dynamic correction of missing values in the runoff data through multi-level feature interaction and dynamic weight allocation;
[0037] The WRF-Hydro model training module is used to divide the training set and the validation set based on the corrected runoff data, and input the obtained divided data into the initial WRF-Hydro model for model training;
[0038] The final runoff simulation module is used to perform the final runoff simulation based on the trained target WRF-Hydro model.
[0039] The present invention has the following beneficial effects: first, by obtaining the target runoff dataset and inputting it into the initial WRF-Hydro model for preliminary simulation, basic data is provided for subsequent correction; second, the TBLformer model incorporating the Transformer mechanism is used to correct the preliminary simulation results, effectively improving the accuracy and completeness of the runoff data. In particular, through the multi-level feature interaction and dynamic weight distribution mechanism, missing values in the runoff data can be accurately and dynamically corrected; then, model training is performed based on the corrected runoff data, further optimizing the performance of the WRF-Hydro model; finally, the final runoff simulation is performed based on the trained target WRF-Hydro model, achieving high-precision and high-reliability runoff prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 A flow chart of a runoff simulation method based on coupling WRF-Hydro and Transformer mechanisms provided by one embodiment of the present invention;
[0042] Figure 2 Schematic diagram of the structure of the encoder and decoder in the TBLformer model;
[0043] Figure 3 The overall implementation flow chart for runoff simulation based on the coupled WRF-Hydro and Transformer mechanisms;
[0044] Figure 4 This is the REFKDT parameter calibration result diagram;
[0045] Figure 5 This is the SLOPE parameter calibration result diagram;
[0046] Figure 6 This is the BEXP parameter calibration result diagram;
[0047] Figure 7 This is the SMCMAX parameter calibration diagram;
[0048] Figure 8 is the DKSAT parameter calibration map;
[0049] Figure 9 This is the RETDEPRTFAC parameter calibration result diagram;
[0050] Figure 10 This is the OVROUGHRTFAC parameter calibration result diagram;
[0051] Figure 11 A system structure diagram of a runoff simulation system based on the coupled WRF-Hydro and Transformer mechanisms provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0052] To further illustrate the technical means and effectiveness of the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementation, structure, features, and effectiveness of a runoff simulation method and system based on a coupled WRF-Hydro and Transformer mechanism proposed in accordance with the present invention. In the following description, references to different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
[0053] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0054] The specific scheme of a runoff simulation method and system based on the coupled WRF-Hydro and Transformer mechanism provided by the present invention is described in detail below with reference to the accompanying drawings.
[0055] See also Figures 1 to 3 , which shows a flow chart of a runoff simulation method based on the coupled WRF-Hydro and Transformer mechanisms provided by one embodiment of the present invention, the method comprising:
[0056] Step S1: Obtain the target runoff dataset of the study area.
[0057] Step S2: input the target runoff dataset into the initial WRF-Hydro model to perform preliminary runoff simulation and obtain preliminary simulation results.
[0058] Step S3: Input the preliminary simulation results into a TBLformer model that incorporates a Transformer mechanism for correction to obtain corrected runoff data. The encoder of the TBLformer model is composed of a multi-head attention mechanism layer for extracting spatiotemporal features, a Bi-LSTM layer for extracting local bidirectional temporal patterns and global dependencies, and a normalization layer for normalizing feature distribution, which are connected in sequence. The decoder incorporates a masked self-attention and weight fusion mechanism, so that missing values in the runoff data can be dynamically corrected through multi-level feature interaction and dynamic weight allocation.
[0059] Step S4: dividing the training set and the validation set based on the corrected runoff data, and inputting the obtained divided data into the initial WRF-Hydro model for model training.
[0060] Step S5: Perform the final runoff simulation based on the trained target WRF-Hydro model.
[0061] As can be seen from the above, the present application discloses a runoff simulation method based on the coupled WRF-Hydro and Transformer mechanisms. First, a target runoff dataset is obtained and input into the initial WRF-Hydro model for preliminary simulation, providing basic data for subsequent correction. Secondly, the preliminary simulation results are corrected using the TBLformer model that incorporates the Transformer mechanism, which effectively improves the accuracy and completeness of the runoff data. In particular, through the multi-level feature interaction and dynamic weight distribution mechanism, missing values in the runoff data can be accurately and dynamically corrected. Then, model training is performed based on the corrected runoff data to further optimize the performance of the WRF-Hydro model. Finally, the final runoff simulation is performed based on the trained target WRF-Hydro model, achieving high-precision and high-reliability runoff prediction.
[0062] In one embodiment, in step S1, the target runoff dataset includes at least one of site observation data, static geographic data, DEM data, and meteorological driven data.
[0063] Specifically, this application takes three stations in the middle reaches of the Yangtze River: Yichang Station, Shashi Station, and Hankou Station as the research area, and obtains runoff data related to the research area.
[0064] It should be noted that the site observation data here include measured data of hydrological elements such as water level, flow, precipitation, and evaporation, which reflect the dynamics of the hydrological processes in the study area. Static geographic data include land use / cover type, soil type, etc., which are used to describe the impact of underlying surface characteristics on hydrological processes. DEM data provides terrain elevation information, which is used to extract parameters such as watershed boundaries, slope, and aspect, and is the basis for the spatialization of hydrological models. Meteorological driving data include temperature, air pressure, air specific humidity, wind speed, downward shortwave radiation from the ground, downward longwave radiation from the ground, precipitation rate, etc., which are the core input variables driving the hydrological model.
[0065] In one embodiment, before inputting the preliminary simulation results into the TBLformer model, the method further includes: using sine-cosine position encoding to determine the absolute position information and relative position information of the data in each sequence, so that the subsequent model can distinguish elements in different positions.
[0066] Specifically, for each position in the data sequence, first, the present application determines its absolute position index in the sequence. Afterwards, the cosine function is used to generate the first coding information associated with the odd index position, and the sine function is used to generate the second coding information associated with the even index position. In other words, the present application can generate a unique position code for each position in the sequence, which contains both absolute position information and implicit relative position information (because the code values at different positions are different). These position code information will then be input into the TBLformer model, enabling the model to distinguish and effectively utilize element information at different positions, thereby improving the performance of the model.
[0067] In one embodiment, for the data to be processed corresponding to the odd index 2i+1, the first encoding information related to the position is generated by a cosine function:
[0068]
[0069] Among them, pos represents each position in the data, i represents the dimension index, and d model Represents the dimension of the TBLformer model.
[0070] For the data to be processed corresponding to the even index 2i, the second encoding information related to the position is generated by the sine function:
[0071]
[0072] In one embodiment, please refer to Figure 2 and Figure 3In step S3, the multi-head attention mechanism layer allocates attention to the input sequence data through multiple heads to enhance the feature extraction capability of the sequence data, wherein the sequence data consists of a dimension of d K The query vector Q, key vector K, and dimension d V The query vector Q, key vector K, and value vector V are mapped to multiple subspaces through linear transformation. For the head h in each subspace, there are:
[0073]
[0074] Among them, Q h , K h 、V h It is the representation mapped from the original Q, K, V to the h-th head through linear transformation, Represents the scaling factor used to stabilize the gradient. The final output of the concatenation of all heads is: MultiHead(Q, K, V) = Concat(head1, ..., head H )W O , where H represents the total number of heads, head i represents the output result of the i-th head, i={1,2,...,H}, W O Represents the preset linear transformation matrix, and Concat represents the concatenation operation.
[0075] It should be noted that the query vector Q is used to query relevant information from the sequence, and its dimension is d K ;The key vector is used to match the query vector, and its dimension is d K ; The value vector is used to store the actual information after matching the key vector, and its dimension is d V The query vector Q, key vector K, and value vector V of the input sequence are mapped to multiple different subspaces, and each head calculates attention weights and generates outputs. Different heads can capture dependencies at different positions or patterns in the sequence. Ultimately, the outputs of multiple heads are concatenated and fused through linear transformations to enhance the model's feature extraction capabilities.
[0076] It should be noted that the input of the encoder is the processed time series p en , and the encoder includes N encoder layers. For the n-th layer encoder, the specific implementation process can be given by the following formula.
[0077]
[0078] The above formula can be further summarized as:
[0079]
[0080] in, n is {1,...,N}, Represents the output of the n-th layer encoder. When n=1, For embedded i is {1, 2}, representing the feature information extracted after the i-th normalization layer module in the n-th encoder layer. R-Norm represents a residual connection followed by normalization. Mul-HeadAtt and BiLSTM represent the multi-head attention mechanism processing module and the Bi-LSTM layer, respectively.
[0081] In one embodiment, in step S3, the Bi-LSTM layer includes an input gate, a forget gate, a state update unit, and an output gate. When extracting local bidirectional temporal patterns and global dependencies based on the Bi-LSTM layer, the method includes calculating the forward output of the Bi-LSTM layer based on the following steps: And backward output
[0082] Step S31: The output h of the previous layer t-1 , and the current input p t Input to the input gate, forget gate, state update unit, and output gate to obtain the corresponding output result i t 、f t 、 o t .
[0083] Specifically, this application calculates the output results of the input gate, forget gate, state update unit, and output gate using the following formula: Among them, σ represents the Sigmoid activation function, W i 、 represents the gating weight of the input gate, b i represents the gate bias of the input gate, W f 、 Indicates that the forget gate is relative to the current input p t , and the previous layer output h t-1 The weight of b f represents the bias of the forget gate, λ represents the tanh activation function, W c , Represents the state update unit relative to the current input p t , and the previous layer output h t-1 The weight of b c represents the deviation of the state update unit, W o , Indicates that the output gate is respectively relative to the current input pt , and the previous layer output h t-1 The weight of b o Represents the bias of the output gate.
[0084] Step S32, based on the output result i t 、f t 、 Update the status and get the status update result c t .
[0085] Specifically, this application updates the status through the status update mechanism based on the following formula: Among them, ⊙ represents multiplying the elements of the corresponding positions of the two matrices, c t-1 + indicates the last status update result, f t Represents the forget gate, which is used to control the previous state c t-1 +Information that needs to be forgotten, i t Represents the input gate, which is used to control the current input Information that needs to be updated. Through this mechanism, the network can remember long-term dependencies and filter out unimportant information.
[0086] Step S33, based on the tanh activation function, the state update result c t Perform nonlinear transformation and based on the obtained transformation result and the output result o of the output gate t Perform element-by-element multiplication to obtain the final output h t ,in,
[0087] Specifically, this application calculates the final output based on the following formula: t =o t ⊙λ(c t ), where λ represents the tanh activation function and ⊙ represents multiplying the elements of the corresponding positions of the two matrices.
[0088] It should be noted that based on steps S31 to S33, the final output of the Bi-LSTM layer is given by the following formula:
[0089]
[0090] Among them, σ f,b Indicates the connection merge operation, which is about to output forward And backward output Merging, since it can consider both forward and backward information at the same time, makes it possible to better extract the features of runoff time series data layer by layer.
[0091] In one embodiment, in step S3, the decoder performs weight fusion based on a Bi-LSTM layer, and the Bi-LSTM layer performs forward propagation and backward propagation feature fusion based on multiple LSTM layers connected by bidirectional rules to obtain better sequence representation.
[0092] Specifically, the Bi-LSTM layer obtains sequence information from front to back through forward propagation, and obtains sequence information from back to front through backward propagation. These two types of information are fused in the Bi-LSTM layer, thereby capturing the bidirectional dependencies in the sequence. This enables the decoder to perform weight fusion based on more comprehensive contextual information, thereby obtaining a more accurate and reliable sequence representation.
[0093] In one embodiment, the present application specifically uses the following formula to perform feature fusion of forward propagation and backward propagation:
[0094] h t =f(w1x t +w2h t-1 )
[0095] h′ t =f(w3x t +w5h′ t-1 );
[0096] o t =g(w4h t +w6h′ t )
[0097] Among them, x t represents the tth element in the input sequence, h t represents the state of the forward hidden layer at time step t, h t-1 represents the state of the forward hidden layer at time step t-1, h' t represents the state of the backward hidden layer at time step t, h' t-1 represents the state of the backward hidden layer at time step t-1, f and g represent the activation functions introduced, and w i (i=1,2,...,6) represents six independent weight matrices, (w1,w3) represents the weights from the input layer to the forward hidden layer, and from the input layer to the backward hidden layer, (w2,w5) represents the weights from the hidden layer self-connection, (w4,w6) represents the weights from the forward hidden layer, and from the backward hidden layer to the output layer, and the values of these six weights are reused at each time step.
[0098] In one embodiment, please refer to Figure 2 , the decoder includes E decoding layers, and the implementation process of each decoding layer is shown in the following formula:
[0099]
[0100] in, Represents the output of the e-th decoding layer. When e=1, Indicates embedded i∈{1,2,3} represents the feature information extracted after the i-th R-Norm layer in the e-th decoding layer, where Linear(·) and Norm(·) represent the linear projection layer and the normalization layer, respectively.
[0101] In one embodiment, please refer to Figure 3 In step S4, before model training, the method further includes: calibrating the WRF-Hydro model based on key parameters that are sensitive to runoff, thereby determining the optimal parameter combination of the WRF-Hydro model, and setting training parameters for the TBLfommer model for training, wherein the parameters used for calibration are pre-calibrated based on the successive approximation method and include at least one of infiltration coefficient, slope coefficient, pore size distribution index, saturated soil water content, soil saturated hydraulic conductivity, surface water holding depth, surface roughness, and Manning roughness.
[0102] Specifically, the parameters selected for calibration in this application are shown in Table 1 below:
[0103] Table 1
[0104]
[0105] This application specifically calibrates parameters based on daily runoff simulations at three stations (Yichang, Hankou, and Shashi) in the middle reaches of the Yangtze River from 2012 to 2014. Specifically, this application uses the successive approximation method to sequentially calibrate eight parameters related to runoff generation. Table 2 below shows the final calibration results for these eight parameters:
[0106] Table 2 Selected calibration parameters
[0107] parameter Value parameter Value REFKDT 0.1 DKSAT 9.0 SLOPE 1.0 RETDEPRTFAC 8.0 BEXP 1.9 OVROUGHRTFAC 0.9 SMCMAX 0.85 MannN 2.0
[0108] In order to evaluate its runoff simulation performance at Yichang, Hankou and Shashi stations, this application sets the experimental simulation time from January 2015 to January 2017, and uses RMSE, NSE and PCC as indicators to compare with the benchmark WRF-Hydro model that has completed fine calibration of eight parameters. The final experimental results of the runoff simulation tasks of different models at the three hydrological stations are as follows Figures 4 to 10 shown.
[0109] The results show that the WH-TBL model proposed in this application, which couples the WRF-Hydro and Transformer mechanisms, exhibits systematic advantages in all stations and indicators. Specifically, the runoff data output by the WRF-Hydro model is corrected in real time and dynamically through the TBLformer model, which significantly improves the simulation accuracy of the WH-TBL model. Among them, at the Yichang station, the RMSE (root mean square error) of the WH-TBL model is reduced by 14.6% compared with the WRF-Hydro model, and its NSE (Nash efficiency coefficient) and PCC (Pearson correlation coefficient) are increased to 0.81 and 0.95, respectively, which are 12.5% and 17.2% higher than the baseline model, indicating that the real-time correction based on the Transformer attention mechanism effectively alleviates the systematic bias of the original model for extreme flow events. The improvements at the Hankou station were even more significant. Specifically, the RMSE of the WH-TBL model decreased by 19.4% compared to the WRF-Hydro model, while the NSE and PCC increased by 13.6% and 9%, respectively. This suggests that the TBLformer may have optimized the model's dynamic response to complex hydrological processes by capturing the nonlinear characteristics of the time-series runoff data. This result further reflects the WH-TBL model's enhanced ability to capture flow dynamics. Data from the Shashi station further validated the robustness of the coupled model, with its RMSE reduced by 14.0% compared to the baseline model, and its NSE and PCC increased by 11.7% and 11.8%, respectively. This also demonstrates the universal applicability of the TBLformer-based correction mechanism even in small and medium flow scenarios.
[0110] In summary, the consistency of data from the three stations demonstrates that the TBLformer model, by integrating the mechanistic constraints of the physical model with data-driven adaptive learning, effectively balances systematic biases and random errors in hydrological process simulation, thereby demonstrating enhanced robustness under complex hydrological conditions. Furthermore, it achieves synergistic optimization in error control (reduced RMSE), dynamic fitting (improved NSE), and overall explanatory power (increased PCC), while also enhancing its ability to explain overall flow series variations.
[0111] Please refer to Figure 11 The present application discloses a runoff simulation system based on the coupled WRF-Hydro and Transformer mechanisms, the system comprising a runoff data acquisition module, a preliminary runoff simulation module, a missing correction module, a WRF-Hydro model training module, and a final runoff simulation module, wherein:
[0112] The runoff data acquisition module is used to acquire a target runoff dataset in a study area.
[0113] The preliminary runoff simulation module is used to input the target runoff dataset into the initial WRF-Hydro model to perform preliminary runoff simulation and obtain preliminary simulation results.
[0114] The missing value correction module is used to input the preliminary simulation results into a TBLformer model that incorporates a Transformer mechanism for correction to obtain corrected runoff data. The encoder of the TBLformer model is composed of a multi-head attention mechanism layer for extracting spatiotemporal features, a Bi-LSTM layer for extracting local bidirectional temporal patterns and global dependencies, and a normalization layer for normalizing feature distribution, which are connected in sequence. The decoder incorporates a masked self-attention and weight fusion mechanism, so that missing values in the runoff data can be dynamically corrected through multi-level feature interaction and dynamic weight allocation.
[0115] The WRF-Hydro model training module is used to divide the training set and the validation set based on the corrected runoff data, and input the obtained divided data into the initial WRF-Hydro model for model training.
[0116] The final runoff simulation module is used to perform the final runoff simulation based on the trained target WRF-Hydro model.
[0117] In one embodiment, the above modules are also used to implement a runoff simulation method based on the coupled WRF-Hydro and Transformer mechanism as described in any one of the above method embodiments, which is not limited in this application.
[0118] As can be seen from the above, the present application discloses a runoff simulation system based on the coupled WRF-Hydro and Transformer mechanisms. First, a target runoff dataset is obtained and input into the initial WRF-Hydro model for preliminary simulation, providing basic data for subsequent correction. Secondly, the preliminary simulation results are corrected using the TBLformer model that incorporates the Transformer mechanism, effectively improving the accuracy and completeness of the runoff data. In particular, through the multi-level feature interaction and dynamic weight distribution mechanism, missing values in the runoff data can be accurately and dynamically corrected. Then, model training is performed based on the corrected runoff data to further optimize the performance of the WRF-Hydro model. Finally, the final runoff simulation is performed based on the trained target WRF-Hydro model, achieving high-precision and high-reliability runoff prediction.
[0119] It should be noted that the order in which the embodiments of the present invention are described above is for illustrative purposes only and does not necessarily represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0120] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.
Claims
1. A runoff simulation method based on the coupled WRF-Hydro and Transformer mechanism, characterized in that: The method comprises: S1. Obtain the target runoff dataset of the study area; S2. Inputting the target runoff dataset into the initial WRF-Hydro model to perform preliminary runoff simulation and obtain preliminary simulation results; S3. Inputting the preliminary simulation results into a TBLformer model that incorporates a Transformer mechanism for correction to obtain corrected runoff data, wherein the encoder of the TBLformer model is composed of a multi-head attention mechanism layer for extracting spatiotemporal features, a Bi-LSTM layer for extracting local bidirectional temporal patterns and global dependencies, and a normalization layer for normalizing feature distribution, which are connected in sequence. The decoder incorporates a masked self-attention and weight fusion mechanism, enabling dynamic correction of missing values in the runoff data through multi-level feature interaction and dynamic weight allocation; S4, dividing the training set and the validation set based on the corrected runoff data, and inputting the obtained divided data into the initial WRF-Hydro model for model training; S5. Perform the final runoff simulation based on the trained target WRF-Hydro model.
2. The method according to claim 1, characterized in that In step S1, the target runoff dataset includes at least one of site observation data, static geographic data, DEM data, and meteorological driving data.
3. The method according to claim 1, characterized in that Before inputting the preliminary simulation results into the TBLformer model, the method further includes: using sine-cosine position encoding to determine the absolute position information and relative position information of the data in each sequence, so that a subsequent model can distinguish elements in different positions.
4. The method according to claim 3, characterized in that For the data to be processed corresponding to the odd index 2i+1, the first encoding information related to the position is generated by the cosine function: Among them, pos represents each position in the data, i represents the dimension index, and d model Represents the dimension of the TBLformer model; For the data to be processed corresponding to the even index 2i, the second encoding information related to the position is generated by the sine function:
5. The method according to claim 1, characterized in that In step S3, the multi-head attention mechanism layer allocates attention to the input sequence data through multiple heads to enhance the feature extraction capability of the sequence data, wherein the sequence data consists of a dimension d K The query vector Q, key vector K, and dimension d V The query vector Q, key vector K, and value vector V are mapped to multiple subspaces through linear transformation. For the head h in each subspace, there are: Among them, Q h , K h 、V h It is the representation mapped from the original Q, K, V to the h-th head through linear transformation, Represents the scaling factor used to stabilize the gradient. The final output of all heads is: MultiHead(Q,K,V)=Concat(head1,...,head H )W O , where H represents the total number of heads, head i represents the output result of the i-th head, i={1,2,...,H}, W O Represents the preset linear transformation matrix, and Concat represents the concatenation operation.
6. The method according to claim 1, characterized in that In step S3, the Bi-LSTM layer includes an input gate, a forget gate, a state update unit, and an output gate. When extracting the local bidirectional temporal pattern and the global dependency relationship based on the Bi-LSTM layer, the method includes calculating the forward output of the Bi-LSTM layer based on the following steps: And backward output S31, the output h of the previous layer t-1 , and the current input p t Input to the input gate, forget gate, state update unit, and output gate to obtain the corresponding output result i t 、f t 、 o t ; S32, based on the output result i t 、f t 、 Update the status and get the status update result c t ; S33, based on the tanh activation function, the state update result c t Perform nonlinear transformation and based on the obtained transformation result and the output result o of the output gate t Perform element-by-element multiplication to obtain the final output h t ,in, 7. The method according to claim 1, characterized in that In step S3, the decoder performs weight fusion based on the Bi-LSTM layer, and the Bi-LSTM layer performs forward propagation and backward propagation feature fusion based on multiple LSTM layers connected by bidirectional rules to obtain better sequence representation.
8. The method according to claim 1, characterized in that In step S3, the decoder includes E decoding layers, and the implementation process of each decoding layer is shown in the following formula: in, Represents the output of the e-th decoding layer. When e=1, Indicates embedded i∈{1,2,3} represents the feature information extracted after the i-th R-Norm layer in the e-th decoding layer, where Linear(·) and Norm(·) represent the linear projection layer and the normalization layer, respectively.
9. The method according to claim 1, characterized in that In step S4, before model training, the method further includes: calibrating the parameters of the WRF-Hydro model based on key parameters sensitive to runoff, thereby determining the optimal parameter combination of the WRF-Hydro model, and setting training parameters for the TBLfommer model for training, wherein the parameters used for calibration are pre-calibrated based on the successive approximation method and include at least one of infiltration coefficient, slope coefficient, pore size distribution index, saturated soil water content, soil saturated hydraulic conductivity, surface water holding depth, surface roughness, and Manning roughness.
10. A runoff simulation system based on coupled WRF-Hydro and Transformer mechanisms, characterized by: The system includes a runoff data acquisition module, a preliminary runoff simulation module, a missing correction module, a WRF-Hydro model training module, and a final runoff simulation module, wherein: The runoff data acquisition module is used to acquire the target runoff dataset of the study area; The preliminary runoff simulation module is used to input the target runoff dataset into the initial WRF-Hydro model to perform preliminary runoff simulation and obtain preliminary simulation results; The missing value correction module is used to input the preliminary simulation results into a TBLformer model that incorporates a Transformer mechanism for correction to obtain corrected runoff data, wherein the encoder of the TBLformer model is composed of a multi-head attention mechanism layer for extracting spatiotemporal features, a Bi-LSTM layer for extracting local bidirectional temporal patterns and global dependencies, and a normalization layer for normalizing feature distribution, which are connected in sequence. The decoder incorporates a masked self-attention and weight fusion mechanism, enabling dynamic correction of missing values in the runoff data through multi-level feature interaction and dynamic weight allocation; The WRF-Hydro model training module is used to divide the training set and the validation set based on the corrected runoff data, and input the obtained divided data into the initial WRF-Hydro model for model training; The final runoff simulation module is used to perform the final runoff simulation based on the trained target WRF-Hydro model.
Citation Information
Cited By
Hydrometric station supervision method and device
CN120873613A