22-11-2022, 09:04 AM
(This post was last modified: 22-11-2022, 09:11 AM by josemendez.)
Hi,
Thanks for the detailed analysis! That code path os not part of the simulation though, and has nothing to do with density constraints: it only gets called when new simplices/particles are added to the simulation: should only be a problem if you're emitting a large amount of particles at very high speeds, very often (which fairly enough, seems to be your use case )
This approach won't work at all. In order to simulate a wind tunnel using density constraints, you have to completely fill the volume you're trying to simulate with particles. This is because each particle simulates a discrete, small volume of fluid: in areas where there are no particles, there's no fluid. This is usually the strength of particle-based simulations, because it focus computational resources only in areas where there's any fluid.
However, completely filling a volume using particles is a worst-case scenario: there's no way to save resources since fluid is everywhere, and particles aren't as accurate as cell-based methods, so you get the worst of both worlds.
Doing this in 2D is fine, because there's a lot less particles than in 3D. I would advise against using a particle-based simulation for a volumetric (3D) wind tunnel simulation though, since particle-based engines are designed for sparse simulations and using them to fill a volume is extremely wasteful. A cell-based (aka eulerian) simulation would be a much better fit, because it's guaranteed to simulate the entire volume, because discretization of space is regular, and because they map almost directly to GPU hardware so most of what you'll find is implemented in the GPU.
kind regards,
(22-11-2022, 12:55 AM)skaughtx0r Wrote: Deep profiler shows that the issue comes from setting the capacity of the List every frame and calling ToArray on it. (I was able to fix this by just using an array instead of a list and only allocating memory when the capacity needed to grow).
Thanks for the detailed analysis! That code path os not part of the simulation though, and has nothing to do with density constraints: it only gets called when new simplices/particles are added to the simulation: should only be a problem if you're emitting a large amount of particles at very high speeds, very often (which fairly enough, seems to be your use case )
(22-11-2022, 12:55 AM)skaughtx0r Wrote: Here is a video of the scene I was running and what I'm trying to do. Not sure if you have any better suggestions on how I could go about trying to do an aerodynamics simulation (for a high speed boat / hydroplane)?
This approach won't work at all. In order to simulate a wind tunnel using density constraints, you have to completely fill the volume you're trying to simulate with particles. This is because each particle simulates a discrete, small volume of fluid: in areas where there are no particles, there's no fluid. This is usually the strength of particle-based simulations, because it focus computational resources only in areas where there's any fluid.
However, completely filling a volume using particles is a worst-case scenario: there's no way to save resources since fluid is everywhere, and particles aren't as accurate as cell-based methods, so you get the worst of both worlds.
Doing this in 2D is fine, because there's a lot less particles than in 3D. I would advise against using a particle-based simulation for a volumetric (3D) wind tunnel simulation though, since particle-based engines are designed for sparse simulations and using them to fill a volume is extremely wasteful. A cell-based (aka eulerian) simulation would be a much better fit, because it's guaranteed to simulate the entire volume, because discretization of space is regular, and because they map almost directly to GPU hardware so most of what you'll find is implemented in the GPU.
kind regards,