Lattice Boltzmann fluid animation simulation method based on implicit particle interpolation
By adopting the lattice Boltzmann fluid animation simulation method based on implicit particle interpolation in the fluid simulation technology, the challenge of simulation time efficiency and volume conservation in the prior art is solved, and efficient fluid simulation is achieved.
Patent Information
- Application Number
- CN202311301157.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-09
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2043-10-09
AI Technical Summary
Existing fluid simulation techniques have challenges in increasing simulation time efficiency and maintaining volume conservation, resulting in longer computational fluid simulation time.
The lattice Boltzmann fluid animation simulation method based on implicit particle interpolation is adopted to perform collision operations and distribution functions by controlling the mesh in the grid set, update the velocity and position of particles, and perform particle resampling to improve the simulation efficiency.
By improving the efficiency of simulated fluid simulation, the time of computational fluid simulation is reduced and volume conservation is effectively maintained.
Smart Images

Figure CN117475040B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the technical field of fluid simulation of computer animation, and in particular to a lattice Boltzmann fluid animation simulation method based on implicit particle interpolation. Background Art
[0002] The basic methods of fluid simulation are divided into Euler method, Lagrangian method and hybrid Euler-Lagrangian method. Among them, the hybrid method has become a popular fluid simulation method because it integrates the advantages of grid-based Euler method and particle-based Lagrangian method. Implicit particle-based methods, such as FLIP, APIC and MPM, have been widely studied. Although FLIP-related methods are widely used, there are still challenges in increasing the time efficiency of simulation and maintaining volume conservation.
[0003] However, when using the above method for fluid simulation, the following technical problems often occur:
[0004] The iterative numerical calculation steps and a large number of particle operation steps will consume a lot of time in the simulation for fluid simulation. In addition, the existing improvement scheme for volume conservation will further consume the time for computational fluid simulation due to the increased complexity of the algorithm.
[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention
[0006] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0007] Some embodiments of the present disclosure propose a lattice Boltzmann fluid animation simulation method, device, electronic device and computer-readable medium based on implicit particle interpolation to solve one or more of the technical problems mentioned in the above background technology section.
[0008] In a first aspect, some embodiments of the present disclosure provide a lattice Boltzmann fluid animation simulation method based on implicit particle interpolation, the method comprising: controlling each grid in a grid set to perform a collision operation, and determining a distribution function after the collision; moving an interface corresponding to the grid set according to grid information included in each grid in the grid set; for each grid in the grid set, performing the following processing steps: executing a flow of a distribution function on the grid to generate a function flow, and determining a grid mass flow according to the function flow; updating a velocity of each particle on the grid; for each particle after the velocity is updated, updating a position of the particle; and performing particle resampling processing on each grid in the grid set according to a target area.
[0009] In a second aspect, some embodiments of the present disclosure provide a lattice Boltzmann fluid animation simulation device based on implicit particle interpolation, the device comprising: a control unit, configured to control each grid in a grid set to perform a collision operation, and to determine a distribution function after the collision; a moving unit, configured to move an interface corresponding to the grid set according to grid information included in each grid in the grid set; an execution unit, configured to perform the following processing steps for each grid in the grid set: execute the flow of the distribution function on the grid to generate a function flow, and determine the grid mass flow according to the function flow; update the speed of each particle on the grid; for each particle after the speed is updated, update the position of the particle; a particle resampling unit, configured to perform particle resampling processing on each grid in the grid set according to the target area.
[0010] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.
[0011] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.
[0012] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the lattice Boltzmann fluid animation simulation method based on implicit particle interpolation of some embodiments of the present disclosure, the time for calculating fluid simulation is reduced. Specifically, the reason for consuming a lot of time for fluid simulation is that iterative numerical calculation steps and a large number of particle operation steps are required, which will consume a lot of time for fluid simulation in the simulation. In addition, the existing improvement scheme for volume conservation will further consume the time for calculating fluid simulation due to the increased complexity of the algorithm. Based on this, the lattice Boltzmann fluid animation simulation method based on implicit particle interpolation of some embodiments of the present disclosure, first, control each grid in the grid set to perform collision operations, and determine the distribution function after the collision. Thus, the collision of the surface fluid can be simulated, and the distribution function after the collision can be determined. Secondly, according to the grid information included in each grid in the above-mentioned grid set, the interface corresponding to the above-mentioned grid set is moved. Thus, the interface of the fluid can be moved. Then, for each grid in the above-mentioned grid set, the following processing steps are performed: first, the flow of the distribution function is performed on the above-mentioned grid to generate the function flow amount, and the grid mass flow amount is determined according to the above-mentioned function flow amount. Thus, the flow of the mass of the grid can be determined. Second, the velocity of each particle on the above-mentioned grid is updated. Thus, the velocity change of the particle caused by the mass flow can be determined. Third, for each particle after the velocity is updated, the position of the above-mentioned particle is updated. Thus, the position of the particle whose velocity has changed can be updated. Finally, according to the target area, the particles in the above-mentioned grid set are subjected to particle resampling processing. Thus, the simulation of the fluid is completed. By mixing the Euler-Lagrangian idea, based on highly parallel calculations and the use of implicit interpolation particles, the efficiency of the simulation of the fluid is improved, thereby reducing the time for computational fluid simulation. Moreover, by resampling the particles in the narrowband area, the number of particles is greatly reduced, the particle operation time is saved, and the time for computational fluid simulation is further reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
[0014] Figure 1 is a flowchart of some embodiments of a lattice Boltzmann fluid animation simulation method based on implicit particle interpolation according to the present disclosure;
[0015] Figure 2 It is a structural schematic diagram of some embodiments of the lattice Boltzmann fluid animation simulation device based on implicit particle interpolation according to the present disclosure;
[0016] Figure 3 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0017] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0018] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0019] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0020] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0021] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0022] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0023] Figure 1 The flowchart 100 of some embodiments of the lattice Boltzmann fluid animation simulation method based on implicit particle interpolation according to the present disclosure is shown. The lattice Boltzmann fluid animation simulation method based on implicit particle interpolation includes the following steps:
[0024] Step 101, controlling each grid in the grid set to perform a collision operation, and determining a distribution function after the collision.
[0025] In some embodiments, the execution subject (e.g., server) of the lattice Boltzmann fluid animation simulation method based on implicit particle interpolation can control each grid in the grid set to perform a collision operation, and determine the distribution function after the collision. The above-mentioned collision operation can be a collision operation performed by a single relaxation collision model. Here, the distribution function after the collision can be expressed by the following formula:
[0026]
[0027] Among them, f i ′ represents the distribution function after collision. i represents the distribution function. X represents the grid position. t represents the current time. τ represents the relaxation time. represents the equilibrium distribution function, i represents the dimension of velocity discretization, and eq represents the equilibrium state. Here, the equilibrium distribution function can be determined by the following formula:
[0028]
[0029] Among them, c i represents the unitized discrete velocity of the lattice model. u represents the velocity. ω i represents the weight of the i-th dimension. ρ represents the density. c s The lattice model may be a discrete velocity model of a grid, including discrete numbers of spatial dimensions and velocities. For example, in response to the space being a three-dimensional space, the velocity is discretized into 19 directions, and the lattice model may be a D3Q19 lattice model. Here, ρ and U may be expressed by the following formulas:
[0030]
[0031] Step 102: moving the interface corresponding to the grid set according to the grid information included in each grid in the grid set.
[0032] In some embodiments, the execution subject may move the interface corresponding to the grid set according to the grid information included in each grid in the grid set. The grid information may be the grid quality. The interface may include multiple interface grids. In practice, the movement of the interface may be determined by the following formula:
[0033] m(x, t+Δt)>(1+κ)ρ(x, t+Δt) Filled grid
[0034] m(x, t+Δt)<(0-κ)ρ(x, t+Δt) Cleared grid.
[0035] Where κ = 10 -3, κ represents the threshold to prevent frequent interface transformation. Δt represents the time step. The above-mentioned filled grid and the above-mentioned cleared grid can be two intermediate grid types. In order to ensure the closure of the interface, the grid type needs to be reinitialized according to these two intermediate types. First, for each air grid around the filled grid, each of the above air grids is converted into an interface grid. The distribution function of each air grid is used To initialize. Among them, ρ avg Represents the average density of the grids around a certain air grid, u avg Indicates the average velocity of the meshes around a certain air mesh, and avg indicates the average value. Second, the filled mesh is converted into a fluid mesh, and the air meshes around the filled mesh are converted into interface meshes. Third, the air meshes around all the empty meshes are converted into interface meshes. In this way, the interface of the fluid can be moved.
[0036] When the interface of the fluid is moved, since the default mass of the fluid grid is m=ρ and the mass of the air grid is m=0, the mass will be lost after the interface moves. To ensure mass conservation, when converting the two intermediate grid types to fluid or air grids, excess mass needs to be allocated:
[0037]
[0038] Among them, m ex Indicates excess mass. total Indicates all w i The sum of. ex means excess. total means the sum. w i It can be expressed by the following formula:
[0039]
[0040]
[0041] Where n represents the normal direction of the interface.
[0042] Step 103: for each grid in the grid set, perform the following processing steps:
[0043] Step 1031 , performing the flow of the distribution function on the grid to generate the function flow quantity, and determining the grid quality flow quantity according to the function flow quantity.
[0044] In some embodiments, the execution subject may execute the flow of the distribution function on the grid to generate the function flow quantity, and determine the grid quality flow quantity according to the function flow quantity. In practice, the execution subject may execute the flow of the distribution function by the following formula:
[0045] fi (x+c i Δt, t+Δt)=f i ′(x, t).
[0046] Thus, the grid mass flow can be determined by the following formula:
[0047]
[0048] in, Indicates the opposite direction of i. ε indicates the volume fraction. Δm indicates the mass change. Δm i Represents the mass change in the l direction. The total mass of the above grid is calculated from the mass change in each direction:
[0049] m(x,t+Δt)=m(x,t)+∑Δm i (x, t+Δt).
[0050] Since the distribution function of the air grid f i = 0, so the distribution function from the air grid direction needs to be reconstructed. In order to balance the forces on both sides of the interface, the forces from the interface normal direction should also be reconstructed. The calculation method of the reconstructed distribution function is:
[0051]
[0052] Among them, ρ A =1, indicating the density of air. The normal direction satisfies:
[0053]
[0054] Among them, j represents the position of the length dimension in three-dimensional space, k represents the position of the width direction in three-dimensional space, and l represents the position of the height dimension in three-dimensional space.
[0055] To maintain the stability of the simulation, the time step needs to be adjusted.
[0056] Step 1032, updating the velocity of each particle on the grid.
[0057] In some embodiments, the execution entity may update the speed of each particle on the grid. Here, in response to the cumulative time step reaching 1.0, the execution entity may update the speed of each particle on the grid. The speed is a vector speed.
[0058] In some optional implementations of some embodiments, for each particle on the grid, the velocity and velocity increment of the particle may be determined, and the velocity of the particle may be updated based on the velocity and velocity increment. Here, trilinear interpolation is used to transmit the velocity and velocity increment (the change in velocity before and after the collision) stored on the grid to the particle:
[0059] u o =∑ v u v S(x v -x o )
[0060]
[0061] Among them, u v represents the velocity stored on the grid, x v Indicates the grid position, X o represents the particle position, u O Represents the particle velocity, the grid variable is stored at the center point of the grid, and d represents the differential sign. S() represents the trilinear interpolation function. O represents the Oth particle. v represents the vth grid. Here, only the fluid grid and the interface grid have valid velocities, so the particles near the interface will have undersampling problems during interpolation. Therefore, the velocity of the interface grid needs to be extrapolated one layer, that is, the velocity of a layer of air grid adjacent to the interface grid is equal to the velocity of the adjacent interface grid.
[0062] Update the particle's velocity:
[0063]
[0064] Here, α is a parameter similar to that in classic FLIP, which is used to control the dissipation. represents the velocity interpolated from the grid, represents the velocity increment obtained from grid interpolation, PIC and FLIP represent different simulation methods.
[0065] Step 1033, for each particle after the speed is updated, the position of the particle is updated.
[0066] In some embodiments, the execution subject may update the position of each particle after the speed is updated. In practice, the position of the particle may be updated by a semi-Lagrangian method. Here, the time step for updating the position of the particle is 1.
[0067] Step 104 , performing particle resampling processing on each grid in the grid set according to the target area.
[0068] In some embodiments, the execution entity may perform particle resampling processing on each grid in the grid set according to the target area.
[0069] In practice, the following steps can be used to perform particle resampling on each grid in the above grid set:
[0070] In the first step, in response to the target region characterizing the fluid region, the following first resampling step is performed:
[0071] In the first sub-step, at least one grid in the above grid set that meets the first filling condition is subjected to particle filling processing. The first filling condition may be that the number of particles on the grid is less than the preset number of particles. In practice, the particle filling processing may be to fill the particles on the grid to the preset number of particles. In practice, before the collision operation performed in step 101, each grid is filled with Y particles. As an example, Y may be 8. The volume ε of each particle is o =1 / Y. For each fluid grid, in response to the number of particles being less than ε / ε o , then the number of particles is replenished to ε / ε o The velocity of the added particle is equal to the average velocity of other particles in the grid. If there are no particles in the grid before filling, the initial velocity is obtained by trilinear interpolation.
[0072] The second sub-step is to remove particles on at least one grid in the above grid set that meets the preset removal condition to a preset number of particles. The preset removal condition may be that the number of particles on the grid is greater than a preset removal number threshold, and the grid is not an interface grid. The preset removal number threshold may be a preset maximum value of particles on the grid. For example, the preset removal number threshold may be 1.5ε / ε o To avoid artifacts, particles in the interface mesh are not removed.
[0073] Optionally, after the first step, in response to the target region characterizing the narrowband region, a second resampling step is performed as follows:
[0074] The first sub-step is to initialize the level set field of the above grid. Here, the initialized level set field φ can be expressed as follows:
[0075]
[0076] The second sub-step is to initialize the scalar field of the above grid. The scalar field L is used to represent the grid hierarchy, and the interface grid L = 0. The condition for defining the two grids at positions X1 and X2 to be adjacent is that their Euclidean distance is equal to 1, that is, |x1-x2| = 1. After that, a hierarchy-based method is used to calculate the L of the remaining grids. If a grid is adjacent to the grid of the previous layer, then its hierarchy:
[0077] L=L last +s.
[0078] For the fluid grid, s = -1, and for the air grid, s = 1. In order to meet the requirements of the narrowband solution, the calculation can be performed up to the r+2 layer, where r represents the narrowband width. The remaining grid level L = s·(r+3). last represents the previous grid layer. L last A scalar field representing the previous grid level.
[0079] The third sub-step is to select each grid that meets the preset grid condition from the above grid set as the target grid set. The grid that meets the preset grid condition may be a grid other than the interface grid.
[0080] The fourth sub-step is to determine the level set value according to the target grid set. Here, the level set value of the target grid set can be determined. In practice, the level set value can be determined by the following formula:
[0081]
[0082] in, Represents the average value of the level set value of the previous layer of grids. For obstacle grids, let the level set value of the above obstacle grid be equal to the value of the adjacent non-obstacle grid.
[0083] The fifth sub-step is to perform a second resampling process on each grid in the above-mentioned grid set according to the above-mentioned level set value. In practice, first, particle filling processing can be performed on at least one grid in the above-mentioned grid set that meets the first filling condition within a preset area. The above-mentioned preset area range can be -1.0<φ<-r. Second, particles on at least one grid in the above-mentioned grid set that meets the preset removal condition can be removed to a preset number of particles within the preset area. In addition, there are 2 types of particles that need to be removed, namely, redundant particles in the narrowband area and particles outside the narrowband area. The level set value φ of each particle i It is obtained by the level set field φ on a trilinear interpolation grid.
[0084] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the lattice Boltzmann fluid animation simulation method based on implicit particle interpolation of some embodiments of the present disclosure, the time for calculating fluid simulation is reduced. Specifically, the reason for consuming a lot of time for fluid simulation is that iterative numerical calculation steps and a large number of particle operation steps are required, which will consume a lot of time for fluid simulation in the simulation. In addition, the existing improvement scheme for volume conservation will further consume the time for calculating fluid simulation due to the increased complexity of the algorithm. Based on this, the lattice Boltzmann fluid animation simulation method based on implicit particle interpolation of some embodiments of the present disclosure, first, control each grid in the grid set to perform collision operations, and determine the distribution function after the collision. Thus, the collision of the surface fluid can be simulated, and the distribution function after the collision can be determined. Secondly, according to the grid information included in each grid in the above-mentioned grid set, the interface corresponding to the above-mentioned grid set is moved. Thus, the interface of the fluid can be moved. Then, for each grid in the above-mentioned grid set, the following processing steps are performed: first, the flow of the distribution function is performed on the above-mentioned grid to generate the function flow amount, and the grid mass flow amount is determined according to the above-mentioned function flow amount. Thus, the flow of the mass of the grid can be determined. Second, the velocity of each particle on the above-mentioned grid is updated. Thus, the velocity change of the particle caused by the mass flow can be determined. Third, for each particle after the velocity is updated, the position of the above-mentioned particle is updated. Thus, the position of the particle whose velocity has changed can be updated. Finally, according to the target area, the particles in the above-mentioned grid set are subjected to particle resampling processing. Thus, the simulation of the fluid is completed. By mixing the Euler-Lagrangian idea, based on highly parallel calculations and the use of implicit interpolation particles, the efficiency of the simulation of the fluid is improved, thereby reducing the time for computational fluid simulation. Moreover, by resampling the particles in the narrowband area, the number of particles is greatly reduced, the particle operation time is saved, and the time for computational fluid simulation is further reduced.
[0085] Further references Figure 2 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a lattice Boltzmann fluid animation simulation device based on implicit particle interpolation. These device embodiments are similar to Figure 1 Corresponding to the method embodiments shown, the lattice Boltzmann fluid animation simulation device based on implicit particle interpolation can be specifically applied to various electronic devices.
[0086] like Figure 2As shown, some embodiments of the lattice Boltzmann fluid animation simulation device 200 based on implicit particle interpolation include: a control unit 201, a moving unit 202, an execution unit 203 and a particle resampling unit 204. The control unit 201 is configured to control each grid in the grid set to perform a collision operation and determine the distribution function after the collision; the moving unit 202 is configured to move the interface corresponding to the above grid set according to the grid information included in each grid in the above grid set; the execution unit 203 is configured to perform the following processing steps for each grid in the above grid set: execute the flow of the distribution function on the above grid to generate the function flow amount, and determine the grid mass flow amount according to the above function flow amount; update the speed of each particle on the above grid; for each particle after the speed is updated, update the position of the above particle; the particle resampling unit 204 is configured to perform particle resampling processing on each grid in the above grid set according to the target area.
[0087] It can be understood that the units recorded in the lattice Boltzmann fluid animation simulation device 200 based on implicit particle interpolation are similar to the reference Figure 1 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the lattice Boltzmann fluid animation simulation device 200 based on implicit particle interpolation and the units contained therein, and will not be described in detail here.
[0088] Reference below Figure 3 , which shows a schematic diagram of the structure of an electronic device 300 suitable for implementing some embodiments of the present disclosure. The electronic devices in some embodiments of the present disclosure may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0089] like Figure 3As shown, the electronic device 300 may include a processing device 301 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0090] Typically, the following devices may be connected to the I / O interface 305: input devices 306 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 308 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 309. The communication devices 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 3 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 3 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0091] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 309, or installed from the storage device 308, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.
[0092] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-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 of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer 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. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0093] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0094] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: controls each grid in the grid set to perform a collision operation, and determines the distribution function after the collision. According to the grid information included in each grid in the grid set, the interface corresponding to the grid set is moved. For each grid in the grid set, the following processing steps are performed: the flow of the distribution function is performed on the grid to generate a function flow, and the grid mass flow is determined based on the function flow; the speed of each particle on the grid is updated; for each particle after the speed is updated, the position of the particle is updated. According to the target area, particle resampling processing is performed on each grid in the grid set.
[0095] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0096] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0097] The units described in some embodiments of the present disclosure may be implemented by software or by hardware. The described units may also be arranged in a processor, for example, may be described as: a processor includes a control unit, a mobile unit, an execution unit and a particle resampling unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the control unit may also be described as "a unit for controlling each grid in a grid set to perform collision operations and determining a distribution function after the collision".
[0098] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0099] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.
Claims
1. A lattice Boltzmann fluid animation simulation method based on implicit particle interpolation, comprising: Control each mesh in the mesh set to perform collision operations and determine the distribution function after the collision; According to the grid information included in each grid in the grid set, the interface corresponding to the grid set is moved; For each grid in the grid set, perform the following processing steps: A distribution function flow is performed on the grid to generate a function flow quantity, and a grid mass flow quantity is determined according to the function flow quantity, wherein the distribution function flow is performed by the following formula: f i (x+c i Δt,t+Δt)=f′ i (x,t), Among them, f i ′ is the distribution function after collision, X is the grid position, t is the current time, c i is the unitized discrete velocity of the lattice model, f i is the distribution function; The mesh mass flow is determined by the following formula: in, is the opposite direction of i, ε is the volume fraction, Δm is the mass change, Δm i is the mass change in the i direction, c i is the unitized discrete velocity of the lattice model, and the total mass of the grid is calculated from the mass change in each direction: m(x,t+△t)=m(x,t)+ΣΔm i (x,t+△t) Since the distribution function of the air grid f i =0, so the distribution function from the air grid direction needs to be reconstructed. In order to balance the forces on both sides of the interface, the forces from the interface normal direction should also be reconstructed. The calculation method of the reconstructed distribution function is: Among them, ρ A =1, is the density of air, X is the grid position, t is the current time, f i eq is the equilibrium distribution function, u is the velocity, is the opposite direction of i, f i ′ is the distribution function after collision, f i is the distribution function, and the normal direction satisfies: Among them, j is the position of the length dimension in three-dimensional space, k is the position of the width direction in three-dimensional space, and l is the position of the height dimension in three-dimensional space. is the opposite direction of i; Update the velocity of each particle on the grid, where the velocity and velocity delta stored on the grid are transferred to the particle using trilinear interpolation: Among them, u v is the velocity stored on the grid, X v is the grid position, X O is the particle position, u O is the particle velocity, the grid variable is stored at the center point of the grid, d is the differential sign, S() is the trilinear interpolation function, O is the Oth particle, and v is the vth grid. Here, only the fluid grid and the interface grid have valid velocities, so the particles near the interface will have undersampling problems during interpolation. Therefore, the velocity of the interface grid needs to be extrapolated one layer, that is, the velocity of a layer of air grid adjacent to the interface grid is equal to the velocity of the adjacent interface grid; Update the particle's velocity: Among them, α is used to control the dissipation, is the velocity interpolated from the grid, is the velocity increment obtained from the grid interpolation, PIC and FLIP are different simulation methods; For each particle after the speed is updated, the position of the particle is updated; according to the target area, each grid in the grid set is subjected to particle resampling processing; The step of performing particle resampling processing on each grid in the grid set according to the target area includes: In response to the target region characterizing the fluid region, a first resampling step is performed as follows: Perform particle filling processing on at least one grid in the grid set that meets the first filling condition, wherein the first filling condition is that the number of particles on the grid is less than the preset number of particles, and before performing the collision operation, each grid is filled with Y particles, and the volume of each particle ε o = 1 / Y, for each fluid grid, in response to the number of particles being less than ε / ε o , then the number of particles is replenished to ε / ε o , the speed of the added particle is equal to the average speed of other particles in the grid. If there are no particles in the grid before filling, the initial speed is obtained by trilinear interpolation; Removing particles on at least one grid in the grid set that meets a preset removal condition to a preset number of particles, wherein the preset removal condition is that the number of particles on the grid is greater than a preset removal number threshold, and the grid is not an interface grid, and the preset removal number threshold is a preset maximum value of particles on the grid; In response to the target region characterizing a narrowband region, performing a second resampling step as follows: Initialize the level set field of the grid, where the initialized level set field φ is expressed by the following formula: Initialize the scalar field of the grid, where the scalar field L represents the grid hierarchy. Let the interface grid L = 0. Define the condition that two grids at positions x1 and x2 are adjacent is that their Euclidean distance is equal to 1, that is, |x1-x2| = 1. Calculate L of the remaining grids. If a grid is adjacent to the grid of the previous layer, then its hierarchy is: LL last +S, For the fluid grid, s = -1, and for the air grid, s = 1. In order to meet the requirements of the narrowband solution, the calculation is performed up to the r+2 layer, where r is the narrowband width, and the level of the remaining grids is L = s·(r+3), last is the previous grid, L last is the scalar field of the previous grid; Selecting each grid that meets the preset grid condition from the grid set as the target grid set; According to the target grid set, a level set value is determined, wherein the level set value is determined by the following formula: in, is the average value of the level set value of the previous grid; According to the level set value, a second resampling process is performed on each grid in the grid set, wherein a particle filling process is performed on at least one grid in the grid set that meets the first filling condition within a preset area range, wherein the preset area range is -1.0<φ<-r, and within the preset area range, particles on at least one grid in the grid set that meets the preset removal condition are removed to a preset number of particles, and the level set value φ of each particle i It is obtained by the level set field φ on a trilinear interpolation grid.
2. The method according to claim 1, wherein: The updating of the velocity of each particle on the grid comprises: For each particle on the grid, a velocity and a velocity increment of the particle are determined, and the velocity of the particle is updated according to the velocity and the velocity increment.
3. A lattice Boltzmann fluid animation simulation device based on implicit particle interpolation, comprising: A control unit configured to control each grid in the grid set to perform a collision operation and determine a distribution function after the collision; A moving unit, configured to move an interface corresponding to the grid set according to grid information included in each grid in the grid set; The execution unit is configured to perform the following processing steps for each grid in the grid set: executing the flow of the distribution function on the grid to generate the function flow amount, and determining the grid mass flow amount according to the function flow amount; updating the speed of each particle on the grid; for each particle after the speed is updated, updating the position of the particle; the execution unit is further configured to: wherein, executing the flow of the distribution function on the grid to generate the function flow amount, and determining the grid mass flow amount according to the function flow amount, includes: The flow of the distribution function is performed by the following formula: f i (x+·c i Δt,t+Δt)=f′ i (x,t), Among them, f′ i is the distribution function after collision, X is the grid position, t is the current time, c i is the unitized discrete velocity of the lattice model, f i is the distribution function; The mesh mass flow is determined by the following formula: in, is the opposite direction of i, ε is the volume fraction, Δm is the mass change, Δm i is the mass change in the i direction, c i is the unitized discrete velocity of the lattice model, and the total mass of the grid is calculated from the mass change in each direction: m(x,t+△t)=m(x,t)+ΣΔm i (x,t+△t), Since the distribution function of the air grid f i =0, so the distribution function from the air grid direction needs to be reconstructed. In order to balance the forces on both sides of the interface, the forces from the interface normal direction should also be reconstructed. The calculation method of the reconstructed distribution function is: Among them, ρ A = 0, is the density of air, X is the grid position, t is the current time, f i eq is the equilibrium distribution function, u is the velocity, is the opposite direction of i, f′ i is the distribution function after collision, ′ is the distribution function, and the normal direction satisfies: Among them, j is the position of the length dimension in three-dimensional space, k is the position of the width direction in three-dimensional space, and l is the position of the height dimension in three-dimensional space. is the opposite direction of i; Wherein, updating the speed of each particle on the grid comprises: The velocities and velocity deltas stored on the grid are transferred to the particles using trilinear interpolation: Among them, u v is the velocity stored on the grid, x v is the grid position, X O is the particle position, u O is the particle velocity, the grid variable is stored at the center point of the grid, d is the differential sign, S() is the trilinear interpolation function, O is the Oth particle, and v is the vth grid. Here, only the fluid grid and the interface grid have valid velocities, so the particles near the interface will have undersampling problems during interpolation. Therefore, the velocity of the interface grid needs to be extrapolated one layer, that is, the velocity of a layer of air grid adjacent to the interface grid is equal to the velocity of the adjacent interface grid; Update the particle's velocity: Among them, α is used to control the dissipation, is the velocity interpolated from the grid, is the velocity increment obtained from grid interpolation, PIC and LFIP are different simulation methods; The particle resampling unit is configured to perform particle resampling processing on each grid in the grid set according to the target area; the particle resampling unit is further configured to: in response to the target area representing the fluid area, perform the following first resampling step: Perform particle filling processing on at least one grid in the grid set that meets the first filling condition, wherein the first filling condition is that the number of particles on the grid is less than the preset number of particles, and before performing the collision operation, each grid is filled with Y particles, and the volume of each particle ε o = 1 / Y, for each fluid grid, in response to the number of particles being less than ε / ε o , then the number of particles is replenished to ε / ε o , the speed of the added particle is equal to the average speed of other particles in the grid. If there are no particles in the grid before filling, the initial speed is obtained by trilinear interpolation; Removing particles on at least one grid in the grid set that meets a preset removal condition to a preset number of particles, wherein the preset removal condition is that the number of particles on the grid is greater than a preset removal number threshold, and the grid is not an interface grid, and the preset removal number threshold is a preset maximum value of particles on the grid; In response to the target region characterizing a narrowband region, performing a second resampling step as follows: Initialize the level set field of the grid, where the initialized level set field φ is expressed by the following formula: Initialize the scalar field of the grid, where the scalar field L represents the grid hierarchy. Let the interface grid L = 0. Define the condition that the two grids at positions X1 and X2 are adjacent is that their Euclidean distance is equal to 1, that is, |x1-x2| = 1. Calculate the L of the remaining grids. If a grid is adjacent to the grid of the previous layer, then its hierarchy is: L=L last +s, For the fluid grid, s = -1, and for the air grid, s = 1. In order to meet the requirements of the narrowband solution, the calculation is performed up to the r+2 layer, where r is the narrowband width, and the level of the remaining grids is L = s·(r+3), last is the previous grid, L last is the scalar field of the previous grid; Selecting each grid that meets the preset grid condition from the grid set as the target grid set; According to the target grid set, a level set value is determined, wherein the level set value is determined by the following formula: in, is the average value of the level set value of the previous grid; According to the level set value, a second resampling process is performed on each grid in the grid set, wherein a particle filling process is performed on at least one grid in the grid set that meets the first filling condition within a preset area range, wherein the preset area range is -1.0<φ<-r, and within the preset area range, particles on at least one grid in the grid set that meets the preset removal condition are removed to a preset number of particles, and the level set value φ of each particle i It is obtained by the level set field φ on a trilinear interpolation grid.
4. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 2.
5. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
Citation Information
Patent Citations
Fluid simulation method based on Eulerian-Lagrangian coupling method
CN104268943A
Fluid simulation method based on grid-boltzmann model
CN106021828A