But How DO Fluid Simulations Work?

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 มิ.ย. 2024
  • Fluid simulations. How on is it possible that a computer can recreate the crashing waves, the rolling clouds and the swirling smoke that we see in our daily lives, phenomena which seem characterized by randomness and chaos? This video will attempt to explain exactly how the mathematics behind fluid simulations work.
    Timestamps:
    00:00 Intro
    00:42 Navier-Stokes Equations
    02:38 Representation
    04:52 Diffusion
    07:53 Gauss-Seidel Method
    09:36 Advection
    11:31 Clearing Divergence
    14:33 Outro
    Paper referenced: Jos Stam - Real Time Fluid Dynamics for Games (2003)
    www.autodesk.com/research/pub...
    Music: Soft Piano Music by Relax Music Meditation
    • Video
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 431

  • @cpkreuuuuu
    @cpkreuuuuu 3 ปีที่แล้ว +1890

    I like your funny words magic man

    • @nimphilia
      @nimphilia 3 ปีที่แล้ว +8

      man

    • @AlxM96
      @AlxM96 3 ปีที่แล้ว +23

      😂😂😂 your comment cracked me up

    • @aissaelwadjih4785
      @aissaelwadjih4785 3 ปีที่แล้ว +4

      Dumb cant

    • @forbiddenera
      @forbiddenera 3 ปีที่แล้ว +47

      Says any competent programmer could do it..instantly loses me in math...been coding for 30 years..not the imposter I swear

    • @nimphilia
      @nimphilia 3 ปีที่แล้ว +9

      @@forbiddenera relatable

  • @josstam2217
    @josstam2217 3 ปีที่แล้ว +604

    Nice video. Reminds me of my talks in the early 2000s. I also wrote a book about this. The Art of Fluid Animation. We also implemented this into the Maya software and has been used in blockbuster movies. We got a tech Academy Award for this in 2008.

    • @podemosllegara840anti-tikt7
      @podemosllegara840anti-tikt7 3 ปีที่แล้ว +4

      it advanced a lot since then

    • @HilbertXVI
      @HilbertXVI 2 ปีที่แล้ว +27

      @@podemosllegara840anti-tikt7 and?

    • @benmouginot3734
      @benmouginot3734 2 ปีที่แล้ว +2

      Maya in the 00's was the MVP, I remember booting the silicon graphics stations and play with it for hours.

    • @sandipanborthakur8637
      @sandipanborthakur8637 2 ปีที่แล้ว +1

      Amazing!!!

    • @Bentroen_
      @Bentroen_ 2 ปีที่แล้ว +3

      Nice to see you here, Jos!!

  • @David-zy1lr
    @David-zy1lr 3 ปีที่แล้ว +495

    When I finished the video I expected it to have at least 100k views with how well made this is. You deserve many, many subs

    • @t4ky0n
      @t4ky0n 2 ปีที่แล้ว +3

      50 views away from 100k as im typing this

    • @David-zy1lr
      @David-zy1lr 2 ปีที่แล้ว

      @@t4ky0n hello fellow anarcho-troll-ist

    • @t4ky0n
      @t4ky0n 2 ปีที่แล้ว +1

      @@David-zy1lr YOOOOOO

    • @user-hv5tl2ij7o
      @user-hv5tl2ij7o 2 ปีที่แล้ว +8

      There is 100k views now

    • @Sebastian-rp9np
      @Sebastian-rp9np 2 ปีที่แล้ว

      check braintruffle bro

  • @thygrrr
    @thygrrr 3 ปีที่แล้ว +184

    Hey, I found this video via a Reddit post. This is really well-made, thank you!

    • @evank7858
      @evank7858 3 ปีที่แล้ว +2

      What sub?

    • @mastershooter64
      @mastershooter64 3 ปีที่แล้ว +7

      @Caleb Landry Wow you used a bot account to market some scam and reply to it using another bot account to make it seem reputable?? that's disgusting

  • @raletran
    @raletran 8 หลายเดือนก่อน +5

    Careful viewers! I might be wrong, but the equations shown for diffusion in the video are incorrect. If you look at the paper by Jos Stam, the simple, unstable equation for the next density is dn = dc + k(sc-4dc) (where sc means the sum of the densities in surrounding cells), which is not the same as the equation shown in the video, dn = dc + k(sc-vc), where sc is the average of densities in the surrounding cells. I saw that when implementing the method seen in the video, density was lost after diffusion even though it should just spread out.

  • @rigtio8887
    @rigtio8887 3 ปีที่แล้ว +35

    TH-cam just recommended this video to me. Hope you get picked up by the algorithm!

  • @timothygao9442
    @timothygao9442 ปีที่แล้ว +2

    Slight correction on the diffusion step, the equation according to original paper is x0[IX(i,j)] = x[IX(i,j)] - a*(x[IX(i-1,j)]+x[IX(i+1,j)]+x[IX(i,j-1)]+x[IX(i,j+1)] -4*x[IX(i,j)]), which would be d_n = d_c + k (s_c - 4 * d_c).
    Without doing 4 * d_c, the amount donated to the 4 surrounding cells would only be subtracted once from the original, resulting in a net increase in density/velocity from nowhere and breaking conservation of mass.
    Additionally, I believe the equation d_n = d_c + k (s_c - 4 * d_c) explains why its necessary to diffuse density reverse in time, because it blows up under certain scenarios, resulting in negative values. An example is if you have a really high value cell (say 100) surrounded by really small value cells (say 1). Let K=1. On the next iteration, the high value cell will have -396. While having negative velocity possible, having "negative density" is not and will cause the simulation to blow up.

  • @user-nj1qc7uc9c
    @user-nj1qc7uc9c 3 ปีที่แล้ว +10

    Under a minute in and ive never been this excited to watch a video by someone ive never heard of before

    • @easyidle123
      @easyidle123 3 ปีที่แล้ว +1

      The craziest thing: this seems to be this guy's first video from what I can find

  • @peksn
    @peksn 3 ปีที่แล้ว +17

    Wow! Awesome video, I always hated how science videos never went deep into how equations actually worked and how to implement/use them, but you did both! Thank you! Awesome video, subscribed and I hope to receive new notifications from you :)

  • @dsi-films1264
    @dsi-films1264 3 ปีที่แล้ว +4

    This channel is amazing! The quality of production this video has is incredible, keep up the great work!

  • @donovanholm
    @donovanholm 3 ปีที่แล้ว +5

    This is extremely high quality, well made and really drives my interest in modeling and simulations. Thank you

  • @quantumgaming9180
    @quantumgaming9180 3 ปีที่แล้ว +175

    Too bad I found about this video after I did the same thing. It took me over a year to understand the theory and algorithms behind Stam's papers, but you explained it in 15 minutes! Great video anyway!

    • @Gonkee
      @Gonkee  3 ปีที่แล้ว +44

      If it took you a year, I'm sure you won't forget it anytime soon! :)

    • @pinkyrng7104
      @pinkyrng7104 3 ปีที่แล้ว +6

      @@Gonkee I still have no clue how to program that. Have to watch the video 5 more times :D

    • @cory99998
      @cory99998 2 ปีที่แล้ว +6

      @@pinkyrng7104 just start one step at a time, try and get the basic system working so that you only need to learn one new concept at a time to eventually get it all working

    • @Polygarden
      @Polygarden 2 ปีที่แล้ว +3

      Same for me. But it's not an easy subject though and contains many different algorithms and approaches. I also skipped the lerp part, because on the GPU you are able interpolate between pixels by default, with the filtering step.
      Overall very detailed and well made video! It helps a lot of curious people.

    • @nullbeyondo
      @nullbeyondo 2 ปีที่แล้ว

      ​@@pinkyrng7104 You're making it sounds complicated more than it is. You just look at the N solver equation and implement an N loop for it. I did it in 1 time watching the video and just rewinding it to where the equations are.

  • @niekvandam9427
    @niekvandam9427 3 ปีที่แล้ว +2

    Great editing and informative video, you deserve a lot more acknowledgement for the quality you put out!

  • @CandianWorkbench
    @CandianWorkbench 3 ปีที่แล้ว +8

    This channel is gonna blow past 1M subs if videos like these keep getting posted

  • @sujals7108
    @sujals7108 3 ปีที่แล้ว +73

    woah I just realised how less subs and views this guy has. This video deserves way more views with such good animation and narration.

  • @makra2077
    @makra2077 3 ปีที่แล้ว +124

    Man, I'm a Unity dev and TH-camr. I came here from reddit, when I saw the video I thought you had somewhat around 100k subs bro. Keep griding you'll easily reach there :) Good Luck!

    • @AkariInsko
      @AkariInsko 3 ปีที่แล้ว +1

      Gdrinding*

    • @makra2077
      @makra2077 3 ปีที่แล้ว +2

      @@AkariInsko *grainding

    • @lebaguette5393
      @lebaguette5393 2 ปีที่แล้ว

      @@makra2077 *grdinaining

    • @user-cw3nb8rc9e
      @user-cw3nb8rc9e 2 ปีที่แล้ว

      Are "subs" so important to you? Who cares how many subs. The world is not only about money. Good is minority, stupidity is majority.

    • @makra2077
      @makra2077 ปีที่แล้ว

      @@user-cw3nb8rc9e 110k now hehe

  • @1982pwr
    @1982pwr 3 ปีที่แล้ว +7

    Great job with all the videos. The level is very good and the explanations are great. Most of all the topic/topics are a good niche - they're not some sort of basic tutorial, but they're not at an advanced academic level either discussing the details of the respective topics they cover. They're very much the type of stuff I'd love to see if I just want to get an actual technical introduction to something I've never thought about before.

  • @NotTofuFood
    @NotTofuFood 3 ปีที่แล้ว +7

    Wow! Can not believe you have this little subs. Fantastic video and you have inspired me to give fluid simulation a try.

  • @melody3741
    @melody3741 3 ปีที่แล้ว +8

    Finally, I’ve been looking all over for information on health physics simulations in general work but literally every single one just tells you to get a library and doesn’t actually go over the math. Thank you for making this video

    • @parthsavyasachi9348
      @parthsavyasachi9348 3 ปีที่แล้ว +2

      This video doesnt even come close to what really happens.
      Btw the book that has complete navier stokes solver as used in industry is by milovan peric. Google cfd and peric.

  • @glace848
    @glace848 9 หลายเดือนก่อน

    thanks for this video man. with the help of this video, jos stams paper, a paper by nvidea and weeks of my life spent understanding everything i was able to implement jos stams fluid simulation, while understanding all the processes involved in it. your visualizations we're really valuable in the way they helped me visually grasp everything.

  • @aditya_a
    @aditya_a ปีที่แล้ว +1

    Cool video! (U got that Jos Stam reply, epicccc.)

  • @Steveplays28
    @Steveplays28 3 ปีที่แล้ว +3

    Very nice video! I randomly came across your channel via my recommended lol
    I like the pacing and the animations a lot. Keep going!

  • @duret-robertlouis2973
    @duret-robertlouis2973 3 ปีที่แล้ว +115

    Your video is really well made ! The animations, the pace, the narration, the music, everything looks like a professionnal channel with many thousands of followers. Keep up the great work ! I can't wait to see more videos from you

  • @hassanahmadsheikh5130
    @hassanahmadsheikh5130 ปีที่แล้ว

    if not the best than one of the best ever youtube explanaion here of CFD.... Did't knew it was so easy to understand the CFD.... Appriciated mate

  • @monsieur910
    @monsieur910 3 ปีที่แล้ว +1

    great video! Can't wait for the next

  • @mr_rowboto
    @mr_rowboto 2 ปีที่แล้ว +1

    Excellent presentation dude. Insta-subscribed. A couple of weeks ago I simulated a boat by voxelizing it and using buoyancy and drag laws, then I wanted to simulate a fluid next... and found your channel. This is pure gold.

  • @rdasher7747
    @rdasher7747 3 ปีที่แล้ว +3

    This is such a great video, I probably won't be making fluid simulations, but I really enjoyed that

  • @rishichudasama3435
    @rishichudasama3435 3 ปีที่แล้ว +13

    I can’t believe people can actually understand this stuff. Great job man, this is amazing stuff. I just subscribed

    • @jaredjones6570
      @jaredjones6570 2 ปีที่แล้ว +1

      It wasn't that hard to follow. The hardest part was actually the lerp for density redistributions. The rest was purely vector calculus and was nothing new.

  • @J2000Ray
    @J2000Ray 3 ปีที่แล้ว +1

    This is awesome. Thank you for making this.

  • @rohanasokan7338
    @rohanasokan7338 3 ปีที่แล้ว +4

    Honestly, the best content. I dont understand why youtube didn't put this high up on the search results when I was searching for something similar a week back - all I got was shitty lectures and some other crap. Keep going @Inspecto.

  • @hakamabedmohammed6497
    @hakamabedmohammed6497 2 ปีที่แล้ว

    Very happy to find a kind of beautiful genuine, well understand concept channel.

  • @nnesseth
    @nnesseth 3 ปีที่แล้ว +2

    Great video, looking forward to more.

  • @ZeroPlayerGame
    @ZeroPlayerGame 3 ปีที่แล้ว +1

    Really nice video, despite having read several papers about fluidsim recently, I still feel like I walked away with a clearer understanding of the fundamental implementation details.

  • @leonstansfield
    @leonstansfield 3 ปีที่แล้ว +1

    video got reccomended to me! it was really good. I hope you hit algorithm gold with this one.

  • @bigmistqke
    @bigmistqke 3 ปีที่แล้ว +1

    Great video! That was really insightful

  • @mikeohc
    @mikeohc 3 ปีที่แล้ว +5

    Came across your video from YT algorithm. It's really well-made! Subbed

  • @maddieLund
    @maddieLund 3 ปีที่แล้ว

    This kind of stuff if the stuff I want to make more of but don't know how. You just earned a sub :) keep up the good work and make more!! Things like this are hard to learn on your own but things like this make it possible. Thanks.

  • @DragonFoxStudios
    @DragonFoxStudios 3 ปีที่แล้ว +1

    Amazing! Amazing source for research!

  • @evanlane1690
    @evanlane1690 10 หลายเดือนก่อน

    Duuude! 11:59 is something I've been trying to wrap my head around for ages. Thanks!

  • @bastelfreund
    @bastelfreund 3 ปีที่แล้ว +1

    Awesome stuff, I came from reddit and i really like the quality of your video keep it up.

  • @NozaOz
    @NozaOz 3 ปีที่แล้ว +50

    Hey, I recently changed from engineering at Uni to computer science/math, I’ve been feeling a little Gino because I miss physics concepts and understanding things, but this video reminded me that with math and computer science I can recreate all the sciences that lie between using mathematical models and programming skills. Thanks :)

    • @artoshia
      @artoshia 3 ปีที่แล้ว +7

      if you ever touch bits of game dev, its full of math/physics (a lot more than people realize), would totally recommend trying it out, the math is very interesting and visual.

    • @BlastinRope
      @BlastinRope 3 ปีที่แล้ว +1

      As a fellow cs student, a degree in cs is just tools that need to be applied to some other field, and physics is a fun and interactive one to program

  • @minetech4898
    @minetech4898 3 ปีที่แล้ว +1

    This is an amazing video with great information which I will promptly use in about 20 years.

  • @_notch
    @_notch 3 ปีที่แล้ว +1

    Great video! The part about subtracting the divergence was especially fascinating.
    Having never implemented any actual fluid dynamics, I sort of assumed you'd rely on the density to pull and push to even it out, close your eyes, and hope you don't have any rounding errors.

  • @prafulsrivastava7684
    @prafulsrivastava7684 2 ปีที่แล้ว

    Exactly what I was looking for! Thanks man!

  • @nighteule
    @nighteule 3 ปีที่แล้ว +1

    I just found this channel today. Quite underrated :)

  • @Oscar-vs5yw
    @Oscar-vs5yw ปีที่แล้ว

    Your explanations for these very complex are amazing

  • @kerch00
    @kerch00 2 ปีที่แล้ว

    You explain Jos Stam's code and theory extremely well

  • @nin10dorox
    @nin10dorox 3 ปีที่แล้ว +1

    Thank you, this demystified it a lot!

  • @AJ-et3vf
    @AJ-et3vf 2 ปีที่แล้ว

    Awesome video! Thank you!

  • @targetmhk269
    @targetmhk269 3 ปีที่แล้ว +1

    This was extremely helpful and well made video.

  • @XanderGouws
    @XanderGouws 3 ปีที่แล้ว +1

    Phenomenal. Amazing video.

  • @ivanperezavellaneda4031
    @ivanperezavellaneda4031 3 ปีที่แล้ว +1

    Jus what I was looking for! thanks

  • @anthonywelsh1496
    @anthonywelsh1496 2 ปีที่แล้ว

    I'm a CS student and I have a critical paper review to write on Stam's Real Time Fluid Dynamics for Games paper, your video really explained fluid simulations well! Also realised I'm already subbed to your channel from your sound synthesis video I used to understand the concept for a personal project implementing a sound synth in C++ from last year. Cheers!

  • @gregor-alic
    @gregor-alic 3 ปีที่แล้ว +2

    I read the same paper before I watched this video and I must say this video is amazing

  • @HarhaMedia
    @HarhaMedia 3 ปีที่แล้ว +1

    Very cool explanation, thanks!

  • @ishdx9374
    @ishdx9374 3 ปีที่แล้ว

    this is a hidden gem of a channel

  • @aesthetikun3704
    @aesthetikun3704 2 ปีที่แล้ว

    I loved on how this video was crafted, and your other videos too, like legit, you somehow exploit most of human senses to really impart a rather complex idea to someone brain in a really engaging way. It would be highly appreciated if you can make a video or any other form of guidance detailing on how this video is produced, like how you do your research, what tools, to do the research, the video editing software or even the content brainstorming management. I'm so sorry if this is too much to ask for but you would really help me or maybe others in communicating our own ideas or any other complex ideas to the layman. Again, your videos are already on the top notch category and you'll definitely reach a bigger audience and prospects in no time!!

  • @abgekippt
    @abgekippt ปีที่แล้ว

    Very good video! Exactly what I was searching for 👍👍👍

  • @guitaek4100
    @guitaek4100 3 ปีที่แล้ว

    This is really easy. Thanks for the good explanation and the paper.

  • @maybenat
    @maybenat 3 ปีที่แล้ว +1

    Great explanation, nice job ^^

  • @fckndrummczinz
    @fckndrummczinz ปีที่แล้ว

    beautiful, amazing. thank you

  • @edacoose6969
    @edacoose6969 3 ปีที่แล้ว

    Super informative video, really aided my understanding - thanks very much!!

  • @sebastiangudino9377
    @sebastiangudino9377 3 ปีที่แล้ว +1

    You are the 3B1B of computers. You are going to get reeealy big eventualy. And i will love to say that i was here while you only had 4 videos and not even 10k subs.
    Thanks for the absolutely top notch content

  • @trietch
    @trietch 3 ปีที่แล้ว +1

    Thank you for this video, it really helped me :)

  • @quantumcookie64
    @quantumcookie64 3 ปีที่แล้ว

    Really great explanation, thank you!

  • @shaladddin5687
    @shaladddin5687 3 ปีที่แล้ว

    Keep it going man, your content is really great.
    I believe your channel will grow really well.
    +1 subscriber

  • @HubsterPL
    @HubsterPL 3 ปีที่แล้ว +1

    You are amazing, I don't remember ever clikcing the bell button, but today I did.

  • @BehradDavoudi
    @BehradDavoudi 3 ปีที่แล้ว

    very very well made and informative video. thank you!

  • @Afraaz
    @Afraaz 2 ปีที่แล้ว +1

    Hella underrated channel

  • @rickyspanish4792
    @rickyspanish4792 3 ปีที่แล้ว +2

    quality content! good job, very helpful

  • @lizardbeeboy
    @lizardbeeboy 3 ปีที่แล้ว

    I don't know why youtube has been recommending me some really interesting videos lately but I like it

  • @vuubi1
    @vuubi1 3 ปีที่แล้ว +1

    Algorithm brought me here and you got me super interested in Fluid Simulations, extremely well-made video and I'm also leaving this comment to help the algorithm pick up your video for engagement!

  • @snowcrashshaftoe
    @snowcrashshaftoe 3 ปีที่แล้ว

    this channel deserve a lot more subs!!

  • @rayyan21d
    @rayyan21d 2 ปีที่แล้ว

    This work is underrated!

  • @abhishek.chakraborty
    @abhishek.chakraborty 3 ปีที่แล้ว +3

    Wow ! Really well made and educational 👏🏻👏🏻 subscribed to your channel 👍🏼
    However, I can't help but wonder using what softwares was this made 🤔🤓

  • @alexrobbins2288
    @alexrobbins2288 3 ปีที่แล้ว

    Attempting to make my own fluid sim right now and this is extremely helpful!

  • @jonohiggs
    @jonohiggs 3 ปีที่แล้ว +14

    Probably the best explanation I have seen on the topic. Please can you do another one on the advanced topics

  • @super_sayf
    @super_sayf 3 ปีที่แล้ว +1

    I thought you had 800k subs until I looked at the comments. This is next level, well done

  • @deathTurgenev
    @deathTurgenev 2 ปีที่แล้ว

    Great stuff, thank you

  • @meerkat22
    @meerkat22 3 ปีที่แล้ว

    This is pure gold

  • @alejotassile6441
    @alejotassile6441 3 ปีที่แล้ว

    This is so beautiful!

  • @magneat
    @magneat 3 ปีที่แล้ว +1

    Dude, thank you so much!

  • @ceylaneray
    @ceylaneray 3 ปีที่แล้ว

    Great explanation for this topic.. simply intellegence Thank you!

  • @kjeldje12345678910
    @kjeldje12345678910 3 ปีที่แล้ว +1

    Assuming that the divergence is 0 is indeed valid in most cases. This is based on the assumption that the fluid is incompressible. However with compressible flows one should use the continuity equation which allows you to solve it. But great video!

  • @mysteryfacebookgirl
    @mysteryfacebookgirl 2 ปีที่แล้ว

    Wow! This is an incredible video.

  • @thianesh9097
    @thianesh9097 2 ปีที่แล้ว

    WOW! Well made.. Nailed it👌

  • @evanburrows
    @evanburrows 3 ปีที่แล้ว

    Awesome explanation! Thanks

  • @AndrewPa
    @AndrewPa 8 หลายเดือนก่อน

    well done - good presentation

  • @pixboi
    @pixboi 3 ปีที่แล้ว +1

    Great video, earned yourself another subscriber

  • @jaashiik
    @jaashiik 3 ปีที่แล้ว +1

    Seriously fantastic content, thank you for answering the very question I have been asking the past few weeks - just how on earth do computers simulate the chaotic motion of fluids ?? Subscribed

  • @darkmagic543
    @darkmagic543 2 ปีที่แล้ว

    Great video, thank you

  • @jequiti6057
    @jequiti6057 3 ปีที่แล้ว +1

    I'm already a fan!

  • @PFnove
    @PFnove 3 หลายเดือนก่อน

    i will need to rewatch this a couple times but it's extremely interesting

  • @TheJosephStalin420
    @TheJosephStalin420 3 ปีที่แล้ว

    So that's where the advance mathematics and CFD equations come to play in real life! Also I thought I'd never be seeing those iterative equation solving methods. You've no idea what this video is to an enthusiastic mechanical engineer! Thanks alot!

  • @stefanguiton
    @stefanguiton 3 ปีที่แล้ว

    Excellent!

  • @JumpTrajectory
    @JumpTrajectory 3 ปีที่แล้ว +1

    Great video!

  • @strangeWaters
    @strangeWaters 3 ปีที่แล้ว

    ive always been mystified by navier stokes so super looking forward to watching this series

  • @Michallote
    @Michallote 2 ปีที่แล้ว

    Whoa man, awesome job your channel is going big soon enough just keep doing quality content like this! How do you recommend me start implementing this for my very first fluid simulation? My main issue is just where to start for making the graphics and data structures for the grid and display of vectors. Which programming paradigm is best for this kind of endeavour?

  • @goodnightmr5892
    @goodnightmr5892 3 ปีที่แล้ว

    Outstanding Space Cowboy!

  • @rexygama7697
    @rexygama7697 3 ปีที่แล้ว

    This channel is severely underrated