A channel flow inversion method

By combining deep learning technology with OpenFOAM to generate simulation data, the problems of low accuracy and high cost in open channel flow measurement are solved, achieving fast and accurate flow monitoring that is applicable to different water flow environments.

CN120493718BActive Publication Date: 2025-11-21CHINA AGRI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510575923.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-11-21
Estimated Expiration
2045-05-06

AI Technical Summary

Technical Problem

Existing open channel flow measurement methods suffer from low accuracy, high cost, and limited applicability, especially in complex water flow environments where rapid and accurate flow monitoring is difficult to achieve.

Method used

By employing deep learning technology combined with the computational fluid dynamics software OpenFOAM, a deep learning model is trained by generating a large amount of simulation data, and channel flow can be directly inverted from the surface velocity distribution, reducing reliance on equipment such as radar.

Benefits of technology

It enables low-cost, high-precision channel and river flow measurement, reduces equipment and labor costs, expands the applicability of flow measurement, and adapts to different water flow environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120493718B_ABST
    Figure CN120493718B_ABST
Patent Text Reader

Abstract

The application provides a channel flow inversion method and relates to the technical field of hydrology, water resources and hydraulic engineering, and the method comprises the following steps: debugging a calculation case by using a computational fluid dynamics software OpenFOAM; using a script to batch copy and modify the calculated case river channel parameters; calling the computational fluid dynamics software OpenFOAM in a script mode to batch solve all the calculation cases and calculate simulation structure construction datasets; constructing a deep learning model based on the datasets; training the deep learning model; reading the cross-section time-averaged flow velocity distribution from a flow velocity distribution cloud picture and using the trained deep learning model to invert the channel flow. The application solves the problems of low precision, high cost and limited application scope of the existing open channel flow measurement method, and realizes rapid and accurate measurement of the open channel flow.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of hydrology, water resources and water conservancy, and particularly relates to a channel flow inversion method. BACKGROUND

[0002] In the promotion of digital construction, real-time and accurate flow monitoring is crucial for water resource management and allocation. There are many methods for measuring open channel flow, but they all have certain limitations. Traditional current meter measurement method requires placing the instrument directly in the water flow, which is not only cumbersome to operate, but also the instrument is easily damaged in complex water flow environment (such as high flow rate, high sediment content, etc.), and the measurement accuracy is also affected. The method of calculating flow based on water level is simple and efficient, but it relies on a large amount of data accumulation. For newly built channels or unexplored rivers, it is impossible to accurately measure the flow. Acoustic Doppler current profiler (ADCP) improves the measurement accuracy to some extent and does not require data accumulation. However, it is difficult to achieve real-time monitoring, and a large amount of measurement requires high labor and time cost.

[0003] With the development of technology, especially image processing and computer vision technology, particle tracking velocimetry and large-scale particle image velocimetry (PIV) methods based on particle tracking velocimetry and large-scale particle image velocimetry (PIV) make it easy to obtain surface flow rate. Whether based on unmanned aerial vehicles or fixed or handheld remote sensing technology, including optical and microwave, it has been proven to be able to provide instantaneous surface velocity at a remote access with fast and low cost. However, it still needs to give the conversion depth average flow rate proportional coefficient and river cross section sounding data to complete the flow calculation. Both of them are complex and difficult to obtain an accurate result, and the current method still needs additional measurement cost after surface flow rate measurement to obtain the two.

[0004] Deep learning technology has a very wide application in the field of data mining, and with the progress of algorithm and the enhancement of computing power, its influence is still expanding. The most difficult part of deep learning calculation is the acquisition of high-quality training data, and the quality of training data will directly affect the effect of the final model, and data is difficult to obtain. The flexibility of OpenFOAM (a open source software for computational fluid) can generate a large amount of simulation data to support the training model. It is worth exploring to obtain average depth and flow rate directly from surface flow rate distribution through a large amount of data training. This will greatly facilitate the measurement of flow rate and provide technical support for the digital construction management of irrigation areas and river basins.

[0005] Therefore, it is urgent to develop a data-driven deep learning method. This method is expected to overcome the above limitations and provide continuous and reliable flow data support for water resource management and allocation. SUMMARY

[0006] In view of the above deficiencies in the prior art, the channel flow inversion method provided by the application solves the problems of low precision, high cost and limited application range of the existing open channel flow measurement method, and realizes rapid and accurate measurement of the open channel flow.

[0007] To achieve the above object, the technical scheme adopted by the application is as follows: a channel flow inversion method, comprising the following steps:

[0008] The computational cases are debugged by using the computational fluid dynamics software OpenFOAM, wherein the debugging result is used to ensure the correctness of the batch solution result;

[0009] The river channel parameters of the computational cases are batch copied and modified by using a script;

[0010] The computational fluid dynamics software OpenFOAM is called in a script mode to batch solve all the computational cases, and a simulation structure construction data set is calculated;

[0011] A deep learning model is constructed based on the data set;

[0012] The deep learning model is trained;

[0013] The cross-section time-averaged flow velocity distribution is read from the flow velocity distribution cloud picture, and the channel flow is inverted by using the trained deep learning model.

[0014] The application has the advantages that: without the measurement of the cross-section shape and water depth by using radar and other equipment, the flow data of the channel and river can be obtained at a lower cost by using an algorithm, so that the channel and river flow measurement is realized at a low cost and high precision, the cost is reduced in economy, and a more powerful algorithm is provided in technology.

[0015] The application aims to provide a method for more accurately inverting flow based on surface flow velocity by using deep learning technology and how to use the computational fluid dynamics software OpenFOAM to generate training data, so as to solve the problems of low precision, high cost and limited application range of the existing open channel flow measurement method, and realize rapid and accurate measurement of the open channel flow.

[0016] Further, the debugging of the computational cases is specifically as follows:

[0017] By using the computational fluid dynamics software OpenFOAM, a basic geometric model is selected, a computational grid with a geometric shape is generated by giving a grid accuracy, and a boundary condition of the channel is set in the basic geometric model;

[0018] The bottom and side wall boundaries of the channel are set as wall surfaces, and the near-wall flow dynamics is simulated by using the Spalding wall function, wherein the free surface is regarded as a rigid cover that slides freely, the channel outlet is set as a far field, and backflow is not allowed;

[0019] The turbulent flow model and the solving method are selected and set, and the debugging of the test case is completed.

[0020] The further scheme has the beneficial effects that: combined with the turbulent flow model optimization solving, the complex near-wall flow and the free surface interaction can be effectively simulated, the precision and stability of the channel turbulent flow simulation are significantly improved, the calculation cost is reduced, and reliable data support is provided for engineering fluid analysis.

[0021] Further, the script is used to batch copy and modify the calculated case channel parameters, which specifically comprises:

[0022] The parameters for controlling the flow channel shape in the calculation case are modified, and the initial calculation file is saved;

[0023] The parameters for controlling the initial velocity and the background grid size in the calculation case file are set;

[0024] The initial calculation file is copied by the script, and the river parameters to be modified are replaced with random numerical values in the form of random numbers.

[0025] The further scheme has the beneficial effects that: the random parameterized channel cases are batch generated by the script, the flow channel shape is automatically modified, and diversified calculation files are created, the parameter research efficiency is significantly improved, the simulation sample library under different geometric conditions is quickly constructed, a large-scale data foundation is provided for optimization design or sensitivity analysis, and the errors caused by manual repeated operations are reduced.

[0026] Further, the calculation simulation structure is constructed dataset, which specifically comprises:

[0027] The computational fluid dynamics software OpenFOAM is called by the script to batch solve all calculation cases;

[0028] Based on the solving result, the surface velocity sampling points are read from the calculation case file, and the water surface flow velocity distribution-water depth-section average flow velocity dataset is made with the randomly generated model geometric shape parameters.

[0029] The further scheme has the beneficial effects that: the OpenFOAM cases are automatically batch solved by the script, and the surface flow velocity data is extracted, the parameterized dataset is efficiently generated, the calculation efficiency and data consistency are significantly improved, the structured water depth-flow velocity correlation data is provided for machine learning or statistical analysis, and the rapid hydrodynamic characteristic research and engineering optimization design are supported.

[0030] Further, the deep learning model is constructed, which specifically comprises:

[0031] read the data set of water surface velocity distribution-depth-section average velocity, extract the surface velocity distribution data and pre-process, take the pre-processing result as the input data of the deep learning model, read the water depth and section average velocity in the data set of water surface velocity distribution-depth-section average velocity, take the water depth and section average velocity as the output data of the deep learning model;

[0032] build an improved ResNet network model;

[0033] define a loss function, and use an Adam optimizer to optimize the parameters of the deep learning model, and complete the construction of the deep learning model.

[0034] The beneficial effects of the above further scheme are: the improved ResNet network establishes the nonlinear mapping relationship between the surface velocity distribution and the water depth and the section average velocity, automatically extracts the flow field features by using deep learning, significantly improves the prediction accuracy and generalization ability, provides an efficient data-driven method for quickly inverting the water depth and the section average velocity, and reduces the complexity and calculation cost of traditional hydraulics calculation.

[0035] Further, the improved ResNet network model comprises:

[0036] A one-dimensional convolutional layer is used to preliminarily extract features of input data, and a maximum pooling operation is combined to compress the feature dimension, wherein the input data is the pre-processed surface velocity distribution data;

[0037] A multi-stage bottleneck module is used to extract the dimensionally compressed features to obtain a feature map, wherein each bottleneck module is provided with an adaptive residual connection path;

[0038] A global average pooling layer is used to compress the feature map into a fixed-length vector;

[0039] A fully connected layer is used to classify the compressed feature map to obtain output data, wherein the output data is the water depth and the section average velocity.

[0040] The beneficial effects of the above further scheme are: the improved ResNet network efficiently extracts the velocity distribution features through the one-dimensional convolutional layer and the multi-stage bottleneck module, combines the adaptive residual connection to enhance the gradient propagation and feature reuse capability, significantly improves the expression capability of the model to the complex flow field features, and simultaneously realizes the high-precision water depth and section average velocity prediction by using the global average pooling and the fully connected layer, thereby improving the generalization and robustness while ensuring the calculation efficiency.

[0041] Further, the extraction of the dimensionally compressed features to obtain the feature map is specifically:

[0042] The input channel number is compressed to an intermediate dimension by a 1x1 convolution kernel;

[0043] Based on the dimensionally compressed features, a 3x1 convolution kernel is used for local feature extraction, and a 1x1 convolution kernel is used through the dimension-increasing convolution layer to restore the feature dimension to the output channel number to complete feature reconstruction, wherein during the process, standardization and activation are required once for each convolution calculation;

[0044] Downsampling is introduced to reduce the spatial resolution of the reconstructed feature map by a convolution with a stride of 2.

[0045] The beneficial effects of the above further scheme are: reducing the amount of calculation by compressing the dimension with a 1x1 convolution kernel, extracting local features with a 3x1 convolution kernel and reconstructing by increasing the dimension, optimizing the calculation efficiency while ensuring the feature expression ability; introducing normalization, activation function and downsampling operation, enhancing the nonlinear fitting ability and feature hierarchical extraction effect of the model, so that the network can more efficiently learn the complex mapping relationship between the flow rate distribution and the hydraulic parameters, further improving the prediction accuracy and generalization performance.

[0046] Further, the expression of the loss function is as follows:

[0047] loss = (((H p -H) / H) 2 +((V p -V) / V) 2 ) 0.5

[0048] Wherein, loss represents the loss function, H p represents the predicted value of water depth, H represents the true value of water depth, V p represents the predicted value of the average flow rate of the section, and V represents the true value of the average flow rate of the section.

[0049] The beneficial effects of the above further scheme are: the loss function adopts the square root form of the sum of the relative error squares of water depth and average flow rate of the section, which can balance the prediction accuracy of the two key hydraulic parameters, avoid the training process from being biased towards a single target due to the difference in dimensions, and at the same time enhance the sensitivity of the model to small errors, improve the overall regression performance, and make the prediction result more stable and reliable.

[0050] Further, the average flow rate distribution of the section is read from the flow rate cloud map, and the channel flow is inverted by using the trained deep learning model, which is specifically:

[0051] Obtain the surface flow rate distribution cloud map;

[0052] Based on the surface flow velocity distribution cloud map, the data file is read by using the python software, the river surface is divided, and the river center line is extracted, and the cross section flow velocity 1D distribution is extracted along the vertical direction of the center line;

[0053] The cross section flow velocity 1D distribution is preprocessed, and according to the preprocessing result, the trained deep learning model is input to obtain the channel flow prediction result, and the channel flow inversion is completed.

[0054] The beneficial effects of the above further scheme are: by automatically extracting the cross section 1D flow velocity data in the surface flow velocity distribution cloud map, and using the pre-trained deep learning model for flow inversion, the efficiency and accuracy of channel flow monitoring are significantly improved, the manual intervention and uncertainty of traditional measurement methods are reduced, and efficient and reliable technical support is provided for real-time hydrological monitoring and water conservancy engineering management. BRIEF DESCRIPTION OF DRAWINGS

[0055] Figure 1 The method flowchart of the application.

[0056] Figure 2 The technical flowchart of the application. DETAILED DESCRIPTION

[0057] The specific embodiments of the application are described below to facilitate understanding of the application by those skilled in the art, but it should be clear that the application is not limited to the scope of the specific embodiments, and for those skilled in the art, it is obvious that various changes are within the spirit and scope of the application defined and determined by the appended claims, and all applications utilizing the concept of the application are within the scope of protection.

[0058] EMBODIMENT

[0059] As Figure 1 shown, the application provides a channel flow inversion method, and the implementation method is as follows:

[0060] S1, using the computational fluid dynamics software OpenFOAM to debug the calculation case, wherein the debugging result is to ensure the correctness of the batch solution result, and the specific is:

[0061] Using the computational fluid dynamics software OpenFOAM, selecting a basic geometric model, generating a calculation grid with a geometric shape by giving a grid accuracy;

[0062] Setting the boundary conditions of the channel in the basic geometric model, setting the channel bottom and side wall boundary as a wall surface, and using the Spalding wall function to simulate the near-wall flow dynamics, wherein the free surface is regarded as a free sliding rigid cover, the channel outlet is set as a far field, and backflow is not allowed;

[0063] Select and set the turbulence model and solving method, complete the debugging of the test case.

[0064] In this embodiment, the basic geometric model is selected, the grid accuracy such as (0.05m) is given, and the calculation grid of the domain with geometric shape is generated, such as a rectangular channel.

[0065] In this embodiment, the boundary conditions of the channel are explicitly set in the model, the channel bottom and side wall boundary are set as wall surface, and the Spalding wall function is applied to simulate the near-wall flow dynamics; the free surface is regarded as a free sliding rigid cover; the channel outlet is set as a far field, and backflow is not allowed.

[0066] In this embodiment, the turbulence model and solving method are selected and set, such as the KOmegaSST turbulence model in the Reynolds time average (RANS) method, and the SIMPLE algorithm is used to solve the pressure-velocity field for steady flow. Set a reasonable time step (such as 1S) and the required number of iterations (such as 5000 times) in full development calculation.

[0067] S2, use scripts to batch copy and modify the river channel parameters of the calculated case, which is specifically:

[0068] Modify the parameters that control the shape of the flow channel in the calculation case, and save it as an initial calculation file;

[0069] Set the parameters in the calculation case file that control the initial velocity and background grid size;

[0070] Copy the initial calculation file through the script, and replace the river channel parameters to be modified with random number values.

[0071] In this embodiment, the parameters that control the shape of the flow channel in the calculation case are modified, such as the river width, which is changed to the special symbol of $B. Other parameters that need to be modified are processed in the same way, and saved as an initial calculation file.

[0072] In this embodiment, the parameters in the calculation case file are set, and the surface position is located through the parameters such as $B and $H. A sampling point for reading the surface velocity result is given, such as 1000 sampling points.

[0073] In this embodiment, the initial calculation file is copied through the script, and the above-mentioned river channel parameters to be modified are replaced with random number values, such as the water depth (such as randomly selected within the range of 0.3m-5m), the bottom width (such as randomly selected within the range of 1m-10m), and the average flow velocity (such as randomly selected within the range of 0.1m / s-3m / s) and other key parameters. The parameters are automatically modified and the cases are batch generated through the script to obtain diversified simulation scenarios, providing rich data sources for subsequent data set construction, such as generating 5000 cases.

[0074] S3, calling the computational fluid dynamics software OpenFOAM in a script manner to batch solve all calculation cases, and calculating the simulation structure construction dataset, which specifically comprises:

[0075] Calling the computational fluid dynamics software OpenFOAM in a script manner to batch solve all calculation cases;

[0076] Based on the solving result, the surface velocity sampling points are read from the calculation case file, and the water surface flow velocity distribution-water depth-section average flow velocity dataset is made with the randomly generated model geometric shape parameters.

[0077] In this embodiment, OpenFOAM is called in a script manner to batch solve all cases, and the flow velocity distribution results of all cases can be quickly calculated in a parallel multi-machine manner.

[0078] In this embodiment, the surface velocity sampling points obtained by reading the smpleLines calculation case file are made into the "water surface flow velocity distribution-water depth-section average flow velocity" dataset with the randomly generated model geometric shape parameters for subsequent training of the deep learning model.

[0079] S4, based on the dataset, a deep learning model is constructed, which specifically comprises:

[0080] The water surface flow velocity distribution-water depth-section average flow velocity dataset is read, the surface flow velocity distribution data is extracted and preprocessed, and the preprocessing result is taken as the input data of the deep learning model; the water depth and the section average flow velocity in the water surface flow velocity distribution-water depth-section average flow velocity dataset are read, and the water depth and the section average flow velocity are taken as the output data of the deep learning model;

[0081] An improved ResNet network model is built, which comprises:

[0082] A one-dimensional convolutional layer is used to preliminarily extract features of the input data, and a maximum pooling operation is combined to compress the feature dimension, wherein the input data is the preprocessed surface flow velocity distribution data;

[0083] The multi-stage bottleneck module is used to extract the dimensionally compressed features to obtain a feature map, wherein each bottleneck module is provided with an adaptive residual connection path, which specifically comprises: compressing the input channel number to an intermediate dimension through a 1x1 convolution kernel; based on the dimensionally compressed features, a 3x1 convolution kernel is used for local feature extraction, and a 1x1 convolution kernel is used in the dimension restoration convolution layer to restore the feature dimension to the output channel number to complete feature reconstruction, wherein in this process, each convolution calculation needs to be standardized and activated once;

[0084] The global average pooling layer is used to compress the feature map into a fixed length vector;

[0085] The fully connected layer is used to classify the compressed feature map to obtain output data, wherein the output data is the water depth and the cross-sectional average flow velocity;

[0086] The loss function is defined, and the Adam optimizer is used to optimize the parameters of the deep learning model to complete the construction of the deep learning model.

[0087] In this embodiment, an iterator for data input is constructed, the data set data for training is first read, the surface flow velocity distribution data is extracted for data preprocessing, including reselection of discrete intervals, data gradient enhancement, and recalculation of discrete interval average flow velocity and distance, which will be used as input data of the deep learning model. The water depth H and the cross-sectional average flow velocity V in the data set are read as output data of the deep learning model. The input and output are packaged for the back propagation learning and training of the network model.

[0088] In this embodiment, an improved ResNet network model is built. First, a one-dimensional convolutional layer (kernel_size=7, stride=2) is used to preliminarily extract features from the input data, and a maximum pooling operation (MaxPool1d) is used to further compress the feature dimension. Second, a multi-stage bottleneck module (BottleneckGELU) is established, which includes a normalization (BN) layer, a GELU activation layer and a convolutional layer (Conv). The input channel number is compressed to an intermediate dimension by a 1x1 convolution kernel to reduce the computational overhead, that is, a dimension reduction convolutional layer; a 3x1 convolution kernel is used to extract local features, and then a dimension increasing convolutional layer uses a 1x1 convolution kernel to restore the feature dimension to the output channel number, thereby completing feature reconstruction. Each convolution calculation is accompanied by normalization and activation. In a specific stage, a down sampling (downsample=True) operation is introduced to reduce the spatial resolution of the feature map by a convolution with a stride of 2, thereby gradually expanding the receptive field and extracting higher-level abstract features. Each bottleneck module (BottleneckGELU) is equipped with an adaptive residual connection path to alleviate the gradient vanishing problem and speed up the training process. When the input channel number does not match the output channel number, an additional 1x1 convolutional layer is used to adjust the dimension to ensure that the output of the residual branch and the main network can be seamlessly added, thereby effectively transmitting low-level feature information. After the feature extraction in the last stage is completed, the deep learning model compresses the feature map into a fixed length vector through global average pooling (AdaptiveAvgPool1d), and then connects a fully connected layer (Linear Layer) to perform the final classification task. The design of the fully connected layer fully considers the class number requirement and supports flexible expansion to multiple classification scenarios.

[0089] In this embodiment, the mean squared error (MSE) is used as the loss function, and two predicted values are loss = (((H p -H) / H) 2 +((V p -V) / V) 2 ) 0.5 , the Adam optimizer is used to optimize the parameters of the model, wherein loss represents the loss function, H p represents the predicted value of water depth, H represents the true value of water depth, V p represents the predicted value of the average flow velocity of the section, and V represents the true value of the average flow velocity of the section.

[0090] S5, training the deep learning model;

[0091] In this embodiment, when setting the data iterator, 20% of the data is randomly selected from the dataset as the validation set, and the remaining 80% is used as the training set. The deep learning model is then trained and optimized. The hyperparameters of the neural network are set as follows: 200 training epochs, batch size of 20, and a learning rate decreasing by 10 every 200 epochs. -4 10 -4 10 -5 10 -6 10 -7 A total of 1000 training rounds were conducted. During the training process, the model parameters were continuously adjusted to improve the accuracy of the model in traffic inversion, thus completing the model training.

[0092] S6. Read the cross-sectional time-averaged velocity distribution from the velocity distribution cloud map, and use the trained deep learning model to invert the channel flow rate, specifically as follows:

[0093] Obtain surface velocity distribution contour maps;

[0094] Based on the surface velocity distribution cloud map, the data file was read using Python software, the river surface was delineated and the river centerline was extracted, and the 1D distribution of cross-sectional velocity was extracted along the direction perpendicular to the centerline.

[0095] The 1D distribution of cross-sectional flow velocity is preprocessed, and based on the preprocessing results, the channel flow is inverted using a trained deep learning model.

[0096] In this embodiment, taking video PIV flow measurement as an example, after obtaining the surface velocity distribution cloud map, the Python software is used to read the data file, divide the river surface and extract the river centerline, and extract the 1D distribution of cross-sectional velocity along the vertical direction of the centerline.

[0097] In this embodiment, the data input is constructed according to the model preprocessing method, and the trained model parameter file is input to complete the prediction of river and channel flow.

[0098] In this embodiment, different models can be built in S1 to cope with different artificial channels, while a rectangular cross-section is used as an approximation for natural rivers. More factors can be added, such as appropriately modifying the roughness of the sidewalls when actual river cross-section materials are available to obtain more accurate training data. The influence of disturbances such as fluctuations can also be added to increase the robustness of the trained model. In S4 and S5, other simpler or more complex network models can be selected to achieve faster training speeds or pursue more accurate estimation results. In testing, MLP (Multilayer Perceptron), after gradient enhancement, can also predict river flow well as a relatively simple neural network model. AlexNet, with the addition of convolutions, shows some improvement and significantly reduces training time, but both are less accurate than ResNet. Alternatively, a deeper and wider network architecture can be used to improve accuracy. Simultaneously, to ensure optimal training results, the training hyperparameters should also be adjusted according to the model. In S6, it is important to note that the selected river channel should be a fully developed flow, with a cross-sectional width as constant as possible and no significant river bends in the actual river. Meanwhile, the model prediction has a certain range of applicability because it relies on the influence of the riverbed velocity on the surface to invert the depth. In the case of large rivers, the influence of depth on the surface is very small, and the prediction of depth in deep rivers is still challenging.

[0099] In this embodiment, as Figure 2 As shown, Figure 2 This paper demonstrates the entire process of estimating open channel flow by simulating data generated using OpenFOAM software, and then using a neural network to learn and predict the processed data. First, parameters such as water depth, bottom width, and average velocity are randomly generated. A mesh model with free surface and wall conditions is constructed in OpenFOAM using the K-ωSST (Shear Stress Transport Turbulence) model. The SimpleFoam solver calculates the velocity distribution, and then calculates the flow rate and surface velocity distribution to establish the basic dataset. Next, the surface velocity distribution data undergoes preprocessing, including calculating the average value, velocity gradient, and distance difference. The processed data is then input into a network model (i.e., a ResNet network model) consisting of an input layer, a network containing batch normalization, Gaussian error linear unit activation functions, and convolutional layers, and finally, a convolutional neural network consisting of an output layer that outputs the average velocity and water depth changes to calculate the flow rate, thus completing the flow prediction.

[0100] In this embodiment, the computational fluid dynamics (CFD) software OpenFOAM is used to model and solve the flow in a rectangular open channel. A rectangular channel model is constructed (e.g., Figure 2OpenFOAM grid model) in OpenFOAM, which is generated by building a Cartesian coordinate system at the bottom center of the channel, using blockMesh (block-structured mesh generator) in OpenFOAM to generate a structured grid, and setting the grid precision to 0.05 m. Set the boundary conditions, and set the channel bottom and side wall boundary as a wall surface, and apply the Spalding wall function to simulate the near-wall flow dynamics; the free surface is regarded as a free sliding rigid cover; the channel outlet is set as a far field, and backflow is not allowed. Select the KOmegaSST turbulence model in the Reynolds time-averaged (RANS) method, and use the SIMPLE (semi-implicit pressure coupling equation algorithm) algorithm to solve the pressure-velocity field for steady flow, and set the time step to 1 s and the iteration number to 5000 times. Through the above settings, the cross-sectional flow velocity distribution of the rectangular open channel flow under different water depths is solved, and the "water surface velocity distribution-water depth-cross-sectional average flow velocity" dataset is generated.

[0101] In this embodiment, random numbers are generated within a suitable range to change the state of the river, including river depth, river width, and cross-sectional average flow velocity. The computational fluid dynamics software OpenFOAM is used to solve the simulation results of the flow of rivers in different states. The cross-sectional flow velocity distribution is extracted to obtain the "water surface velocity distribution-water depth-cross-sectional average flow velocity" dataset. After obtaining the surface flow velocity distribution of the river, the surface width of the river is easily obtained, and it is also usually measured when measuring the surface flow velocity distribution. It will be known as the corresponding discrete data point interval input model. By actively calculating the transverse flow velocity gradient of the surface flow velocity distribution, it is also part of the input of the deep learning model. The calculation uses the single difference quotient instead of the derivative, called gradient data enhancement, which will improve the training efficiency and improve the prediction accuracy and generalization ability of the model to a certain extent. The 1D data of the water surface flow velocity distribution will constitute 3x(n-1) input data after preprocessing, which are the normalized flow velocities u * i , transverse flow velocity gradient g i , and discrete interval width b i , n is the number of discrete data points, and the calculation method is shown in Figure 2 , in which u i is the discrete data of the surface flow velocity distribution, y i is the corresponding position coordinate, the discrete interval average flow velocity u i * , the discrete interval transverse cross-sectional flow velocity gradient g i , and the discrete interval interval b i .

[0102] In this embodiment, a deep learning model is built based on the Pytorch framework. The surface flow velocity distribution of the open channel is taken as the input data, and the water depth and the average flow velocity of the section are taken as the output. The data set is obtained by OpenFOAM calculation for neural network calculation loss value back propagation learning. The application builds a one-dimensional convolutional neural network (1D-CNN) based on an improved bottleneck structure (Bottleneck Structure) and a GELU (Gaussian Error Linear Unit) activation function. The model improves the learning ability of complex data patterns by optimizing the feature extraction module and the residual connection mechanism, while maintaining high computational efficiency. The model is composed of the following core parts:

[0103] (1) Input feature extraction layer (i.e. one-dimensional convolutional layer): the deep learning model first extracts the input data through a one-dimensional convolutional layer (kernel_size=7, stride=2), and combines the maximum pooling operation (MaxPool1d) to further compress the feature dimension. This step aims to reduce data redundancy while retaining key spatial information, laying the foundation for efficient learning of subsequent deep networks.

[0104] (2) Multi-stage bottleneck module (BottleneckGELU): the core feature extraction part is composed of multiple improved bottleneck modules, each of which contains three main operations:

[0105] 1) Dimension reduction convolutional layer: the input channel number is compressed to the intermediate dimension through 1x1 convolution kernel to reduce the computational overhead; 2) deep feature extraction layer: 3x1 convolution kernel is used for local feature extraction, combined with batch normalization (BatchNormalization) and GELU activation function to enhance the non-linear expression ability; 3) Dimension increasing convolutional layer: 1x1 convolution kernel is used again to restore the feature dimension to the output channel number, thus completing the feature reconstruction.

[0106] In addition, down sampling (downsample=True) operation is introduced at a certain stage, which reduces the spatial resolution of the feature map through convolution with a stride of 2, thereby gradually expanding the receptive field and extracting higher-level abstract features.

[0107] 2) Residual connection mechanism: in order to alleviate the problem of gradient vanishing and speed up the training process, each bottleneck module is equipped with an adaptive residual connection path. When the input channel number and the output channel number do not match, the dimension is adjusted through an additional 1x1 convolutional layer to ensure that the output of the residual branch and the main network can be seamlessly added, thereby effectively transmitting low-level feature information.

[0108] (3) Global average pooling and classifier: after the last stage of feature extraction is completed, the deep learning model compresses the feature map into a fixed length vector through global average pooling (AdaptiveAvgPool1d), and then connects a fully connected layer (Linear Layer) to perform the final classification task. The design of the fully connected layer fully considers the number of categories required, and supports flexible expansion to multiple classification scenarios.

[0109] The construction of the deep learning model can capture subtle changes in the data distribution compared to traditional ReLU or other activation functions, and is particularly suitable for signal processing tasks in high noise environments; by stacking multiple bottleneck modules to achieve progressive feature extraction, the scalability of the model is ensured, and the parameter size is greatly reduced, and the residual branch structure is dynamically adjusted according to the feature dimension difference of different stages, which enhances the robustness and generalization ability of the model. When setting the data iterator, 20% of the data in the data set is randomly selected as the validation set, and the remaining 80% is used as the training set. The deep learning model is trained and optimized, the hyperparameters of the neural network are set, the Adam optimizer is selected, the training rounds are 200, the batch size is 20, the learning rate is reduced every 200 rounds, and the learning rates are 10 -4 , 10 -4 , 10 -5 , 10 -6 and 10 -7 respectively. A total of 1000 rounds are trained. During the training process, the model parameters are constantly adjusted to improve the accuracy of the deep learning model for flow inversion. The trained deep learning model is used for flow inversion. The measured surface flow velocity distribution data of the open channel is input into the trained deep learning model, and the model outputs the predicted water depth and cross-sectional average flow velocity, and then calculates the open channel flow. The method of the present application can realize the rapid inversion of the open channel flow by measuring only the surface flow velocity. In the test, for the flow inversion of the simple rectangular channel, the deep learning model has the highest accuracy for flow inversion, and the mean square error of the predicted flow of the test set is 10 -1 (m 3 / s) 2 , and the determination coefficient R 2 is 0.988; when facing this, the present application can accurately invert the open channel flow, and provide reliable data support for hydrological monitoring. The present application combines CFD simulation technology to generate a large amount of data, solves the problem of difficult access to the initial data set of the deep learning model, and reduces the data acquisition cost. At the same time, the application of the deep learning model reduces the dependence on expensive measuring equipment (such as ADCP), and reduces the measurement cost. The present application is not limited by geographical conditions, and can be used for flow inversion by measuring the surface flow velocity distribution data of different channels, thereby expanding the application range of flow measurement.

[0110] The present application utilizes the variability of OpenFOAM and the data mining ability of deep learning technology in the field of hydrological monitoring to achieve the goal of more accurately inverting flow based on surface flow rate, involves the cross-fusion of multiple disciplines, and aims to improve the provision of strong and reliable technical support for water resource management and allocation, especially in the modernization of artificial water channels and agricultural irrigation water channels. In summary, the present application has the following technical effects:

[0111] Significant precision improvement: Compared with traditional measurement methods (such as current meters, float methods, etc.), the present application based on deep learning technology can mine deep features in surface flow rate data and more accurately invert flow, greatly improving measurement precision. Compared with methods based on water level to derive flow, it does not rely on design and historical measurement data and can achieve high-precision measurement in new areas.

[0112] Significant cost reduction: Reduces dependence on complex measurement equipment, reduces equipment purchase, maintenance costs, and human and time costs. Using CFD simulation to generate data avoids a large number of repeated operations and cross-section measurement processes in actual tests, saving time and economic costs.

[0113] Widespread adaptability: Deep learning models have strong generalization ability and can adapt to different open channel conditions (such as different water depths, bottom widths, etc.) and complex water flow environments, and can be widely applied in most water channels and have certain flow measurement ability for some rivers.

[0114] Innovative technology fusion: Combining CFD simulation technology and deep learning technology is an innovative technical means. CFD simulation provides rich initial data, and deep learning models perform deep mining and analysis of data, complementing each other and bringing a new solution to open channel flow measurement.

Claims

1. A method for channel traffic inversion, characterized in that, Includes the following steps: The computational fluid dynamics software OpenFOAM was used to debug the calculation cases, and the debugging results were used to ensure the correctness of the batch solution results. Use a script to batch copy and modify the river parameters of the calculated cases; The computational fluid dynamics software OpenFOAM is invoked using scripts to solve all computational cases in batches and to construct a dataset from the simulation structures. Based on the dataset, a deep learning model is constructed. Specifically, this construction involves: reading a dataset of surface velocity distribution, water depth, and cross-sectional average velocity; extracting and preprocessing the surface velocity distribution data; using the preprocessed results as input data for the deep learning model; reading the water depth and cross-sectional average velocity from the surface velocity distribution-water depth-cross-sectional average velocity dataset; using the water depth and cross-sectional average velocity as output data for the deep learning model; building an improved ResNet network model; defining a loss function; and using the Adam optimizer to optimize the parameters of the deep learning model, thus completing the construction of the deep learning model. The improved ResNet network model includes: a one-dimensional convolutional layer for preliminary feature extraction from the input data and compression of the feature dimension using max pooling, wherein the input data is preprocessed surface velocity distribution data; a multi-stage bottleneck module for extracting the dimension-compressed features to obtain a feature map, wherein each bottleneck module is equipped with an adaptive residual connection path; a global average pooling layer for compressing the feature map into a fixed-length vector; and a fully connected layer for classifying the compressed feature map to obtain output data, wherein the output data is water depth and cross-sectional average velocity. The extraction of dimensionally compressed features to obtain a feature map specifically involves: compressing the input channel number to an intermediate dimension using a 1x1 convolutional kernel; based on the dimensionally compressed features, performing local feature extraction using a 3x1 convolutional kernel, and restoring the feature dimension to the output channel number using a 1x1 convolutional kernel through a dimension-upgrading convolutional layer to complete feature reconstruction. During this process, normalization and activation are performed after each convolution calculation; downsampling is introduced, and the spatial resolution of the reconstructed feature map is reduced using a convolution with a stride of 2. The deep learning model is trained; the cross-sectional time-averaged velocity distribution is read from the velocity distribution cloud map, and the channel flow is inverted using the trained deep learning model.

2. The channel traffic inversion method according to claim 1, characterized in that, The debugging of the computational case specifically includes: Using the computational fluid dynamics software OpenFOAM, a basic geometric model is selected, and a computational mesh with a geometrically shaped domain is generated given the mesh accuracy. In the basic geometric model, the boundary conditions of the channel are set, the bottom and sidewall boundaries of the channel are set as walls, and the Spalding wall function is used to simulate the near-wall flow dynamics. The free surface is regarded as a rigid cap that slides freely, the channel outlet is set as the far field, and backflow is not allowed. Select and set the turbulence model and solution method to complete the debugging of the test case.

3. The channel traffic inversion method according to claim 1, characterized in that, The specific steps of using a script to batch copy and modify the calculated case river parameters are as follows: Modify the parameters controlling the flow channel shape in the calculation case and save it as the initial calculation file; Configure parameters in the calculation case file to control the initial velocity and background mesh size; The initial calculation file is copied using a script, and the river parameters to be modified are replaced with random values ​​using random numbers.

4. The channel traffic inversion method according to claim 1, characterized in that, The computational simulation structure constructs a dataset, specifically as follows: The script is used to call the computational fluid dynamics software OpenFOAM to solve all computational cases in batches. Based on the solution results, surface velocity sampling points are obtained by reading the calculation case file, and a dataset of water surface velocity distribution-water depth-cross-sectional average velocity is created by combining it with randomly generated model geometry parameters.

5. The channel traffic inversion method according to claim 1, characterized in that, The expression for the loss function is as follows: loss=( (( H p - H ) / H ) 2 + (( V p - V ) / V ) 2 ) 0.5 Where loss represents the loss function. H p This represents the predicted water depth. H This represents the true value of the water depth. V p This represents the predicted value of the average flow velocity across the cross section. V This represents the true value of the average flow velocity across the cross section.

6. The channel traffic inversion method according to claim 1, characterized in that, The process of reading the cross-sectional time-averaged velocity distribution from the velocity distribution cloud map and using a trained deep learning model to invert channel flow specifically involves: Obtain surface velocity distribution contour maps; Based on the surface velocity distribution cloud map, the data file was read using Python software, the river surface was delineated and the river centerline was extracted, and the 1D distribution of cross-sectional velocity was extracted along the direction perpendicular to the centerline. The 1D distribution of cross-sectional flow velocity is preprocessed, and the preprocessing results are input into the trained deep learning model to obtain the channel flow prediction results, thus completing the inversion of channel flow.

Citation Information

Patent Citations

  • Flow rate level prediction method based on convolutional neural network deep learning

    CN108875161A

  • Mean flow velocity calculation method based on channel cross section

    CN113887142A