Hydrodynamic model display method, system and equipment based on digital twinning and storage medium

Through the digital twin-based method, the three-dimensional water model is generated and visualized, and the problem that the existing technology is difficult to display the hydrodynamic results in complex water structures is solved, and a true and intuitive display of water flow and water level changes is achieved.

CN119783589AInactive Publication Date: 2025-04-08BEIJING YINGTELIWEI ENVIRONMENTAL TECH CO LTD

Patent Information

Application Number
CN202510273161.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-10
Publication Date
2025-04-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing hydrodynamic simulation technology is difficult to truly and intuitively display the three-dimensional hydrodynamic model, especially in large depths or complex water structures, which cannot effectively express the hydrodynamic results and the flow and water level changes of water bodies at different levels.

Method used

Through a digital twin-based method, grid Shp files and simulation result files of the hydrodynamic model are prepared, data structures are defined to store flow field and water level data, and a three-dimensional water model is generated in the digital twin system. The dynamic visualization of flow field and water level is achieved using material and GPU rendering technology.

Benefits of technology

The real and intuitive display of the three-dimensional hydrodynamic model is achieved, which can effectively express the hydrodynamic situation at different depths, and the flow field phenomenon is more obvious, especially the flow field phenomena such as circulation are more intuitive, helping users understand the overall hydrodynamic situation of the water body.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783589A_ABST
    Figure CN119783589A_ABST
Patent Text Reader

Abstract

The invention discloses a digital twinning-based hydrodynamic model display method, system and device and a storage medium, and the method comprises the steps: obtaining a simulation result of a hydrodynamic model from local storage or network data service, and storing the simulation result in a data structure of a digital twinning system; a water body three-dimensional model is generated through the grid Shp file, vertex flow field and water level data are calculated based on a model simulation result, and after normalization, the vertex flow field and water level data are mapped to a color channel and vertex height of the water body three-dimensional model; a water surface dynamic effect is enhanced by adopting a water surface ripple normal mapping and flow velocity color mapping, and PostProcessVolume is created to simulate interface refraction and underwater visual effects of the water surface and air. The three-dimensional flow field and water level change of the hydrodynamic model can be displayed, visualization of underwater simulation results is supported, and the sense of reality of the flow effect is improved; and in combination with network data service and a local file access mode, the data loading and updating speed is increased, and the method is suitable for various data access environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of digital twin visualization simulation technology, and in particular to a hydrodynamic model display method, system, device and storage medium based on digital twin. Background Art

[0002] A hydrodynamic model is a mathematical model that describes the relationship between the force and movement of water flow, and is used to simulate physical information such as water velocity, flow direction, and water depth. Common hydrodynamic simulations are mostly based on one-dimensional or two-dimensional models. For example, the technical solution disclosed in CN118395522A obtains one-dimensional and two-dimensional hydrodynamic result data in the hydrodynamic model, combines digital twin technology for rendering and display, and displays water depth data through dynamic coloring. However, existing methods are difficult to express hydrodynamic results at different levels in deep or complex water structures, and cannot truly present the flow and water level changes of water bodies. The existing simulation effects are quite different from the material and dynamic changes of actual water bodies. Usually, only lines or arrows can be used to represent the direction of water flow and flow field effects, or color scales can be used to represent water depth or water level, and underwater effects cannot be displayed. Therefore, the existing technology can usually only display the surface state of the water body, and lacks intuitive expression of underwater flow field and water level changes. In addition, the visualization of existing hydrodynamic simulation results is mostly limited to the expression of a single water body (such as a river, lake or ocean), lacking sufficient versatility. When faced with more complex water systems, such as when a river is connected to a bay or the open sea, existing methods are difficult to achieve a unified overall display of the water body. This limitation makes it impossible to fully and effectively express the hydrodynamic characteristics of different water bodies in large river basins or large-scale water systems, making it difficult to meet the needs of users in complex hydrological environments. Summary of the invention

[0003] Purpose of the invention: The first purpose of the present invention is to provide a method for realistically and intuitively displaying a three-dimensional hydrodynamic model based on a digital twin. The second purpose of the present invention is to provide a system for realistically and intuitively displaying a three-dimensional hydrodynamic model based on a digital twin. The third purpose of the present invention is to provide a device for implementing the method. The fourth purpose of the present invention is to provide a storage medium for implementing the method.

[0004] Technical solution: The hydrodynamic model display method based on digital twins of the present invention comprises the following steps: (1) Prepare a grid Shp file and a simulation result file of the hydrodynamic model, wherein the simulation result file includes flow field data and water level data of each grid unit, and the flow field data includes flow direction data and flow velocity data; If the simulation result file contains multiple sets of simulation result data under different input parameters, the simulation result file is uploaded to the data service system for centralized management and query; if it only contains a single simulation result data set, the simulation result file is stored in a local storage device to reduce the data transmission burden; Store the grid Shp file in a local storage device; (2) Create a configuration file on the local storage device and write the storage path of the grid Shp file, the storage path of the simulation result file, or the access address of the data service system into the configuration file; (3) defining a data structure for the digital twin system to read simulation results in real time, wherein the data structure includes a timestamp field, a grid number field, a flow field simulation result field, and a water level simulation result field; (4) According to the content written in the configuration file, the simulation results are parsed and loaded through the storage path of the simulation result file or the access address of the data service system; if the simulation results are loaded through the storage path, the timestamp, grid number, flow field data and water level data in each line of data are extracted by line parsing; if the simulation results are loaded through the data service system, the required data is obtained through HTTP requests and stored in the data structure of the digital twin system; (5) Load the mesh Shp file according to the storage path of the mesh Shp file in the configuration file, read the vertex and edge data of the mesh Shp file, and generate a visual three-dimensional model of the water body in the digital twin system based on the geometric information of the mesh; (6) Extract the flow field data and water level data of each grid from the data structure in the digital twin system, interpolate the flow field data and water level data of the grid vertex according to the flow field data and water level data of the grid, and normalize the vertex flow field data to the range of [0, 1]; (7) Update the flow field data and vertex water level data of the grid vertices into the three-dimensional model of the water body, input the water level data z1 of the grid vertex into the z-direction coordinate of the grid vertex to support underwater effect simulation; input the flow field data of the grid vertex into the R color channel and G color channel of the grid vertex to display the flow direction and flow velocity; (8) Create a water material, set the water body basic absorption light and water surface ripple normal map to simulate the optical and texture effects of the water surface; create a post-processing volume PostProcessVolume in the digital twin system to simulate the underwater effect of the water body and the refraction effect of the interface between the water surface and the air; reserve the water surface height parameter z2 to receive the water surface z coordinate of the current camera position in the twin world coordinate system to control whether to display the visual effect at the interface between the water surface and the air or below the water surface; (9) Draw the mesh edges of the three-dimensional water body model, display the dynamic three-dimensional effect of the water body based on the hydrodynamic model in the digital twin system, and realize the visualization of the flow field and water level simulation results.

[0005] Furthermore, in step (4), the method for parsing and loading the simulation results through the storage path of the simulation result file or the access address of the data service system is: parsing the content of the simulation result file line by line, and storing the extracted flow field data and water level data in the data structure in time series according to the timestamp and grid number field of each line of data.

[0006] Furthermore, in step (4), the simulation result is parsed and loaded through the access address of the data service system of the simulation result file, and the method for storing the loaded simulation result in the data structure of the digital twin system is: obtain the Http module of the digital twin system, create a request object, set the request type to POST, the request address to the access address of the data service system, the request parameter to the scenario name of the simulation result, and bind a callback function, and store the simulation result in the data structure in the callback function.

[0007] Furthermore, in step (5), the method for generating a visualized three-dimensional water body model in the digital twin system according to the geometric information of the mesh is: using the GDAL library to read the mesh Shp file, extracting the Polygon geometric elements, obtaining the vertex coordinates of each Polygon, and storing them in a three-dimensional vector array; In the three-dimensional vector array, traverse each vertex, and for a quadrilateral mesh, divide it into two triangles along the diagonal line, and add the vertex number of each triangle to the triangle topology array; In the triangle topology array, the light normal vector of each vertex is calculated, the light normal vector of each vertex is obtained by vector multiplication, and added to the light normal vector array; The triangle topology array and the light normal vector array are used to generate a three-dimensional model of a water body using a procedural model component.

[0008] Furthermore, step (5) also includes converting the vertex coordinates in the projection coordinate system in the read mesh Shp file into the world coordinate system used by the digital twin system; and performing precision correction on the converted coordinates to adapt to the model rendering requirements of the digital twin system.

[0009] Furthermore, in step (7), updating the flow field data and vertex water level data of the grid vertices to the three-dimensional water body model includes the following three modes: time series update mode, that is, updating the water level data and flow field data in sequence according to the time series order to dynamically display the water surface height change and flow field evolution process at each moment; specified time update mode, according to the time step specified by the user, extracting the water level data and flow field data at the corresponding moment, and updating them to the three-dimensional water body model to display the water surface height and flow field distribution at that moment; data completion mode, when the water level data or flow field data at a specified moment is missing, the closest water level data and flow field data of the same period are used for direct replacement to ensure the continuous visualization of the water surface height and flow field.

[0010] Furthermore, in step (8), after creating the water body material, the step further includes mapping the values ​​of the flow velocity data in the R color channel and the G color channel of the mesh vertex from the range of [0, 1] to the range of [-1, 1].

[0011] The hydrodynamic model display system based on digital twins of the present invention includes: A basic data preparation unit, used for preparing a grid Shp file and a simulation result file of a hydrodynamic model, wherein the simulation result file includes flow field data and water level data of each grid unit, and the flow field data includes flow direction data and flow velocity data; If the simulation result file contains multiple sets of simulation result data under different input parameters, the simulation result file is uploaded to the data service system; if it contains only a single simulation result data set, the simulation result file is stored in a local storage device; Store the grid Shp file in a local storage device; A data configuration unit is used to create a configuration file in a local storage device, and write the storage path of the grid Shp file, the storage path of the simulation result file or the access address of the data service system into the configuration file; A data structure creation unit, used to define a data structure for real-time reading of simulation results by the digital twin system, wherein the data structure includes a timestamp field, a grid number field, a flow field simulation result field, and a water level simulation result field; The simulation result storage unit is used to parse and load the simulation results according to the content written in the configuration file through the storage path of the simulation result file or the access address of the data service system; if the simulation results are loaded through the storage path, the timestamp, grid number, flow field data and water level data in each line of data are extracted by line-by-line parsing; if the simulation results are loaded through the data service system, the required data is obtained through HTTP requests and stored in the data structure of the digital twin system; A water body three-dimensional model generation unit is used to load a mesh Shp file according to the storage path of the mesh Shp file in the configuration file, read the vertex and edge data of the mesh Shp file, and generate a visualized water body three-dimensional model in the digital twin system according to the geometric information of the mesh; The hydrodynamic data parsing unit is used to extract the flow field data and water level data of each grid from the data structure in the digital twin system, interpolate the flow field data and water level data of the grid vertices according to the flow field data and water level data of the grid, and normalize the vertex flow field data to the range of [0, 1]; The model updating unit is used to update the flow field data and vertex water level data of the grid vertex into the three-dimensional model of the water body, input the water level data z1 of the grid vertex into the z direction coordinate of the grid vertex to support underwater effect simulation; input the flow field data of the grid vertex into the R color channel and the G color channel of the grid vertex to display the flow direction and flow velocity; The water material setting unit is used to create water material, set the basic absorption light of the water body and the water surface ripple normal map to simulate the optical and texture effects of the water surface; create a post-processing volume PostProcessVolume in the digital twin system to simulate the underwater effect of the water body and the refraction effect of the interface between the water surface and the air; reserve the water surface height parameter z2 to receive the z coordinate of the water surface at the current camera position in the twin world coordinate system to control whether to display the visual effect of the interface between the water surface and the air or below the water surface; The visualization display unit is used to draw the mesh edges of the three-dimensional water body model, display the dynamic three-dimensional water body effect based on the hydrodynamic model in the digital twin system, and realize the visualization of the flow field and water level simulation results.

[0012] The electronic device described in the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded into the processor, the digital twin-based hydrodynamic model display method is implemented.

[0013] The computer-readable storage medium described in the present invention stores a computer program, and when the computer program is executed by a processor, the hydrodynamic model display method based on digital twins is implemented.

[0014] Beneficial effects: Compared with the prior art, the advantages of the present invention are: (1) The present invention realizes the digital twin display of water bodies through the simulation results based on the three-dimensional hydrodynamic model, and can extract the hydrodynamic model results at different levels for display, presenting the hydrodynamic conditions at different depths to the user, including the flow velocity and flow direction of each grid and vertex. (2) The water surface shading mode of the present invention can set the absorption light parameters to more realistically simulate the caustic and refraction effects of the water body; by using the material UV that automatically scales with the distance, it ensures that the flow and fluctuation effects of the water surface at different viewing angles and distances are clearly visible, and avoids obvious duplication of the map. In this way, the hydrodynamic results can be more intuitive, the flow field phenomena are more obvious, especially the flow field phenomena such as circulation are more intuitive, helping non-professionals to intuitively understand the overall hydrodynamic conditions of the water body, rather than just through color levels and arrows. (3) The present invention obtains the hydrodynamic model results through network data services, reducing the occupation of local resources (such as memory). If the amount of data is small, it also supports local file reading, thereby speeding up the update speed of hydrodynamic data. The combination of the two methods can more flexibly adapt to different usage scenarios. (4) The present invention uses GPU rendering technology to generate water bodies of any shape more quickly and conveniently, saving the cost and time of three-dimensional water body modeling. At the same time, it breaks through the limitation of a single water body type and supports more free simulation of water bodies of complex shapes, including underwater effects. Users can intuitively view the situation of underwater submerged areas, not just limited to water surface effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A flow chart showing a method of hydrodynamic modeling of the present invention.

[0016] Figure 2 It is a schematic diagram of a grid Shp file of a river channel and a bay according to an embodiment of the present invention.

[0017] Figure 3 This is a visualization diagram showing the digital twin effect of unified overall simulation of the river channel and bay in an embodiment of the present invention.

[0018] Figure 4 This is a visualization diagram of the digital twin of the lake viewed from a high altitude in this embodiment.

[0019] Figure 5 This is a diagram showing the underwater digital twin visualization effect of an embodiment of the present invention.

[0020] Figure 6 This is a diagram showing the digital twin visualization effect of single grid data in an embodiment of the present invention.

[0021] Figure 7 The system architecture diagram of the hydrodynamic model of the present invention is shown. DETAILED DESCRIPTION

[0022] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.

[0023] Example 1 like Figure 1 As shown, the hydrodynamic model display method based on digital twins includes the following steps.

[0024] Step 1: Prepare the mesh Shp file and simulation result file of the hydrodynamic model.

[0025] First, prepare the mesh Shp file of the hydrodynamic model. In order to ensure that the terrain and scene can be accurately matched in the three-dimensional coordinate system of the digital twin system, the mesh data needs to be converted into a projected coordinate system. Figure 2 A schematic diagram of the grid Shp file of the river and the bay in this embodiment is shown.

[0026] Then, prepare the simulation result file of the hydrodynamic model. The simulation result file contains the hydrodynamic data, that is, the water level data H of each grid cell, the flow velocity vector in the x direction and the velocity vector in the y direction ,in and The sum vector is the velocity vector of the vertex .

[0027] If the simulation results of the hydrodynamic model contain multiple sets of data (for example, different simulation scenarios, multi-level three-dimensional data, or data for multiple time periods), the simulation result files are stored in the data service, and data for different times, scenarios, or simulation layers are requested through the data service interface. If there are only simulation results for a single time period and scenario, they are stored in the local storage device, and the simulation results are obtained by traversing the files later.

[0028] Step 2: Configure the storage path or the access address of the data service system.

[0029] The storage path of the local storage device of the grid Shp file and the storage path of the local storage device of the simulation result file or the access address of the data service system are written into the configuration file in yaml format so as to be used in subsequent steps to generate a three-dimensional water model and update hydrodynamic data.

[0030] Step 3: Create a data structure that can be used by the digital twin system to read simulation results in real time.

[0031] Construct a data structure for storing hydrodynamic data. This structure can store the two-dimensional vector of flow velocity and direction, water level scalar, timestamp (indicating the simulation time) and the number of each grid at a specific time.

[0032] Step 4: Read the hydrodynamic data from a local or network data service into a data structure.

[0033] Get the simulation results of the hydrodynamic model from the storage path of the local storage device. According to the storage path configured in step 2, read the hydrodynamic data line by line, and store the flow velocity, flow direction data and water level data read in each line into the data structure constructed in step 3 according to different timestamps and grid numbers. Finally, generate arrays of different sizes according to the time series of the simulation results. Each data item in the array contains the hydrodynamic data and grid information of all grids at a specific moment, so as to be used in the subsequent update of water bodies and water body materials.

[0034] If the water body contains data for multiple simulation scenarios or multiple time periods, you need to create an HTTP request to obtain the data from the network data service. First, get the Http module of the digital twin framework, create a request object, set the request type to POST, and the request address to the access address configured in step 2. The request body includes the case name of the hydrodynamic data and the simulation time to be displayed, and binds the callback function to process the returned data. In the callback function, store the returned hydrodynamic data in the data structure constructed in step 3. After binding the callback function, send the data request and wait for the data to return.

[0035] Step 5: Generate a 3D model of the water body.

[0036] Get the storage path of the mesh Shp file of the hydrodynamic model from the configuration file in step 2, use the GDAL library of the C++ programming language to read the mesh Shp file, and extract all polygon features. Convert the mesh coordinates in the projection coordinate system to the coordinate system in the digital twin system by subtracting the offset, and then store the vertex of each polygon in a three-dimensional vector array, while saving the relationship between the number of each mesh and its corresponding vertex.

[0037] Traverse the vertices of each mesh. If it is a quadrilateral mesh, divide the quadrilateral into two triangles along the diagonal line and add the vertices to the vertex array. In a clockwise direction, add the three vertex numbers of each triangle to the triangle topology array. Then traverse the triangle topology array, perform vector multiplication on the two edges of each vertex, calculate the light normal vector of each vertex, and generate a light normal vector array. Finally, use the triangle topology array and the light normal vector array to generate a three-dimensional water model using the Procedural Mesh Component.

[0038] Step 6: Hydrodynamic data analysis.

[0039] The hydrodynamic data read from the data structure needs to be processed before it can be rendered on the screen through the material and GPU. First, traverse the flow field data and calculate the average of the flow velocity and water level data of the four adjacent grids around each grid vertex as the flow velocity data and water level data of the grid vertex. Record the maximum flow velocity of each grid vertex in different directions. and minimum flow rate , and then map the velocity data on all mesh vertices to the range of 0 to 1, and save the processed data. The velocity data mapping formula on each mesh vertex is as follows: ; in, is the mapped velocity data, v is the original simulated velocity result, is the maximum simulated flow velocity of the grid during the entire simulation period, It is the minimum simulated flow velocity of the grid during the entire simulation period.

[0040] Step 7: Update the hydrodynamic data into the 3D water body model.

[0041] In order to meet the needs of decision-making and display, the method of the present invention includes three update modes: ① Automatic time series update mode, which automatically updates the hydrodynamic data in time series to show the changes in water level and flow field at each moment. This mode can be used to show the flow field changes in different seasons (such as monthly display) and the impact of tidal changes on flow field and water level (such as hourly or minute display).

[0042] ② Manually specified time update mode automatically updates the hydrodynamic data at the time specified by the user, making it convenient for users to view the hydrodynamic simulation results of a specific date and time.

[0043] ③Data completion mode: if there is no hydrodynamic simulation result for the current year, the data of the same period in previous years will be automatically extracted and updated. This mode is suitable for the display of tidal and periodic water results to ensure the continuity and integrity of the data.

[0044] In each update mode, the flow velocity data in the x direction of each vertex of the water body is placed in the R channel of the vertex color, and the flow velocity data in the y direction is placed in the G channel of the vertex color. The sum vector of the flow velocity in the x direction and the y direction still represents the flow direction of the vertex; then the water level data of each vertex is input into the vertex, and the water level data is used to change the z direction position of this vertex in three-dimensional space. Traverse each vertex of the three-dimensional water body model and update the water level data to the vertex position attribute to change the water level height of the water body.

[0045] Step 8: Create water material.

[0046] Create a blank material in the digital twin system and select the water surface mode as the shading mode, using the vertex color channel to store the flow field data. Set the basic absorption light of the water body to simulate the visual effect of the water body more realistically, especially to show the effect of different water depths. Add a ripple normal map to the water surface to restore the water surface fluctuation and flow effect. Calculate the scaling level of the water body normal map with the viewing distance through the pixel depth to ensure that the water level and flow field changes of the water body can be clearly displayed at different distances and directions.

[0047] Extract the flow velocity and direction data from the vertex color channel, remap the flow velocity values ​​in the x and y directions to the range of -1 to 1, and then pass them to the flow field map. At the same time, set the flow velocity scaling factor to adjust the flow field effect. Finally, create a material instance and display it in real time.

[0048] The remapped flow rate data is calculated as: ; in, is the remapped flow rate data, It is the flow rate data after the first mapping.

[0049] In the digital twin system, create PostProcessVolume as a simulator for underwater visual effects, which is used to process underwater effects in the submerged area of ​​the water body and the interface effects between the water surface and the air. Calculate the pixel depth relative to the camera, set the absorption light intensity and the absorption ratio that varies with distance, and adjust the volume fog effect that varies with distance and depth. Reserve the water surface height parameter z2 to receive the water surface z coordinate of the current camera position in the twin world coordinate system, so as to control whether to display the visual effects at the interface between the water surface and the air or below the water surface.

[0050] Step 9: Visualization of single grid data and water body grid data.

[0051] In order to facilitate the user to perform analysis, the present invention provides visualization functions for single grid data and water body grid data.

[0052] According to the polygon divided by the water body grid, the drawing interface is called to draw the boundary of each water body grid with high contrast color, mark the grid range, and add a mouse click event for each grid. When clicking the grid, the data extraction function and the time series graph display link are bound. The user can view the time series data corresponding to the grid by clicking the grid, and draw a line graph. The line graph will always float in front of the camera and follow the user's perspective and position, so that the user can view the data changes in real time.

[0053] like Figure 3As shown, the digital twin visualization effect of the river and the bay in this embodiment is demonstrated, which can clearly display the complex water system, especially the area where the river and the bay are connected. Figure 4 The digital twin visualization effect of looking down at the lake from a high altitude is demonstrated. As can be seen from the figure, the method described in the present invention can clearly display the simulation results of the water body at different distances and angles. Figure 5 An underwater digital twin visualization is shown, highlighting the submerged effect of the water level. Figure 6 The digital twin visualization effect of single-grid data is demonstrated, using high-contrast colors to identify the grid range and displaying the corresponding timestamp information.

[0054] Example 2 like Figure 7 The figure shows the architecture diagram of the hydrodynamic model display system based on digital twins described in the present invention, including a basic data preparation unit, a data configuration unit, a data structure creation unit, a simulation result storage unit, a water body three-dimensional model generation unit, a hydrodynamic data parsing unit, a model update unit, a water body material setting unit and a visualization display unit.

[0055] In the basic data preparation unit, first, prepare the mesh Shp file of the hydrodynamic model. In order to ensure that the terrain and scene can be accurately matched in the three-dimensional coordinate system of the digital twin system, the mesh data needs to be converted into a projection coordinate system.

[0056] Then, prepare the simulation result file of the hydrodynamic model. The simulation result file contains the hydrodynamic data, that is, the water level data H of each grid cell, the flow velocity vector in the x direction and the velocity vector in the y direction ,in and The sum vector is the velocity vector of the vertex .

[0057] If the simulation results of the hydrodynamic model contain multiple sets of data (for example, different simulation scenarios, multi-level three-dimensional data, or data for multiple time periods), the simulation result files are stored in the data service, and data for different times, scenarios, or simulation layers are requested through the data service interface. If there are only simulation results for a single time period and scenario, they are stored in the local storage device, and the simulation results are obtained by traversing the files later.

[0058] In the data configuration unit, the storage path of the local storage device of the grid Shp file and the storage path of the local storage device of the simulation result file or the access address of the data service system are written into the configuration file in the yaml format so as to be used in subsequent steps to generate a three-dimensional model of the water body and update the hydrodynamic data.

[0059] In the data structure creation unit, a data structure for storing hydrodynamic data is constructed. The structure can store the two-dimensional vector of flow velocity and direction of each grid at a specific time, the water level scalar, the timestamp (indicating the simulation time), and the number of each grid.

[0060] In the simulation result storage unit, the simulation results of the hydrodynamic model are obtained from the storage path of the local storage device. According to the storage path configured in the data configuration unit, the hydrodynamic data is read line by line, and the flow velocity, flow direction data and water level data read in each line are stored in the data structure constructed in the data structure creation unit according to different timestamps and grid numbers. Finally, arrays of different sizes are generated according to the time series of the simulation results. Each data item in the array contains the hydrodynamic data and grid information of all grids at a specific moment, so as to be used in the subsequent update of water bodies and water body materials.

[0061] If the water body contains data for multiple simulation scenarios or multiple time periods, you need to create an HTTP request to obtain the data from the network data service. First, get the Http module of the digital twin framework, create a request object, set the request type to POST, and the request address to the access address configured in the data configuration unit. The request body includes the case name of the hydrodynamic data and the simulation time to be displayed, and binds the callback function to process the returned data. In the callback function, store the returned hydrodynamic data in the data structure constructed in the data structure creation unit. After binding the callback function, send the data request and wait for the data to return.

[0062] In the water body 3D model generation unit, the storage path of the grid Shp file of the hydrodynamic model is obtained from the configuration file in the data configuration unit, and the grid Shp file is read using the GDAL library of the C++ programming language, and all polygon features are extracted. The grid coordinates in the projection coordinate system are converted to the coordinate system in the digital twin system by subtracting the offset, and then the vertex of each polygon is stored in a 3D vector array, and the relationship between the number of each grid and its corresponding vertex is saved.

[0063] Traverse the vertices of each mesh. If it is a quadrilateral mesh, divide the quadrilateral into two triangles along the diagonal line and add the vertices to the vertex array. In a clockwise direction, add the three vertex numbers of each triangle to the triangle topology array. Then traverse the triangle topology array, perform vector multiplication on the two edges of each vertex, calculate the light normal vector of each vertex, and generate a light normal vector array. Finally, use the triangle topology array and the light normal vector array to generate a three-dimensional water model using the Procedural Mesh Component.

[0064] In the hydrodynamic data parsing unit, the hydrodynamic data read from the data structure needs to be processed before it can be rendered on the screen through the material and GPU. First, traverse the flow field data and calculate the average of the flow velocity and water level data of the four adjacent grids around each grid vertex as the flow velocity data and water level data of the grid vertex. Record the maximum flow velocity of each grid vertex in different directions. and minimum flow rate , and then map the velocity data on all mesh vertices to the range of 0 to 1, and save the processed data. The velocity data mapping formula on each mesh vertex is as follows: ; in, is the mapped velocity data, v is the original simulated velocity result, is the maximum simulated flow velocity of the grid during the entire simulation period, It is the minimum simulated flow velocity of the grid during the entire simulation period.

[0065] In the model updating unit, in order to meet the needs of decision-making and display, the system of the present invention includes three updating modes: ① Automatic time series update mode, which automatically updates the hydrodynamic data in time series to show the changes in water level and flow field at each moment. This mode can be used to show the flow field changes in different seasons (such as monthly display) and the impact of tidal changes on flow field and water level (such as hourly or minute display).

[0066] ② Manually specified time update mode automatically updates the hydrodynamic data at the time specified by the user, making it convenient for users to view the hydrodynamic simulation results of a specific date and time.

[0067] ③Data completion mode: if there is no hydrodynamic simulation result for the current year, the data of the same period in previous years will be automatically extracted and updated. This mode is suitable for the display of tidal and periodic water results to ensure the continuity and integrity of the data.

[0068] In each update mode, the flow velocity data in the x direction of each vertex of the water body is placed in the R channel of the vertex color, and the flow velocity data in the y direction is placed in the G channel of the vertex color. The sum vector of the flow velocity in the x direction and the y direction still represents the flow direction of the vertex; then the water level data of each vertex is input into the vertex, and the water level data is used to change the z direction position of this vertex in three-dimensional space. Traverse each vertex of the three-dimensional water body model and update the water level data to the vertex position attribute to change the water level height of the water body.

[0069] In the water material setting unit, create a blank material in the digital twin system, select the water surface mode as the shading mode, and use the vertex color channel to store the flow field data. Set the basic absorption light of the water body to simulate the visual effect of the water body more realistically, especially to show the effect of different water depths. Add a ripple normal map to the water surface to restore the water surface fluctuation and flow effect. Calculate the scaling level of the water body normal map with the viewing distance through the pixel depth to ensure that the water level and flow field changes of the water body can be clearly displayed at different distances and directions.

[0070] Extract the flow velocity and direction data from the vertex color channel, remap the flow velocity values ​​in the x and y directions to the range of -1 to 1, and then pass them to the flow field map. At the same time, set the flow velocity scaling factor to adjust the flow field effect. Finally, create a material instance and display it in real time.

[0071] The remapped flow rate data is calculated as: ; in, is the remapped flow rate data, It is the flow rate data after the first mapping.

[0072] In the digital twin system, create PostProcessVolume as a simulator for underwater visual effects, which is used to process underwater effects in the submerged area of ​​the water body and the interface effects between the water surface and the air. Calculate the pixel depth relative to the camera, set the absorption light intensity and the absorption ratio that varies with distance, and adjust the volume fog effect that varies with distance and depth. Reserve the water surface height parameter z2 to receive the water surface z coordinate of the current camera position in the twin world coordinate system, so as to control whether to display the visual effects at the interface between the water surface and the air or below the water surface.

[0073] In the visualization display unit, according to the polygon divided by the water body grid, the drawing interface is called, the boundary of each water body grid is drawn with high-contrast colors, the grid range is marked, and a mouse click event is added to each grid. When clicking on a grid, the data extraction function and the time series graph display link are bound. Users can view the time series data corresponding to the grid by clicking on the grid, and draw a line graph. The line graph will always float in front of the camera and follow the user's perspective and position, so that users can view data changes in real time.

[0074] Example 3

[0075] The electronic device described in the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is loaded into the processor, the digital twin-based hydrodynamic model display method is implemented.

[0076] Example 4

[0077] The computer-readable storage medium described in the present invention stores a computer program, and when the computer program is executed by a processor, the hydrodynamic model display method based on digital twins is implemented.

[0078] The computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage, flash memory, or any other medium that can be used to store program code in the form of instructions or data structures and that can be accessed by a computer.

[0079] The processor is used to execute the computer program stored in the memory to implement each step of the method involved in the above embodiment.

Claims

1. A hydrodynamic model display method based on digital twin, characterized in that: The steps include: (1) Prepare a grid Shp file and a simulation result file of the hydrodynamic model, wherein the simulation result file includes flow field data and water level data of each grid unit, and the flow field data includes flow direction data and flow velocity data; If the simulation result file contains multiple sets of data sets of simulation results under different input parameters, then uploading the simulation result file to the data service system; If the data set only contains a single simulation result, the simulation result file is stored in a local storage device; Store the grid Shp file in a local storage device; (2) Create a configuration file on the local storage device and write the storage path of the grid Shp file, the storage path of the simulation result file, or the access address of the data service system into the configuration file; (3) defining a data structure for the digital twin system to read simulation results in real time, wherein the data structure includes a timestamp field, a grid number field, a flow field simulation result field, and a water level simulation result field; (4) According to the content written in the configuration file, parse and load the simulation results through the storage path of the simulation result file or the access address of the data service system; If the simulation results are loaded through the storage path, the timestamp, grid number, flow field data and water level data in each row of data are extracted by line-by-line parsing; if the simulation results are loaded through the data service system, the required data is obtained through HTTP requests and stored in the data structure of the digital twin system; (5) Load the mesh Shp file according to the storage path of the mesh Shp file in the configuration file, read the vertex and edge data of the mesh Shp file, and generate a visual three-dimensional model of the water body in the digital twin system based on the geometric information of the mesh; (6) Extract the flow field data and water level data of each grid from the data structure in the digital twin system, interpolate the flow field data and water level data of the grid vertex according to the flow field data and water level data of the grid, and normalize the vertex flow field data to the range of [0, 1]; (7) Update the flow field data and vertex water level data of the grid vertices into the three-dimensional model of the water body, input the water level data z1 of the grid vertex into the z-direction coordinate of the grid vertex to support underwater effect simulation; input the flow field data of the grid vertex into the R color channel and G color channel of the grid vertex to display the flow direction and flow velocity; (8) Create a water material, set the water body basic absorption light and water surface ripple normal map to simulate the optical and texture effects of the water surface; create a post-processing volume PostProcessVolume in the digital twin system to simulate the underwater effect of the water body and the refraction effect of the interface between the water surface and the air; reserve the water surface height parameter z2 to receive the water surface z coordinate of the current camera position in the twin world coordinate system to control whether to display the visual effect at the interface between the water surface and the air or below the water surface; (9) Draw the mesh edges of the three-dimensional water body model, display the dynamic three-dimensional effect of the water body based on the hydrodynamic model in the digital twin system, and realize the visualization of the flow field and water level simulation results.

2. The method for displaying a hydrodynamic model based on digital twins according to claim 1, characterized in that: In step (4), the method for parsing and loading the simulation results through the storage path of the simulation result file or the access address of the data service system is: parsing the content of the simulation result file line by line, and storing the extracted flow field data and water level data in the data structure in time series according to the timestamp and grid number field of each line of data.

3. The method for displaying a hydrodynamic model based on digital twins according to claim 1, characterized in that: In step (4), the simulation result is parsed and loaded through the access address of the data service system of the simulation result file, and the method for storing the loaded simulation result in the data structure of the digital twin system is: obtain the Http module of the digital twin system, create a request object, set the request type to POST, the request address to the access address of the data service system, the request parameter to the scenario name of the simulation result, and bind a callback function, and store the simulation result in the data structure in the callback function.

4. The method for displaying a hydrodynamic model based on digital twins according to claim 1, characterized in that: In step (5), the method for generating a visualized three-dimensional water body model in the digital twin system according to the geometric information of the mesh is as follows: using the GDAL library to read the mesh Shp file, extracting the Polygon geometric elements, obtaining the vertex coordinates of each Polygon, and storing them in a three-dimensional vector array; In the three-dimensional vector array, traverse each vertex, and for a quadrilateral mesh, divide it into two triangles along the diagonal line, and add the vertex number of each triangle to the triangle topology array; In the triangle topology array, the light normal vector of each vertex is calculated, the light normal vector of each vertex is obtained by vector multiplication, and added to the light normal vector array; The triangle topology array and the light normal vector array are used to generate a three-dimensional model of a water body using a procedural model component.

5. The method for displaying a hydrodynamic model based on digital twins according to claim 1, characterized in that: Step (5) also includes converting the vertex coordinates in the projection coordinate system in the read mesh Shp file into the world coordinate system used by the digital twin system; and performing precision correction on the converted coordinates to adapt to the model rendering requirements of the digital twin system.

6. The method for displaying a hydrodynamic model based on digital twins according to claim 1, characterized in that: In step (7), updating the flow field data and vertex water level data of the grid vertices to the three-dimensional water body model includes the following three methods: Time series update mode, that is, updating water level data and flow field data in sequence according to the time series order to dynamically display the changes in water surface height and flow field evolution process at each moment; specified time update mode, extracting water level data and flow field data at the corresponding moment according to the time step specified by the user, and updating them to the three-dimensional model of the water body to display the water surface height and flow field distribution at that moment; data completion mode, when the water level data or flow field data at a specified moment is missing, the closest water level data and flow field data of the same period are used for direct replacement to ensure continuous visualization of the water surface height and flow field.

7. The method for displaying a hydrodynamic model based on digital twins according to claim 1, characterized in that: In step (8), after creating the water body material, the step further includes mapping the values ​​of the flow velocity data in the R color channel and the G color channel of the mesh vertex from the range of [0, 1] to the range of [-1, 1].

8. A hydrodynamic model display system based on digital twins, characterized in that: include: A basic data preparation unit, used for preparing a grid Shp file and a simulation result file of a hydrodynamic model, wherein the simulation result file includes flow field data and water level data of each grid unit, and the flow field data includes flow direction data and flow velocity data; If the simulation result file contains multiple sets of data sets of simulation results under different input parameters, then uploading the simulation result file to the data service system; If the data set only contains a single simulation result, the simulation result file is stored in a local storage device; Store the grid Shp file in a local storage device; A data configuration unit is used to create a configuration file in a local storage device, and write the storage path of the grid Shp file, the storage path of the simulation result file or the access address of the data service system into the configuration file; A data structure creation unit, used to define a data structure for real-time reading of simulation results by the digital twin system, wherein the data structure includes a timestamp field, a grid number field, a flow field simulation result field, and a water level simulation result field; A simulation result storage unit, used to parse and load the simulation result according to the content written in the configuration file through the storage path of the simulation result file or the access address of the data service system; If the simulation results are loaded through the storage path, the timestamp, grid number, flow field data and water level data in each row of data are extracted by line-by-line parsing; if the simulation results are loaded through the data service system, the required data is obtained through HTTP requests and stored in the data structure of the digital twin system; A water body three-dimensional model generation unit is used to load a mesh Shp file according to the storage path of the mesh Shp file in the configuration file, read the vertex and edge data of the mesh Shp file, and generate a visualized water body three-dimensional model in the digital twin system according to the geometric information of the mesh; The hydrodynamic data parsing unit is used to extract the flow field data and water level data of each grid from the data structure in the digital twin system, interpolate the flow field data and water level data of the grid vertices according to the flow field data and water level data of the grid, and normalize the vertex flow field data to the range of [0, 1]; The model updating unit is used to update the flow field data and vertex water level data of the grid vertex into the three-dimensional model of the water body, input the water level data z1 of the grid vertex into the z direction coordinate of the grid vertex to support underwater effect simulation; input the flow field data of the grid vertex into the R color channel and the G color channel of the grid vertex to display the flow direction and flow velocity; The water material setting unit is used to create water material, set the basic absorption light of the water body and the water surface ripple normal map to simulate the optical and texture effects of the water surface; create a post-processing volume PostProcessVolume in the digital twin system to simulate the underwater effect of the water body and the refraction effect of the interface between the water surface and the air; reserve the water surface height parameter z2 to receive the z coordinate of the water surface at the current camera position in the twin world coordinate system to control whether to display the visual effect of the interface between the water surface and the air or below the water surface; The visualization display unit is used to draw the mesh edges of the three-dimensional water body model, display the dynamic three-dimensional water body effect based on the hydrodynamic model in the digital twin system, and realize the visualization of the flow field and water level simulation results.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is loaded into the processor, the hydrodynamic model display method based on digital twin is implemented according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the digital twin-based hydrodynamic model display method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Fusion rendering and dynamic display method of hydrodynamic model and digital twinborn scene

    CN118395522A

  • WebGL-based three-dimensional flood routing simulation method and system

    CN117173369A

  • Visual simulation method for reciprocating water level process of tidal river network under complex conditions

    CN118917251A

  • Dynamic simulation method for digital twinning flood inundation of small and medium-sized watershed based on UE5

    CN119203856A

  • Multi-time-sequence three-dimensional visualization expression method for flood routing

    CN119294293A

Cited By

  • Rapid flow field visualization data loading method

    CN119987901A

  • Hydrological monitoring multi-element real-time management system

    CN120181802A