Advertisement

Navier-Stokes fluid dynamics

Started by March 01, 2025 01:27 AM
6 comments, last by taby 3 days, 11 hours ago

I basically started studying Unreal Engine 5 because it has a really nice Navier-Stokes solver. However, it was not clear to me whether or not they allowed you to report collision data for things other than rendering purposes. That was a big disappointment for me, because I would have had to pay some major cash to get official support on the subject.

So I decided to see how far I could get using Claude AI. After some alterations, the code that I got from Claude is at:

https://github.com/sjhalayka/navier-stokes

It collects data on the collisions with obstacles, and reports it on the CPU end of things.

Below is a grayscale image, with orange highlights where the density field interacts with the obstacle field. Not bad for an AI (under some selective guidance).

 

There is one problem. The simulation is apparently square, and when the window is widescreen, it is squashed/stretched.

Any ideas on how to go about fixing that?

Advertisement

I fixed it, but now the mouse position is messed up on the y axis… looks good on the x axis.

Right on. I got it working. I'm going to submit it to Code Review Stack Exchange.

I added in code and data for a colour texture, which advects and diffuses like the density texture. This way I can visually differentiate between enemy fire and friendly fire. Claude helped.

At one point i got Zebra shadows by accident. Looked fluidy in motion. : )

 

Advertisement
Advertisement