As a fluid dynamic engineer, I’m very aware of the complexity of CFD. It’s absolutely stunning not just that you wrote a basic cfd code in 200 lines, but that it even runs on a browser and, most of all, that you could explain it in 10 minutes. Astonishing
@nathan872 жыл бұрын
It's a nice piece of code, but it's literally CFD 101. Everybody's first fluid sim looks like this.
@mastrake2 жыл бұрын
@@nathan87 Perhaps intended for people like me who are new to the topic?
@ProjectPhysX2 жыл бұрын
Lattice Boltzmann is even simpler, a basic C implementation is 100 lines. Yet it's a lot faster and much more accurate :)
@mastrake2 жыл бұрын
@@ProjectPhysX This is super cool stuff for someone just learning about it.
@abebuckingham8198 Жыл бұрын
As a functional programmer I see a great deal of redundancy and excess in this code so it could be shortened too. It's rather impressive that they kept it so small.
@notapplicable72922 жыл бұрын
These videos are such a nice breath of fresh air after reading simulation papers
@TenMinutePhysics2 жыл бұрын
Hi all, thanks so much for all your positive feedback! A great motivation to do more videos!
@nolram2 жыл бұрын
Glad to see this channel finally get the attention it deserves :) PS: Matthias, consider putting the Discord server in the description of these, since we have a bunch of people there willing to help out others and discuss these videos.
@DogeMultiverse2 жыл бұрын
These r awesome! Physicist content creator
@momoaraki79342 жыл бұрын
Incredible!!!
@LJ_Dev2 жыл бұрын
yes please
@King-mj2bn Жыл бұрын
It would be great if you could use variables names that were slightly more self-describing. Readability is far more important than brevity.
@kathmanducity2 жыл бұрын
I have been looking for this eloquent lecture for the last 15 years.
@CosineKitty2 жыл бұрын
This is exactly what I have wanted to understand for years now. I have long thought it would be so cool to simulate a lava lamp, or the waves on the surface of a swimming pool. Every time I try to read about fluid mechanics, it's page after page of differential equations. You have made this so clear and intuitive. Thank you so much!
@joepeters87462 жыл бұрын
I know that you have little views, but the content you makes me delightet! It is very hard to find University level tutorials or explanations for fluids and softbodies, so your well made videos are a treasure! Especially for me as a Games Engineer it is very funny to know the math and algorythms.
@voxelltech2 жыл бұрын
absolutely
@TenMinutePhysics2 жыл бұрын
I am glad you like it. The numbers will go up with more videos. 3K subs for only 17 videos is actually quite good :-)
@adrianalanbennett2 жыл бұрын
This is the shortest, clearest explanation I have ever heard of method like this. Do you have any sources I could look into to learn more? Thanks.
@marcinszydowski556313 күн бұрын
Hello Matthias. Thank you for this tutorial - it's very helpful and informative. Currently I'm playing with it and I noticed that you probably wrote it in GL and then adapted to simpler version for make it compact and be able to fit in about 200 lines. What struck me at the first time was that the code in a pure JS is many times faster than in Python, thanks to specialised typed arrays of floats. I also noticed, that changing tables to 64bit floats reduces conversions in JS and let save another bunch of FPS of frames. Adapting code to workers and WebGL also made it so fast that in practice it's the best solution for visualising and presenting physical simulations with relative small effort.
@snsacharya17372 жыл бұрын
A great video for aspiring numerical analysts. Amazing to see how you covered incompressibility to the Gauss-Seidel method within 10 minutes and a code that demonstrates all that 👏
@joxterjones25632 жыл бұрын
Great video, thanks for posting this. I first wrote a MAC-type simulation for incompressible viscous flow back in the early 1980's. Seeing what you have done in 200 lines of code is amazing - we have come a long way! Your explanations are excellent and are a first rate introduction to a complex topic.
@AlienXtream18 ай бұрын
THANKYOU! SO many talks about fluid simulations (and fluid/water in general) mistakingly claim (orimply) that water *is* incompressable. this is the first time i've seen someone correctly assert its "functionally incompressable" XD
@akinagudaАй бұрын
I was learning about this years ago and came across some papers you wrote/where involved with. So happy you are making videos on this too
@harrymattah4182 жыл бұрын
I just can't decide what impresses me most. The conciseness of the code, or that of your explanations.
@abonham822 жыл бұрын
Quite appreciate the way you articulate variables. “Boldface V”, “italic u and v”. Great work
@GeoffryGifari2 жыл бұрын
really appreciate that you go all the way with the instructions, AND put the whole source code out for the public
@j1d7s2 жыл бұрын
I just stumbled on your channel. It is great how much good explanations you pack into a dozen minutes. I will recap all the videos in your series and try out the code.
@erang422 жыл бұрын
Love your videos, Matthias! Such a great initiative to create this video series, and to use web-based tech so that it's easy to play around with your interactive demos. Keep up the great work. ~ Eran.
@TenMinutePhysics2 жыл бұрын
Thanks! I am happy to hear that people like it and will definitely make more videos
@deathTurgenev2 жыл бұрын
So glad I got this channel recommended to me. The videos along with the PDF overviews are amazing. I'm looking to try them in another language and will be happy to share
@jabaadams47342 жыл бұрын
I've read Bridson's book on Fluid Simulation for Computer Graphics, but you give an excellent and brief, yet detailed explanation. It cleared some things up for me. Thank you! Subscribed.
@thomasspader69502 ай бұрын
Please keep making videos and resources like you have been! You are an absolute gold mine.
@pixel_physics2 жыл бұрын
Ohh my, i never thought i will see a tutorial from THE Matthias Müller. Im such a huuuuuuuuuge fan of your works and papers! You are probably the most cited person in my bachelor and masters thesis - both about fluids. And damn i like your research. So awesome! Keep up your work! Youre freakn awesome in what youre doing!
@halihammer2 жыл бұрын
Thank you so much for this information! This is such valuable content for people who are interested but don't have the opportunity or time to acquire this knowledge at a university or by reading specialist literature!
@tantumDicoQuodCogito2 жыл бұрын
Description of physical behavior of particle is perfect for free interpretation on code by programmers, for me is most important than explaining mathematical. Good video.
@stefdevs2 жыл бұрын
You're doing god's work here. Thank you! Your XPBD research and educational media is enabling me to make a game that I would otherwise not be able to.
@humblerambler2 жыл бұрын
So effective! 15 years ago I was doing these simulations with industrial level CFD software and I was writing much more code just to analyze results. [feels nostalgic]
@imafackinjunglist Жыл бұрын
So that is when this would of been groundbreaking?
@irtizahussain50012 жыл бұрын
Its so beautiful. I am just going to cry with joy.
@noertri6182 жыл бұрын
Man, thinking about ball hanging motion make my head hurt, but you make simulation of fluid, that is amazing
@sietsebuijsman85232 жыл бұрын
That was very interesting! I’ve been wanting to work towards a fluid simulation for a while, and your explanation really helped!
@skippythemagnificent81032 жыл бұрын
This is exceptionally well and clearly explained, many thanks, now to work out how to make the force flow around a 2D planet .....
@j.j.maverick92522 жыл бұрын
finally youtube recommended something good! Thanks for a clear and still concise explanation, the staggered grid approach is new to me also
@supersaiyan96162 жыл бұрын
Hello Matthias, Thank you so much for your video series
@rodrigocarvalho515422 жыл бұрын
As a physicist who moved to CS this is a delight!
@hoytvolker32 жыл бұрын
Elegant as always, thanks for taking the time to share such informative videos.
@7177YT2 жыл бұрын
Brilliant, I could follow along pretty easily. The simple simulation strategy and clear visualisations helped. please prepare more projects simulating closed little systems like this! Thank you!
@maverick.laurel9 ай бұрын
Thank you so much for the great contents and I have been rewatching the videos many times! ❤ Definitely looking forward to the upcoming tutorials for viscous liquids and other fluid simulation methods.
Жыл бұрын
Thank you very much. Greetings from Popayan, Colombia.
@blacklistnr12 жыл бұрын
I don't understand why the pressure can be calculated like that. What am I missing? If it's incompressible d will be 0 "after projection"(@7:03), and if you mean the d before the projection then the liquid is no longer incompressible(it compresses/expands momentarily before propagating the corrected values).
@lamienkassienou41774 ай бұрын
I didn't ask for more. What can I say except a very big thank you. Tank you really.
@alansmithee4192 жыл бұрын
Something I've noticed in my physics course is that simulations of complex systems can be incredibly simple. The difficult bit is determining what is the best way to program something, so that it is both accurate and has reasonable computation costs. The programming itself will almost invariably result in a very short program. From what I can tell the huge thousands-of-lines projects that people spend years developing are tools which have many different methods of doing many different things for many different purposes. Each thing is short, the collation of them all into one widely useable toolkit so that no one ever has to code any of it again is not.
@georgen97555 ай бұрын
Fluid pressure in a tank demo Advection Pressure distribution Guass seidel method Water tunnel Wind tunnel Divergence = 0 Pixels Pixels of television Depends on the resolution of the television Great sir thank you
@veitheld1672 жыл бұрын
Awesome! That is the little programm that I always wanted to write myself to simulate the flow around airfoils or sails, but I never managed to get this done. I got a s far as translating the equations to discrete cells, but then I always ended up with very large scarce equation systems, which needed an engine like Matlab to solve. Your choice of the staggered grid and all the other tricks are so elegant and make the solution so lean and efficient. Too bad that you did not post this video years ago, it would have saved me a lot of time. Great job!! Now I am looking forward to your solution of the full Navier-Stokes equations. OK, I'll give you a budget of 300 lines of code for that...😀
@miguelguerrero3394 Жыл бұрын
You cant find analytic solutions to fluid dynamics unless in some very simple cases like laminar flow through a pipe, which your case definitely isn't. The only solution is discrete CFD simulation and then verify it is close enough to reality
@veitheld167 Жыл бұрын
@@miguelguerrero3394 Yes, I know that. Thats why solving the Navier-Stokes equations is on the list of the Millennium Problems, for which the Clay Mathematics Institute offered a US $7 million prize fund ($1 million per problem). CFD is the only option to approach these problems for now...
@miguelguerrero3394 Жыл бұрын
@@veitheld167 oh ok, nevermind then.
@ArnoldStefanek5 ай бұрын
Wow, it's really good. It's very attractive and the AD is very interesting
@CharlesVanNoland Жыл бұрын
Ah, a staggered grid. I never heard of that little trick! Thanks! :D
@ianglenn2821 Жыл бұрын
3:11 The staggered grid is sometimes called the Arakawa grid, after Akio Arakawa, the scientist who popularized it during the nascent years of fluid simulations.
@rstknives24232 жыл бұрын
Everything is easy when you are both a programmer and a physicist
@Premrajcfd72 жыл бұрын
Me too..I am a mechanical engineer with a ardent interest and hands-on working knowledge of python,C,C++ to simulate physics
@wallbrick21702 жыл бұрын
you forgot mathematicians ;-;
@this_is_mayhem2 жыл бұрын
@@wallbrick2170 yeah, mostly methematician, because if you know math then you are able understand physics as well
@krishnakarthik47522 жыл бұрын
@@this_is_mayhem Well, not really
@multiarray23202 жыл бұрын
@@this_is_mayhem meth?
@kiaranritchie30212 жыл бұрын
Another excellent tutorial. Thank you very much for this!
@lucas-coutinho Жыл бұрын
Wow that's amazing! I'm really excited about your channel! Thanks for sharing your knowledge
@Trust_me_I_am_an_Engineer10 ай бұрын
Thank you so much for this explanation, Matthias! I just found this video : it's fascinating. I've subscribed (of course) and now I'll get a (large) mug of coffee and watch your other videos. Actually, you only need 1000 kgf /cm² to compress water more than 3% , but only an engineer who works in high pressure hydraulics would notice that. Don't worry. 😁
@lobo1510755 ай бұрын
Congratulation!!! Greetings from Bolivia.
@SmartAndSecureWay2 жыл бұрын
Excellente vidéo et démo ! 👋 Un plaisir de découvrir votre vidéo et maintenant de vous suivre.
@skhelladi Жыл бұрын
Nice job Matthias! I developed the same code in c++ based in part on yours, I put a demo on youtube.
@TenMinutePhysics Жыл бұрын
Nice work!
@samanthaqiu34162 жыл бұрын
looking forward for upcoming tutorials!
@sciencefordreamers211511 ай бұрын
Thank you so very much man, absolutely valuable content, thank you for generously sharing the code too!
@Havealot2 жыл бұрын
@Matthias: Talking about divergence, in theory your video should be five times more informative than the ones on "Two Minute Papers". However, I find this so much more interesting and useful. So, thanks for the additional information inflow. Keep up the great work!
@segunda_parte6 ай бұрын
Awesome, very very awesome. Thank you so much.
@youtubeicin28362 жыл бұрын
Just discovered your channel and tried out the simulator, so fun! Keep up the good work :)☺
@adidanusaputra47618 ай бұрын
Very impressive make me build an interest in programming
@manuelnovella392 жыл бұрын
Ok, you definitely earned yourself a new subscriber. Keep it up, man, and congrats for your work 👌🏽
@Elta3052 жыл бұрын
Very good vidéo ! Just a little remark, Lagrange was born in Italy but worked in France with "L'Académie des Sciences", lived through the French Revolution and his body is actually in the Pantheon so it should probably be Franco-Italian. (the concept of nationality came with the Revolution so it's a bit fuzzy)
@kingofmaglos32 жыл бұрын
Excellent video and a really interesting channel. Defo going to check out more of your videos!
@joshuabeattie62462 жыл бұрын
Thanks for the great information. Hope you're doing well.
@MissPiggyM9766 ай бұрын
Very well done, many thanks!
@andrewsheehy24412 жыл бұрын
This is really great! Thank you and well done!
@cobaltxii2 жыл бұрын
Beautiful video, subscribed
@linjianru2 жыл бұрын
What an amazing channel! I'm very interested in physics simulation, and your channel is awesome! Thank you so much.
@kqiesaw.93852 жыл бұрын
This is amazing. I'm going to see if I can reimplement this in unity with as much optimization I can shove into it and see what is the largest resolution I can simulate in real time.
@mickeymcfly4954 Жыл бұрын
So did you? How did it go?
@AsmageddonPrince Жыл бұрын
Omg, are you the same Matthias who used to present awesome physics simulation stuff as an Nvidia researcher years and years ago? If yes, I can't believe I found another of your channels after so many years haha :-)
@blinded65022 жыл бұрын
I've read paper named "Real-time fluid dynamics for games" before, which follows similar idea This explanation is a lot more insightful though
@olbtube2 жыл бұрын
Great video, good explanations and the result is beautiful! Subscribed!
@IgneousGorilla2 жыл бұрын
Why do "n iterations" when forcing incompressibility for the whole grid (6:20)? How is the value of "n" chosen?
@TenMinutePhysics2 жыл бұрын
Gauss-Seidel is an iterative method. When you fix one cell you might "unfix" a neighbor cell. With multiple iterations the solution converges to a global one. You could measure the total error and if it goes below a threshold you stop iterating. Or, typical for real-time apps, you just choose a fixed number.
@Croesquared2 жыл бұрын
Cool stuff, just finished my aerospace engineering masters. My favorite course was a class in CFD theory. Maybe you could make some videos on the finite volume method as well, or finite elements.
@mghemke Жыл бұрын
This **was** finite volume (the volume we are talking about is one Cell) - for each volume (cell) you are enforcing applying body forces, the divergence is zero (incompressible fluid and no sources or sinks) and the advection of velocities.
@Neutrioms2 жыл бұрын
Instantly subscribed. Thank you.
@KlaudiusL2 жыл бұрын
Your channel is gold! .. new subs, thank you
@reik2006 Жыл бұрын
9:43 Small correction to your slide on the general grid interpolation which doesn't effect your simulation, since you calculate the average velocity according to 9:30 in your code on lines 211 and 219. I'm referring to the slides on your website and think the weights in the last two terms should be: v = w00*w10*vij + w01*w10*vi+1,j + w00*w11*vi,j+1 + w01*w11*vi+1,j+1 Lerp in x direction for y = 0 and y = h: v(y=0) = w00*vij + w01*vi+1,j v(y=h) = w00*vi,j+1 + w01*vi+1,j+1 Lerp in y direction: v(0
@reik2006 Жыл бұрын
*Just want to add that I loved the video :) Thanks for sharing
@ricard4582 жыл бұрын
Amazing! Please teach us how to do other types of simulations. I will try all for sure. Thanks for your time.
@TenMinutePhysics2 жыл бұрын
Many videos will follow. I am currently working on one about flip water simulation.
@TheAmazingFlint2 жыл бұрын
Amazing explanation!
@benjaminlehmann6 ай бұрын
That was so great. Thanks
@bajsejohannes2 жыл бұрын
Really nice explanation! I feel like I can go implement it immediately. A small typo at 4:04, g should be in m/s^2, not m/s
@TenMinutePhysics2 жыл бұрын
Thanks! Yes I noticed it before. There are other typos which I all fixed in the slides.
@bajsejohannes2 жыл бұрын
@@TenMinutePhysics Ah, I see now that the slides are updated. Thanks again for a great explanation :)
@nolram2 жыл бұрын
I would still love to see a video about rigidbodies, since they tend to be the most common type of simulation in games and film :) Maybe a more detailed tutorial (especially in regards to angular velocity) based on your XPBD bodies paper could be possible ?
@TenMinutePhysics2 жыл бұрын
Sure, eventually I will cover everything I have been doing. However, since people seem to like fluid sim a lot the next one will be about FLIP 🙂
@artemiyf9078 Жыл бұрын
Thank you so much for this tutorial, sir. Can you please explain where you took the equation for the pressure on 7:04?
@fCauneau2 жыл бұрын
Great... Great... Great job guy !! Thanks so much for sharing !!! (I wrote such simulator for meteorological applications long time ago, but the code was far from this beauty...)
@tunahandogan53092 жыл бұрын
Super Content and Nicely Done 👌👌
@ogibinedi2 жыл бұрын
i see the code with html 779 line of code .... i just do not know how did you figured out all of those stuff sir, you are incredible...
@zaqk2 Жыл бұрын
at 9:44 , the subscript of weights of last 2 terms seems like typo. Its w00w11 and w01w11. This was an amazing tutorial thou... Most understandable vdo... Thanks for making this.
@peterhall66562 жыл бұрын
That was insightful.
@antoine14072 жыл бұрын
It would be awesome if you could make a playlist on how to write such kind of codes for CFD! Thanks for such great video
@TenMinutePhysics2 жыл бұрын
I am glad you like it. In my pipeline are videos about flip, sph and more...
@Nosirrbro2 жыл бұрын
@@TenMinutePhysics A video on SPH would be awesome!
@muggzzzzz2 жыл бұрын
Karman vortex street is one of the possible explanations of the wave-particle duality of light. These vortices act as particles and waves at the same time. Imagine that photons are just ether vortices appearing when the ether flows through atoms.
@stati5tikАй бұрын
When will compressible fluid simulations be uploaded?
@jplanet8 Жыл бұрын
This is very informative!!!!! 😃
@nononononobita Жыл бұрын
Very amazing effect ! Will fluid simulation from Lagrange perspective (e.g. SPH) be covered in the future ?
@mytino2 жыл бұрын
Fantastic tutorial!
@TenMinutePhysics2 жыл бұрын
Thanks, I am glad so many viewers like it!
@azscab Жыл бұрын
This may have changed my life.
@AchiragChiragg2 жыл бұрын
5:12 I can't seem to make sense of the signs. Can you explain/elaborate?
@ASMacman2 жыл бұрын
Do you expect to have any upcoming example of Semi-Lagrangian simulations like the kind used in oceanic+atmospheric models?
@MrTomyCJ2 жыл бұрын
6:08 in this general case, the velocities at most get added zero, but they are never set to zero even if there is an obstacle. As opposed to the particular clase shown before. I don't understand :( I checked out the code but I'm not good enough at javascript, and I see that there are several things not mentioned in the video.
@marcoottaviano5272 жыл бұрын
That's incredible, congratulations! But there's something that's not very clear to me. How is it possible to have vortex shedding if fluid viscosity is not modeled? In an inviscid fluid with initial zero vorticity (potential flow), vorticity would remain zero everywhere in subsequent time steps. In this case, for an inviscid fluid the flow around a cylinder would not have vortex shedding, but would be symmetrical and produce no net drag (D'Alembert paradox).
@lierdakil2 жыл бұрын
His advection method introduces computational (i.e. non-physical) viscosity. Which, to be fair, he mentions in the video (9:06)
@shilo_kulo Жыл бұрын
great tutorial
@prot0form7752 жыл бұрын
I love this and will attempt to recreate this on Python, I only wish we would've gotten an explanation as you were writing the code. I feel sometimes equations and stuff aren't so obvious when implemented into a programming language.
@fiveoneecho2 жыл бұрын
Yeah, the code itself is actually quite poorly-written. I counted at least one variable that was defined, not used, and then redefined in the same scope among many other issues. That's ignoring the random bits of code that are used and never explained in this or a previous tutorial.
@TenMinutePhysics2 жыл бұрын
I don't write the examples in one go from top to bottom. Getting simulation code right and debugging it is tricky. So I don't spend much time on the beauty of the code. But if you have the time it would be great if you could go over future examples before I publish them. Just let me know (tenminphysics at gmail dot com).
@wile97632 жыл бұрын
Very interesting approach! But as has been mentioned a few times already, the Euler equations shouldn't cause vortex shedding, since shedding is a consequence of fluid viscosity. It seems the shedding in this simulation appears due to numerical viscosity.
@TenMinutePhysics2 жыл бұрын
Correct. I do mention numerical damping later in the video.
@eazegpi2 жыл бұрын
I really liked this video. Superbly explained. I have one small question though. What would be the neccessary modifications if your grid had a different spacing in each direction? I think the divergence would have to ve corrected by a factor hy for the u components and a factor hx for the v components, but I can't figure out how to correctly calculate the pressure, which also depends on h. Thanks!
@wee8149Ай бұрын
thx for your great intro to this the, it awked the interest to start over with programming simulations.. therefore, my question, how can i start to become more familiar with programming simulations?