Hacker News new | past | comments | ask | show | jobs | submit login
A fun website that simulates fluid (paveldogreat.github.io)
314 points by svikashk on Nov 9, 2020 | hide | past | favorite | 47 comments




I'm pretty sure 3 months ago is in the range for this to be considered a duplicate? Don't get me wrong, the site is cool and all, but...


This is a good introduction to what is actually going on here: http://developer.download.nvidia.com/books/HTML/gpugems/gpug...


It's crazy how this has 0 impact on my rig's temps. Cranked it up to the highest settings and the temps barely moved 1C.


I came to say it’s crazy how lightning fast this is on an iPhone. Impressive.


This is crazy efficient, my iPhone 7 was just fine at highest settings.


Quite useful for generating wallpapers - I made mine using it: https://imgur.com/5VEg1YC


The developer has also released an app on the Play Store, which I use as a live wallpaper.


Does that not end up being a massive battery hog? To be sure, the site is impressively lightweight, but I'm not sure it's to the point where I'd want it always running on the homescreen...


That was my concern as well. I haven't measured it but the impact on battery life seems negligible. My phone is a Nokia 6.2, for reference.


......


There is an incredible short version of this fluid simulation effect (light and movement) here: https://www.dwitter.net/d/18112 (just 140 characters of javascript code)


This has cool graphics but it doesn't seem to simulate fluid dynamics (which requires solving a differential equation).


It's possible to solve differential equations in 140 characters of javascript, here are some (e.g. Lorenz Attractor dynamical system "chaos butterfly") that generates 3D cool graphics and really solves ordinary differential equations (ODEs): https://www.dwitter.net/h/lorenz/top

Here is one short code example using Euler's method where Y(n+1) = Yn + step_size * f(Xn,Yn,Zn)

  c.width|=X=Y=Z=6;for(i=3e3;i--;)
  X+=.1*(Y-X),
  Y+=.01*(X*(29-Z)-Y),
  Z+=.01*(X*Y-1.6*Z),
  x.fillRect(960+X*30,Z*22,6,9)


Euler's method is non-conservative, you ought to be using a hire order method e.g. leap frog or Backward Time, Centered Space Method.


or for ODEs a higher order method.


Really? That's really a shame you know. Solving the anxiety of suffering people is already not that bad.


You need to renew your let's encrypt certificate ;)


Maybe you commented on the wrong planet?


Maybe you commented in the wrong thread?


It's interesting to note that the original implementation for this was in Haxe, 6 years ago! https://news.ycombinator.com/item?id=8325700


My kids play with this casually now and then (both <4yrs). My 3yo practice reading the instructions which is a intuitive way for us to explore letters/text (mainly "time" and "pixelate" but in Swedish). They love stopping time, enabling pixelate and draw their names. Really love the android app, I even unlocked all the settings :)


Completely smooth on 4yo iPhone SE 1st gen. Nicely done.


Physics simulators like this is something I find really fun to play with, but there’s one thing I’ve been searching for but can’t find any: fluid and erosion simulation.

I’ve been playing Cities: Skylines since it came out and I love the fluid simulation in the rivers and mountains and dams, but I would love to see the course of the river change over the years. I’d love to see the rivers carving paths out of the mountains, and have floods/tsunamis change the shape of the coast.

I doubt they’re going to add that to Cities: Skylines any time soon, but does anyone know of any toy/game like that? Interactive fluid and erosion simulators?


That reminded me of plasma pong: https://www.youtube.com/watch?v=yGJO5bydch4


I really enjoyed that game.


Spent a little too long playing with all the settings there. Very cool and buttery smooth.


Even on mobile.


Is it only a few tweaks and controls short of being a handy basic 2D fluid-dynamics simulator? I've used this [0] but the UI for barriers is really frustrating.

It would be nice if there was something web-based that falls between the extremely basic and things like SimScale

[0] https://physics.weber.edu/schroeder/fluids/


So satisfying on a tablet…


I didn't realize you could click it before this comment, thanks for that.


I’m amazed it even works perfectly with multitouch on my phone. Impressive.


A similar project I found some time ago: https://apps.amandaghassaei.com/FluidSimulation/



The mobile app is a fun fidget toy


It really is. Updated every few weeks too!

https://apps.apple.com/us/app/fluid-simulation/id1443124993


Is there an Android version?



Also great as a live wallpaper. I have set mine up to be black and white, which goes well with my icon set.


I wanted to play with it, but that apps popup...

Those things are so rude. I just close on principle anything which has one.

Newsletters, too.


Can there be a 3D equivalent?


Vincent Houzé is an artist who works with 3D fluid sims quite a bit. These run in real-time and are interactive. He’s a wizard. https://www.instagram.com/p/B8Z2ZUYndxL/?igshid=15jc8xisc171...


Mathematically, the extension to 3D is trivial. Computationally, the difference is enormous. You're moving from O(n²) cells required to fill a space to O(n³).

Rendering also becomes significantly more complex, as you wouldn't be able to see anything interesting if it remained fully opaque.


should be possible.. I got something similar working in 3d a few years ago, and I'm just a mild-mannered code monkey who almost flunked out of the relevant courses on computational differential equations in college.

Mine was sloppy cpu-based C# code and not this butter-smooth webGL, but mathematically it's "relatively straightforward" so long as you aren't doing anything too tricky with the boundaries


A simulation of 3D space that I came across is what piqued my interest. https://youtu.be/xdZNwlzaUxI


Yes. Typically these types of GPU based fluid solvers use texture maps to store velocity and pressure information. (See NVIDIA’s GPU Gems paper on fluids.)

Most GPUs support 3D texture maps, and changing something like this to support 3D should be fairly trivial. From what I remember, the calculations for each dimension are identical.


Obligatory [REPOST] flag. I see this page here for the fourth time.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: