WEBVTT 00:00.690 --> 00:03.870 All right. Welcome to class today. Before we get to the 00:03.870 --> 00:06.210 comments, questions, concerns or other things for me 00:17.310 --> 00:27.270 how's homework for coming? Huh? Unfortunately expected quite a 00:27.270 --> 00:33.840 response. Yeah. I don't think it's conceptually as hard as 00:33.840 --> 00:36.930 some of the earlier ones, but it does require some work. So 00:38.040 --> 00:41.040 anyway, um, today we're primarily going to be talking 00:41.040 --> 00:44.910 about fluids. I guess before that, though, say fish anything 00:44.910 --> 00:47.250 want me to describe what it looks like? And why? 00:54.330 --> 01:00.390 Yes. Like button, huh? 01:02.820 --> 01:03.510 Yeah. 01:05.100 --> 01:08.550 How could I make a screen that people around me couldn't see? 01:10.770 --> 01:12.450 Somebody proposed technology Yes. 01:17.490 --> 01:21.930 Right. So I can make, I can effectively make two polarized 01:21.930 --> 01:26.580 lenses the look through to have the screen behind. How can two 01:26.580 --> 01:32.460 polarizing filters help? One won't polarizing filter just 01:32.460 --> 01:34.770 changes which polarization of light we see. And that's the 01:34.770 --> 01:41.250 same from all angles. To can how can two Yeah. 01:46.530 --> 01:53.430 If I rotate one, I can't see through them. But I do there's a 01:53.430 --> 01:57.750 rotation going on here, I want to put in this space here 01:57.780 --> 02:02.190 something that will rotate the polarization of light, like a 02:02.190 --> 02:06.660 liquid crystal. And then as you see it from a sharper angle, it 02:06.660 --> 02:09.750 will go through more liquid crystal rotating like more and 02:09.750 --> 02:15.180 cause a blocking. This is not the best we could possibly do. 02:15.690 --> 02:20.250 Because you can look steep enough angle and it'll go 02:20.250 --> 02:22.470 rotating all the way around to being able to see through again. 02:23.940 --> 02:28.380 And so this can work. But it will give her multiple 02:28.380 --> 02:32.820 distances, right. So for example, if this distance causes 02:32.820 --> 02:36.090 exactly enough rotation for us to see through, then if I can 02:36.090 --> 02:40.380 find whatever goes twice that distance, and expect that also 02:40.380 --> 02:45.690 to give us something we could see through. So this is part of 02:45.690 --> 02:49.290 a solution. Another part of the solution 02:58.020 --> 03:01.770 there's a really easy way to do this mechanically, although it's 03:01.770 --> 03:05.490 a little bit difficult to the size of the screen. But I could. 03:06.360 --> 03:10.560 So I remember our basic idea of our screen is that we have some 03:10.560 --> 03:16.110 sort of colored filter with a light source behind it. I could 03:16.110 --> 03:24.330 simply add fins behind this back fins and put the light source 03:24.330 --> 03:27.840 back here someplace. So if you look at too sharp, there is no 03:27.840 --> 03:31.740 light to see. I could also put the fins in front, but then 03:31.740 --> 03:35.250 people might bump into them. If I wanted to make this variable, 03:35.250 --> 03:38.040 I could make sure of like two sources like extremely close up 03:38.040 --> 03:41.430 front and back in the back. So they could flip a switch to see 03:41.430 --> 03:44.160 which one's going and change things or maybe move something 03:44.160 --> 03:46.620 physically around. This doesn't undo something like this. And 03:46.620 --> 03:51.330 now in an engineering problem of how do I make stiff dark fins of 03:51.330 --> 03:56.220 sufficient depth to do what I want to do. But some combination 03:56.220 --> 03:58.710 of these are typically done for privacy screens and there's a 03:58.710 --> 04:03.000 lot of different privacy screen approaches out there. In 04:03.000 --> 04:05.130 practice, I'm actually not going to make these fins because they 04:05.130 --> 04:07.230 will hold up well and I also do want people to be able to see 04:07.230 --> 04:09.690 from above or below will make them these little hexagonal 04:09.690 --> 04:13.620 cells like a honeycomb kind of thing. And then they don't 04:13.620 --> 04:16.440 really need to be regular they can be irregular as long as 04:16.440 --> 04:19.440 they're all cylindrical. There's all kinds of little tricks we 04:19.440 --> 04:23.640 can do there to make that work. How the one you saw it worked I 04:23.640 --> 04:26.820 have no idea but I know there are multiple solutions that have 04:26.820 --> 04:32.430 been used in principle to make these things happen. Other 04:32.430 --> 04:35.640 questions or things look or anything else before we dive 04:35.640 --> 04:36.630 into materials Yes. 04:49.980 --> 04:53.460 says not an old desktop because old desktops use cathode ray 04:53.460 --> 04:56.160 tubes and if you cut part of them out, they lose their vacuum 04:56.160 --> 05:01.440 and stop operating altogether. But if you have a LCD depending 05:01.440 --> 05:04.590 on exactly how it's designed or some other like some plasma 05:04.590 --> 05:08.520 displays and so forth, you can do something where you move the 05:08.550 --> 05:12.360 color filtering to another location and effectively this is 05:12.360 --> 05:16.890 the idea of optics of virtual reality goggles all they have 05:16.890 --> 05:18.900 the light source there as well but there's nothing that 05:18.900 --> 05:21.600 requires the light source to be up near the other piece it could 05:21.600 --> 05:26.130 be farther away but these are much more modern technologies 05:26.130 --> 05:29.790 the earliest ones required a giant vacuum chamber shooting 05:29.790 --> 05:33.240 electrons that phosphors and you can't break them and have them 05:33.240 --> 05:40.470 run Alright, today we're gonna continue our deep dive into 05:40.470 --> 05:43.200 fluids well our skimming slightly over the subject I 05:43.200 --> 05:47.970 guess on Monday I think I taught you everything you need to know 05:48.000 --> 05:51.060 to make your own little fluid simulation suitable for homework 05:51.060 --> 05:59.070 five and my plan to move on from there before I do that, I want 05:59.070 --> 06:03.210 to make sure it all click there was a lot of material. So take a 06:03.210 --> 06:06.300 minute glance of your notes Gladstone homework five, see if 06:06.300 --> 06:11.070 there are things I can clarify about how our basic oil Aryan 06:11.070 --> 06:13.290 fluid simulation we discussed last class works. 06:55.740 --> 07:11.820 Other questions yes okay 07:16.830 --> 07:26.970 others yeah 07:37.230 --> 07:40.770 You mean like the boundaries of the whole simulation region? 07:43.470 --> 07:43.950 Everything 07:49.920 --> 07:51.270 I'm not sure I understand the question 08:02.100 --> 08:16.170 Is this a question? Yeah. Okay. Other questions? Yeah. 08:25.080 --> 08:30.990 Okay and any others? 08:44.520 --> 08:47.160 Alright, let's start working through this. Let's start with 08:47.160 --> 08:52.530 the first button matrices. Suite explain how eventually, you'll 08:52.530 --> 08:56.490 end up with a matrix where each row is most of the rows? Well, 08:56.490 --> 08:59.970 all the rows are going to have a positive number on the main 08:59.970 --> 09:03.030 diagonal proportional to the number of neighboring cells to 09:03.030 --> 09:07.320 that cell, and negative numbers on all of the pairing cells. So 09:07.860 --> 09:11.880 most of them, therefore will have a four somewhere here and 09:11.880 --> 09:14.700 some negatives scattered around, you're typically if you near 09:14.700 --> 09:18.240 them, and if you're not near them in the most common layouts. 09:21.300 --> 09:24.870 And I need to be able to do matrix vector multiplication. 09:25.680 --> 09:31.170 But I don't want to store this gargantuan thing. Right? So 09:31.320 --> 09:34.680 we're going to ask you, even the tiny little pictures are going 09:34.680 --> 09:38.670 to be a few 100 by a few 100 pixels, which are already 09:38.670 --> 09:43.860 talking 10s of 1000s of rows and columns. And you multiply those 09:43.860 --> 09:48.300 together, you could easily be in the many megabytes up to many 09:48.300 --> 09:51.090 gigabytes of storage. If you want to try to store the whole 09:51.090 --> 09:55.110 matrix. It's just not doable. So what we're going to do instead 09:55.110 --> 09:58.350 we're going to store a very short version. We're going to 09:58.350 --> 10:03.810 store each row So let's consider just one row, short list of rows 10:04.770 --> 10:09.900 for that row. Let's suppose arbitrarily that this is row 27. 10:11.220 --> 10:15.420 Okay, that means this is an index 27. This is an index 26. 10:15.450 --> 10:20.580 This is an index 28. And then I've got some other things 10:20.580 --> 10:23.070 floating around here, I don't know, maybe this is index eight. 10:23.400 --> 10:28.890 And this is index 103. I would never get this exact matrix out 10:28.890 --> 10:30.840 of what we're doing. But the fact that I wouldn't, isn't 10:30.840 --> 10:33.270 declare, so we'll just use this anyway, it'll give us the idea 10:33.270 --> 10:38.340 we need for what we're doing. So how do I store this matrix, it 10:38.340 --> 10:47.280 store this matrix as NX negative one, and 26, negative one, and 10:47.280 --> 10:57.060 27, four, and 28, negative one. And 103, negative one, I store 10:57.060 --> 11:04.920 it is these five pairs index value. I'm going to store such a 11:04.920 --> 11:08.190 row for everything for the matrices we will be doing for 2d 11:08.190 --> 11:12.540 fluids, no row of the matrix will have more than five values. 11:13.200 --> 11:16.830 But some of them will have three or four instead of five. So we 11:16.830 --> 11:19.830 need some ability to store variables, late rows that will 11:19.830 --> 11:22.890 never need more than five, this can create more efficient data 11:22.890 --> 11:25.320 structures, if you think about it carefully. But whatever. 11:25.950 --> 11:30.690 Alright, so I have this row. Now how would I multiply that by a 11:30.690 --> 11:37.080 vector multiplies matrix by a vector, one of the elements of 11:37.080 --> 11:40.680 the result will be the dot product of this vector. And this 11:40.680 --> 11:44.910 row, that will be the 27th element in my resulting vector. 11:46.980 --> 11:49.860 And the normal way is I would iterate through the vector and 11:49.860 --> 11:53.250 do all the multiplies. But I really don't need to do that, I 11:53.250 --> 11:57.360 only need five elements of my vector, I need index eight, I'm 11:57.360 --> 12:00.690 going to multiply that by negative 127. Go to multiply 12:00.690 --> 12:06.720 that by negative one, I need the next 2627 multiplied by 428, my 12:06.720 --> 12:09.360 negative one and one of the three by negative one, add those 12:09.390 --> 12:13.230 five numbers together, that is the 27th entry of my resulting 12:13.230 --> 12:18.000 vector. And so I'm going to design this, it's going to loop 12:18.000 --> 12:20.430 through the rows to see each value of my resulting vector. 12:20.730 --> 12:22.560 But for each of those, it's going to loop through the values 12:22.560 --> 12:25.320 of that row and look up just those specific values of my 12:25.320 --> 12:39.030 vector. Questions. Yes, correct. I don't store all the zeros and 12:39.030 --> 12:42.240 I don't use the zeros in my math, I just ignore them 12:42.240 --> 12:47.100 entirely at all times both space and time. Give me a effectively 12:47.100 --> 12:50.850 a square root term in both my space and my time to run this 12:50.880 --> 12:51.330 Yes. 13:02.580 --> 13:05.700 Correct sparse matrix type sparse matrix is, in general, 13:05.700 --> 13:11.520 less sparse, we're not going to do that. Even the more fancy 13:11.520 --> 13:13.980 versions of handling this, we're going to do some sort of 13:13.980 --> 13:18.000 preconditioning, we're going to push around the matrices until 13:18.000 --> 13:21.540 they can all be multiplied by vectors, not each other. And 13:21.540 --> 13:24.480 this is a big part of making the efficient sparse matrix 13:24.480 --> 13:28.020 libraries. For the one we'll need, we'll just have the one. 13:28.050 --> 13:30.210 And if you look through the algorithm, we outline for the 13:30.210 --> 13:34.980 conjugate gradient. Or if you wanted to do the, the, I can't 13:34.980 --> 13:36.780 remember there's simpler one that's described in the one 13:36.780 --> 13:41.010 paper. Anyway, both of them will only involve vector times matrix 13:41.010 --> 13:44.190 math, nothing else, those involve vector type vector math, 13:44.580 --> 13:51.690 but I'm assuming you can do that. Okay, so this is how we do 13:51.690 --> 13:57.030 that. Um, alright, I think I'm gonna do these other slightly 13:57.030 --> 14:05.880 out of order. What happens between cells inside a cell, for 14:05.880 --> 14:08.490 the one we're asking you to do, you're going to have something 14:08.490 --> 14:11.250 that we're calling temperature, although it isn't actually 14:11.700 --> 14:14.700 mechanically like temperature. But in general, this is the 14:14.700 --> 14:21.300 contents of the cell. Okay, so if we're doing smoke, this will 14:21.300 --> 14:24.930 be how dense the smoke is in that place, if and so forth. 14:24.930 --> 14:27.900 We're doing training to a water air simulator. This will be how 14:27.900 --> 14:32.580 much water is in the cell, and so forth. And in order to make 14:32.580 --> 14:39.810 our math easy, on these edges, I will store the x velocity on 14:39.810 --> 14:45.540 both of these edges. And on these edges, I will store the y 14:45.540 --> 14:55.170 velocity Hey, so what is between the cells of the grid depends on 14:55.170 --> 15:00.000 which cells I'm thinking about, between the content cells of the 15:00.000 --> 15:06.630 Read are the velocities between the Y Velocity Grid centers are 15:06.630 --> 15:10.080 the contents, right? Do something between they're all 15:10.110 --> 15:12.330 they've got three different grids are differently aligned. 15:12.330 --> 15:15.180 If I was doing 3d, I'd have a fourth one for z is velocities 15:15.180 --> 15:22.470 as well. No slightly differently aligned. So how do I do my 15:22.470 --> 15:26.670 linear interpolation? Well, depends entirely on what I am 15:26.670 --> 15:32.970 interpolating. Hey, so let's suppose I want to know, at this 15:32.970 --> 15:38.040 point, what are the values of things? If I want to know what 15:38.040 --> 15:41.400 are the values of the contents of the cell, I would need to 15:41.400 --> 15:49.380 look at the four surrounding contents centers. And for those, 15:49.380 --> 15:54.360 I would then need to figure out some distances. Right, let's 15:54.360 --> 15:56.790 suppose that this was oh, I don't know, maybe that's point 15:56.790 --> 16:00.480 three. And this is point seven. I don't know. So find these 16:00.480 --> 16:04.170 distances, maybe this is point four, and this is point six. 16:06.480 --> 16:11.550 Then the weight of each of these, right, I want the weights 16:11.580 --> 16:16.110 to get approach unity as this number approaches zero. So the 16:16.110 --> 16:19.860 weight of this point to contributing to that one is 16:19.860 --> 16:25.620 going to be point four times point seven. Which is going to 16:25.620 --> 16:33.030 be equal points, 28 points 28 of this. And for this one, and then 16:33.030 --> 16:35.490 take the two that are far apart from that, multiply them 16:35.490 --> 16:43.110 together to get what is that point 42. If I'm doing my math 16:43.110 --> 16:46.590 correctly, in my head, for this one, point, 3.6, that's point 16:46.590 --> 16:51.060 one, eight. And for this 1.3, and point four, that's point 16:51.060 --> 16:54.660 one, two. If I've done my math, right, these should all sum to 16:54.660 --> 16:58.980 one. Hurray, they do. And those will be the weights of those 16:58.980 --> 17:01.950 points to contribute to the contents at this point. 17:03.750 --> 17:17.010 Questions? Yes. This is a grid. It's not a grid of colors. It's 17:17.010 --> 17:22.290 a grid of fluid. So it's designed like a raster, but it's 17:22.290 --> 17:25.920 not actually represent that just because both of them are regular 17:25.920 --> 17:29.790 grids. Other questions? 17:35.940 --> 17:42.720 All right. Let's see if this clicked. Given this location I 17:42.720 --> 17:48.630 have given you what is the weight if I were interpolating 17:48.660 --> 17:53.430 instead, the X velocities so I'm going to find the x velocities 17:53.670 --> 17:59.100 what for XYZ shade look at and what is the weight of each child 17:59.100 --> 18:01.380 who are sitting next to see if you can come up with which four 18:01.620 --> 18:04.290 and what the weight of each of them would be given the numbers 18:04.290 --> 18:05.250 I've already put on the board. 18:59.760 --> 20:14.220 up every week, the center So I put one answer up the board. 20:16.260 --> 20:17.040 Questions? 20:21.720 --> 20:23.820 Have you want me to go any farther? Explain any part of 20:23.820 --> 20:24.180 this? 20:30.960 --> 20:31.470 Yes. 20:41.790 --> 20:49.110 Why do I want? I don't? How did I get this number? Okay, so here 20:49.110 --> 20:55.260 are my four things. This distance must be point two. This 20:55.260 --> 20:58.770 distance is still point 6.2 times point six is point one, 20:58.770 --> 21:01.170 two. Yes. 21:07.410 --> 21:10.890 Because if I use the two in the same cell, I have a sudden 21:10.890 --> 21:14.760 change in x velocity when I cross this boundary, I don't 21:14.760 --> 21:23.820 want anything to happen suddenly in my fluid. Yes. If I do more 21:23.820 --> 21:27.060 than two of these points, yes, so there are approaches where I 21:27.060 --> 21:30.750 would look at more than two places, I could grab three 21:30.750 --> 21:33.900 places and do a quadratic interpolation, I could do four 21:33.900 --> 21:37.140 places into a cubic interpolation, I could try using 21:37.140 --> 21:41.130 a sink or other functions have weird behaviors. And I could get 21:41.130 --> 21:46.230 a smoother fluid than the linear interpolation. There is a 21:46.230 --> 21:51.180 general trade off that linear is smooth enough, I will get more 21:51.180 --> 21:55.590 payoff beyond linear by doing more frames, smaller timescales 21:55.590 --> 21:58.170 than I will by doing more math, but that's not always true. And 21:58.170 --> 22:00.060 it depends a little bit on your application here. And then here, 22:00.810 --> 22:07.440 we talk about the red points. Depends on what I'm 22:07.440 --> 22:11.550 interpolating, I need to find the four things where the thing 22:11.550 --> 22:15.990 I'm interpolating live. So the contents live in cell centers, y 22:15.990 --> 22:18.690 velocities live in vertical boundaries, X velocities live in 22:18.690 --> 22:21.930 horizontal boundaries. And so if I wanted to get all of those 22:21.930 --> 22:24.240 things, for this point, I have to check all three of those 22:24.240 --> 22:27.330 grids, but different ones for different content here. 22:29.040 --> 22:31.980 When so when you're modeling, like if you just use a bunch of 22:31.980 --> 22:33.570 random points and scattered throughout the 22:33.569 --> 22:38.879 grid. So we we will talk about doing that later today. But for 22:38.879 --> 22:41.849 what we've talked about so far, no, we'll just move the contents 22:41.849 --> 22:44.309 into the self interest, then plot those directly as a pixel. 22:46.349 --> 22:50.309 So for the homework five, I'm going to do this and then just 22:50.309 --> 22:52.139 going to use the temperature coordinate and turn it into 22:52.139 --> 22:57.959 color and draw it as a raster. Aha, that's what homework five 22:57.959 --> 22:59.969 asks you to do. There are fancier versions where I would 22:59.969 --> 23:02.189 put particles or other things in them and move them around and 23:02.189 --> 23:05.669 draw those. For example, this approach won't work great for 23:05.669 --> 23:11.129 3d. Because 3d raster you can't see through, right? Um, but this 23:11.129 --> 23:13.049 is what we're going to do for the starters. Yes. 23:14.609 --> 23:15.359 Vertical line. 23:19.020 --> 23:23.760 Yeah, interesting question and worth answering. So let's 23:23.760 --> 23:27.270 suppose my point is here, and I'm trying to find the x 23:27.270 --> 23:33.780 velocity. If I just naively apply my approximation, I will 23:33.780 --> 23:38.340 clearly find these two points, I might find these two or these 23:38.340 --> 23:44.820 two, it won't matter which of those I find because I'm going 23:44.820 --> 23:49.050 to be multiplying by zero for the weights. But suppose I pick 23:49.050 --> 23:54.660 these two, right? This distance is zero, and this distance is 23:54.660 --> 23:58.920 one. And so the weight of those points will vanish. So actually 23:58.920 --> 24:02.700 won't have to do anything special at all. It will just do 24:02.700 --> 24:06.420 the right thing. Without any special effort. 24:08.250 --> 24:09.030 Other questions? 24:12.660 --> 24:15.300 Okay, so this is what's going on between the cells is how we do 24:15.300 --> 24:20.070 our linear interpolation. And this brings back our post 24:20.070 --> 24:24.510 solution. So we solve this linear system. Once we solve the 24:24.510 --> 24:28.680 linear system, that's going to give us some information. Hey, 24:29.130 --> 24:32.520 remember, before we saw the linear system, we're going to 24:32.520 --> 24:36.090 have maybe i Oh, maybe this is a point where all the fluid is 24:36.090 --> 24:40.620 flowing into this point. This solution of the linear system is 24:40.620 --> 24:45.030 going to come up with a set of pressures, really ways to change 24:45.030 --> 24:47.340 the divergence. It's not literally pressure in the 24:47.340 --> 24:49.860 mechanical sense. It's something sort of like pressure and 24:49.860 --> 24:54.090 behavior. And it will come back with the pressure for every 24:54.090 --> 24:58.140 cell. Let's just suppose let's look at some neighboring cells 24:58.140 --> 25:01.410 with this. Let's suppose they said Pressure three, and this 25:01.410 --> 25:04.020 has pressure one, and this has pressure eight and this has 25:04.020 --> 25:09.120 pressure negative three. This has pressure to, like you don't 25:09.120 --> 25:13.380 need that one for what I'm doing right now. Right, so this now is 25:13.380 --> 25:16.200 going to have a high enough pressure, it will have a high 25:16.200 --> 25:20.280 enough pressure to push this flow out. So what's the sum of 25:20.280 --> 25:25.350 those. So this might have something like 12. No, I don't 25:25.350 --> 25:27.360 need that I just need bigger than all the neighbors Sorry, I 25:27.360 --> 25:31.140 just will have something like four, five, let's say it's five, 25:31.440 --> 25:35.220 I think this will do what I want to do. So once I have my 25:35.220 --> 25:39.660 pressures, I using this to change my velocities. And the 25:39.660 --> 25:45.180 change is really simple. It's just subtraction. So I'm going 25:45.180 --> 25:51.000 to add, I'm going to move this one up by two. This one is going 25:51.000 --> 25:55.350 to go that way by three, this one is going to go this way by 25:55.350 --> 25:59.970 eight. And this one is going to go this way by three, sorry, I 25:59.970 --> 26:02.340 move this one in the wrong direction. This is going to go 26:02.340 --> 26:08.820 this way by three. I just take the difference of adjacent cells 26:09.300 --> 26:12.360 and add them to the velocity between those two cells for 26:12.360 --> 26:17.580 every velocity. So ver I just loop over all the x's and 26:17.580 --> 26:20.820 subtract 2x Bangs loop over all the y's attract y things, add 26:20.820 --> 26:24.390 them to velocity. And because of how we set up our linear system 26:24.420 --> 26:28.260 of equations, the end result will always be divergence free. 26:29.790 --> 26:33.360 Okay, so if it doesn't end up divergent for you, then you did 26:33.360 --> 26:36.720 your linear algebra wrong. Or you set up your matrix wrong, we 26:36.720 --> 26:40.800 created the matrix to have the property that this subtraction 26:40.800 --> 26:42.990 will cause our velocities to become divergent. 26:44.760 --> 26:47.520 And that's what we do. Yes. 26:49.980 --> 26:53.280 Looks like everything is just collapsing. Right? So I don't 26:53.280 --> 26:58.350 have to only do this. If I decide I want some cell to 26:58.350 --> 27:02.910 absorb. How could I say I want this to be a sink, I want fluid 27:02.910 --> 27:07.800 to vanish into this cell. I couldn't make the pressure 27:07.800 --> 27:10.470 negative back I should make my linear algebra do that for me. 27:11.880 --> 27:16.500 Remember, when I'm solving my linear algebra, right, the basic 27:16.500 --> 27:22.050 structure we have is we have some matrix times some pressures 27:22.080 --> 27:28.380 equal some divergence. And the way we set to set this up is to 27:28.380 --> 27:32.760 set this to the current divergence of the system. So 27:32.760 --> 27:36.270 that when I subtract out my pressures, derivative of 27:36.270 --> 27:40.800 pressures, that divergence will vanish. Well, if I decide that 27:40.800 --> 27:45.450 there are some magical cell that ought to absorb fluid, I just 27:45.450 --> 27:48.450 saw for our pressure that will absorb that much fluid into that 27:48.450 --> 27:52.380 cell. So I'm gonna change this thing before I start my linear 27:52.380 --> 27:55.920 system of equations. And it will solve it globally. For me, it 27:55.920 --> 27:58.980 won't just make that one thing absorb fluids, it'll distributed 27:58.980 --> 28:01.920 across the rest of the fluids, everything else continues to be 28:02.820 --> 28:07.170 divergence free as desired. And so I can make sources and sinks 28:07.200 --> 28:09.570 of fluid while still maintaining the divergence free of 28:09.570 --> 28:15.060 everything else. Other questions, our fluid simulation 28:15.060 --> 28:18.090 we talked about on Monday before we dive into fancier things. 28:26.430 --> 28:30.120 All right. Today is mostly for the rest of our time, I guess 28:30.120 --> 28:33.420 together today, we're going to just sort of dive dance across a 28:33.420 --> 28:38.460 large number of MC things we do with fluids. Hey, each of them 28:38.460 --> 28:40.470 we're just going to say here's a fancier thing. And here's a 28:40.470 --> 28:42.660 fancier thing. On top of that, occasionally, I'll play little 28:42.660 --> 28:45.720 videos and talk about them. I'm not going to talk about them in 28:45.720 --> 28:48.480 the level of detail that will let you program them. So why are 28:48.480 --> 28:52.110 you talking about them at all? Because this is an introduction, 28:52.710 --> 28:55.740 I want to give you a feel for what's happening in this space. 28:56.100 --> 28:59.670 And this is a major space in computer graphics. Many 28:59.670 --> 29:03.750 different aspects of things will hinge on this isn't a dance over 29:03.750 --> 29:06.540 things give you enough of a sense, or some idea what's going 29:06.540 --> 29:09.450 on, not enough that you understand everything. And if 29:09.450 --> 29:14.010 you want to dive in more, you're welcome to. So we're gonna start 29:14.010 --> 29:16.500 by talking about fancier things you can do with Euler 29:16.500 --> 29:22.470 simulations, or Euler grid. Okay, so let's, we'll start 29:22.500 --> 29:24.840 we're going to start by talking about something called 29:25.050 --> 29:31.560 circulation. Thus far, we'll solve NaVi a stokes the 29:31.560 --> 29:35.220 equations for incompressible fluids. We've solved NaVi a 29:35.220 --> 29:38.220 stokes on our grid by using this approximation of the 29:38.220 --> 29:42.000 differential equation that the grid provides. By thinking about 29:42.990 --> 29:47.400 velocities as the primary thing we are moving. We're making our 29:47.400 --> 29:50.700 velocity fields divergence free, we're making sure our velocity 29:50.700 --> 29:55.080 field gets infected. But here's an interesting property of 29:55.080 --> 29:59.970 divergence feed fluids over time. If I have any arbitrary 30:00.000 --> 30:06.510 load path, I can measure the circulation around this path. 30:07.440 --> 30:11.400 Meaning on the whole is fluid flowing one direction or the 30:11.400 --> 30:13.440 other direction around the path. Now, certainly there may be 30:13.440 --> 30:16.860 places this flowing the wrong way. But I can effectively 30:16.860 --> 30:20.460 integrate the flow along the path around the path. If you're 30:20.460 --> 30:23.310 familiar with line integrals, that's what we're doing. If 30:23.310 --> 30:27.120 you're not, we can just imagine this general idea of, if I put 30:27.120 --> 30:30.600 this in the fluid, if I put a string here, would it spin one 30:30.600 --> 30:34.980 way or the other way? Okay, so this is a circulation around 30:34.980 --> 30:39.030 this pack. An interesting property of divergence free 30:39.030 --> 30:42.750 fluids, if they have no viscosity, circulation is 30:42.750 --> 30:47.940 preserved over adduction. What do I mean? I mean, later on, 30:48.300 --> 30:51.660 this may have moved to a new position in the field, it may 30:51.660 --> 30:54.420 have even changed shape, because different parts of the fluid are 30:54.420 --> 30:58.890 moving at different speeds. But the circulation around it will 30:58.890 --> 31:03.570 not change. Unless there is viscosity or some outside force, 31:03.780 --> 31:08.070 it is preserved by the Navi stokes equations. proving this 31:08.070 --> 31:10.530 is an interesting exercise in differential equations that we 31:10.530 --> 31:15.360 don't have to do, somebody else did it. Okay. So this is a fact, 31:16.200 --> 31:19.380 this is a you prompt that we can actually use to make better 31:19.410 --> 31:24.780 versions of our Euler simulation. So let's explain how 31:24.780 --> 31:33.840 we would do that. In my grid, we have stuff and we have X 31:33.840 --> 31:40.800 velocities and y velocities. Right. But we haven't put 31:40.800 --> 31:44.310 anything at the intersections, the intersections are the 31:44.310 --> 31:49.770 natural place to put what we call vorticity. Or we can, so 31:50.370 --> 31:53.640 circulation is over a whole ring around a point, we call it 31:53.640 --> 31:58.950 vorticity. Meaning how much like a vortex is it. And so we can 31:58.950 --> 32:04.560 solve that vorticity on the corners. And in our discrete 32:04.560 --> 32:08.490 world, our vorticity is again, just a simple adding and 32:08.490 --> 32:14.250 subtracting of the four neighboring velocities. We can 32:14.250 --> 32:20.040 then use our vorticity keys to define that the vorticity at 32:20.040 --> 32:29.400 some point here is equal to the circulation around this. Hey, we 32:29.400 --> 32:32.520 just define this to be the case, we can actually cause our linear 32:32.520 --> 32:35.670 interpolation to make this literally true, need to tweak a 32:35.670 --> 32:37.290 little bit about our interpolation. But we can do 32:37.290 --> 32:43.770 that. Now what we can do is instead of instead of directing 32:43.770 --> 32:49.560 velocities, we can add vector circulations. So I can come 32:49.560 --> 32:53.340 along here and I can say, Ah, I'm going to advect each of 32:53.340 --> 32:58.380 these points based on the local velocity field that is here. To 32:58.380 --> 33:03.690 wherever it happens to go, I'm going to get another ring. I'll 33:03.690 --> 33:05.940 do this backwards in time, like our backward induction, we 33:05.940 --> 33:08.160 already doing less, and I'll just measure what is the 33:08.160 --> 33:12.060 circulation around that circle? What was the circulation back, 33:12.060 --> 33:16.110 then that's going to be my new vorticity at this cell. And so 33:16.110 --> 33:18.690 instead of doing what we were doing for velocities look where 33:18.690 --> 33:21.030 the velocity point would have been in the past, see what 33:21.030 --> 33:24.030 velocity was there, do the same thing for circulations instead. 33:25.710 --> 33:29.940 And when we do this, poof, we will suddenly have an energy 33:29.940 --> 33:35.040 preserving fluid. The math just works out better, this is a 33:35.040 --> 33:39.150 better thing to interpolate. However, we're not going to talk 33:39.150 --> 33:43.200 about doing on this kind of grid, because the circulations 33:43.200 --> 33:47.400 need to then be turned back into velocities. And on a square 33:47.400 --> 33:51.600 grid, the matrix that we would solve for that is highly 33:51.600 --> 33:57.570 singular. That is to say it has a highly under constrained 33:57.570 --> 34:03.180 situation. So we can't actually solve for the velocities in a 34:03.180 --> 34:07.230 numerically robust way. So when we want to do this, we're going 34:07.230 --> 34:09.690 to have to do it, instead of on a square grid, we're gonna have 34:09.690 --> 34:14.340 to do it on a triangular grid. Instead, we need effectively the 34:14.340 --> 34:20.610 property we need is that the each of the velocities that 34:20.610 --> 34:24.390 contributes to circulation needs to be linearly independent of 34:24.390 --> 34:27.300 the others, they can't ever line up if you had to make a 34:27.300 --> 34:29.940 triangular grid or 3d tetrahedral grid undirected 34:29.970 --> 34:33.840 guarantee that no two of these are coplanar in order to have 34:33.840 --> 34:37.980 well conditioned matrices want to meet highly non coplanar. And 34:37.980 --> 34:42.360 then we can prove use this and make a dramatically better fluid 34:42.360 --> 34:46.320 simulation that preserves energy as well as momentum. And 34:46.320 --> 34:49.680 therefore we can start doing useful things with it, like 34:49.680 --> 34:56.610 measuring actual precise work of viscosity and diffusion and 34:56.610 --> 34:59.520 other behaviors and get started actually making it look like a 34:59.520 --> 35:05.370 real flow. instead of a vaguely fluid ish simulation. So this is 35:05.370 --> 35:08.520 the thing we can do. There's a fair amount of code to get this 35:08.520 --> 35:10.380 to work because you got to get your triangular grid and you 35:10.380 --> 35:12.630 have to make sure it has right properties. And your matrices 35:12.690 --> 35:15.450 suddenly all have weird numbers in them, because it all depends 35:15.450 --> 35:18.900 on the links and areas and things. And you can solve all of 35:18.900 --> 35:22.620 that. And it's doable. It's just a lot more work. But the end 35:22.620 --> 35:26.460 result is also a lot prettier. So this is the thing we can do. 35:29.160 --> 35:31.530 Questions on this before we talk about another thing we can do? 35:36.690 --> 35:43.950 Alright, Tinder, the another thing we can do. Let's look at 35:44.340 --> 35:51.030 what do we want? I want this one, I think. Yeah. This is a 35:51.030 --> 35:59.070 demo video from a relatively recent SIGGRAPH paper. What's 35:59.070 --> 36:02.730 happening in this video? What do you see? You are trying to 36:02.730 --> 36:05.400 describe this video for an audio only podcast? What would you 36:05.400 --> 36:05.790 say? 36:14.160 --> 36:17.940 I'm hearing a lot of toothpastes. I'm hearing some 36:17.940 --> 36:23.880 other things too. Where's this from? I think there's a SIGGRAPH 36:23.880 --> 36:26.010 Asia 2017. But I could have that wrong. 36:31.800 --> 36:36.150 Oh, yeah, actually, IQ factor is a useful thing and making people 36:36.150 --> 36:42.330 remember your paper, right. So all right, we got no idea what's 36:42.330 --> 36:46.620 going on here. This is an example of what we'll call an A 36:46.620 --> 36:52.050 Lascaux Elasto. viscous fluid has a high viscosity rate. 36:52.680 --> 36:57.120 That's causing it to move slowly. Okay, but not only moves 36:57.120 --> 37:00.690 slowly, it moves slowly. Anyway, it sort of preserves shape. We 37:00.690 --> 37:03.630 call that some kind of elasticity. This actually has 37:03.630 --> 37:08.880 less elasticity than some other systems. So let's pause this one 37:08.880 --> 37:12.720 and look at a different one. I think this is the one I want. 37:13.830 --> 37:17.040 Nope, this is not the one I want. What do I have here? I 37:17.040 --> 37:22.590 want this is the one I want. This one probably won't have the 37:22.590 --> 37:23.220 ick factor. 37:28.860 --> 37:31.620 It mostly doesn't have the X factor because they rendered it 37:31.620 --> 37:37.620 in a different color. Right? But notice this band is wiggling. 37:39.780 --> 37:43.530 It's wiggling in part, because every time it moves to one side, 37:43.530 --> 37:46.530 there's some like sort of little internal springy force that 37:46.530 --> 37:51.000 trying to pull it back. And here's the paper. Hey, oh, this 37:51.000 --> 37:53.640 was the one from SIGGRAPH. 20, Asia 2017. So the other one must 37:53.640 --> 37:59.250 have been from somewhere else I don't remember anyway. But how 37:59.250 --> 38:02.280 do we do this? Before we talk about a simulated let's talk 38:02.310 --> 38:06.120 about what's going on mechanically, in the fluid. 38:07.470 --> 38:10.350 Fluid involves lots of little particles that are moving past 38:10.350 --> 38:15.390 each other. Okay. But as they move past each other in other 38:15.390 --> 38:18.750 materials, like you think about rubber, they can sort of move 38:18.750 --> 38:20.790 past each other, but they'll always try to get back to where 38:20.790 --> 38:24.480 they were before. For this example, they're going to move 38:24.480 --> 38:27.030 past each other and they're sort of going to try to get back to 38:27.030 --> 38:29.100 where they were before but eventually get far enough apart. 38:29.100 --> 38:32.700 They'll forget about that. Okay, it's we want to be able to 38:32.700 --> 38:37.500 simulate this kind of behavior for various purposes, some of 38:37.500 --> 38:39.750 which are the ick factor, some of which are making things look 38:39.750 --> 38:42.600 like honey doing weird things in ribbons, right? There's various 38:42.600 --> 38:47.460 reasons why you might want to do this. So how do we go about 38:47.460 --> 38:51.540 doing that, in practice, many of them are not going to be based 38:51.540 --> 38:54.120 purely on oil or simulations. But explaining how it works in 38:54.120 --> 38:56.310 the oil or space to actually make it easier to understand how 38:56.310 --> 39:00.000 works in the other spaces. We're going to need to talk about two 39:00.300 --> 39:03.060 characteristics of material that you may or may not have led 39:03.060 --> 39:06.810 encountered before, or we're going to talk about stress and 39:06.810 --> 39:16.290 strain. It I personally find it annoying that these phrases 39:16.290 --> 39:18.750 don't have any intuitive meaning even though they sound like 39:18.750 --> 39:21.630 English related to what they're actually talking about. We're 39:21.630 --> 39:28.140 going to start with strain. Strain means sort of internal 39:28.200 --> 39:35.850 displacement. What do I mean by internal displacement? I do not 39:35.850 --> 39:39.690 mean object move from here to there, that will be external 39:39.690 --> 39:43.890 displacements, the whole thing move that is not strain. What I 39:43.890 --> 39:48.630 mean instead is what used to be a straight line in the fluid 39:48.660 --> 39:53.730 changed into a non straight line. That is going to be 39:53.730 --> 39:58.500 strained. The interior contents of the material moved in 39:58.500 --> 40:01.950 relationship to each other I also want strain to be 40:01.950 --> 40:07.590 rotationally invariant. So changing to the same situation, 40:07.590 --> 40:14.040 another orientation, no strain. So here I have no strain. But 40:14.040 --> 40:18.720 here between these two, I do have strain. There has been some 40:18.720 --> 40:24.540 displacement. There's several different kinds of strain. We 40:24.540 --> 40:27.390 have shear strains, which are sort of like this bending II 40:27.390 --> 40:31.350 kind of thing. And we have compress Island tensile strains 40:31.350 --> 40:34.830 where things move closer together or farther apart. But 40:35.100 --> 40:39.540 here's the basic idea of how we're going to. So strain strain 40:39.540 --> 40:42.930 just happens as the fluid flows, its internal change situation 40:42.930 --> 40:48.480 changes. strain is part of what occurs. Strain by itself is just 40:48.510 --> 40:52.470 something I can measure. It doesn't do anything, it's just a 40:52.470 --> 40:58.500 characteristic of what happened. But many materials strain causes 40:58.500 --> 41:09.450 stress. And stress is internal force. Hey, so if I take a 41:09.450 --> 41:12.750 rubber band, and I stretch it out, there is strain because the 41:12.750 --> 41:16.650 individual elements of the rubber band are pulling farther 41:16.650 --> 41:21.510 apart. That strain then causes stress that tries to undo the 41:21.510 --> 41:25.620 strain. That's what we mean by elasticity. So strain causes 41:25.620 --> 41:28.650 stress, and the stress tries to undo the strain, we have an 41:28.650 --> 41:36.180 elastic material. So what does this mean for a fluid? One thing 41:36.180 --> 41:41.550 I can think about doing in my grid, we have been tracking 41:41.550 --> 41:46.920 velocities, contents, possibly vorticity, or circulations, we 41:46.920 --> 41:49.980 could also actually track strain. 41:51.540 --> 41:55.710 So I could say, Alright, I'm going to measure how different 41:55.740 --> 41:58.560 the flow is between the different de adjacent places, it 41:58.560 --> 42:01.320 turns out in the oil, Air and Space, strain turns into a 42:01.320 --> 42:04.500 special type of second derivative, I can just solve it 42:04.500 --> 42:08.250 on my grade, I can measure the strain of my velocity field, 42:08.700 --> 42:12.720 over time how much strain is accumulating. Now my strain is 42:12.720 --> 42:15.870 going to be a vector quantity. And so I might say, in this 42:15.870 --> 42:18.390 place, the strain is that direction in this place, it's 42:18.390 --> 42:23.250 this direction, and so forth. I can measure my strain, and I can 42:23.280 --> 42:28.020 advect it across the grid, I can accumulate it from frame to 42:28.020 --> 42:32.370 frame, I can have a measure of how much the fluid has moved 42:32.610 --> 42:39.780 internally. And then I can use that strain to apply stress, I 42:39.780 --> 42:44.550 can add a force. Before I do my all my other things, I can apply 42:44.550 --> 42:49.440 a force or I just change all of the velocities. To do my stress 42:49.440 --> 42:52.890 term, you've accumulated this amount of strain, I want to undo 42:52.890 --> 42:55.020 that amount of strain by applying a force, I'm just gonna 42:55.020 --> 42:57.540 change all the velocities based on what the force told me to do. 42:58.020 --> 43:00.630 And then I'll use my usual projection technique to remove 43:00.630 --> 43:05.010 the divergence and make it still look fluid. And so the result of 43:05.010 --> 43:09.270 this is that I can make Elasto viscous fluids, viscosity, I 43:09.270 --> 43:12.480 already have that just smoothing out the velocity field, I now 43:12.480 --> 43:15.750 have a way of doing elasticity by tracking the strain, using it 43:15.750 --> 43:18.840 to generate a stress that tries to move the fluid back into its 43:18.840 --> 43:22.980 original position. And if I could figure out how to do my 43:22.980 --> 43:28.170 math with no errors, I could literally undo the entire fluid 43:28.170 --> 43:31.560 flow by applying all my strain backwards, I could simulate 43:31.560 --> 43:35.400 bouncing rubber balls inside a fluid simulation, if I could do 43:35.400 --> 43:41.820 my math without errors by using stress and strain. So this is a 43:41.820 --> 43:48.180 thing that we could try to do. It turns out to doing math 43:48.180 --> 43:50.220 without errors, and the grid is a little bit tricky, which is 43:50.220 --> 43:52.770 why we're often going to do this more complicated settings. But 43:52.770 --> 43:55.920 this is the basic idea. And this will allow us to get all of the 43:55.920 --> 43:59.310 interplay between different kinds of pieces. So actually, 43:59.310 --> 44:04.380 let's come back to just nope, not this one. Let's come back to 44:04.380 --> 44:07.200 this one. No, this is not the one I did before. Where is it? 44:09.360 --> 44:16.260 This one alright, right. So let's look at this simulation 44:16.260 --> 44:17.700 right here just a moment. 44:24.660 --> 44:30.660 So here, they just made them basically rigid. The viscosity 44:30.660 --> 44:33.510 is very high, that goes to zero very high, they just stay there. 44:34.590 --> 44:38.490 I don't think any less to see me only have a viscosity here. But 44:38.490 --> 44:43.260 then you can melt them by changing that internal 44:43.260 --> 44:48.930 parameter. Right, and you can decide how you want them to melt 44:49.650 --> 44:54.420 based on tweaking how that parameter works. If we had a 44:54.420 --> 44:58.200 lossless integrator, we could then undo the melting. We could 44:58.200 --> 45:00.750 say no, no, I actually want you to come back They had spring 45:00.750 --> 45:04.950 back into existence. I had a good video for that, but I seem 45:04.950 --> 45:07.590 to have misplaced it. So anyway, there are some where they 45:07.590 --> 45:11.130 actually let them undo their melt, Enos just come back into 45:11.130 --> 45:15.510 what they were before as they go. So we can have this sort of 45:15.540 --> 45:19.800 integration of the rigid and the fluid and everything in between, 45:19.800 --> 45:23.430 we could do multi things robbery things, all in the same system, 45:23.700 --> 45:26.910 which allows a great deal more flexibility in our simulations. 45:28.350 --> 45:30.810 Questions. Yes. 45:36.210 --> 45:38.790 So it turns out, what you're gonna do have is costly like 45:38.790 --> 45:41.940 thing in every piece. So we're gonna have some out of 45:41.940 --> 45:44.400 viscosity, viscosity literally is just applying on the 45:44.400 --> 45:47.790 velocities. So to place to have different velocities and they're 45:47.790 --> 45:49.830 near each other, we're going to get closer to similar more 45:49.830 --> 45:53.130 similar velocities. If we do it to the contents, we call it 45:53.130 --> 45:57.450 diffusion. If we do it to the stress or strain, there's I 45:57.450 --> 46:00.660 can't remember there's some modulus name. Somebody is 46:00.660 --> 46:03.870 modulus, I always get different modules is mixed up. But there's 46:03.870 --> 46:07.230 some modulus that sticks out sir, how quickly this strain 46:07.230 --> 46:09.720 dissipates. So you can't get back to where you were before. 46:10.320 --> 46:12.690 And these are known quantities for different materials. So I 46:12.690 --> 46:15.540 can just look up where somebody is measured, the modulus is 46:15.540 --> 46:18.150 appropriate for honey, and put it into my simulation and get 46:18.150 --> 46:20.460 something looks like honey, look it up for toothpaste, I guess it 46:20.460 --> 46:21.660 looks like toothpaste and so on. 46:24.900 --> 46:25.620 Other questions? 46:29.760 --> 46:34.500 Okay, one more thing on oil Aryan before we move on to other 46:34.500 --> 46:37.170 systems and start talking about Lagrangian and mixed Euler and 46:37.170 --> 46:41.640 the grungy and techniques. We have solved the Navi stokes 46:41.640 --> 46:46.470 equations. The navio stokes equations make a very important 46:46.470 --> 46:50.700 simplification about fluids. They suggested at one point, the 46:50.700 --> 46:56.280 fluid is moving in one direction. This probably seems 46:56.280 --> 46:59.010 obvious, at any one point, the fluid is moving one direction. 46:59.520 --> 47:03.420 But it turns out this is a bad way of simulating very large 47:03.420 --> 47:08.220 fluids. Because if I think about it, for example, one cell of my 47:08.220 --> 47:13.230 simulation was this room. What is the motion of fluid in this 47:13.230 --> 47:20.760 room? Well, I guess it's not moving, probably, except inside 47:20.760 --> 47:24.270 the room, there's some motion. And that motion inside the room 47:24.270 --> 47:30.300 is important. So in addition to the Navi a stokes equations that 47:30.300 --> 47:35.820 we've been dealing with so far, there is also the Boltzmann 47:35.820 --> 47:43.080 equations. And the Boltzmann equations give you a probability 47:43.080 --> 47:48.750 density function of velocities at a point. They say, at this 47:48.750 --> 47:52.290 point, what is the likelihood that I'm going this way versus 47:52.290 --> 47:56.910 that way versus that way versus this way, and so on. The 47:56.910 --> 48:00.480 Boltzmann equations are a lot more complicated than the UVA 48:00.480 --> 48:04.410 stokes equations. they encompass things like temperature and 48:04.440 --> 48:10.200 turbulence inside their formulation. But they allow me 48:10.200 --> 48:13.950 to do fancy things. So let's look at one of those fancy 48:13.950 --> 48:22.740 things. Let's look at Boltzmann. So here's quite recent paper, 48:22.770 --> 48:27.930 this is this year, this was published. Using the Boltzmann 48:27.930 --> 48:32.100 equations in Larian grids, you notice up here, 100 by 200, by 48:32.100 --> 48:36.600 300, just a simple square grid. But they're getting all this 48:36.600 --> 48:40.350 turbulent flow. They're also talking about how you can use 48:40.350 --> 48:42.900 this for other kinds of things. But this but we have an 48:42.900 --> 48:47.520 interesting parameters. Once we have that this is smoke around a 48:47.520 --> 48:51.120 spinning cylinder. There we see that same smoke around and 48:51.120 --> 48:53.100 spinning cylinder again, we're gonna change something up here 48:53.100 --> 48:55.500 called the Reynolds number. I'll come back and talk about 48:55.500 --> 48:59.100 Reynolds number again. Here's the same smoke, same cylinder, 48:59.130 --> 49:06.390 very different behavior. Hey, what's going on? Let me back up. 49:08.040 --> 49:11.790 So this simulation, we have this thing called the Reynolds 49:11.790 --> 49:14.070 number, which is 3000. They barely knew what the Reynolds 49:14.070 --> 49:19.290 number means. Okay, I'm always curious. Reynolds number is 49:19.290 --> 49:23.550 trying to measure the relative importance of momentum versus 49:23.550 --> 49:29.310 viscosity in your fluid. Hey, it's this dimensionless content 49:29.340 --> 49:34.380 constant. That means that I can create I can serve deal with 49:34.380 --> 49:37.530 scale, as long as they also deal with pressure and temperature. 49:37.530 --> 49:41.670 And I anyway, makes all kinds of things cool. But small Reynolds 49:41.670 --> 49:45.030 numbers effectively mean the easiest thing about this is a 49:45.030 --> 49:49.920 small a physically small simulation. So if I have air 49:49.920 --> 49:53.580 spinning around a small cylinder, I'm going to see this 49:53.580 --> 49:58.140 kind of wispy behavior, the same kind of behavior I would see 49:58.140 --> 50:04.050 from a smoking match. Right, it's small, these large nicely 50:04.050 --> 50:08.370 contained things, the flow tends to be fairly laminar. That is to 50:08.370 --> 50:11.490 say all of this flows moving in basically the same direction. 50:11.970 --> 50:16.230 Because the viscosity is important, things aren't moving 50:16.230 --> 50:20.580 very far. And so anything that's moving is likely to pull all the 50:20.580 --> 50:25.770 other fluid along with it being the Boltzmann equations, this is 50:25.770 --> 50:29.520 just a parameter of the equation. And so my next 50:29.520 --> 50:32.010 simulation in this video or their next simulation, this 50:32.010 --> 50:40.410 video jumps from 3000 is or no number to 300,000. Effectively, 50:40.410 --> 50:45.630 this is like scaling this up by a factor of 100. Where before it 50:45.630 --> 50:49.050 was like spinning a toilet paper tube, now it's like spinning a 50:49.050 --> 50:54.660 skyscraper. And now we're gonna see what the same fluid does, if 50:54.660 --> 50:55.620 it's gargantuan. 50:57.210 --> 51:00.990 And now we see that the momentum dominates, there's very little 51:00.990 --> 51:06.180 viscosity going on, as energy causes all of this puffing, as 51:06.180 --> 51:09.930 all that energy inside each of these, if we zoom in 100 fold, 51:09.930 --> 51:13.170 we would see those nice laminar flows, except it's a big grid. 51:13.170 --> 51:17.250 So we couldn't actually do that. Right. But that's the concept of 51:17.250 --> 51:21.780 what's happening is that I can inside these grids, I've got 51:21.780 --> 51:25.980 that nice, whoa. But overall, I mean, these big, puffy clouds, I 51:25.980 --> 51:30.840 can't do this in an obvious stokes equation. I can tweak 51:30.840 --> 51:33.540 around the Reynolds number a little bit. But to get this kind 51:33.540 --> 51:39.300 of behavior, I need a gargantuan grid. Right, that first 51:39.300 --> 51:44.070 simulation is the sort of thing that if we had fixed up our 51:44.070 --> 51:48.060 simulation, we could have got something vaguely like this, we 51:48.060 --> 51:51.870 need to fix up quite a bit. But then we need to make our grid 51:51.900 --> 51:57.120 100 fold as large in every direction, in order to get the 51:57.180 --> 52:03.180 more big cloud kind of effects. So this is something that can be 52:03.180 --> 52:05.580 done. No, this is actually done. And this particular paper 52:05.580 --> 52:10.500 actually uses an Euler grid. But he uses a weird Euler grid. 52:11.220 --> 52:13.530 Because of these probability density functions in all 52:13.530 --> 52:18.120 directions, ug, I'm going to discretize on more than 52:18.120 --> 52:21.540 location. So in their 2d version, they're going to have 52:21.540 --> 52:24.330 at this location, they're going to solve the Boltzmann equations 52:24.330 --> 52:26.910 in this direction, and in this direction, and in this 52:26.910 --> 52:28.560 direction, and in this direction, and in this 52:28.560 --> 52:31.950 direction, and in this direction, no solid in eight 52:31.980 --> 52:36.090 different directions. And that is going to be what the 52:36.090 --> 52:38.820 discretize what is the probability of flows in this 52:38.820 --> 52:42.240 direction, and so on only around for every grid cell. And when 52:42.240 --> 52:45.900 they do in 3d, there's actually going to be 29, or 20, something 52:45.900 --> 52:49.620 of 27 of them instead of 26. I remember the numbers instead of 52:49.620 --> 52:53.310 these eight, as they do all of the 45 degree angle 52:53.310 --> 52:57.180 combinations. And there's this thing called the Boltzmann 52:57.180 --> 52:59.820 lattice, which this is and there's all various work on it. 52:59.820 --> 53:01.980 And that particular paper is all about how we make a couple 53:01.980 --> 53:04.200 nicely with solid which is why we had spinning toilet paper 53:04.200 --> 53:09.270 tubes. But this is sort of going to a different equation of 53:09.270 --> 53:12.750 nature and figure out how to discretize it and simulate it 53:12.750 --> 53:16.770 using the same basic grid techniques. Questions. 53:22.110 --> 53:27.420 Okay, that's way Larian. We're now going to switch to 53:27.450 --> 53:34.860 Lagrangian. Lagrangian, we're going to move particles to say 53:34.890 --> 53:37.440 this particle is moving and there's another particle over 53:37.440 --> 53:45.810 here this moving like you know, water molecules do. Hey, when 53:45.810 --> 53:48.150 we're dealing with these first let me talk about something we 53:48.150 --> 53:51.900 can do that none of the Lagrangian oil Aryan techniques 53:51.900 --> 53:55.950 we can talk about so far can do. There's actually a really simple 53:55.950 --> 54:01.290 picture that you just is very hard to do. In oil, Arian 54:01.290 --> 54:07.800 systems, a splash. We're doing everything on the grid. I can't 54:07.800 --> 54:12.120 really make it miscible fluids like water and air. Because it's 54:12.120 --> 54:15.810 a grid. And so I have fractional constants of things. I don't 54:15.810 --> 54:20.160 have these nice boundaries. It turns out splashes are really 54:20.160 --> 54:24.810 important in graphics. Smoke is cool, but water is cooler. 54:25.800 --> 54:29.730 Roughly speaking, I need these boundaries and boundaries are 54:29.730 --> 54:32.460 hard to do on a grant. There are techniques to do them, but 54:32.460 --> 54:35.490 they're quite convoluted. And so what we're going to do instead 54:35.490 --> 54:39.240 is we're going to move particles and so I'm going to model this 54:39.240 --> 54:42.660 in this space by putting a lot of particles around the edge. 54:43.920 --> 54:45.570 Let's start by seeing what this looks like. 54:51.360 --> 54:56.880 Here is somebodies relatively simple simulation of the basic 54:56.880 --> 55:01.770 version of particle based fluids Lagrangian In simulation, it 55:01.770 --> 55:04.800 goes on for a while. So let's talk about some things we are 55:04.800 --> 55:08.430 seeing. First, you'll notice that droplets are not one 55:08.430 --> 55:12.540 particle particles, we want them to stick together, we want 55:12.540 --> 55:16.650 surface tension. Hey, you also there's weird things, there's 55:16.650 --> 55:19.950 way too many particles on the bottom. And in the corners. 55:20.760 --> 55:23.040 There's something strange happening when they hit the 55:23.040 --> 55:27.990 boundaries. We have this sort of sloshing around big nose look 55:27.990 --> 55:32.550 sort of gloopy. And it may not be obvious in this, but it's 55:32.550 --> 55:35.670 actually compressing a little bit from time to time. It's 55:35.670 --> 55:38.640 close to incompressible, but it's a little bit rubbery, 55:38.640 --> 55:43.350 incompressible, instead of rigidly incompressible, hey, 55:43.530 --> 55:46.230 it's got a fair amount of numerical dampening, so acts 55:46.230 --> 55:51.240 sort of thick, but it's not but it has splashes, it's really 55:51.240 --> 55:53.820 hard to argue with splashes versus non splashes, it's so 55:53.820 --> 55:59.700 much cooler. So how are we going to do this, we want particles 55:59.700 --> 56:02.940 gonna move each particle, but somehow has to know where it is 56:02.940 --> 56:07.560 in the fluid how the fluid is moving. And so the basic 56:07.560 --> 56:13.650 technique we're going to use is, let's actually pause this right 56:13.650 --> 56:20.640 here. When I look at some particle, I need its motion to 56:20.640 --> 56:25.290 be dependent upon the particles around it. If we solve the Navi 56:25.290 --> 56:29.700 a stokes equation, under the moving reference frame of a 56:29.700 --> 56:33.630 particle moving with the fluid, we will realize the main thing I 56:33.630 --> 56:36.750 need to know at any given point is the pressure of the fluid. 56:37.590 --> 56:40.680 But the pressure is not something a particle handles, 56:41.160 --> 56:44.130 pressure is a characteristic of the particles around it. So 56:44.130 --> 56:47.220 we're going to do is we're going to average some contents about 56:47.220 --> 56:51.540 all the neighbors of a particle and find some area in which 56:51.540 --> 56:54.510 particles interact, they're going to measure various 56:54.510 --> 56:59.970 aggregates aspects of the flow across that area. The bigger the 56:59.970 --> 57:03.720 area we pick, the more accurate the simulation will be. But also 57:03.750 --> 57:08.220 the more particles you'll need to make a droplet. And so 57:08.310 --> 57:11.970 generally pick fairly small usually on the order of two to 57:11.970 --> 57:15.060 three times the radius, we'll draw our particles in. And we 57:15.060 --> 57:18.270 will measure our density and pressure and so forth, and those 57:18.600 --> 57:22.470 and then use that area behavior to change the behavior of each 57:22.470 --> 57:27.420 individual particle. And thus, the name of this is called 57:27.420 --> 57:31.530 smoothed particle hydrodynamics. Because I am smoothing out the 57:31.530 --> 57:35.190 particles over space. So let's look at the weird thing 57:35.190 --> 57:39.390 happening down here, I appear to have a carpet a very dense 57:39.390 --> 57:42.480 particles and then other particles floating above them. 57:44.040 --> 57:48.660 This happens because of how I am smoothing the particles, the 57:48.660 --> 57:53.340 particles at the bottom don't see any particles below them. So 57:53.340 --> 57:56.160 there seems to be a gap, they seem to be in a low density 57:56.160 --> 57:59.370 area. And so they get right and they're being pressed up against 57:59.370 --> 58:01.920 some boundary by gravity. So they're getting pressed down 58:01.920 --> 58:05.280 there nice tight carpet, getting the density we're allowing for 58:05.280 --> 58:09.570 particles just along the bottom, then the particles above them 58:09.570 --> 58:14.550 seem to be levitating. This is the levitating because as soon 58:14.550 --> 58:18.420 as that carpet of particles enters that region, they can 58:18.420 --> 58:21.900 sense they suddenly see themselves in a highly dense 58:21.900 --> 58:26.910 fluid. Because we get these odd kinds of behaviors. We'll also 58:26.910 --> 58:30.540 notice as this keeps going, the corners are going to build these 58:30.540 --> 58:35.100 little columns of particles. In part, that's because they're 58:35.100 --> 58:38.580 being pressed into the corner by the particles on both sides in 58:38.580 --> 58:41.070 the wall. At a party again, it's because there's just fewer 58:41.070 --> 58:43.590 neighbors there. So they see themselves as being less dense 58:43.590 --> 58:47.730 and are willing to accept more particles. All these things can 58:47.730 --> 58:52.080 be fixed. But the naive interpolate in implementations 58:52.080 --> 58:55.410 will do these things. They will have all of these behaviors. 58:58.020 --> 59:01.230 This is what I call smoothed particle hydrodynamics 59:02.280 --> 59:02.880 questions. 59:14.250 --> 59:19.410 Alright, let's show off what it can do in a recent paper. Let's 59:19.410 --> 59:26.760 do this one. This is a relatively recent paper that 59:26.760 --> 59:30.870 figured out finally how to make truly divergence free, smoothed 59:30.870 --> 59:34.260 particle hydrodynamics. And they've got waves that can 59:34.260 --> 59:36.900 splash in waves going over them and so forth. Here they're 59:36.900 --> 59:39.000 dragging the individual particles so you can show it off 59:40.140 --> 59:44.550 here or they are going to make it look like water. Hey, notice 59:44.550 --> 59:48.510 they have this wall is moving to create additional waves. This is 59:48.510 --> 59:52.380 gonna be the kind of thing that they literally just grabbed some 59:52.380 --> 59:55.020 stock models that get used in graphics all the time and put 59:55.020 --> 59:58.440 them in a box and it already looks not bad. And they're not 59:58.440 --> 01:00:00.000 even doing something particularly fancy with it right 01:00:00.000 --> 01:00:02.640 Wondering even when they draw them as individual dots, it's 01:00:02.640 --> 01:00:06.570 not bad. Note, however, they're drawing each individual sphere. 01:00:07.320 --> 01:00:10.230 Let's play the count the jelly beans in the jar circus game, 01:00:10.230 --> 01:00:17.460 how many particles are they using more than in the 01:00:17.460 --> 01:00:20.070 neighborhood of a million, most of their simulations are in the 01:00:20.070 --> 01:00:24.360 neighborhood of a million particles. Okay, that means 01:00:24.360 --> 01:00:27.060 we're looking on the neighborhood of a five second 01:00:27.060 --> 01:00:29.970 clip takes 30 seconds, 30 minutes to simulate somewhere in 01:00:29.970 --> 01:00:34.470 that neighborhood. It's doable. It's slow, but it's not super 01:00:34.470 --> 01:00:37.200 slow. Notice here, they actually say, here's a simulation with 01:00:37.200 --> 01:00:43.080 125,000 particles. And they're comparing it to two different 01:00:43.080 --> 01:00:45.990 simulations. This is an older version, where they're showing 01:00:45.990 --> 01:00:48.900 that is a little bit spongy, all of the orange is places it got 01:00:48.900 --> 01:00:51.690 compressed or expanded. And their version manages to fix 01:00:51.690 --> 01:00:54.480 that. That's what they're showing off. But that's an 01:00:54.480 --> 01:00:58.500 25,000 particles, it's not very much, here's 80,000. Even fewer. 01:00:58.710 --> 01:01:05.130 Again, this is just showing some problems. Let's skip that. This 01:01:05.160 --> 01:01:10.230 particles do all you do weird and cool things. Other geometry 01:01:10.530 --> 01:01:14.040 can easily interact with particles, if I want to make 01:01:14.040 --> 01:01:17.130 something floating in the particles, and the particles can 01:01:17.130 --> 01:01:22.200 just bump into the polygons. I can just use whatever simulation 01:01:22.200 --> 01:01:24.870 I want there. There's no special thing after you there's no grid 01:01:24.870 --> 01:01:28.170 boundaries to worry about things aligning with. And so this will 01:01:28.170 --> 01:01:30.450 even allow me to make things that will flip over on their 01:01:30.450 --> 01:01:34.830 side to be more hydraulically buoyant, and so forth. This 01:01:34.830 --> 01:01:37.530 particular paper is really focusing on how they managed to 01:01:37.530 --> 01:01:39.480 fix some problems. And so they're going to show something 01:01:39.480 --> 01:01:42.450 where the particles are moving extremely quickly. And splashing 01:01:42.450 --> 01:01:44.790 around in some random scene they created to show they can move 01:01:44.790 --> 01:01:51.540 very quickly. Hey, so smoothed particle hydrodynamics are cool, 01:01:51.600 --> 01:01:54.930 they get a splashes thing is we're getting better and better 01:01:54.930 --> 01:01:58.980 at doing them. And when we want to do something like water and 01:01:58.980 --> 01:02:03.630 air, it tends to be a quite a good technique. Those melting 01:02:03.630 --> 01:02:06.270 things we saw that were a little icky. They were actually done 01:02:06.270 --> 01:02:09.480 with smooth particle hydrodynamics. They were not in 01:02:09.480 --> 01:02:12.060 an oil Aryan system, they were done with these particles as 01:02:12.060 --> 01:02:17.640 well. The trick to making this better largely has to do with 01:02:17.640 --> 01:02:22.200 picking the right the right smoothing radius, the right 01:02:22.200 --> 01:02:25.710 smoothing function, the right equations based on the math and 01:02:25.710 --> 01:02:29.280 switch of these papers will solve the math again, in a new 01:02:29.280 --> 01:02:32.580 and better way. In order to get the simulation they want to get 01:02:36.690 --> 01:02:45.180 smoothed particle hydrodynamics questions all right. So why 01:02:45.180 --> 01:02:49.170 Larian bridge, lots of cool things great for smoke, not as 01:02:49.170 --> 01:02:52.950 great for other things. smoothed particle hydrodynamics great for 01:02:52.950 --> 01:02:57.150 water surfaces and splashes. Not actually particularly good for 01:02:57.150 --> 01:02:59.880 smokers, it turns out it tends to be a bit heavy handed for 01:02:59.880 --> 01:03:03.240 that tend to be a little bit expensive to compute. It's also 01:03:03.240 --> 01:03:06.600 good for splashing things against other things and goop 01:03:06.630 --> 01:03:14.220 and so forth. But we can do better than both of those. And 01:03:14.220 --> 01:03:16.380 the way we're gonna do better than both of those is just use 01:03:16.410 --> 01:03:24.090 both of those. So now we're going to talk about mixed oil 01:03:24.090 --> 01:03:28.080 Aryan Lagrangian methods. 01:03:37.170 --> 01:03:41.700 Let's start simple. Let's suppose I have an oil Arian 01:03:41.700 --> 01:03:51.150 system. But I want to have splashy waves. Here's how I can 01:03:51.150 --> 01:04:00.810 do it. I am going to put particles in my grid. Maybe I 01:04:00.810 --> 01:04:04.350 start my particles in this position, I'm going to say a 01:04:04.350 --> 01:04:08.790 cell with particles is water. A cell without particles is there 01:04:08.820 --> 01:04:11.430 a cell with some particles and some not particles is somewhere 01:04:11.430 --> 01:04:16.140 in between. I now need to figure out how to solve the equations 01:04:16.140 --> 01:04:21.570 of air and water. Notably, water is 1000 times denser than air. 01:04:21.990 --> 01:04:24.150 And you're gonna need to make sure my math is capable of 01:04:24.150 --> 01:04:27.690 dealing with 1000 fold density differences. But in general, our 01:04:27.690 --> 01:04:30.840 Euler in simulations can do that. Okay? We're not we're not 01:04:30.840 --> 01:04:34.560 going to have particular trouble in that. And then what I'm going 01:04:34.560 --> 01:04:40.800 to do is I'm going to have this sort of two stage simulation. I 01:04:40.800 --> 01:04:44.430 want to take my particles, and I'm going to move their 01:04:44.430 --> 01:04:49.350 information into grid cells to say what's the velocity of every 01:04:49.350 --> 01:04:53.160 particle? Use those losses to initialize the velocities in my 01:04:53.160 --> 01:05:02.940 grid. Then I'm going to do the linear algebra in my grid So I'm 01:05:02.940 --> 01:05:05.970 gonna do these divergence freeness, I might do my stress 01:05:05.970 --> 01:05:09.570 and strain tensors and other things here that I want to do, 01:05:09.570 --> 01:05:13.890 they're easier to do in this global context. And then I'm 01:05:13.890 --> 01:05:19.650 going to try to move the results back into my particles. So I'm 01:05:19.650 --> 01:05:22.290 gonna say, Okay, this is how I might update velocities, move 01:05:22.290 --> 01:05:26.220 those update velocities back into my particles. And then I'm 01:05:26.220 --> 01:05:31.200 going to do the moving of them to a new particle positions and 01:05:31.200 --> 01:05:36.750 repeat. Hey, this is the idea of a mixed oil Arian Lagrangian 01:05:36.750 --> 01:05:43.320 system. And this is the workhorse of graphics fluid 01:05:43.320 --> 01:05:47.700 simulations today. If you take an off the shelf significant 01:05:48.060 --> 01:05:52.200 graphics library, like mayo or blender or the like, their fluid 01:05:52.200 --> 01:05:54.360 simulations will default to this, you have to tell them a 01:05:54.360 --> 01:05:57.840 grid. And you'll have to create a particle source, because 01:05:57.840 --> 01:06:00.120 they're wanting to have the particles or the be the liquid. 01:06:00.450 --> 01:06:04.200 And they're going to have the grid to do the work. And so we 01:06:04.200 --> 01:06:10.230 have these mixed techniques. All kinds of interesting things 01:06:10.230 --> 01:06:14.190 become possible when you have these mixed techniques. For 01:06:14.190 --> 01:06:19.020 example, let's suppose I want to melt something, and then make it 01:06:19.020 --> 01:06:23.760 spring back hole as if it had never been melted. Well, all I 01:06:23.760 --> 01:06:26.730 need to do is remember the original distance between every 01:06:26.730 --> 01:06:30.300 pair of points before I melted it. So I run my fluid 01:06:30.300 --> 01:06:32.790 simulation, all the particles go all over the place. And then I 01:06:32.790 --> 01:06:34.920 just say, let's apply spring forces between neighboring 01:06:34.920 --> 01:06:38.610 particles and believe bounce back together. Right, I can do 01:06:38.610 --> 01:06:42.630 physically impossible things I can do whatever I there's a huge 01:06:42.630 --> 01:06:44.850 amount of benefit, because almost anything I want to think 01:06:44.850 --> 01:06:49.080 about either has a sort of global effect, then I can 01:06:49.080 --> 01:06:52.380 describe based on physical material behaviors, like 01:06:52.380 --> 01:06:56.370 incompressibility, or it has this sort of moving things 01:06:56.370 --> 01:06:58.920 spring forces bumping into things effect I could do on the 01:06:58.920 --> 01:07:02.790 particles, I have both functionality available to me in 01:07:02.790 --> 01:07:07.200 these things. And so this is another set of techniques we 01:07:07.200 --> 01:07:12.930 have available, is these mixed techniques. These continue to 01:07:12.930 --> 01:07:17.250 get better and better, as we figure out fancier ways of 01:07:17.250 --> 01:07:21.960 moving information back and forth. So very early ones of 01:07:21.960 --> 01:07:25.200 these use what's called the particle in cell method. 01:07:27.000 --> 01:07:33.870 Particle in cell. Here's where we started, we started to remove 01:07:33.870 --> 01:07:37.620 the velocities from particles to the cells, do my divergence free 01:07:37.650 --> 01:07:39.990 find the velocities, I found in my cells move the those 01:07:39.990 --> 01:07:43.800 velocities to the particle. This turns out to force the 01:07:43.800 --> 01:07:46.920 resolution of my particles to be as bad as the resolution of my 01:07:46.920 --> 01:07:51.060 grid is gonna be served linearly interpolating my particles. 01:07:51.570 --> 01:07:56.160 Since somebody came up with this cool new idea called the I don't 01:07:56.160 --> 01:07:58.800 remember what it stands for, I only think I've heard it once 01:07:58.800 --> 01:08:03.210 the flip method. The fourth method says, Okay, I'm going to 01:08:03.210 --> 01:08:08.550 move my velocities into my grid, I'm going to going to compute my 01:08:08.580 --> 01:08:14.160 change in velocity, a move that change in velocity back to my 01:08:14.160 --> 01:08:19.710 particles. So effectively, I'm going to take that gradient to 01:08:19.710 --> 01:08:22.590 my pressure term, use that to modify the velocities but leaves 01:08:22.590 --> 01:08:26.430 for the lossy they had. Now my particles get much higher 01:08:26.430 --> 01:08:30.570 resolution behavior than my grid. This is the flip method. 01:08:31.500 --> 01:08:35.340 And then somebody says, Oh, no, no, I have a better idea. I 01:08:35.340 --> 01:08:38.370 don't want to do what's called the fine particle in cell 01:08:38.370 --> 01:08:38.910 method. 01:08:40.230 --> 01:08:43.260 This is Alpha Phi. We have talked about F phi before. What 01:08:43.260 --> 01:08:43.920 does that phi mean? 01:08:53.160 --> 01:08:56.970 Foi, even what general topic, were we talking about? Offline 01:08:56.970 --> 01:09:06.300 in? Yes. Correct. It's rigid transformations. As actually 01:09:06.300 --> 01:09:12.120 rigid and scale. But not not skewing. Yeah, so trends, 01:09:12.150 --> 01:09:14.640 translation, rotation and scaling, although we're not 01:09:14.670 --> 01:09:16.710 typically not actually going to use the scaling very much here. 01:09:16.710 --> 01:09:19.710 But we're going to anyway, so we have these anti transformations. 01:09:19.710 --> 01:09:23.430 So the idea here is, I'm going to take my particles, and I'm 01:09:23.430 --> 01:09:28.500 going to put to them, this whole matrix, this matrix of 01:09:28.500 --> 01:09:31.950 behaviors, that gives me the fine behaviors, I'm going to put 01:09:31.950 --> 01:09:35.700 that into my grid. Right. And so this is going to have my 01:09:35.700 --> 01:09:38.940 velocities, but it's also going to have my rotations, it's also 01:09:38.940 --> 01:09:42.840 going to have my scaling. All of those things are going to come. 01:09:43.110 --> 01:09:45.690 I'm then going to work on my grid and I'm going to put those 01:09:45.690 --> 01:09:50.130 things back. And this suddenly allows rotations to work because 01:09:50.130 --> 01:09:53.040 my picker my flips tend to make things not rotate very much 01:09:53.040 --> 01:09:55.020 because grids aren't good at rotation. But if I give you 01:09:55.020 --> 01:09:58.530 matrices they are and then there's a paper that people came 01:09:58.530 --> 01:10:03.030 on so we can do it. Now What if we do higher order matrices? And 01:10:03.150 --> 01:10:05.820 anyway, there's fancy things we can do there. We can do fancier 01:10:05.820 --> 01:10:11.130 things with our particles. We can do fancier physics. And so 01:10:11.880 --> 01:10:14.280 Oh, I don't think I download this one in advance. Let me see 01:10:14.280 --> 01:10:23.160 here. Let's see if we can find I don't know if this will get it 01:10:23.160 --> 01:10:28.200 to me or not. Nope. 01:10:36.900 --> 01:10:42.930 I should have downloaded this in advance, and I didn't. Alright, 01:10:42.930 --> 01:10:49.860 let's do this. Instead, this will work. Okay. Yeah, this will 01:10:49.860 --> 01:10:50.310 work. 01:10:56.670 --> 01:11:00.600 Oh, well, hopefully this will work. If the resolution get high 01:11:00.600 --> 01:11:05.130 enough for you see what's happening. Here we have water 01:11:05.130 --> 01:11:12.690 running through sand. To do this, what we have to do is we 01:11:12.690 --> 01:11:16.320 have to come up with like we've solved the Navi stokes equations 01:11:16.350 --> 01:11:20.340 for water, we have to solve the appropriate equations for Sam. 01:11:21.450 --> 01:11:24.360 They're a little different NaVi Stokes have the same basic idea. 01:11:25.650 --> 01:11:29.490 And once we have solved that, then we can use this in our 01:11:29.490 --> 01:11:32.970 particle in cell type of methods. And we because it's 01:11:32.970 --> 01:11:36.000 just a different equation in different cells, we can combine 01:11:36.000 --> 01:11:40.590 it with water. And we can then make wet sand and dry sand and 01:11:40.590 --> 01:11:45.420 coarse sand and so forth. And so there has been this effort of 01:11:45.420 --> 01:11:48.870 how do we simulate sand not by particle by particle, but by 01:11:48.870 --> 01:11:51.000 putting the particles into a grid to figure out what they're 01:11:51.000 --> 01:11:56.490 half what's happening to them, and moving them along. And so on 01:11:56.490 --> 01:11:59.490 and so forth. More and more of these things keep coming along. 01:12:00.000 --> 01:12:05.850 So every time you see something in a movie, that looks like hey, 01:12:05.880 --> 01:12:11.040 it's changing inside it has strain, it is likely the most 01:12:11.040 --> 01:12:15.150 likely case is they are doing some sort of mix oil Aryan 01:12:15.150 --> 01:12:18.690 Lagrangian system using impart something like Nagi a stokes 01:12:18.720 --> 01:12:22.230 impart some other techniques in order to make things work. And 01:12:22.230 --> 01:12:24.210 of course, this paper is mostly comparing yourself to other 01:12:24.210 --> 01:12:29.310 papers, which is why we have all these tests. But this is 01:12:29.370 --> 01:12:32.460 probably where we're going to stop talking about fluids. 01:12:32.730 --> 01:12:33.870 thoughts, comments, questions? 01:12:36.690 --> 01:12:37.260 Yes. 01:12:45.030 --> 01:12:51.540 Mechanically moves very similar to water. Properties. 01:12:53.100 --> 01:12:55.410 Yeah, so everything we talked about so far just talks about 01:12:55.410 --> 01:13:00.390 how they move, not what they look like. So what how do I draw 01:13:00.390 --> 01:13:05.970 any of these? Right? I mean, I could just draw the individual 01:13:05.970 --> 01:13:09.060 particles if I just draw the individual particles, then I'll 01:13:09.060 --> 01:13:11.580 just see a bunch of balls if I want to make it look like water 01:13:11.580 --> 01:13:16.080 or like honey or like silly, but let go or whatever it is. How do 01:13:16.080 --> 01:13:18.780 I do that? When she already talked about this technique a 01:13:18.780 --> 01:13:28.590 lot while ago. Yeah. So we did so yes, the job was to move 01:13:28.590 --> 01:13:33.450 closer together and merge recalled. blobbies. We could use 01:13:33.450 --> 01:13:36.660 Bobby's, remember how we said if we have lobbies? How do we get 01:13:36.660 --> 01:13:44.220 the surface of the blobby marching, marching cubes. All 01:13:44.220 --> 01:13:46.740 right, we check what's inside and outside and how much fine 01:13:46.740 --> 01:13:50.190 surfaces between the move them. marching cubes or something like 01:13:50.190 --> 01:13:53.700 them are used for practically all of these will turn the 01:13:53.700 --> 01:13:56.940 particles into a dense density function like the blobbies will 01:13:56.940 --> 01:13:59.100 then put marching cubes over them or use the marching cubes 01:13:59.100 --> 01:14:02.760 directly on the grid in order to draw it unless you until like 01:14:02.760 --> 01:14:05.940 smoke, in which case we can draw the density using some sort of 01:14:05.940 --> 01:14:10.740 volume based ray tracing. Alright, this is the time we 01:14:10.740 --> 01:14:13.740 have we come back next week we'll dive into a new topic. I 01:14:13.740 --> 01:14:16.470 don't remember which one but anyway, I will see you all on 01:14:16.470 --> 01:14:16.800 Monday.