A fluid unified simulation method and system

By modeling incompressibility, viscosity, and surface tension as incremental potential energy terms in the fluid variational energy, and using a nonlinear optimization method to uniformly solve for the position of fluid particles, the problem of coupling error in particle fluid simulation is solved, achieving higher simulation accuracy and stability.

CN122242380APending Publication Date: 2026-06-19INST OF SOFTWARE - CHINESE ACAD OF SCI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INST OF SOFTWARE - CHINESE ACAD OF SCI
Filing Date
2026-05-13
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing particle fluid simulation methods suffer from coupling errors when calculating incompressibility, viscosity, and surface tension, leading to instability in the simulation process over large time steps and making it difficult to achieve a unified solution for all three.

Method used

A nonlinear optimization method based on variational energy is adopted, which models incompressibility, viscosity and surface tension as incremental potential energy terms in the variational energy of the fluid. The position of fluid particles is solved in a unified way by optimizing the total variational energy of the fluid system. Shear viscosity and volume viscosity calculations are introduced to improve the accuracy and stability of the simulation.

Benefits of technology

It significantly improves the accuracy and stability of fluid simulation, avoids coupling errors in traditional methods, and can independently control the motion pattern of viscous fluids.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122242380A_ABST
    Figure CN122242380A_ABST
Patent Text Reader

Abstract

This invention discloses a unified fluid simulation method and system. The method involves: modeling the incompressibility, viscosity, and surface tension in a fluid system as incremental potential energy terms in the fluid variational energy to obtain the total variational energy of the fluid system; optimizing the total variational energy of the fluid system to obtain the positions of fluid particles; wherein the optimization calculation method is as follows: initializing the simulation calculation step count and the initial positions of the fluid particles; in each simulation step, traversing each fluid particle and calculating its temporary predicted velocity and temporary predicted position; based on the current position of each fluid particle, finding all neighboring fluid particles within a set radius centered on that fluid particle; optimizing the variational energy of the fluid particles based on the neighboring fluid particles and the temporary predicted positions to obtain the positions of the fluid particles; calculating the actual velocities of the fluid particles; and rendering the fluid system based on the final positions of each fluid particle to obtain the simulation results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer graphics, specifically relating to a particle-based unified fluid simulation method and system. Background Technology

[0002] The motion of free-surface flow is typically influenced by three mechanical mechanisms: incompressibility, viscosity, and surface tension. Therefore, accurate and stable calculations of these three mechanisms are fundamental to achieving accurate simulations of most free-surface flows. Traditional particle fluid simulation methods based on the Lagrangian perspective commonly use operator splitting to simulate free-surface flows, calculating the fluid's incompressibility, viscosity, and surface tension separately step by step. This inevitably introduces conflicts between different calculation steps, leading to severe coupling errors. Consequently, simulations of high-viscosity fluids or high-surface-tension fluids with large time steps are highly susceptible to serious errors, and may even result in simulation failure.

[0003] For the coupling problem between different mechanical mechanisms of free surface flow, there are currently three strategies: (1) Constructing a unified linear system for solving free surface flow. However, this method can only achieve the coupling of viscosity and surface tension at this stage, and it is difficult to further incorporate incompressibility into this strategy; (2) Constructing an LCP (Linear Complementarity Problem) system for solving fluid motion. However, this method can only achieve strong coupling between incompressibility and surface tension, and a slightly larger time step may lead to non-convergence; (3) Introducing the SIMPLE (Semi-Implicit Method for Pressure Linked Equation) algorithm strategy. However, this method can only achieve strong coupling between viscosity and incompressibility at present, and it requires multiple calculations of a large-scale linear system with the same number of particles in each calculation step, so its computational efficiency is low.

[0004] Despite some progress, achieving a unified solution for the incompressibility, viscosity, and surface tension of fluids remains a significant challenge. First, the motion of fluids inherently exhibits a nonlinear mechanical response under the influence of these three physical mechanisms, making it extremely difficult to transform their combined effects into a unified linear system. Second, the methods for implementing these three physical mechanisms differ substantially: incompressibility requires imposing global velocity divergence-free constraints or constant density constraints on the flow; viscosity calculations involve second-order differential calculations of the velocity field; and surface tension is related to the curvature of the fluid's free surface. This makes it very difficult to achieve a unified calculation formula for these three different mechanisms within the same framework. Summary of the Invention

[0005] To address the conflict between incompressibility, viscosity, and surface tension calculations caused by operator splitting strategies in particle fluid simulation methods, this invention aims to provide a unified fluid simulation method and system. This invention presents a novel nonlinear optimization method for unifying incompressibility, viscosity, and surface tension. Based on nonlocal interaction theory, this method constructs a unified computational framework for incompressibility, viscosity, and surface tension. Based on a variational energy strategy, this invention transforms fluid motion into a position-based nonlinear optimization problem, thereby achieving a unified solution for fluid dynamics including incompressibility, viscosity, and surface tension.

[0006] This invention transforms fluid simulation into a nonlinear variational energy calculation, modeling incompressibility, viscosity, and surface tension as incremental potential energy terms in the fluid variational energy. Then, it optimizes the total variational energy of the fluid particles to obtain their positions under these three dynamic mechanisms, ultimately achieving a unified solution for fluid motion. Compared to traditional particle fluid simulation methods employing operator splitting strategies, the unified solution method proposed in this invention avoids coupling errors between step-by-step calculations, thus significantly improving the accuracy and stability of fluid simulation. Furthermore, this invention also introduces methods for calculating shear viscosity and volumetric viscosity in simulations of fluids with different surface viscosities, enabling more accurate control of fluid motion at different viscosities.

[0007] The technical solution of this invention is as follows: A unified fluid simulation method, comprising the following steps: The effects of incompressibility, viscosity, and surface tension in a fluid system are modeled as incremental potential energy terms in the fluid variational energy, thus obtaining the total variational energy of the fluid system. The total variational energy of the fluid system is optimized to obtain the positions of fluid particles; the optimization calculation method is as follows: Initialize the simulation step count and the initial positions of the fluid particles; In the nth simulation step, traverse each fluid particle. , causing fluid particles Location And calculate fluid particles Temporary forecast speed and provisional predicted location ;in, It is the acceleration due to gravity. For fluid particles The position after performing n-1 simulation calculation steps. For fluid particles Prediction speed after performing n-1 simulation calculation steps; Based on each fluid particle Current location Find all fluid particles in the fluid particle Centered on, with radius The range of nearby fluid particles; Based on the nearby fluid particles and the provisional predicted location For fluid particles Optimize the variational energy to obtain fluid particles Location Computational fluid dynamics particle physics actual speed ; Update the simulation calculation step count n until the simulation calculation step count n reaches the set maximum number of calculation steps N; The fluid system is rendered based on the final position of each fluid particle to obtain the simulation results of the fluid system.

[0008] Preferably, through total variational energy For fluid particles The variational energy is optimized to obtain the value of each fluid particle. Location Among them, the incremental potential energy function of the total system energy. , For the mass of the fluid particles, This represents the position of the fluid particles before the variational optimization calculations are performed in the current simulation step. Let be the volume potential energy function used to realize the incompressibility of fluids. Let be the viscous incremental potential function used to achieve the viscous effect. This is the incremental potential energy function used to achieve the effect of surface tension.

[0009] Preferably, the volume potential energy function ;in, Fluid particles density, The fluid's static density, This represents the total number of fluid particles.

[0010] Preferably, the viscous incremental potential energy function ;in, Shear viscosity, It is bulk viscosity. For the first derivative of the smooth particle hydrodynamic function, For fluid particles With fluid particles Shear deformation resulting from the interaction between them For fluid particles With fluid particles Volumetric deformation resulting from the interaction between them For fluid particles With fluid particles The initial relative positions between them.

[0011] Preferably, shear deformation Volume deformation ;in, For fluid particles With fluid particles The normal vector between them It is the identity matrix. For fluid particles With fluid particles The relative positions between them.

[0012] Preferably, the incremental potential energy function used to achieve the surface tension effect... ;in, To control the coefficient of surface tension strength, Let be the potential energy change function.

[0013] Preferably, the total variational energy is solved using a semi-implicit iterative method or a nonlinear optimization calculation method. For fluid particles Optimize the variational energy to obtain fluid particles The location.

[0014] A unified fluid simulation system, characterized in that it includes a modeling module, an initialization module, an iterative simulation calculation module, and a rendering module; The modeling module is used to model the effects of incompressibility, viscosity and surface tension in the fluid system as incremental potential energy terms in the fluid variational energy, so as to obtain the total variational energy of the fluid system. The initialization module is used to initialize the simulation calculation step count and the initial position of the fluid particles; The iterative simulation calculation module is used to perform the following calculation when the simulation calculation step count n is less than the set maximum calculation step count N: Traversing every fluid particle , causing fluid particles Location And calculate fluid particles Temporary forecast speed and provisional predicted location ;in, It is the acceleration due to gravity. For fluid particles The position after performing n-1 simulation calculation steps. For fluid particles Prediction speed after performing n-1 simulation calculation steps; Based on each fluid particle Current location Find all fluid particles in the fluid particle Centered on, with radius The range of nearby fluid particles; Based on the nearby fluid particles and the provisional predicted location For fluid particles Optimize the variational energy to obtain fluid particles Location Computational fluid dynamics particle physics actual speed ; Update the simulation calculation step count n; The rendering module is used to render the fluid system according to the final position of each fluid particle to obtain the simulation results of the fluid system.

[0015] A computing device, characterized in that it comprises: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the described method.

[0016] A computer-readable storage medium, characterized in that it stores instructions that, when executed on a computer, cause the computer to perform the above-described method.

[0017] Compared with existing methods, the present invention has the following advantages: (1) The fluid calculation method based on variational energy optimization proposed in this invention can realize the unified calculation of fluid incompressibility, viscosity and surface tension, and avoid the coupling error introduced by the operator splitting strategy and step-by-step solution scheme in the traditional particle method. Therefore, it can greatly improve the accuracy and stability of simulation of high viscosity fluid and high surface tension.

[0018] (2) The viscosity calculation method proposed in this invention can realize independent control of the shear viscosity and volume viscosity of the fluid, and can more accurately control the motion pattern of viscous fluid. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0020] Figure 2 This is a flowchart of the particle position update method of the present invention.

[0021] Figure 3 This is a flowchart of the particle velocity update method of the present invention.

[0022] Figure 4 This is a graph of the surface tension energy function; (a) Kernel function of surface tension potential energy (b) Differential kernel function of surface tension potential energy .

[0023] Figure 5 This is a system diagram of the present invention. Detailed Implementation

[0024] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be described in detail below with reference to specific implementations and accompanying drawings, but this does not constitute a limitation on the present invention.

[0025] like Figure 1 As shown, an optional embodiment of the present invention provides a fluid uniform simulation method, the steps of which include: The effects of incompressibility, viscosity, and surface tension in a fluid system are modeled as incremental potential energy terms in the fluid variational energy, thus obtaining the total variational energy of the fluid system. The total variational energy of the fluid system is optimized to obtain the positions of fluid particles; the optimization calculation method is as follows: Initialize the simulation step count and the initial positions of the fluid particles; In the nth simulation step, traverse each fluid particle. , causing fluid particles Location And calculate fluid particles Temporary forecast speed and provisional predicted location ;in, It is the acceleration due to gravity. For fluid particles The position after performing n-1 simulation calculation steps. For fluid particles Prediction speed after performing n-1 simulation calculation steps; Based on each fluid particle Current location Find all fluid particles in the fluid particle Centered on, with radius The range of nearby fluid particles; Based on the nearby fluid particles and the provisional predicted location For fluid particles Optimize the variational energy to obtain fluid particles Location Computational fluid dynamics particle physics actual speed ; Update the simulation calculation step count n until the simulation calculation step count n reaches the set maximum number of calculation steps N; Render the fluid system according to the final positions of each fluid particle to obtain the simulation result of the fluid system.

[0026] In one embodiment of the present invention, the steps of the fluid unified simulation method are as follows: Step 0. Set the simulation calculation step n to 0, and the initial position of the fluid particle is ; Step 1. If the simulation calculation step count n < N, start the following calculations (N is the maximum number of calculation steps required in the simulation calculation task).

[0027] Step 2. Traverse all fluid particles , and let ; Calculate the temporary predicted velocity of the fluid particle : ; Calculate the temporary predicted position of the fluid particle . Where is the gravitational acceleration, and are the particle positions and velocities obtained from the previous calculation step respectively, is the simulation time step, is the positive integer index number of the particle starting from 0.

[0028] Step 3. Traverse all fluid particles , and find all neighboring fluid particles within the range of their radius based on the particle position ; Step 4. Perform variational energy optimization calculations on the fluid particle position and the neighborhood relationship of each particle, that is: , calculate the position of each fluid particle , and let the final position of the particle in the current calculation step be = ; As shown in Figure 2 ; Step 5. Calculate the actual motion velocity of each fluid particle at the current (n + 1)-th simulation calculation step; Step 6. Use the particle position in the current calculation step for other post-processing calculations of the simulation such as rendering and data output. Update the calculation step count , and repeat the operations between Step 1 and Step 6 until n < N, as shown in Figure 3 .

[0029] In the above calculation process, step 4 is the core content of this invention. This invention treats the simulation of free surface flow as an adaptation to the position of fluid particles. The nonlinear variational optimization process. Based on the variational principle, particle fluid simulation under the combined effects of incompressibility, viscosity, and surface tension is equivalent to the following optimization calculation of the total variational energy of the fluid: The incremental potential energy function of the total energy of the fluid system in the current simulation. It is in the following form: in To predict the temporary velocity of fluid particles The location to be calculated, i.e.: , For the mass of the fluid particles, This represents the position of the fluid particle before the variational optimization calculation is performed in the current simulation step. This is the volume potential energy function used to realize the incompressibility of fluids; Let be the viscous incremental potential function used to achieve the viscous effect; This refers to the incremental potential energy used to achieve surface tension. The variable for all three incremental potentials is the particle position after deformation. .

[0030] In the variational energy of the above system, the volume potential energy function used to achieve incompressibility is... The format is as follows: Here The incompressibility constraint strength coefficient. The fluid's static density, Fluid particles density, Assign particle index numbers, The total number of fluid particles is calculated using the density calculation method of SPH (Smooth Particle Hydrodynamics), which is as follows: , For fluid particles With fluid particles The relative positions between them, that is: , For fluid particles With fluid particles The modulus of their relative positions, i.e., the Euclidean distance. This refers to the Kernel function in the SPH method. is the neighborhood radius in the SPH method.

[0031] Incremental potential energy function used to achieve viscous action The following formula is used for calculation: in, and These are shear viscosity and volume viscosity, respectively. For fluid particles in the current calculation step With fluid particles The initial relative positions between them, that is: , Let SPH be the first derivative of the function, i.e.: , and Particles With particles The specific calculation method for the shear deformation and volumetric deformation between them is as follows: Here For fluid particles With fluid particles The normal vector between them, that is: ; It is an identity matrix.

[0032] Incremental potential energy function used to achieve surface tension as follows in, To control the coefficient of surface tension strength, Let be the potential energy change function, when the fluid particle With fluid particles Spacing between For fluid particles With fluid particles When the initial default spacing between the simulations is used, The function takes its minimum value.

[0033] Step 4 in the calculation process of this invention involves calculating the total variational energy of the currently simulated fluid system. Optimization calculations can be performed using semi-implicit iterative methods or other nonlinear optimization methods to obtain the positions of fluid particles that simultaneously satisfy incompressibility, viscosity, and surface tension. .

[0034] The hardware platform for this invention uses an Intel i7-14700K 20-core CPU with a clock speed of 3.4GHz and an NVIDIA GeForce GTX4080 graphics card with 16GB of video memory. The system program is written in C++, with CUDA language used for acceleration of the parallel computing portion, and open-source libraries such as OpenGL were used during development.

[0035] Optimization calculation of variational energy of fluid particles: A semi-implicit continuous iterative calculation method can be used to achieve variational energy... The optimization first requires... The calculation of each potential energy term in the formula is related to... The first-order differential, where the differential forms of each potential energy function are as follows: Volume potential energy function The differential form is: Here , It is an identity matrix.

[0036] Viscous potential energy function The differential form is: Here ,matrix and They are respectively: , .

[0037] Surface tension potential energy function The differential form is: Here , for The first derivative.

[0038] Drawing inspiration from the semi-implicit successive substitution method, the energy optimization process for fluid particles can be achieved through iterative calculation of the following formula: in This represents the number of semi-implicit iterations. ; ; Here , , , ; here and functions respectively The part that takes always positive values ​​and the part that takes always negative values.

[0039] Surface tension variation function: To ensure stable convergence of the semi-implicit continuous iterative calculation, the surface tension potential energy differential function... It needs to be broken down into a consistently positive part and a consistently negative part, that is: )= This section uses a cubic spline curve as an example to illustrate the method of splitting the positive and negative terms of this function. If the formula for the surface tension energy kernel function is: The initial spacing between the particles. As a function variable, its first-order differential function is: The consistently positive and consistently negative parts are respectively: The above surface tension energy kernel function and its differential function like Figure 4 As shown.

[0040] like Figure 5 As shown, an optional embodiment of the present invention provides a unified fluid simulation system, characterized in that it includes a modeling module, an initialization module, an iterative simulation calculation module, and a rendering module; The modeling module is used to model the effects of incompressibility, viscosity and surface tension in the fluid system as incremental potential energy terms in the fluid variational energy, so as to obtain the total variational energy of the fluid system. The initialization module is used to initialize the initial positions of the fluid particles in the simulation calculation step count; The iterative simulation calculation module is used to perform the following calculation when the simulation calculation step count n is less than the set maximum calculation step count N: Traversing every fluid particle , causing fluid particles Location And calculate fluid particles Temporary forecast speed and provisional predicted location ;in, It is the acceleration due to gravity. For fluid particles The position after performing n-1 simulation calculation steps. For fluid particles Prediction speed after performing n-1 simulation calculation steps; Based on each fluid particle Current location Find all fluid particles in the fluid particle Centered on, with radius The range of nearby fluid particles; Based on the nearby fluid particles and the provisional predicted location For fluid particles Optimize the variational energy to obtain fluid particles Location Computational fluid dynamics particle physics actual speed ; Update the simulation calculation step count n; The rendering module is used to render the fluid system according to the final position of each fluid particle to obtain the simulation results of the fluid system.

[0041] A computing device, characterized in that it comprises: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the described method.

[0042] A computer-readable storage medium, characterized in that it stores instructions that, when executed on a computer, cause the computer to perform the above-described method.

[0043] The above are preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A unified fluid simulation method, comprising the following steps: The effects of incompressibility, viscosity, and surface tension in a fluid system are modeled as incremental potential energy terms in the fluid variational energy, thus obtaining the total variational energy of the fluid system. The total variational energy of the fluid system is optimized to obtain the positions of fluid particles; the optimization calculation method is as follows: Initialize the simulation step count and the initial positions of the fluid particles; In the nth simulation step, traverse each fluid particle. , causing fluid particles Location And calculate fluid particles Temporary forecast speed and provisional predicted location ;in, It is the acceleration due to gravity. For fluid particles The position after performing n-1 simulation calculation steps. For fluid particles Prediction speed after performing n-1 simulation calculation steps; Based on each fluid particle Current location Find all fluid particles in the fluid particle Centered on, with radius The range of nearby fluid particles; Based on the nearby fluid particles and the provisional predicted location For fluid particles Optimize the variational energy to obtain fluid particles Location Computational fluid dynamics particle physics actual speed ; Update the simulation calculation step count n until the simulation calculation step count n reaches the set maximum number of calculation steps N; The fluid system is rendered based on the final position of each fluid particle to obtain the simulation results of the fluid system.

2. The method according to claim 1, characterized in that, Through total variational energy For fluid particles The variational energy is optimized to obtain the value of each fluid particle. Location Among them, the incremental potential energy function of the total system energy. , For the mass of the fluid particles, This represents the position of the fluid particles before the variational optimization calculations are performed in the current simulation step. Let be the volume potential energy function used to realize the incompressibility of fluids. Let be the viscous incremental potential function used to achieve the viscous effect. This is the incremental potential energy function used to achieve the effect of surface tension.

3. The method according to claim 2, characterized in that, The volume potential energy function ;in, Fluid particles density, The fluid's static density, The total number of fluid particles. It is the constraint strength coefficient for incompressibility.

4. The method according to claim 2, characterized in that, The viscous incremental potential energy function ;in, Shear viscosity, It is bulk viscosity. For the first derivative of the smooth particle hydrodynamic function, For fluid particles With fluid particles Shear deformation resulting from the interaction between them For fluid particles With fluid particles Volumetric deformation resulting from the interaction between them For fluid particles With fluid particles The initial relative positions between them.

5. The method according to claim 4, characterized in that, Shear deformation Volume deformation ;in, For fluid particles With fluid particles The normal vector between them It is the identity matrix. For fluid particles With fluid particles The relative positions between them.

6. The method according to claim 2, characterized in that, The incremental potential energy function used to achieve surface tension ;in, To control the coefficient of surface tension strength, Let be the potential energy change function.

7. The method according to claim 2, characterized in that, The total variational energy can be solved using semi-implicit iterative methods or nonlinear optimization methods. For fluid particles Optimize the variational energy to obtain fluid particles The location.

8. A unified fluid simulation system, characterized in that, It includes a modeling module, an initialization module, an iterative simulation calculation module, and a rendering module; The modeling module is used to model the effects of incompressibility, viscosity and surface tension in the fluid system as incremental potential energy terms in the fluid variational energy, so as to obtain the total variational energy of the fluid system. The initialization module is used to initialize the simulation calculation step count and the initial position of the fluid particles; The iterative simulation calculation module is used to perform the following calculation when the simulation calculation step count n is less than the set maximum calculation step count N: Traversing every fluid particle , causing fluid particles Location And calculate fluid particles Temporary forecast speed and provisional predicted location ;in, It is the acceleration due to gravity. For fluid particles The position after performing n-1 simulation calculation steps. For fluid particles Prediction speed after performing n-1 simulation calculation steps; Based on each fluid particle Current location Find all fluid particles in the fluid particle Centered on, with radius The range of nearby fluid particles; Based on the nearby fluid particles and the provisional predicted location For fluid particles Optimize the variational energy to obtain fluid particles Location Computational fluid dynamics particle physics actual speed ; Update the simulation calculation step count n; The rendering module is used to render the fluid system according to the final position of each fluid particle to obtain the simulation results of the fluid system.

9. A computing device, characterized in that, include: A processor, a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A storage instruction that, when executed on a computer, causes the computer to perform the method as described in any one of claims 1 to 7.