Fluid simulation method and device, storage medium and electronic equipment

By obtaining the initial fluid parameters and velocity parameters in each grid of the area to be simulated, and calculating the physical force and target velocity parameters, the problems of large amount of fluid simulation calculation and inaccurate dynamic effects in the prior art are solved, and efficient and accurate fluid dynamic effect simulation is achieved.

CN119740512AActive Publication Date: 2025-04-01GUANGZHOU BOGUAN TELECOMM TECH LTD

Patent Information

Application Number
CN202411808208.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-01
Estimated Expiration
2044-12-09

AI Technical Summary

Technical Problem

When simulating the dynamic effects of fluids, the prior art has a large amount of calculation and high performance consumption, making it difficult to achieve real-time calculations. At the same time, the fixedness of the flow map is difficult to accurately simulate the dynamic effects of fluids.

Method used

By obtaining the initial fluid parameters and velocity parameters of the fluid submodels in each grid in the area to be simulated, the physical force affected by the fluid submodels in each grid is determined based on these parameters, and the target velocity parameters of the target grid are then calculated to generate a fluid dynamic effect.

Benefits of technology

This method simulates fluid changes in units of grids, reducing calculation amounts, reducing performance consumption, accurately simulates the dynamic effects of fluids, and interacts with other objects, improving the authenticity of fluid simulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740512A_ABST
    Figure CN119740512A_ABST
Patent Text Reader

Abstract

The invention provides a fluid simulation method, a fluid simulation device, a computer storage medium and electronic equipment, and relates to the technical field of computers. The method comprises the following steps: acquiring an initial fluid parameter of a fluid sub-model in each grid of a to-be-simulated area under the current iteration frequency and an initial speed parameter under the current iteration frequency; according to the initial fluid parameters, physical quantity values of physical acting force borne by the fluid sub-models in the grids are determined; determining a target speed parameter of a target grid under the current number of iterations based on an initial speed parameter of a fluid sub-model in the target grid in the plurality of grids and a physical quantity value of a physical acting force applied to the target grid; and generating a fluid dynamic effect of the fluid model in the to-be-simulated region based on the target speed parameter of the fluid sub-model in each grid under each iteration frequency. According to the mode, the calculation amount can be greatly reduced, the performance consumption is further reduced, the real-time fluid simulation requirement is met, and the accuracy of simulating the dynamic effect of the fluid is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] In some top-down games, there are usually dynamic art effects of fluids in large maps, such as floods, debris flows, waterfalls and other fluids. In existing technical solutions, smoothed particle hydrodynamics (SPH) algorithm and FlowMap technology are often used to achieve fluid simulation. Among them, the above-mentioned SPH algorithm simulates real three-dimensional water bodies through microscopic particles. This process requires rapid iteration of a large amount of water body information, which makes the calculation amount of fluid simulation effects large, and thus leads to high performance consumption and difficulty in real-time calculation; while Flowmap technology controls the texture offset direction and speed through flow maps to achieve flow effects, but due to the fixed nature of flow maps, it is difficult to accurately simulate the dynamic effects of fluids.

[0003] Therefore, there is an urgent need for a fluid simulation method that can accurately simulate the dynamic effects of fluids while ensuring low performance consumption to meet the needs of practical applications. Summary of the invention

[0004] The present disclosure provides a fluid simulation method, a fluid simulation device, a computer storage medium and an electronic device, which can significantly reduce the amount of calculation and thus reduce performance consumption, so as to adapt to the actual needs of real-time fluid simulation, while also improving the accuracy of simulating fluid dynamic effects.

[0005] In a first aspect, an embodiment of the present disclosure provides a fluid simulation method, the method comprising: obtaining initial fluid parameters of the fluid sub-model in each grid in the area to be simulated at the current number of iterations, and initial velocity parameters at the current number of iterations, the initial fluid parameters and initial velocity parameters being parameter data obtained by each fluid sub-model based on the number of iterations before the current number of iterations; determining the physical magnitude of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters; determining, for a target grid among multiple grids, a target velocity parameter of the target grid at the current number of iterations based on the initial velocity parameters of the fluid sub-model in the target grid and the physical magnitude of the physical force acting on the target grid; generating a fluid dynamic effect of the fluid model in the area to be simulated based on the target velocity parameters of the fluid sub-model in each grid at each number of iterations.

[0006] In a second aspect, an embodiment of the present disclosure provides a fluid simulation device, which includes: a fluid parameter acquisition module, which is used to obtain the initial fluid parameters of the fluid sub-model in each grid in the area to be simulated at the current number of iterations, and the initial velocity parameters at the current number of iterations, the initial fluid parameters and the initial velocity parameters are parameter data obtained by each fluid sub-model based on the number of iterations before the current number of iterations; a physical quantity value determination module, which is used to determine the physical quantity value of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters; a velocity parameter determination module, which is used to determine the target velocity parameters of the target grid at the current number of iterations for the target grid among multiple grids based on the initial velocity parameters of the fluid sub-model in the target grid and the physical quantity value of the physical force acting on the target grid; a fluid simulation module, which is used to generate the fluid dynamic effect of the fluid model in the area to be simulated based on the target velocity parameters of the fluid sub-model in each grid at each number of iterations.

[0007] In a third aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which implements the above fluid simulation method when executed by a processor.

[0008] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above fluid simulation method by executing the executable instructions.

[0009] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which is executed by a processor to implement the above fluid simulation method.

[0010] The technical solution disclosed in this disclosure has the following beneficial effects:

[0011] The above-mentioned fluid simulation method obtains the initial fluid parameters of the fluid sub-model in each grid of the area to be simulated at the current number of iterations, and the initial velocity parameters at the current number of iterations, the initial fluid parameters and the initial velocity parameters are parameter data obtained by each fluid sub-model based on the previous number of iterations of the current number of iterations; according to the initial fluid parameters, the physical value of the physical force acting on the fluid sub-model in each grid is determined; for the target grid among the multiple grids, based on the initial velocity parameters of the fluid sub-model in the target grid and the physical value of the physical force acting on the target grid, the target velocity parameters of the target grid at the current number of iterations are determined; based on the target velocity parameters of the fluid sub-model in each grid at each number of iterations, the fluid dynamic effect of the fluid model in the area to be simulated is generated.

[0012] On the one hand, this method simulates the fluid changes of particles by using grids as units, which can greatly reduce the amount of calculation compared to the particle simulation method used in the prior art. In this method, the area to be simulated is a two-dimensional plane, and it is only necessary to simulate the fluid effect in the three-dimensional scene on the basis of the two-dimensional plane, thereby reducing performance consumption. On the other hand, this method uses grids as simulation units and calculates the forces between grids to simulate the dynamic effects of the fluid. Compared to the flow mapping method used in the prior art, it can interact with other objects, such as objects floating on the fluid, thereby correctly expressing the fluid effect and improving the authenticity of the fluid simulation.

[0013] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0015] Figure 1 A schematic diagram showing an architecture of a fluid simulation system according to the exemplary embodiment;

[0016] Figure 2 A flow chart schematically showing one of the fluid simulation methods of this exemplary embodiment;

[0017] Figure 3 A schematic diagram of a grid effect in this exemplary embodiment is schematically shown;

[0018] Figure 4 A schematic diagram schematically shows a deduction effect of one advection in this exemplary embodiment;

[0019] Figure 5A A schematic diagram showing the conversion of physical forces under fluid data between the first grids of this exemplary embodiment is shown;

[0020] Figure 5B A schematic diagram of physical force conversion under fluid data between the second grids of this exemplary embodiment is schematically shown;

[0021] Figure 6 A schematic diagram showing the conversion of physical forces under fluid data between the third grids of this exemplary embodiment is shown;

[0022] Figure 7A schematic diagram schematically shows the conversion of physical forces under fluid data between the fourth grids of this exemplary embodiment;

[0023] Figure 8 A schematic diagram of the structure of a fluid simulation device in this exemplary embodiment is shown;

[0024] Fig. 9 The structure diagram of an electronic device in this exemplary embodiment is schematically shown. DETAILED DESCRIPTION

[0025] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the exemplary embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0026] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0027] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps may be decomposed, while some steps may be combined or partially combined, so the actual execution order may change according to the actual situation.

[0028] In the related technical background, in some top-down perspective games, it is usually necessary to simulate the dynamic art effects of fluids in large maps, such as adding fluids such as floods, mudslides, waterfalls, etc. to the scene.

[0029] In the existing related technical solutions, the SPH algorithm and FlowMap technology are mainly used to realize fluid simulation. Among them, the SPH algorithm is a particle-based fluid solution method, which is widely used to simulate the movement of liquids and gases. It realizes the dynamic effect of fluid by simulating a large number of particles and the interaction between them. However, a large amount of information needs to be iterated in this process, which will lead to a large amount of calculation of fluid effects, making the performance consumption too large, and thus not suitable for application in applications such as games. The FlowMap technology is a texture-based fluid simulation method, which mainly uses a flow map to control the moving direction and speed of the texture, so as to realize the dynamic effect of the fluid. However, since the flow map is fixed, and the virtual scene produced also contains obstacles such as buildings, there must be problems such as the fluid turning when encountering obstacles such as buildings, or making objects float on the fluid to cause interactive dynamic effects such as mudslide scouring, but it cannot accurately simulate the fluid performance effect.

[0030] Therefore, there is an urgent need for a fluid simulation method that can accurately simulate the dynamic effects of fluids while ensuring low performance consumption to meet the needs of practical applications.

[0031] Taking the above problems into consideration, the exemplary embodiment of the present disclosure proposes a fluid simulation method, which can be applied to any application scenario that requires fluid simulation, such as producing debris flow effects, waterfall effects, etc. The method obtains initial fluid parameters of the fluid sub-model in each grid of the area to be simulated at the current number of iterations, and initial velocity parameters at the current number of iterations, the initial fluid parameters and initial velocity parameters are parameter data obtained by each fluid sub-model based on the number of iterations before the current number of iterations; according to the initial fluid parameters, the physical value of the physical force acting on the fluid sub-model in each grid is determined; for a target grid among multiple grids, based on the initial velocity parameters of the fluid sub-model in the target grid and the physical value of the physical force acting on the target grid, the target velocity parameters of the target grid at the current number of iterations are determined; based on the target velocity parameters of the fluid sub-model in each grid at each number of iterations, the fluid dynamic effect of the fluid model in the area to be simulated is generated.

[0032] On the one hand, this method simulates the fluid changes of particles by using grids as units, which can greatly reduce the amount of calculation compared to the particle simulation method used in the prior art. In this method, the area to be simulated is a two-dimensional plane, and it is only necessary to simulate the fluid effect in the three-dimensional scene on the basis of the two-dimensional plane, thereby reducing performance consumption. On the other hand, this method uses grids as simulation units and calculates the forces between grids to simulate the dynamic effects of the fluid. Compared to the flow mapping method used in the prior art, it can interact with other objects, such as objects floating on the fluid, thereby correctly expressing the fluid effect and improving the authenticity of the fluid simulation.

[0033] The following will be combined Figure 1 , a fluid simulation method and device proposed in the present disclosure is applied to Figure 1 The embodiments are described in the system architecture of the exemplary application environment shown.

[0034] like Figure 1 As shown, it is a schematic diagram of an application scenario provided by an embodiment of the present application. In this scenario, a terminal device 101 and a server 102 may be included.

[0035] The terminal device 101 can be, for example, a mobile phone, a tablet computer (PAD), a laptop computer, a desktop computer, a smart TV, a smart vehicle-mounted device, a smart wearable device, a smart TV, and an aircraft, and any other device involved in item recommendation. The terminal device 101 can be installed with a target application, and the target application can have functions such as displaying fluid simulation effects. The application involved in the embodiment of the present application can be a software client, or a client such as a web page or a small program. The server 102 is a server corresponding to the software or a web page, a small program, etc., and does not limit the specific type of the client.

[0036] The server 102 may be a background server of the target application, used to provide corresponding background services for it, such as recommendation services and recommendation reason generation services, etc. It may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, i.e., content delivery networks (CDN), as well as big data and artificial intelligence platforms, but is not limited thereto.

[0037] It should be noted that the fluid simulation method in the embodiment of the present application can be executed by the terminal device 101 or the server 102 alone, or can be executed by the server 102 and the terminal device 101 together. Among them, the server 102 and the terminal device 101 can both include one or more processors, memories, and interactive I / O interfaces, etc. In addition, the server 102 can also be configured with a database, which can be used to store model parameters obtained by training, etc. Among them, the memories of the server 102 and the terminal device 101 can also store the program instructions required to be executed in the fluid simulation method provided in the embodiment of the present application, and these program instructions can be used to implement the process of providing simulated fluid effects in the embodiment of the present application when executed by the processor.

[0038] It should be noted that when the fluid simulation method provided in the embodiment of the present application is executed by the server 102 or the terminal device 101 alone, the above-mentioned application scenario may also only include a single device of the server 102 or the terminal device 101, or the server 102 and the terminal device 101 may also be considered to be the same device. Of course, in actual application, when the fluid simulation method provided in the embodiment of the present application is jointly executed by the server 102 and the terminal device 101, the server 102 and the terminal device 101 may also be the same device, that is, the server 102 and the terminal device 101 may be different functional modules of the same device, or virtual devices virtualized by the same physical device.

[0039] In the embodiment of the present application, the terminal device 101 and the server 102 can be directly or indirectly connected to each other through one or more networks 103. The network 103 can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a wireless fidelity (Wireless-Fidelity, WIFI) network. Of course, it can also be other possible networks, which are not limited in the embodiment of the present application. It should be noted that Figure 1 The figure is only an example. In fact, the number of terminal devices and servers is not limited and is not specifically limited in the embodiments of the present application.

[0040] For example, in an exemplary embodiment, the terminal device obtains the initial fluid parameters of the fluid sub-model in each grid of the area to be simulated at the current number of iterations, and the initial velocity parameters at the current number of iterations, the initial fluid parameters and the initial velocity parameters are parameter data obtained by each fluid sub-model based on the number of iterations before the current number of iterations; according to the initial fluid parameters, the physical value of the physical force acting on the fluid sub-model in each grid is determined; for a target grid among multiple grids, based on the initial velocity parameters of the fluid sub-model in the target grid and the physical value of the physical force acting on the target grid, the target velocity parameters of the target grid at the current number of iterations are determined; based on the target velocity parameters of the fluid sub-model in each grid at each number of iterations, the fluid dynamic effect of the fluid model in the area to be simulated is generated.

[0041] Below, in combination with the application scenarios described above, the method provided by the exemplary implementation of the present application is described with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present application, and the implementation of the present application is not limited in this respect. It should be noted that the following method can be executed by the above terminal device or server, or by the terminal device and the server together. Here, the terminal device is specifically used as the execution subject for example.

[0042] The following uses the above-mentioned terminal device as an execution subject and illustrates the application of the fluid simulation method to the above-mentioned terminal device as an example. Figure 2 A flow chart schematically showing one of the fluid simulation methods of this exemplary embodiment is shown in Figure 2 The fluid simulation method provided by the embodiment of the present disclosure includes the following steps S201 to S204:

[0043] Step S201, obtaining the initial fluid parameters of the fluid sub-model in each grid of the area to be simulated at the current iteration number, and the initial velocity parameters at the current iteration number.

[0044] The initial fluid parameters and initial velocity parameters are parameter data obtained by each fluid sub-model based on the number of iterations before the current number of iterations.

[0045] Step S202: Determine the physical value of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters.

[0046] Step S203: for a target grid among the multiple grids, based on the initial velocity parameters of the fluid sub-model in the target grid and the physical value of the physical force acting on the target grid, determine the target velocity parameters of the target grid at the current iteration number.

[0047] Step S204: Generate the fluid dynamic effect of the fluid model in the area to be simulated based on the target velocity parameters of the fluid sub-model in each grid at each iteration number.

[0048] In the technical solutions provided by some embodiments of the present disclosure, by obtaining the initial fluid parameters of the fluid sub-models in each grid of the area to be simulated at the current number of iterations, and the initial velocity parameters at the current number of iterations, the initial fluid parameters and the initial velocity parameters are the parameter data obtained by each fluid sub-model based on the previous number of iterations of the current number of iterations; according to the initial fluid parameters, the physical value of the physical force on the fluid sub-model in each grid is determined; for the target grid among multiple grids, based on the initial velocity parameters of the fluid sub-model in the target grid and the physical value of the physical force on the target grid, the target velocity parameters of the target grid at the current number of iterations are determined; based on the target velocity parameters of the fluid sub-models in each grid at each number of iterations, the fluid dynamic effect of the fluid model in the area to be simulated is generated. On the one hand, this method simulates the fluid changes of particles by taking grids as units, which can greatly reduce the amount of calculation compared with the particle simulation method of the prior art. In this method, the area to be simulated is a two-dimensional plane, and it is only necessary to simulate the fluid effect in the three-dimensional scene on the basis of the two-dimensional plane, thereby reducing performance consumption. On the other hand, this method uses grids as simulation units and calculates the forces between grids to simulate fluid dynamic effects. Compared with the existing technology that uses flow mapping, it can interact with other objects, such as objects floating on the fluid, thereby correctly expressing the fluid effect and improving the realism of fluid simulation.

[0049] In conjunction with the specific embodiments Figure 2 The specific implementation methods of each step in the embodiment shown are described in detail:

[0050] In step S201, the initial fluid parameters of the fluid sub-model in each grid of the area to be simulated at the current iteration number and the initial velocity parameters at the current iteration number are obtained.

[0051] Among them, the area to be simulated is the area in the virtual scene used to simulate the fluid dynamic effects. It can be understood that the area to be simulated can be a partial area occupied in the virtual scene, or it can be the entire virtual scene area, and the embodiments of the present disclosure do not impose any special restrictions on this. The fluid model is a model that can flow dynamically, for example, models of floods, debris flows, waterfalls, smoke, water mist, etc. The fluid sub-model is a part of the fluid model, that is, the fluid model is composed of fluid sub-models in each grid. The current number of iterations is any simulation number on the timeline of simulating fluid dynamic effects, and the fluid dynamic effect displayed by the fluid model is a visual effect formed by the change of flow velocity under different iteration numbers using the fluid sub-model.

[0052] Among them, the above initial fluid parameters and initial velocity parameters are parameter data obtained by each fluid sub-model based on the previous iteration number of the current iteration number. That is, the initial fluid parameters of the current iteration number are the fluid parameters obtained through the fluid simulation process of the previous iteration number, and they are used as the initial fluid parameters of the next iteration number to continue the fluid simulation; similarly, the initial velocity parameters are used to characterize the flow velocity of the fluid sub-model in each grid, and the initial velocity parameters under the current iteration number are the fluid velocity parameters obtained through the fluid simulation process of the previous iteration number, and they are used as the initial velocity parameters of the next iteration number to continue the fluid simulation.

[0053] It should be explained that when the current iteration number is the first iteration number on the timeline of simulating the fluid dynamic effect, the fluid parameters and fluid speed of the previous iteration number may take the initial default values.

[0054] In the related technical solutions, the annual simulation process for fluid dynamic effects is usually implemented in a three-dimensional virtual scene. Considering the technical problems that directly simulating fluid effects in a three-dimensional virtual scene has a large amount of calculation, increases performance consumption, and thus affects the real-time dynamic effects of the fluid, the embodiment of the present disclosure may first need to grid the two-dimensional plane of the area to be simulated before executing the above step S201, so as to obtain multiple grids. By simulating only the two-dimensional plane of the area to be simulated, the fluid dynamic effects in the three-dimensional virtual scene can be realized based on the two-dimensional plane, which greatly reduces the amount of calculation. The above process will be described in detail below:

[0055] In an optional embodiment of the present disclosure, a two-dimensional plane of the area to be simulated is obtained, and the two-dimensional plane is gridded according to a first grid precision to obtain multiple grids for the two-dimensional plane; a two-dimensional array is constructed according to the first grid precision, and the initial fluid parameters of the fluid sub-model in each grid at the current number of iterations are stored in the two-dimensional array, so as to obtain the initial fluid parameters of each grid from the two-dimensional array.

[0056] The two-dimensional plane of the area to be simulated can be a two-dimensional plane area formed based on a bird's-eye view. For example, in some large-map game scenes, each virtual model in the virtual scene is usually displayed from a bird's-eye view. In addition, the process of obtaining the two-dimensional plane of the area to be simulated can also avoid the hollowing out of the fluid model. Taking the fluid model as a waterfall model as an example, by obtaining the two-dimensional plane of the waterfall model, the user can prevent the user from seeing the interior of the waterfall model.

[0057] Exemplarily, after obtaining the two-dimensional plane of the area to be simulated, the two-dimensional plane can be gridded according to the first grid accuracy to obtain multiple grids for the two-dimensional plane. The first grid accuracy is used to determine the number of grids generated for the two-dimensional plane of the area to be simulated. Generally, the greater the grid accuracy, the more grids are generated, the smaller the area of ​​the two-dimensional plane occupied by a single grid, and the smaller the area of ​​the fluid sub-model in each grid.

[0058] It should be understood that the greater the grid precision is set, the more grids are generated, which in turn increases the amount of calculation and increases the performance consumption of computer equipment; while the smaller the grid precision is set, the fewer grids are generated, which in turn reduces the amount of calculation, but the accuracy of calculating fluid parameters for each fluid sub-model is lower, resulting in poor fluid model effects. Therefore, it is necessary to select a more appropriate grid precision to grid the area to be simulated.

[0059] For ease of understanding, the following will be combined Figure 3 The effect diagram of meshing the two-dimensional plane of the simulation area according to the first mesh accuracy is exemplarily described.

[0060] Figure 3 A schematic diagram of a grid effect of this exemplary embodiment is shown schematically, referring to Figure 3 As shown, assuming that Figure 3 The flood effect is simulated in the area shown in Figure 3 The two-dimensional plane of the region shown is in a top-down perspective, and the two-dimensional plane is gridded according to the first grid accuracy, so as to obtain a region to be simulated composed of different grids.

[0061] In an optional embodiment, regarding the method of determining the grid accuracy, the embodiment of the present disclosure can automatically determine the appropriate grid accuracy based on the area of ​​the area to be simulated as a default value (i.e., the first grid accuracy) and directly perform gridding processing, or provide the user with a reference grid accuracy based on the above-mentioned default value for the user to manually determine. The embodiment of the present disclosure does not impose any special restrictions on this.

[0062] The following will describe in detail the process of manually determining the grid accuracy shown in the above embodiment based on the gridding process based on the first grid accuracy and in combination with specific embodiments.

[0063] In an optional embodiment, the user may also adjust the first grid precision in real time, that is, the terminal device responds to the adjustment operation on the first grid precision and grids the two-dimensional plane of the simulation area according to the adjusted second grid precision.

[0064] The second grid accuracy can be greater than the first grid accuracy, or less than the first grid accuracy. Figure 3 If the adjusted second grid accuracy is greater than the first grid accuracy, then Figure 3 The number of grids shown becomes denser, and the area occupied by the corresponding single grid becomes smaller; conversely, if the adjusted second grid accuracy is less than the first grid accuracy, then Figure 3 The number of grids shown becomes more sparse, and the area occupied by the corresponding single grid becomes larger.

[0065] Exemplarily, the graphical user interface of the terminal device can also display or trigger an editing interface for grid accuracy, so that the user can adjust the first grid accuracy to the second grid accuracy in the editing interface, and then re-grid the two-dimensional plane of the simulation area according to the second grid accuracy.

[0066] Through the above embodiments, the flexibility of grid processing can be improved, and the user can determine a better fluid dynamic effect or a fluid dynamic effect with better visual effect by comparing the fluid model effects under different grid accuracies.

[0067] In the above embodiment, while the gridding process is performed according to the first grid accuracy or the second grid accuracy, a two-dimensional array is also constructed according to the same grid accuracy used for the gridding process, so that the initial fluid data of the fluid sub-model in each grid under the current number of simulations can be stored in the two-dimensional array accordingly, so as to obtain the initial fluid data of each grid from the two-dimensional array.

[0068] A two-dimensional array is a set of values ​​arranged in order, and a value can be uniquely determined based on two dimensions in the two-dimensional array. For example, a[3][5] in a two-dimensional array contains two dimensions, usually the number of rows and the number of columns. a[3][5] represents the two-dimensional array element in the third row and fifth column of the two-dimensional array.

[0069] In this regard, after constructing a two-dimensional array based on the above embodiment, the initial fluid parameters of the fluid sub-model in each grid at the current iteration number can be stored in the two-dimensional array so that each grid corresponds to a data in the two-dimensional array.

[0070] In an optional embodiment of the present disclosure, in the process of storing the initial fluid parameters of the fluid sub-model in each grid at the current number of iterations into a two-dimensional array, a one-to-one correspondence between the position information of each grid and the index value in the two-dimensional array can be pre-constructed; according to the corresponding relationship, the initial fluid parameters in each grid are stored in the two-dimensional array elements of the corresponding index value.

[0071] The initial fluid parameters of each grid at least include the position information of each grid, so the initial fluid parameters can be stored based on the position information of each grid. The one-to-one correspondence between the position information of each grid and the index value in the two-dimensional array indicates that each grid determined based on the position information corresponds to a unique index value, so that a unique two-dimensional array element can be determined based on the index value.

[0072] Exemplarily, the terminal device can construct a two-dimensional array element with the same number of grids as obtained after the gridding process based on the grid accuracy used in the gridding process, so that the initial fluid parameters of each grid at the current number of iterations can be matched to the corresponding two-dimensional array elements for data storage, thereby ensuring data security and the logic of data processing.

[0073] Taking the grid precision used in the gridding process as the first grid precision as an example, the first number of grids is obtained by gridding the area to be simulated based on the first grid precision, and a two-dimensional array is constructed according to the first grid precision, so that the two-dimensional array contains the first number of two-dimensional array elements. Then, based on the position information contained in the initial fluid parameters of each grid, a one-to-one correspondence between the first number of grids and the first number of two-dimensional array elements is constructed, and the initial fluid parameters of the fluid sub-model in a grid with a position information (such as (x, y) coordinates) can be stored in the two-dimensional array element of the corresponding index value based on the corresponding relationship. For example, the position coordinates of a certain grid are (3, 5), which corresponds to the position index a[3][5] in the two-dimensional array a, then the data value corresponding to a[3][5] is the initial fluid parameter of the fluid sub-model in the grid under the current number of simulations.

[0074] It is understandable that the initial speed parameters of each grid may also be stored in a two-dimensional array accordingly, and the embodiments of the present disclosure do not impose any special limitation on this.

[0075] In this embodiment, the initial fluid parameters of each grid are stored through a one-to-one correspondence between the position information of each grid and the index value in the two-dimensional array, which can improve the efficiency of data storage and search.

[0076] Based on the above embodiment, in response to the adjustment operation for the first grid precision, when the two-dimensional plane of the area to be simulated is gridded according to the adjusted second grid precision, a two-dimensional array is constructed according to the second grid precision to store the initial fluid parameters of the fluid sub-model in each grid at the current number of iterations in the two-dimensional array constructed based on the second grid precision. In this regard, it is always ensured that the number of generated grids is the same as the number of array elements in the created two-dimensional array.

[0077] In an optional embodiment of the present disclosure, the initial fluid parameters in any of the above embodiments may include one or more of the position information of the fluid sub-model in each grid, the ground height, the fluid direction, the fluid height, and the fluid pressure field parameters.

[0078] Exemplarily, the initial fluid parameters shown in any of the above embodiments may include a single parameter or multiple parameters such as the current position information of the fluid sub-model in each grid (such as the xy coordinates of the grid), ground height, fluid direction, fluid height, fluid pressure field parameters, etc.

[0079] In order to facilitate the storage and calculation of the initial fluid parameters, the initial fluid parameters corresponding to each grid can be stored in the form of tuples, and then for each tuple, the corresponding fluid dynamic effect can be simulated by simply calculating the changes in the fluid information of the tuple. The initial fluid parameters of each tuple are as follows:

[0080] Position: represents the position information of the fluid sub-model in each grid. In the two-dimensional plane, the Position information of each grid is stored as (X, Y), and the position information can also be transformed into the world space position.

[0081] Height: represents the surface height information in the tuple, that is, the height information brought to the fluid sub-model in the grid based on the terrain;

[0082] Liquid_Velocity: represents the fluid direction of the fluid sub-model in each grid;

[0083] Liquid_Height: represents the fluid height of the fluid sub-model in each grid;

[0084] Liquid_Pressure: Characterizes the fluid pressure field of the fluid sub-model in each grid.

[0085] In this embodiment, the initial fluid data of the fluid sub-model in each grid at the current iteration number is stored in a tuple structure, which is convenient for displaying multiple attribute data of the fluid information and provides convenience for the subsequent fluid parameter update process.

[0086] After the initial fluid parameters of the fluid sub-model in each grid at the current iteration number are obtained in the above step S201, step S202 can be continued to determine the physical value of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters.

[0087] In an optional embodiment, the physical force includes one or more of pressure, gravity, and externally applied force.

[0088] Among them, the pressure is determined by the velocity parameters (such as flow rate) of the fluid sub-model in the adjacent grids, and the gravity can be determined based on the surface height, fluid height, etc. of the fluid sub-model in each grid; the externally applied force can be generated by the rigid body collision between the external virtual model and the fluid sub-model. For example, when a stone (external virtual model) falls into the water, an externally applied force is introduced and a rigid body collision is generated with other fluid sub-models based on the force to propagate the velocity. As for the externally applied force, it is mainly to correct the three-dimensional spatial influence that does not exist in the two-dimensional fluid model.

[0089] In step 203, for a target grid among the multiple grids, a target velocity parameter of the target grid at the current iteration number is determined based on the initial velocity parameter of the fluid sub-model in the target grid and the physical value of the physical force acting on the target grid.

[0090] Exemplarily, based on the initial velocity parameters of the fluid sub-model in the target grid and the physical magnitude of the physical force acting on the target grid, the fluid velocity update of the target grid at the current number of iterations can be achieved.

[0091] First, combine Figure 4 , the advection deduction process between fluid sub-models is illustrated as follows:

[0092] Reference Figure 4 For the multiple adjacent grids shown, when there is an initial velocity direction indicated by the solid arrow in the internal grid, it makes them gather in the direction indicated by the solid arrow, which will cause the pressure in the initial velocity direction indicated by the solid arrow to rise, and then generate corresponding pressure fields for other grids, and then bring about the velocity of the dotted part. That is, in the process of advection deduction, the velocity will affect the pressure field, and the pressure field will then affect the fluid velocity.

[0093] Based on the above description, it can be seen that for the fluid in the plane space, in order to facilitate calculation, it can be assumed that the fluid is a quasi-rigid body (that is, the fluid is assumed to be an incompressible uniform fluid). The process of simulating its dynamic fluid effect must follow the above-mentioned advection deduction process, and then the above-mentioned advection deduction process can be displayed through the advection equation.

[0094] That is, in an optional embodiment of the present disclosure, the physical force includes at least pressure and an externally applied force. The process of determining the target velocity parameters of the target grid at the current number of iterations based on the initial velocity parameters of the fluid sub-model in the target grid and the physical magnitude of the physical force applied to the target grid may include: determining the advection velocity of the fluid sub-model based on the initial velocity parameters of the fluid sub-model in the target grid; determining the diffusion velocity of the fluid sub-model in the target grid based on the advection velocity; determining the velocity of the fluid sub-model in the target grid under the externally applied force based on the diffusion velocity; determining the pressure applied to the fluid sub-model in the target grid based on the velocity under the externally applied force; and determining the target velocity parameters of the target grid at the current number of iterations based on the pressure and the velocity of the fluid sub-model in the target grid under the externally applied force.

[0095] That is, the above process can be divided into the following contents using logic:

[0096] u1=advect(u); calculate the advection velocity of each fluid sub-model on the plane;

[0097] u2=diffuse(u1); calculate the diffusion velocity of each fluid sub-model on the plane;

[0098] u3 = addForces(u2); calculate the velocity of each fluid sub-model under the action of external force;

[0099] p=computePressure(u3); calculate the pressure field;

[0100] u4=subtractPressureGradient(u3,p); Calculate the velocity under the negative pressure gradient field based on the pressure field and the velocity under the external force, that is, the target velocity parameter;

[0101] The above parameters u1, u2, u3, and u4 all represent velocity fields, p represents pressure fields, and the negative pressure gradient field is derived based on the velocity field and pressure field calculated above to derive the flow velocity of each fluid sub-model under the above physical forces.

[0102] The above process represents the simulation process of the fluid model at the current number of iterations, so as to achieve the process of simulating three-dimensional fluid effects through a two-dimensional plane. And the above code logic represents the advection equation that needs to be followed for simulating fluid dynamic effects.

[0103] In the above fluid simulation process, the iterative calculation is strictly carried out according to the processing logic of the above advection equation, so that the processing logic satisfies the advection equation, otherwise it will not satisfy the calculation method of the above advection equation. And the advection term and diffusion term of each fluid sub-model are necessary terms of Poisson's equation.

[0104] In an optional embodiment of the present disclosure, the total pressure value of the fluid model maintains a preset pressure value unchanged, and the preset pressure value is determined by the surface tension coefficient of each fluid sub-model.

[0105] Exemplarily, while the pressure field changes within the above-mentioned fluid model, the total pressure value of the total fluid model in the system always needs to be maintained at a preset pressure value, and the total pressure value can be determined based on the viscosity of the fluid sub-model, that is, the surface tension coefficient.

[0106] It should be explained that the surface tension coefficient σ is the partial derivative of Gibbs free energy G with respect to area S when temperature T and pressure p remain unchanged. The unit of Gibbs free energy is energy unit, so the unit of surface tension coefficient is energy / area, and the force that causes the surface of liquid (i.e. fluid) to contract is called surface tension.

[0107] With respect to externally applied forces, when determining the physical magnitude of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters in the above step 202, the magnitude of the externally applied force can be calculated based on at least the ground surface height and the fluid height included in the initial fluid parameters and the source externally applied force.

[0108] In an optional embodiment of the present disclosure, the sum of the ground height and the fluid height of the first target grid is determined to obtain a first height sum; the sum of the ground height and the fluid height of the second target grid is determined to obtain a second height sum; if the first height sum is equal to the second height sum, and the third height sum is less than the second height sum, the gravity value between the second target grid and the third target grid is determined to determine the value of the external force transmitted from the second target grid to the third target grid for each fluid sub-model based on the gravity value; the third height sum is the sum of the ground height and the fluid height of the third target grid; the distance between the first target grid and the source of the externally applied force is the smallest.

[0109] Exemplarily, when the sum of the first height of the first target grid is equal to the sum of the second height of the second target grid, the pressure values ​​of the grids between the first target grid and the second target grid are equal. Based on the principles of advection and diffusion, the external force applied to the second target grid will continue to be transmitted outward until it encounters a third target grid of a third height or lower.

[0110] At this point, the gravitational potential energy can be determined based on the height difference between the second target grid and the third target grid, so that the gravitational potential energy can be subsequently converted into the flow velocity of each fluid sub-model according to Newton's theorem, thereby realizing the velocity conversion when the fluid liquid surface falls.

[0111] For ease of understanding, the following will be combined Figure 5A , Figure 5BThe determination process of the externally applied force and pressure in the above embodiment is described respectively, so as to determine the target velocity parameters of each grid in step 203 based on the determined externally applied force and pressure values.

[0112] Figure 5A Schematically showing the physical force conversion diagram under the fluid data between the first grids of this exemplary embodiment, referring to Figure 5A As shown in the figure, for the three grid points Sv1, Sv2 and Sv3, when Figure 5A A source external applied force S is added to the position shown in , wherein the source external applied force is the source of the external applied force, and the direction indicated by the arrow is the direction of fluid flow.

[0113] Under the action of the external force S applied from the source, since the liquid surface satisfies the condition that d2+h2=d1+h1 is equal, it can be understood that at the current height, the surface pressure of the water bodies of each grid between the first target grid and the second target grid is equal, and the external force applied to Sv2 will continue to affect the fluid in other ranges according to the advection formula (for example, refer to Poisson's equation). Based on the transmission of the above external force, when the fluid flows to Sv1 and Sv3, d3+h3≠d1+h1, that is, the liquid surfaces are not at the same height. In this case, according to Newton's law, the height potential energy mgh between the second target grid and the third target grid (where h is the height difference between the second target grid and the third target grid) will be equivalently converted into kinetic energy, that is, 1 / 2mv 2 That is, based on the height potential energy, it can be calculated that when the liquid surface falls, its speed also satisfies Newton's law for the subsequent speed conversion. And because the tuple information retains the fluid height d1, the size range of each fluid parameter in the tuple, and the viscosity of the liquid (i.e., the surface tension coefficient), the external force V1 transmitted by the fluid in the direction of Sv3 can be obtained.

[0114] In another optional embodiment of the present disclosure, if the first height sum is less than the second height sum and is not equal, then based on the ground surface between the first target grid and the second target grid, the magnitude of the force applied to the outside of the fluid sub-model of each grid between the first target grid and the second target grid is determined.

[0115] Among them, the first target mesh has the smallest distance from the source externally applied force.

[0116] Exemplarily, if the sum of the first heights of the first target grid is less than the sum of the second heights of the second target grid, there is a surface slope between the first target grid and the second target grid, and the surface height pushes the fluid sub-model inward, that is, the supporting force, and the externally applied force Foutward = Finward at this position.

[0117] For a two-dimensional plane, the corresponding externally applied force F is in two-dimensional space, and the surface has a slope that is not vertical. Therefore, the force F should be split into an upward support force and an inward support force to obtain the internal support force F as the value of the externally applied force of the fluid sub-model of each grid between the first target grid and the second target grid.

[0118] exist Figure 5A Based on the surface height shown, Figure 5B Schematically showing the physical force conversion diagram under the fluid data between the second grids of this exemplary embodiment, referring to Figure 5B As shown, for the grid points Sv1 (i.e., the second target grid) and Sv2 (i.e., the first target grid) shown in the figure, when the page height of the Sv2 grid is k2, the corresponding liquid level height of the Sv2 grid is k2+h2. At this time, d1+h1>k2+h2 exists. For this case, the surface slope pushes the fluid sub-model inward, that is, the external force F is applied, and the force F outward = F inward at this position.

[0119] But it is worth noting that, as a plane fluid, what we need to pay attention to is the force F in two-dimensional space, but our mountain has a slope and is not vertical, so the externally applied force F should be split into an upward externally applied force F1 and an inward externally applied force F2, and the externally applied force output is the inward externally applied force F2.

[0120] In this regard, after determining the magnitude of the external force applied to each grid based on the above embodiment, step 203 can be performed based on the initial speed parameters of each grid and the speed conversion caused by the external force applied to obtain the target speed parameters of each grid.

[0121] Further, for the physical force at least including pressure, the initial fluid parameters at least include the ground surface height and the fluid height. In this regard, when executing the above step 202, in an optional embodiment of the present disclosure, the sum of the ground surface height and the fluid height of the fourth target grid is determined to obtain a fourth height sum; the sum of the ground surface height and the fluid height of the fifth target grid is determined to obtain a fifth height sum; if the fourth height sum is greater than the fifth height sum, and the distance between the fourth target grid and the source external force is the smallest, then based on the source external force, a first pressure magnitude is provided to the fourth target grid, and the first pressure magnitude is transmitted to the fifth target grid;

[0122] For example, when the distance between the fourth target grid and the external force applied by the source is the smallest, when the sum of the fourth height is greater than the sum of the fifth height, that is, the ground surface height is different, the corresponding fluid level height is also different, and the corresponding liquid pressure is also different. Since the liquid has a communicating vessel effect and the external pressure is assumed to be constant, the internal pressure of the fluid of the fourth target grid will increase under the force applied by the external force of the source, thereby continuously increasing the pressure of the surrounding fifth target grid.

[0123] Figure 6 Schematically showing the physical force conversion diagram under the fluid data between the third grids of this exemplary embodiment; Figure 6 As shown, the Sv1 grid is the fourth target grid, and the Sv3 grid is the fifth target grid. Accordingly, when Figure 6 When the source external force S1 is added at the position shown, additional pressure is provided by the source external force S1, which will continuously increase the pressure of the surrounding fourth target grid to obtain the first pressure magnitude, and while transmitting the first pressure magnitude to the Sv3 grid, the first pressure magnitude is transmitted due to the effect of gravity.

[0124] In some other exemplary embodiments of the present disclosure, if the fourth height sum is less than the fifth height sum, and the distance between the fifth target grid and the source external force is the smallest, a second pressure magnitude is provided to the fourth target grid based on the source external force, and a third pressure magnitude is provided to the fourth target grid by the fifth target grid;

[0125] Continue to refer to Figure 7 As shown, the source of external force S2 is at the smallest distance from the fifth target grid, and its pressure change will be transmitted to Sv3 with the same liquid level d3. Since d2+h2=d3+h3, at this time, the pressure between Sv3 and Sv2 is equal, both of which are the second pressure magnitude. However, due to the existence of the liquid level (d1+h1) of Sv1 (the fourth target grid), it means that there is a higher pressure at Sv1, so it cannot continue to be transmitted to Sv1, but Sv1 transmits pressure to the fifth target grid such as Sv3 or Sv2 to provide the third pressure magnitude.

[0126] In another optional embodiment of the present disclosure, if the sum of the fourth heights is equal to the sum of the fifth heights, and the distance between the fourth target grid and the source of externally applied force is the smallest, a fourth pressure magnitude is provided to the fourth target grid based on the source of externally applied force, and the fourth pressure magnitude is transmitted to the fifth target grid, and the total pressure magnitude of the fourth target grid is equal to the total pressure magnitude of the fifth target grid.

[0127] Exemplarily, since the liquid levels are the same, the total pressure magnitude of the fourth target grid is equal to the total pressure magnitude of the fifth target grid, both being the fourth pressure magnitude.

[0128] Figure 6 Schematically showing the physical force conversion diagram under the fluid data between the third grids of this exemplary embodiment; Figure 6 As shown, the Sv1 grid is the fourth target grid, and the Sv3 grid is the fifth target grid. Regardless of whether the distance between the source and the fourth target grid or the distance between the source and the fifth target grid is the smallest, the total pressure magnitude of the fourth target grid can be equal to the total pressure magnitude of the fifth target grid.

[0129] It needs to be explained that even if there is an occlusion between the Sv1 grid and the Sv2 grid, the pressure of the liquid is consistent.

[0130] In the above manner, the height information can be converted into the two-dimensional influence coefficient of the actual fluid, and the fluid parameters and velocity parameters in the actual tuple are corrected by these influence coefficients. Subsequently, the fluid dynamic effect is simulated by reading the information in the tuple.

[0131] It should be explained that, when solving the Poisson pressure equation, the divergence of the effect of pressure on the actual fluid liquid surface can be calculated based on the position coordinates of each grid.

[0132] In step S204, based on the target velocity parameters of the fluid sub-models in each grid at different iteration times, the fluid dynamic effect of the fluid model in the area to be simulated is generated.

[0133] Exemplarily, based on the above embodiment, the target velocity parameters of the fluid sub-model in each grid at different iteration times are calculated, so that the fluid dynamic effect of the fluid model in the area to be simulated can be simulated.

[0134] In order to implement the above-mentioned fluid simulation method, a fluid simulation device is provided in one embodiment of the present disclosure. Figure 8 A schematic diagram of the structure of a fluid simulation device is shown schematically.

[0135] The fluid simulation device 800 includes a fluid parameter acquisition module 801 , a physical quantity value determination module 802 , a speed parameter determination module 803 and a fluid simulation module 804 .

[0136] The fluid parameter acquisition module 801 is used to obtain the initial fluid parameters of multiple grids in the area to be simulated; the value determination module 802 is used to determine the value of the physical force corresponding to each grid under the first simulation number based on the initial fluid parameters of the multiple grids; the speed parameter determination module 803 is used to obtain the initial speed parameters of the fluid corresponding to the target grid in the second simulation number for the target grid among the multiple grids, and determine the target speed parameters of the target grid under the first simulation number based on the initial speed parameters and the value of the physical force of the target grid under the first simulation number; the fluid simulation module 804 is used to simulate the fluid dynamic effect based on the target speed parameters of each grid in the area to be simulated under the first simulation number.

[0137] In an optional embodiment of the present disclosure, the device may also include a grid processing module and an array construction module. The grid processing module is used to obtain a two-dimensional plane of the area to be simulated, and grid the two-dimensional plane according to a first grid accuracy to obtain multiple grids for the two-dimensional plane; the array construction module is used to construct a two-dimensional array according to the first grid accuracy, and store the initial fluid parameters of the fluid sub-model in each grid at the current number of iterations into the two-dimensional array, so as to obtain the initial fluid parameters of each grid from the two-dimensional array.

[0138] In an optional embodiment of the present disclosure, the initial fluid parameters of each grid include at least the position information of each grid, and the array construction module is used to construct a one-to-one correspondence between the position information of each grid and the index value in the two-dimensional array; according to the corresponding relationship, the initial fluid parameters in each grid are stored in the two-dimensional array elements of the corresponding index value.

[0139] In an optional embodiment of the present disclosure, the device may also include a precision adjustment module, which is used to respond to the adjustment operation on the first grid precision and grid the two-dimensional plane of the simulation area according to the adjusted second grid precision; an array construction module is used to construct a two-dimensional array according to the second grid precision to store the initial fluid parameters of the fluid sub-model in each grid at the current number of iterations into the two-dimensional array.

[0140] In an optional embodiment of the present disclosure, the initial fluid parameters include one or more of the position information of the fluid sub-model in each grid, the ground height, the fluid direction, the fluid height, and the fluid pressure field parameters.

[0141] In an optional embodiment of the present disclosure, the initial fluid parameters include at least the ground surface height and the fluid height; the physical quantity value determination module 802 is used to determine the sum of the ground surface height and the fluid height of the first target grid to obtain the first height sum; determine the sum of the ground surface height and the fluid height of the second target grid to obtain the second height sum; if the first height sum is equal to the second height sum, and the third height sum is less than the second height sum, determine the gravity value between the second target grid and the third target grid, so as to determine the value of the external force transmitted from the second target grid to the third target grid for each fluid sub-model based on the gravity value; the third height sum is the sum of the ground surface height and the fluid height of the third target grid; or, the physical quantity value determination module 802 is used to determine the value of the external force applied to the fluid sub-model of each grid between the first target grid and the second target grid based on the ground between the first target grid and the second target grid if the first height sum is less than the second height sum and is not equal; wherein the distance between the first target grid and the source of the externally applied force is the smallest.

[0142] In an optional embodiment of the present disclosure, the initial fluid parameters include at least the ground surface height and the fluid height, the physical force includes at least the pressure, and the physical quantity value determination module 802 is used to determine the sum of the ground surface height and the fluid height of the fourth target grid to obtain a fourth height sum; determine the sum of the ground surface height and the fluid height of the fifth target grid to obtain a fifth height sum; if the fourth height sum is greater than the fifth height sum, and the distance between the fourth target grid and the source external force is the smallest, then provide a first pressure magnitude to the fourth target grid based on the source external force, and transfer the first pressure magnitude to the fifth target grid; or, the physical quantity value determination module 802 is used to provide a second pressure magnitude to the fifth target grid based on the source external force, and provide a third pressure magnitude from the fourth target grid to the fifth target grid if the fourth height sum is greater than the fifth height sum, and the distance between the fifth target grid and the source external force is the smallest.

[0143] In an optional embodiment of the present disclosure, the magnitude determination module 802 may also be used to provide a fourth pressure magnitude to the fourth target grid based on the external force applied from the source, and transmit the fourth pressure magnitude to the fifth target grid, if the fourth height sum is equal to the fifth height sum and the distance between the fourth target grid and the external force applied from the source is the smallest, and the total pressure magnitude of the fourth target grid is equal to the total pressure magnitude of the fifth target grid.

[0144] In an optional embodiment of the present disclosure, the velocity parameter determination module 803 is used to determine the advection velocity of the fluid sub-model based on the initial velocity parameters of the fluid sub-model in the target grid; determine the diffusion velocity of the fluid sub-model in the target grid according to the advection velocity; determine the velocity of the fluid sub-model in the target grid under the external force based on the diffusion velocity; determine the pressure on the fluid sub-model in the target grid according to the velocity under the external force; and determine the target velocity parameters of the target grid at the current number of iterations based on the pressure and the velocity of the fluid sub-model in the target grid under the external force.

[0145] In an optional embodiment of the present disclosure, the total pressure value of the fluid model maintains a preset pressure value unchanged, and the preset pressure value is determined by the surface tension coefficient of each fluid sub-model.

[0146] The fluid simulation device 800 provided in the embodiment of the present disclosure can execute the technical solution of the fluid simulation method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to those of the fluid simulation method. Please refer to the implementation principle and beneficial effects of the fluid simulation method, and no further details will be given here.

[0147] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.

[0148] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device.

[0149] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0150] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0151] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, radio frequency (RF), etc., or any suitable combination of the foregoing.

[0152] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet Service Provider).

[0153] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0154] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".

[0155] Refer to the following Fig. 9 An electronic device 900 according to this embodiment of the present invention will be described. Fig. 9 The electronic device 900 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0156] like Fig. 9 As shown, the electronic device 900 is in the form of a general computing device. The components of the electronic device 900 may include, but are not limited to: the at least one processing unit 910, the at least one storage unit 920, a bus 930 connecting different system components (including the storage unit 920 and the processing unit 910), and a display unit 940.

[0157] The storage unit stores program codes, which can be executed by the processing unit 910, so that the processing unit 910 executes the steps of various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 910 can execute Figure 2 Steps S201 to S204 shown in FIG.

[0158] The storage unit 920 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 9201 and / or a cache storage unit 9202 , and may further include a read-only storage unit (ROM) 9203 .

[0159] The storage unit 920 may also include a program / utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0160] Bus 930 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0161] The electronic device 900 may also communicate with one or more external devices 1000 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 900, and / or communicate with any device that enables the electronic device 900 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 950. In addition, the electronic device 900 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 960. As shown, the network adapter 960 communicates with other modules of the electronic device 900 via a bus 930. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems.

[0162] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0163] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0164] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0165] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0166] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A fluid simulation method, characterized in that: include: Obtaining initial fluid parameters of the fluid sub-models in each grid of the area to be simulated at the current iteration number, and initial velocity parameters at the current iteration number, wherein the initial fluid parameters and the initial velocity parameters are parameter data obtained by each fluid sub-model based on the previous iteration number of the current iteration number; Determining the physical value of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters; For a target grid among the grids, based on an initial velocity parameter of a fluid sub-model in the target grid and a physical value of a physical force acting on the target grid, determining a target velocity parameter of the target grid at the current number of iterations; Based on the target velocity parameters of the fluid sub-models in the grids at each iteration number, the fluid dynamic effect of the fluid model in the area to be simulated is generated.

2. The method according to claim 1, characterized in that Before obtaining the initial fluid parameters of the plurality of grids in the area to be simulated under the current number of simulations, the method further comprises: Acquire a two-dimensional plane of the area to be simulated, and perform gridding processing on the two-dimensional plane according to a first grid accuracy to obtain a plurality of grids for the two-dimensional plane; A two-dimensional array is constructed according to the first grid accuracy, and the initial fluid parameters of the fluid sub-model in each grid at the current iteration number are stored in the two-dimensional array, so as to obtain the initial fluid parameters of each grid from the two-dimensional array.

3. The method according to claim 2, characterized in that The initial fluid parameters of each grid at least include the position information of each grid, and the initial fluid parameters of the fluid sub-model in each grid at the current iteration number are stored in the two-dimensional array, including: Constructing a one-to-one correspondence between the position information of each grid and the index value in the two-dimensional array; According to the corresponding relationship, the initial fluid parameters in each grid are stored in the two-dimensional array elements of the corresponding index values.

4. The method according to claim 2, characterized in that: The method further comprises: In response to the adjustment operation on the first grid precision, gridding the two-dimensional plane of the to-be-simulated area according to the adjusted second grid precision; A two-dimensional array is constructed according to the second grid precision to store the initial fluid parameters of the fluid sub-model in each grid at the current iteration number into the two-dimensional array.

5. The method according to any one of claims 1 to 4, characterized in that The initial fluid parameters include one or more of the position information of the fluid sub-model in each grid, the ground surface height, the fluid direction, the fluid height, and the fluid pressure field parameters.

6. The method according to claim 1, characterized in that The initial fluid parameters at least include the ground surface height and the fluid height; and determining the physical value of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters includes: Determine the sum of the ground surface height and the fluid height of the first target grid to obtain a first height sum; Determine the sum of the ground surface height and the fluid height of the second target grid to obtain a second height sum; If the first height sum is equal to the second height sum, and the third height sum is less than the second height sum, determine the gravity value between the second target grid and the third target grid, so as to determine the value of the external applied force transmitted from the second target grid to the third target grid of each fluid sub-model based on the gravity value; the third height sum is the sum of the ground surface height of the third target grid and the fluid height; Alternatively, if the first height sum is less than the second height sum and is not equal, then based on the ground surface between the first target grid and the second target grid, a magnitude of the force applied to the outside of the fluid submodel of each grid between the first target grid and the second target grid; Among them, the distance between the first target grid and the source of external force is the smallest.

7. The method according to claim 1, characterized in that The initial fluid parameters at least include the ground surface height and the fluid height, and the physical force at least includes the pressure; and determining the physical value of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters includes: Determine the sum of the surface height and the fluid height of the fourth target grid to obtain a fourth height sum; Determine the sum of the ground surface height and the fluid height of the fifth target grid to obtain a fifth height sum; If the fourth height sum is greater than the fifth height sum and the distance between the fourth target grid and the source external force is the smallest, providing a first pressure magnitude to the fourth target grid based on the source external force, and transmitting the first pressure magnitude to the fifth target grid; Alternatively, if the fourth height sum is greater than the fifth height sum and the distance between the fifth target grid and the source external force is the smallest, a second pressure magnitude is provided to the fifth target grid based on the source external force, and a third pressure magnitude is provided to the fifth target grid by the fourth target grid.

8. The method according to claim 7, characterized in that The method further comprises: If the fourth height sum is equal to the fifth height sum, and the distance between the fourth target grid and the source external force is the smallest, a fourth pressure magnitude is provided to the fourth target grid based on the source external force, and the fourth pressure magnitude is transmitted to the fifth target grid, and the total pressure magnitude of the fourth target grid is equal to the total pressure magnitude of the fifth target grid.

9. The fluid simulation method according to claim 1, characterized in that: The physical force at least includes pressure and external applied force, and the target velocity parameter of the target grid at the current iteration number is determined based on the initial velocity parameter of the fluid sub-model in the target grid and the physical value of the physical force applied to the target grid, including: determining the advection velocity of the fluid submodel based on the initial velocity parameter of the fluid submodel in the target grid; Determining the diffusion velocity of the fluid sub-model in the target grid according to the advection velocity; Based on the diffusion velocity, determining a velocity of the fluid submodel in the target grid under the action of the externally applied force; Determining the pressure exerted on the fluid sub-model in the target grid according to the velocity under the action of the external force; Based on the pressure and the velocity of the fluid sub-model in the target grid under the externally applied force, a target velocity parameter of the target grid at the current iteration number is determined.

10. The method according to claim 9, characterized in that The total pressure value of the fluid model maintains a preset pressure value unchanged, and the preset pressure value is determined by the surface tension coefficient of each of the fluid sub-models.

11. A fluid simulation device, characterized in that: The device comprises: A fluid parameter acquisition module is used to obtain the initial fluid parameters of the fluid sub-models in each grid of the area to be simulated at the current iteration number, and the initial velocity parameters at the current iteration number, wherein the initial fluid parameters and the initial velocity parameters are parameter data obtained by each fluid sub-model based on the previous iteration number of the current iteration number; A physical quantity value determination module, used to determine the physical quantity value of the physical force acting on the fluid sub-model in each grid according to the initial fluid parameters; A speed parameter determination module is used to determine, for a target grid among the grids, a target speed parameter of the target grid at the current number of iterations based on an initial speed parameter of a fluid sub-model in the target grid and a physical value of a physical force acting on the target grid; The fluid simulation module is used to generate the fluid dynamic effect of the fluid model in the area to be simulated based on the target velocity parameters of the fluid sub-models in each grid at each iteration number.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the fluid simulation method according to any one of claims 1 to 10 is implemented.

13. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to perform the fluid simulation method according to any one of claims 1 to 10 by executing the executable instructions.

Citation Information

Patent Citations

  • Fluid mechanics simulation method and device and computer readable storage medium

    CN112613243A

  • Lattice Boltzmann fluid animation simulation method based on implicit particle interpolation

    CN117475040A

  • Generating a smooth grid for simulating fluid flow in a well system environment

    US20150066445A1

Cited By

  • Real-time fluid simulation method and system

    CN121234794A