1 00:00:00 --> 00:00:01 2 00:00:01 --> 00:00:02 The following content is provided under a Creative 3 00:00:02 --> 00:00:03 Commons license. 4 00:00:03 --> 00:00:05 Your support will help MIT OpenCourseWare continue to 5 00:00:05 --> 00:00:09 offer high-quality educational resources for free. 6 00:00:09 --> 00:00:11 To make a donation, or to view additional materials from 7 00:00:11 --> 00:00:15 hundreds of MIT courses, visit MIT OpenCourseWare 8 00:00:15 --> 00:00:19 at ocw.mit.edu. 9 00:00:19 --> 00:00:25 PROFESSOR STRANG: So, let's see, you probably guessed on 10 00:00:25 --> 00:00:31 that quiz problem three, it wasn't what I meant. 11 00:00:31 --> 00:00:34 I get a zero for that problem. 12 00:00:34 --> 00:00:37 But you'll get probably good numbers, so that's an election 13 00:00:37 --> 00:00:41 gift if it comes out that way. 14 00:00:41 --> 00:00:46 So they're all in the hands of the TAs to be graded. 15 00:00:46 --> 00:00:48 We have a holiday Monday, I think. 16 00:00:48 --> 00:00:52 We come back to Fourier. 17 00:00:52 --> 00:00:57 Now, so we just have a concentrated shot at Fourier, 18 00:00:57 --> 00:01:01 just about eight or nine lectures in November. 19 00:01:01 --> 00:01:05 So stay with it and that'll be of course the subject 20 00:01:05 --> 00:01:07 of the third quiz. 21 00:01:07 --> 00:01:09 Which will have no mistakes. 22 00:01:09 --> 00:01:14 It'll be solved by the TAs in advance and we'll spot things. 23 00:01:14 --> 00:01:19 So, and if we have the quizzes to return to you by Wednesday 24 00:01:19 --> 00:01:20 that will be great. 25 00:01:20 --> 00:01:26 I hope so, but they have a big job. 26 00:01:26 --> 00:01:31 A little bit, looking far ahead at the end of Fourier the quiz 27 00:01:31 --> 00:01:35 is December 4th, I think that's a Thursday. 28 00:01:35 --> 00:01:39 And that's the end of the course. 29 00:01:39 --> 00:01:41 So December 4th, so we'll be ending the course 30 00:01:41 --> 00:01:45 a little bit early. 31 00:01:45 --> 00:01:52 Because I'll be in Hong Kong, to tell the truth. 32 00:01:52 --> 00:01:55 And and we've done a lot, and with the review sessions 33 00:01:55 --> 00:01:57 we're really doing well. 34 00:01:57 --> 00:02:03 So, that's the future. 35 00:02:03 --> 00:02:09 Fourier, today is an important day too, finite elements in 36 00:02:09 --> 00:02:15 2-D, that's a major part of computational science 37 00:02:15 --> 00:02:17 and engineering. 38 00:02:17 --> 00:02:21 The finite element idea, the idea of using polynomials, you 39 00:02:21 --> 00:02:28 can find in some early papers by Courant, a mathematician in 40 00:02:28 --> 00:02:36 New York, and by a guy in China neat guy named Fung Kong But 41 00:02:36 --> 00:02:39 those papers were sort of, you could do it this 42 00:02:39 --> 00:02:41 way if you wanted. 43 00:02:41 --> 00:02:46 It was really the structural engineers in Berkeley and 44 00:02:46 --> 00:02:50 elsewhere who made it happen ten years later. 45 00:02:50 --> 00:02:54 And the whole idea has just blossomed. 46 00:02:54 --> 00:02:56 Continues to grow. 47 00:02:56 --> 00:03:04 So I had an early book, in the `70s, actually, about the 48 00:03:04 --> 00:03:07 mathematical underpinnings. 49 00:03:07 --> 00:03:11 The math basis for the finite element method. 50 00:03:11 --> 00:03:15 And many other finite element books. 51 00:03:15 --> 00:03:18 Professor Bathe you know, teaches a full 52 00:03:18 --> 00:03:20 of course on that. 53 00:03:20 --> 00:03:26 But, I think we can get the idea of finite elements here. 54 00:03:26 --> 00:03:30 We did them in 1-D, and now there's a MATLAB problem and 55 00:03:30 --> 00:03:33 I'd like to just describe that particular problem 56 00:03:33 --> 00:03:36 if I can, as an example. 57 00:03:36 --> 00:03:40 And, of course, you would use the code that's printed in the 58 00:03:40 --> 00:03:48 book, and that's available on the website just to download. 59 00:03:48 --> 00:03:53 But the problem is not on a square domain. 60 00:03:53 --> 00:03:57 It starts on a circle, so that the first lines of the code, 61 00:03:57 --> 00:04:04 the calling the MATLAB command square grid, are 62 00:04:04 --> 00:04:09 not applicable. 63 00:04:09 --> 00:04:12 So you have to create, then, a mesh. 64 00:04:12 --> 00:04:17 Well, I have a suggested mesh so I'll draw that, and then 65 00:04:17 --> 00:04:23 from that you want to make a list of all the node points. 66 00:04:23 --> 00:04:32 A list, P, of - so what the code needs is two lists. 67 00:04:32 --> 00:04:39 Well, let me draw a picture of, well, it's a circle. 68 00:04:39 --> 00:04:43 And I'm going to be solving Poisson's equation. 69 00:04:43 --> 00:04:51 The equation will be -u_xx-u_yy=4, in the circle. 70 00:04:51 --> 00:04:54 So it's Poisson but with a constant right hand side. 71 00:04:54 --> 00:05:01 That will mean that all the integrals of F times v, all the 72 00:05:01 --> 00:05:05 right hand side of our discrete equation will be, the integrals 73 00:05:05 --> 00:05:09 are all easy because we just have a constant there 74 00:05:09 --> 00:05:11 times the trial function. 75 00:05:11 --> 00:05:14 OK, and then on the boundary is going to be u=0. 76 00:05:16 --> 00:05:17 On the boundary. 77 00:05:17 --> 00:05:19 So it's a classic problem. 78 00:05:19 --> 00:05:23 And we can say what the solution is. 79 00:05:23 --> 00:05:25 So it's one with a known solution. 80 00:05:25 --> 00:05:29 I think it would be x squared. 81 00:05:29 --> 00:05:34 No, I guess one, one minus x squared minus y squared. 82 00:05:34 --> 00:05:36 This should all be on the .086 site. 83 00:05:36 --> 00:05:38 I just didn't have a chance to look this morning 84 00:05:38 --> 00:05:40 to be sure it got up. 85 00:05:40 --> 00:05:42 So you can watch, here. 86 00:05:42 --> 00:05:44 So that, I hope, does solve the problem. 87 00:05:44 --> 00:05:48 Two x derivatives give us a two, two y derivatives 88 00:05:48 --> 00:05:50 another two, so we get four. 89 00:05:50 --> 00:05:54 So we know the answer; the question is, and I'm interested 90 00:05:54 --> 00:06:02 in this question, for research reasons too, is what's the 91 00:06:02 --> 00:06:10 error when you go to a polygon? 92 00:06:10 --> 00:06:16 You go to a, these curved boundaries don't get 93 00:06:16 --> 00:06:18 correctly saved. 94 00:06:18 --> 00:06:22 You approximate them by straight lines. 95 00:06:22 --> 00:06:24 That would be the first idea. 96 00:06:24 --> 00:06:28 And with this, all this symmetry, let's keep the 97 00:06:28 --> 00:06:31 problem nice and use a regular polygon. 98 00:06:31 --> 00:06:34 So maybe I'll try to draw one with about eight 99 00:06:34 --> 00:06:38 sides, but, OK. 100 00:06:38 --> 00:06:45 So we impose u=0 at these nodes. 101 00:06:45 --> 00:06:50 So u is zero at those nodes, and then we have a mesh. 102 00:06:50 --> 00:06:53 So we want to create a mesh. 103 00:06:53 --> 00:06:59 OK, so with all the symmetry here, the natural idea would be 104 00:06:59 --> 00:07:11 to start with eight pieces, or M pieces if I have, this is a 105 00:07:11 --> 00:07:18 regular M side, let's say, and I'll take M to be eight 106 00:07:18 --> 00:07:19 in this picture. 107 00:07:19 --> 00:07:24 And I think we can work on just one triangle. 108 00:07:24 --> 00:07:28 By rotational symmetry, all those triangles are 109 00:07:28 --> 00:07:29 going to be the same. 110 00:07:29 --> 00:07:35 So I think our domain is really this one triangle here. 111 00:07:35 --> 00:07:36 That's where we're working. 112 00:07:36 --> 00:07:39 And in that triangle, I think we have zero 113 00:07:39 --> 00:07:43 boundary conditions. 114 00:07:43 --> 00:07:50 And across this edge I think we have natural 115 00:07:50 --> 00:07:51 boundary conditions. 116 00:07:51 --> 00:07:55 Slope zero, if I see the picture correctly. 117 00:07:55 --> 00:07:58 The rotational symmetry would mean that things 118 00:07:58 --> 00:08:00 are not changing. 119 00:08:00 --> 00:08:02 That every triangle is the same. 120 00:08:02 --> 00:08:05 So I think on these boundaries it's the Neumann 121 00:08:05 --> 00:08:06 condition, dU/dn=0. 122 00:08:06 --> 00:08:10 123 00:08:10 --> 00:08:15 And I'm frankly not sure what to do at the origin, so I'll 124 00:08:15 --> 00:08:18 maybe just try both ways and see. 125 00:08:18 --> 00:08:22 OK, so there is a real problem. 126 00:08:22 --> 00:08:25 Of course, it's artificial in the sense that 127 00:08:25 --> 00:08:27 we know the answer. 128 00:08:27 --> 00:08:34 But it's a real open question of what does the error look 129 00:08:34 --> 00:08:36 like, from doing that. 130 00:08:36 --> 00:08:41 So that's the goal and let me just say the problem I'll ask 131 00:08:41 --> 00:08:46 you to do, and it probably is quite enough to be ready for 132 00:08:46 --> 00:08:51 next Friday, is to use piecewise linear elements. 133 00:08:51 --> 00:08:55 Which is what I'm going to do. 134 00:08:55 --> 00:08:59 What every discussion of finite elements will begin 135 00:08:59 --> 00:09:00 with, linear elements. 136 00:09:00 --> 00:09:05 Those pyramids that I spoke about it at the 137 00:09:05 --> 00:09:06 end of last time. 138 00:09:06 --> 00:09:09 So that's what I hope, but actually I would be highly 139 00:09:09 --> 00:09:14 interested if anybody got into the problem, to 140 00:09:14 --> 00:09:16 try quadratic elements. 141 00:09:16 --> 00:09:25 So I'll just say here, second-degree quadratic 142 00:09:25 --> 00:09:34 polynomials would be more accurate. 143 00:09:34 --> 00:09:36 Would be more accurate. 144 00:09:36 --> 00:09:44 So, in other words, this is a first type of finite element 145 00:09:44 --> 00:09:48 called P_1, for polynomials of degree one. 146 00:09:48 --> 00:09:52 These guys, I would call P_2, for polynomials of degree two. 147 00:09:52 --> 00:09:59 And I've mentioned here the possibility of using quads. 148 00:09:59 --> 00:10:04 Instead of triangles, if I had squares for example, the 149 00:10:04 --> 00:10:06 simplest element would be a Q_1. 150 00:10:08 --> 00:10:13 So these are, if I manage today to tell you about how to use 151 00:10:13 --> 00:10:19 P_1 and P_2 and Q_1, you're on your way. 152 00:10:19 --> 00:10:25 And for the requirements of this course, P_1 is the 153 00:10:25 --> 00:10:27 first point to understand. 154 00:10:27 --> 00:10:28 OK. 155 00:10:28 --> 00:10:32 While I'm speaking about codes and meshes, let me draw the 156 00:10:32 --> 00:10:38 mesh I proposed in the homework problem. 157 00:10:38 --> 00:10:42 So I thought OK, we just have to have a simple mesh here. 158 00:10:42 --> 00:10:47 So let me draw that line in. 159 00:10:47 --> 00:10:48 I know all these points, right? 160 00:10:48 --> 00:10:52 This is 0, 0 here. 161 00:10:52 --> 00:10:57 And that point's on the circle. 162 00:10:57 --> 00:11:01 And so is this, that point might be, so what's 163 00:11:01 --> 00:11:04 the angle there? 164 00:11:04 --> 00:11:07 That angle is probably pi/8. 165 00:11:09 --> 00:11:13 The whole angle would be 2pi/8, and eight of them would 166 00:11:13 --> 00:11:14 go all the way around. 167 00:11:14 --> 00:11:16 So I think that angle is pi/8. 168 00:11:17 --> 00:11:20 And so this point would be cos(pi/8). 169 00:11:22 --> 00:11:23 sin(pi/8). 170 00:11:23 --> 00:11:29 We know where they are. 171 00:11:29 --> 00:11:32 But that's going to be what we have to list. 172 00:11:32 --> 00:11:34 We have to list where are the coordinates of 173 00:11:34 --> 00:11:35 all the mesh points. 174 00:11:35 --> 00:11:40 So let me describe the rest of the mesh points and then see 175 00:11:40 --> 00:11:43 what that list would look like. 176 00:11:43 --> 00:11:51 And once you've created the list, the code will take over. 177 00:11:51 --> 00:11:55 And then you plot the results and see what's going on. 178 00:11:55 --> 00:11:59 So let me suggest a mesh. 179 00:11:59 --> 00:12:01 It's pretty straightforward. 180 00:12:01 --> 00:12:12 I just divided this piece into N, this center thing into N, 181 00:12:12 --> 00:12:15 so I called that distance h. 182 00:12:15 --> 00:12:20 So Nh gets me out to here. 183 00:12:20 --> 00:12:25 Whatever that is, that's cos(pi/8), I guess, that's the 184 00:12:25 --> 00:12:27 x coordinate of that line. 185 00:12:27 --> 00:12:31 So those are mesh points and then let me keep drawing these. 186 00:12:31 --> 00:12:34 So these will be mesh points too, and these 187 00:12:34 --> 00:12:37 will be mesh points too. 188 00:12:37 --> 00:12:44 So at this point, I've got probably 12 or 13 mesh points. 189 00:12:44 --> 00:12:47 But I've got quads, right? 190 00:12:47 --> 00:12:49 Well, I've got a couple of triangles here that I'm not 191 00:12:49 --> 00:12:51 going to touch, those are fine. 192 00:12:51 --> 00:12:58 But these are quads and they could be used with the Q_1 193 00:12:58 --> 00:13:02 element, but I'm thinking let's stay with triangles. 194 00:13:02 --> 00:13:06 So I just suggested to put in triangles, put in these 195 00:13:06 --> 00:13:10 diagonals, keeping symmetry. 196 00:13:10 --> 00:13:13 And so there's the mesh. 197 00:13:13 --> 00:13:15 There's the mesh. 198 00:13:15 --> 00:13:19 And then what does the code ask for? 199 00:13:19 --> 00:13:22 So it's got 13 mesh points. 200 00:13:22 --> 00:13:25 And the code, first of all it wants a list of the coordinates 201 00:13:25 --> 00:13:27 of all those mesh points. 202 00:13:27 --> 00:13:32 So that the code will, and I better number them, of course. 203 00:13:32 --> 00:13:36 So let me number them one, shall I number them the center 204 00:13:36 --> 00:13:42 guys first, one, two, three, four, five, and then up here 205 00:13:42 --> 00:13:44 six, seven, eight, nine,, now I don't know if this 206 00:13:44 --> 00:13:45 is a good numbering. 207 00:13:45 --> 00:13:48 Ten, 11, 12, 13. 208 00:13:48 --> 00:13:57 Why don't we, just to have some consistency within plans, 209 00:13:57 --> 00:14:00 why don't you, don't have to take N=4. 210 00:14:01 --> 00:14:06 I hope you'll take, what did I take N as four or five? 211 00:14:06 --> 00:14:08 Yeah, right. 212 00:14:08 --> 00:14:09 N is 4. 213 00:14:09 --> 00:14:13 But you'll want to try different N's. 214 00:14:13 --> 00:14:18 N=4 would be a good crude start to see what's going on, but 215 00:14:18 --> 00:14:23 then I hope you'll go higher and get better accuracy. 216 00:14:23 --> 00:14:27 And you can see how the accuracy improves, how 217 00:14:27 --> 00:14:31 you get closer to that as n gets bigger. 218 00:14:31 --> 00:14:35 OK, but got the nodes numbered. 219 00:14:35 --> 00:14:38 Oh, I better number the triangles. 220 00:14:38 --> 00:14:40 OK, how shall we number the triangles? 221 00:14:40 --> 00:14:43 Shall we do along the top, or this? 222 00:14:43 --> 00:14:44 I don't know. 223 00:14:44 --> 00:14:48 What do you want to do for the numbering of the triangles? 224 00:14:48 --> 00:14:51 Maybe run along the top, and then run along the bottom, 225 00:14:51 --> 00:14:55 because then it'll practically be a copy. 226 00:14:55 --> 00:14:59 So I didn't leave myself much space, but one, two, three, 227 00:14:59 --> 00:15:04 four, five, six, seven. 228 00:15:04 --> 00:15:08 Seven triangles along the top and seven along the bottom, so 229 00:15:08 --> 00:15:14 I have 14 triangles in this mesh. 230 00:15:14 --> 00:15:23 So it's a mesh with 14 triangles and 13 nodes. 231 00:15:23 --> 00:15:26 And I know the positions of everyone, right? 232 00:15:26 --> 00:15:29 I know the x,y coordinates of every one. 233 00:15:29 --> 00:15:34 So what the code will want is a list of those coordinates. 234 00:15:34 --> 00:15:39 So a list, P, P will be a list of coordinates. 235 00:15:39 --> 00:15:44 The first guy will be of, the nodes so 13 236 00:15:44 --> 00:15:50 rows, three columns. 237 00:15:50 --> 00:15:53 So it's a little 13 by three matrix that tells you 238 00:15:53 --> 00:15:55 where all the nodes are. 239 00:15:55 --> 00:15:59 So the first one on that list would be (0,0). 240 00:16:01 --> 00:16:03 that's for node one. 241 00:16:03 --> 00:16:06 And the second one would be whatever the coordinates of 242 00:16:06 --> 00:16:11 that are, something zero. (h,0), I guess it is. 243 00:16:11 --> 00:16:18 The third one will be (2h,0), and so on, and then complete 244 00:16:18 --> 00:16:21 the list of 13 positions. 245 00:16:21 --> 00:16:28 So you are then told the code where all the nodes are. 246 00:16:28 --> 00:16:30 What else do you have to tell it? 247 00:16:30 --> 00:16:32 Not much. 248 00:16:32 --> 00:16:35 You now have to tell it about the triangles. 249 00:16:35 --> 00:16:39 So now for every, why do I say three columns? 250 00:16:39 --> 00:16:44 Maybe only two, is it? 251 00:16:44 --> 00:16:46 You see the point already. 252 00:16:46 --> 00:16:53 I've forgotten, maybe, yeah. 253 00:16:53 --> 00:16:58 I don't see why. 254 00:16:58 --> 00:17:02 Well for triangles, I'm going to need three, for nodes 255 00:17:02 --> 00:17:03 maybe it's only got two. 256 00:17:03 --> 00:17:07 Maybe it's 13 by two. 257 00:17:07 --> 00:17:10 I don't see why I need three. 258 00:17:10 --> 00:17:11 But, anyway. 259 00:17:11 --> 00:17:15 Then the other list is triangles. 260 00:17:15 --> 00:17:20 So this will be the list, t, and so it takes 261 00:17:20 --> 00:17:22 triangle number one. 262 00:17:22 --> 00:17:24 Which is right here. 263 00:17:24 --> 00:17:26 That very first triangle. 264 00:17:26 --> 00:17:31 And what does it have to tell us about triangle one? 265 00:17:31 --> 00:17:32 The three nodes. 266 00:17:32 --> 00:17:37 If it tells us the three node numbers, and this list, P, gave 267 00:17:37 --> 00:17:40 their positions, we've got it. 268 00:17:40 --> 00:17:45 So how many triangles did that I have? 269 00:17:45 --> 00:17:46 14? 270 00:17:46 --> 00:17:56 So t will be 14 by three, and so the first guy will be just 271 00:17:56 --> 00:18:00 one, node number one, node number two, and 272 00:18:00 --> 00:18:02 node number six. 273 00:18:02 --> 00:18:06 That will tell us which is the first triangle. 274 00:18:06 --> 00:18:10 And the second triangle, I guess I've drawn from two. 275 00:18:10 --> 00:18:14 Two, seven to six, right? 276 00:18:14 --> 00:18:19 That's a very skinny triangle up there but it's the one that 277 00:18:19 --> 00:18:22 started at node two, went up to seven and back to six. 278 00:18:22 --> 00:18:26 So a list like that. 279 00:18:26 --> 00:18:32 And then the code will do the rest. 280 00:18:32 --> 00:18:35 I hope. 281 00:18:35 --> 00:18:38 Almost all the rest. 282 00:18:38 --> 00:18:41 The code will create the matrix K. 283 00:18:41 --> 00:18:47 It'll create the matrix K with, it'll be singular. 284 00:18:47 --> 00:18:51 Boundary conditions won't yet be in there. 285 00:18:51 --> 00:18:56 And then a final step after that K, or maybe we could call 286 00:18:56 --> 00:19:02 it K_0 is created, a final step will be to fix u. 287 00:19:02 --> 00:19:04 At least at these three points. 288 00:19:04 --> 00:19:08 So these three will be boundary nodes. 289 00:19:08 --> 00:19:12 And as I say, I'm not too sure about that one, I apologize. 290 00:19:12 --> 00:19:14 At those boundary nodes I'm going to take the 291 00:19:14 --> 00:19:16 values to be zero. 292 00:19:16 --> 00:19:21 So this is going to be zero along the whole edge, because 293 00:19:21 --> 00:19:24 if it's zero there, zero there, zero there and zero there, and 294 00:19:24 --> 00:19:27 if it's linear, it's zero. 295 00:19:27 --> 00:19:35 So the final, sort of, subroutine in the code, the 296 00:19:35 --> 00:19:39 final group of commands you want to impose, zeroes here, 297 00:19:39 --> 00:19:46 that should then make the matrix K invertible, and then 298 00:19:46 --> 00:19:49 you've got KU=F to solve. 299 00:19:49 --> 00:19:54 So what the code is doing is creating K and F. 300 00:19:54 --> 00:19:57 You see the overall picture? 301 00:19:57 --> 00:20:00 I jumped right into this particular mesh, particular 302 00:20:00 --> 00:20:06 problem, but now I really should back up to 303 00:20:06 --> 00:20:09 where it starts. 304 00:20:09 --> 00:20:13 This this is going to be the weak form of Laplace, 305 00:20:13 --> 00:20:15 Poisson, maybe I'll make a 306 00:20:15 --> 00:20:24 little space to put in Poisson's name too. 307 00:20:24 --> 00:20:29 You have a picture already of what this weak form is about, 308 00:20:29 --> 00:20:32 so now I'm really backing up to the start. 309 00:20:32 --> 00:20:36 I take the equation and I get its weak form. 310 00:20:36 --> 00:20:39 And remember that's in the continuous case, as it 311 00:20:39 --> 00:20:41 was in the quiz problem. 312 00:20:41 --> 00:20:45 The first step is the continuous weak form, and then 313 00:20:45 --> 00:20:53 the second step is choose test functions and, trial - I'm 314 00:20:53 --> 00:20:59 sorry, gosh, I'm in bad shape here. 315 00:20:59 --> 00:21:02 Because they're the same. 316 00:21:02 --> 00:21:04 This isn't my worst error, today. 317 00:21:04 --> 00:21:11 But those are trial functions, and these are test functions. 318 00:21:11 --> 00:21:14 OK, questions at this point, because I've, yeah, thank you. 319 00:21:14 --> 00:21:15 Good. 320 00:21:15 --> 00:21:16 Let's look at this picture. 321 00:21:16 --> 00:21:22 AUDIENCE: [INAUDIBLE] 322 00:21:22 --> 00:21:30 PROFESSOR STRANG: Because, we did. 323 00:21:30 --> 00:21:30 That's right. 324 00:21:30 --> 00:21:40 So because my question is what is the continuous problem, I 325 00:21:40 --> 00:21:44 would like to solve has u=0 on the polygon. 326 00:21:44 --> 00:21:50 So in a way you can forget the circle, where we 327 00:21:50 --> 00:21:52 know the answer now. 328 00:21:52 --> 00:21:57 We really are looking on the polygon, and I would like to 329 00:21:57 --> 00:22:01 know what's the solution like on that polygon. 330 00:22:01 --> 00:22:06 And then so there are two steps, the first step was 331 00:22:06 --> 00:22:09 start with a circle, we have the answer. 332 00:22:09 --> 00:22:14 Second step is go to a polygon, continuous problem, Poisson's 333 00:22:14 --> 00:22:16 equation in the polygon. 334 00:22:16 --> 00:22:18 How different is that from this? 335 00:22:18 --> 00:22:23 Because this will not satisfy the polygon boundary 336 00:22:23 --> 00:22:24 conditions. 337 00:22:24 --> 00:22:28 So that's the circle answer. 338 00:22:28 --> 00:22:32 Then the question is, what's the polygon answer. 339 00:22:32 --> 00:22:36 And I don't know that. 340 00:22:36 --> 00:22:39 You may say a regular polygon, you can't do that. 341 00:22:39 --> 00:22:41 I didn't think you can. 342 00:22:41 --> 00:22:44 It's amazing, but probably a triangle or a square. 343 00:22:44 --> 00:22:49 So if M is three or four, probably some formulas 344 00:22:49 --> 00:22:50 would be available. 345 00:22:50 --> 00:22:54 But I think once we get higher, I don't know the answer to the 346 00:22:54 --> 00:22:59 Dirichlet problem, to Poisson's equation on a polygon. 347 00:22:59 --> 00:23:02 On a regular polygon and that's what I would really like 348 00:23:02 --> 00:23:03 to know more about. 349 00:23:03 --> 00:23:06 And how do I find out more about it? 350 00:23:06 --> 00:23:08 By finite elements. 351 00:23:08 --> 00:23:11 With your help. 352 00:23:11 --> 00:23:16 Taking that polygon, breaking it into a mesh, looking only 353 00:23:16 --> 00:23:22 at one triangle just for simplicity, and getting 354 00:23:22 --> 00:23:24 u finite elements. 355 00:23:24 --> 00:23:26 Well, I should say u_p_1. 356 00:23:26 --> 00:23:30 357 00:23:30 --> 00:23:34 That's the finite element solution using linear. 358 00:23:34 --> 00:23:40 I would really like to know u_p_2, the finite element 359 00:23:40 --> 00:23:43 solution which will be better. 360 00:23:43 --> 00:23:45 If I use quadratics. 361 00:23:45 --> 00:23:47 So now I get the fun of describing the linear 362 00:23:47 --> 00:23:51 elements, the quadratic elements, the quads. 363 00:23:51 --> 00:23:53 But did I answer that question OK? 364 00:23:53 --> 00:23:54 Yeah. 365 00:23:54 --> 00:23:59 So this is the problem I would like to know the answer to. 366 00:23:59 --> 00:24:04 If I have this equation, zero boundary conditions on a 367 00:24:04 --> 00:24:09 regular polygon with M sides, what's the answer? 368 00:24:09 --> 00:24:13 And it's going to be close to this, but it won't be the same. 369 00:24:13 --> 00:24:17 Because this does not vanish on the polygon edges. 370 00:24:17 --> 00:24:22 And I would like to compare the slopes, too. 371 00:24:22 --> 00:24:25 So the homework problem asked you not only to compare 372 00:24:25 --> 00:24:32 u circle with u_p_1, but also the slopes. 373 00:24:32 --> 00:24:37 The slopes here are easy, slopes here are easy because 374 00:24:37 --> 00:24:39 it's a bunch of flat functions. 375 00:24:39 --> 00:24:43 So the slopes are just constant in each triangle. 376 00:24:43 --> 00:24:48 OK, I'm guessing that the error gets smaller as you go in. 377 00:24:48 --> 00:24:52 I think that if you plot the error, it'll be largest out 378 00:24:52 --> 00:24:53 here and get small there. 379 00:24:53 --> 00:24:56 But remains to be seen. 380 00:24:56 --> 00:24:57 So I hope you enjoy 381 00:24:57 --> 00:24:59 - yeah, good. 382 00:24:59 --> 00:25:05 AUDIENCE: [INAUDIBLE] 383 00:25:05 --> 00:25:07 PROFESSOR STRANG: Rather than seven. 384 00:25:07 --> 00:25:13 AUDIENCE: [INAUDIBLE] 385 00:25:13 --> 00:25:17 PROFESSOR STRANG: No, the middle. 386 00:25:17 --> 00:25:21 There's nothing magic about any particular mesh. 387 00:25:21 --> 00:25:31 I just chose this mesh as pretty good, and actually, 388 00:25:31 --> 00:25:34 I'm imagining M could get pretty big. 389 00:25:34 --> 00:25:35 That would be interesting. 390 00:25:35 --> 00:25:40 M=8 would be interesting, M=16, M=1,024, now then 391 00:25:40 --> 00:25:42 I'd really get interested. 392 00:25:42 --> 00:25:50 OK, but so if M is 1,024, then this side would be very small. 393 00:25:50 --> 00:25:52 Right? 394 00:25:52 --> 00:25:55 And I just wanted more triangles. 395 00:25:55 --> 00:25:58 Actually, I would like more than I've got. 396 00:25:58 --> 00:26:05 I'd like, if M was really big, then probably N should 397 00:26:05 --> 00:26:07 be at least that big. 398 00:26:07 --> 00:26:09 So I should have a thousand this way, if this 399 00:26:09 --> 00:26:11 is just a tiny bit. 400 00:26:11 --> 00:26:14 I just want little tiny h, and then, yeah. 401 00:26:14 --> 00:26:18 Actually, that might not be too bad. 402 00:26:18 --> 00:26:25 If m anM N were roughly comparable, then that length 403 00:26:25 --> 00:26:28 would be roughly comparable to these lengths. 404 00:26:28 --> 00:26:33 And the triangles would be pretty good shape. 405 00:26:33 --> 00:26:36 And that's what you're looking for. 406 00:26:36 --> 00:26:43 I think there's a lot of experiments to be done here. 407 00:26:43 --> 00:26:45 So, I'm thinking then of M and N. 408 00:26:45 --> 00:26:48 Here I took N to be just four. 409 00:26:48 --> 00:26:50 When M was eight. 410 00:26:50 --> 00:26:51 That's fine. 411 00:26:51 --> 00:26:56 But if you keep M and N roughly the same size, then you've got 412 00:26:56 --> 00:27:00 triangles that are not too long and skinny. 413 00:27:00 --> 00:27:04 I'll tell you when you might want. 414 00:27:04 --> 00:27:07 So generally you want nice shaped triangles. 415 00:27:07 --> 00:27:13 You don't want angles very small or very large, usually. 416 00:27:13 --> 00:27:20 But there would be, anybody in Course 16 can imagine that if I 417 00:27:20 --> 00:27:29 am computing the flow field past a wing, that long, thin 418 00:27:29 --> 00:27:33 triangles in the direction of the wing are natural. 419 00:27:33 --> 00:27:41 I mean, somehow a problem like true aerodynamics is 420 00:27:41 --> 00:27:43 by no means isotropic. 421 00:27:43 --> 00:27:46 I mean, the direction of the wing is kind of critical to 422 00:27:46 --> 00:27:49 whether the plane flies, right? 423 00:27:49 --> 00:27:54 So don't make the wing vertical. 424 00:27:54 --> 00:27:57 And if you want accuracy, then you have long, thin triangles 425 00:27:57 --> 00:27:59 in the direction of the flow. 426 00:27:59 --> 00:28:02 But here we're not doing a flow problem. 427 00:28:02 --> 00:28:06 We haven't got shocks, or trailing edges, and other 428 00:28:06 --> 00:28:10 horrible stuff that makes planes fly. 429 00:28:10 --> 00:28:12 We just got Poisson's equation. 430 00:28:12 --> 00:28:13 OK. 431 00:28:13 --> 00:28:15 Thanks for those good questions, another one. 432 00:28:15 --> 00:28:19 AUDIENCE: [INAUDIBLE] 433 00:28:19 --> 00:28:20 PROFESSOR STRANG: What would the dimension look like? 434 00:28:20 --> 00:28:24 Ah, would you like me to show you something about quadratics? 435 00:28:24 --> 00:28:27 Yeah. 436 00:28:27 --> 00:28:30 Shall I jump into quadratics, it's kind of fun. 437 00:28:30 --> 00:28:37 Quadratics, so let me just do, so I'll come back to the weak 438 00:28:37 --> 00:28:41 form, right it's totally, oh I'll do it now. 439 00:28:41 --> 00:28:44 It's so simple I don't want to forget it. 440 00:28:44 --> 00:28:48 The weak form, so I write the equation down, -u_xx-u_yy=f. 441 00:28:48 --> 00:28:51 442 00:28:51 --> 00:28:57 This is the continuous weak form equal f(x,y), OK? 443 00:28:57 --> 00:29:00 So that's the strong form. 444 00:29:00 --> 00:29:04 And I've made it the Laplace in here to keep it simple, 445 00:29:04 --> 00:29:06 on any right hand side. 446 00:29:06 --> 00:29:09 OK, how do I get to the weak form? 447 00:29:09 --> 00:29:14 Just remind me, I multiply both sides by any 448 00:29:14 --> 00:29:15 test function v(x,y). 449 00:29:17 --> 00:29:23 Multiply by v(x,y), and then what do I do? 450 00:29:23 --> 00:29:28 I integrate over the whole region. 451 00:29:28 --> 00:29:35 So that's the weak form, dxdy, this is for all v, 452 00:29:35 --> 00:29:40 all v(x,y), all, I'll say all admissible v(x,y). 453 00:29:42 --> 00:29:45 So that's the weak form. 454 00:29:45 --> 00:29:51 If this holds for all this great family of v's, the idea 455 00:29:51 --> 00:29:55 behind it is, that if this holds for all these trial 456 00:29:55 --> 00:29:59 functions, test functions, v(x,y), the only way that can 457 00:29:59 --> 00:30:03 happen is for this to actually equal that. 458 00:30:03 --> 00:30:12 That's a fundamental lemma in this part of math, and of 459 00:30:12 --> 00:30:17 course it has to be spelled out more than I'm doing in words. 460 00:30:17 --> 00:30:22 But the idea is that if these hold for such a large class of 461 00:30:22 --> 00:30:25 v(x,y), then the only way that can happen is for the 462 00:30:25 --> 00:30:26 strong form to hold. 463 00:30:26 --> 00:30:29 For this to actually match this. 464 00:30:29 --> 00:30:31 OK, so that's the start. 465 00:30:31 --> 00:30:35 But then what's the next step in the weak form? 466 00:30:35 --> 00:30:38 I I like the right hand side but I'm not so crazy 467 00:30:38 --> 00:30:39 about the left hand side. 468 00:30:39 --> 00:30:43 I'm not crazy about it because this says second derivatives 469 00:30:43 --> 00:30:49 of u, and my little roof functions, pyramid functions, 470 00:30:49 --> 00:30:51 haven't got second derivatives. 471 00:30:51 --> 00:30:55 So I would be dead in the water without doing the natural step 472 00:30:55 --> 00:30:58 that makes everything beautiful, which is? 473 00:30:58 --> 00:31:00 Integration by parts. 474 00:31:00 --> 00:31:01 Integrate by parts. 475 00:31:01 --> 00:31:05 Move derivatives of of u, on to v. 476 00:31:05 --> 00:31:10 One derivative onto v, off of u, so then u and v 477 00:31:10 --> 00:31:12 each have one derivative. 478 00:31:12 --> 00:31:17 I can use my piecewise linear, piecewise quadratics, all my 479 00:31:17 --> 00:31:20 finite elements are going to go fine. 480 00:31:20 --> 00:31:22 So I integrate by parts. 481 00:31:22 --> 00:31:28 So integrate by parts, and what is that mean in 2-D? 482 00:31:28 --> 00:31:30 Of course I have a double integral here. 483 00:31:30 --> 00:31:37 So integrate by parts, that mean you the Green's formula. 484 00:31:37 --> 00:31:43 That was the key point of this Green, or 485 00:31:43 --> 00:31:47 Gauss-Green's, formula. 486 00:31:47 --> 00:32:01 Can I do it first in, this is -div(grad u), times vdxdy, we 487 00:32:01 --> 00:32:03 can write out all the terms. 488 00:32:03 --> 00:32:05 We can use vector notation. 489 00:32:05 --> 00:32:09 I could use that nabla, that upside down triangle 490 00:32:09 --> 00:32:10 notation, or whatever. 491 00:32:10 --> 00:32:13 But maybe good to see it a few different ways. 492 00:32:13 --> 00:32:15 So what's the point? 493 00:32:15 --> 00:32:20 When I integrate by parts, that minus disappears to a plus, I 494 00:32:20 --> 00:32:26 have a double integral then, and these derivatives move off 495 00:32:26 --> 00:32:32 of, I'm taking one derivative off of here, the divergence 496 00:32:32 --> 00:32:35 moves over there, but when the divergence moves 497 00:32:35 --> 00:32:38 onto v it becomes? 498 00:32:38 --> 00:32:39 The transpose. 499 00:32:39 --> 00:32:40 It becomes gradient. 500 00:32:40 --> 00:32:52 And so this is gradient view, gradient of v. dxdy, 501 00:32:52 --> 00:32:54 plus boundary terms. 502 00:32:54 --> 00:32:58 The integral of, what is, let's see. 503 00:32:58 --> 00:33:02 504 00:33:02 --> 00:33:11 What do I have in this integral, I have grad u dot n, 505 00:33:11 --> 00:33:14 times v around the boundary. 506 00:33:14 --> 00:33:18 And that's with my boundary conditions that's going 507 00:33:18 --> 00:33:20 to be gone, so I can come back to that. 508 00:33:20 --> 00:33:26 Now, you all looked a little uncertain when I wrote 509 00:33:26 --> 00:33:29 Green's formula this way. 510 00:33:29 --> 00:33:33 For this problem I can write it more easily. 511 00:33:33 --> 00:33:36 This is my left side. 512 00:33:36 --> 00:33:40 I want to write the answer, I just want to write this weak 513 00:33:40 --> 00:33:44 form in a much simpler form. 514 00:33:44 --> 00:33:49 So let say, what have I got here. 515 00:33:49 --> 00:33:54 Well, all I've got is one derivative is moving 516 00:33:54 --> 00:33:56 off of u and on to v. 517 00:33:56 --> 00:33:58 And the minus sign is disappearing, so I have 518 00:33:58 --> 00:34:02 du/dx times dv/dx. 519 00:34:02 --> 00:34:03 Right? 520 00:34:03 --> 00:34:06 One off of u, onto v. 521 00:34:06 --> 00:34:10 The other term, one y derivative, moving off 522 00:34:10 --> 00:34:12 of this and onto v. 523 00:34:12 --> 00:34:15 Minus sign again going to a plus. du/dy, dv/dy. 524 00:34:15 --> 00:34:19 525 00:34:19 --> 00:34:20 That's the integral. 526 00:34:20 --> 00:34:22 That's it, that's cool. 527 00:34:22 --> 00:34:24 Easy to do. 528 00:34:24 --> 00:34:29 And on the right hand side of course I have no change. 529 00:34:29 --> 00:34:31 The integral of f(x,y)*v(x,y)*dy. 530 00:34:31 --> 00:34:34 531 00:34:34 --> 00:34:36 Now, that's the weak form, dx/dy. 532 00:34:36 --> 00:34:44 533 00:34:44 --> 00:34:52 Here it is, weak form. 534 00:34:52 --> 00:34:55 That's pretty nice. 535 00:34:55 --> 00:34:58 Beautifully symmetric, though the matrix that comes up when 536 00:34:58 --> 00:35:04 we plug in finite specific trial functions and test 537 00:35:04 --> 00:35:07 functions is going to be a symmetric matrix K. 538 00:35:07 --> 00:35:13 And the integrals of first derivatives, so as long as our 539 00:35:13 --> 00:35:19 functions, our trial functions and test functions are 540 00:35:19 --> 00:35:24 continuous, that is, they shouldn't jump. 541 00:35:24 --> 00:35:28 If the trial functions or test functions jump, then if I have 542 00:35:28 --> 00:35:31 a jump, then the derivative would be a delta. 543 00:35:31 --> 00:35:34 I'd have another delta here, I'd have an integral delta, a 544 00:35:34 --> 00:35:37 delta times delta, and I don't want that. 545 00:35:37 --> 00:35:39 That's infinite. 546 00:35:39 --> 00:35:45 Those discontinuous elements would not be conforming, and 547 00:35:45 --> 00:35:48 that's a whole new world of discontinuous Galerkin. 548 00:35:48 --> 00:35:52 I'd have to impose penalty stuff, and Professor 549 00:35:52 --> 00:35:54 Peraire I mentioned. 550 00:35:54 --> 00:36:00 And others, Professor Darmofal in aero are experts on this. 551 00:36:00 --> 00:36:02 We're doing continuous form. 552 00:36:02 --> 00:36:03 CG. 553 00:36:04 --> 00:36:07 Our piecewise linear, piecewise quadratic, 554 00:36:07 --> 00:36:08 they'll be continuous. 555 00:36:08 --> 00:36:11 All I have to do is these derivatives. 556 00:36:11 --> 00:36:14 Integrate those things and that's what the code will do. 557 00:36:14 --> 00:36:19 OK, I've got to the weak form. 558 00:36:19 --> 00:36:22 That's the weak form. 559 00:36:22 --> 00:36:25 Now comes the finite element idea. 560 00:36:25 --> 00:36:28 So there is our weak form, now ready for the 561 00:36:28 --> 00:36:31 finite element idea. 562 00:36:31 --> 00:36:34 OK, so what was that idea? 563 00:36:34 --> 00:36:36 That's the continuous problem. 564 00:36:36 --> 00:36:47 Now, the finite element idea is, plug in U as a combination. 565 00:36:47 --> 00:36:52 Let me write out the terms. 566 00:36:52 --> 00:36:55 You know what's coming here. 567 00:36:55 --> 00:36:58 If I'm using finite elements, I'm going to choose nice 568 00:36:58 --> 00:37:07 polynomials, phi, say, N of them. 569 00:37:07 --> 00:37:10 That would be like, one for every node, so I would 570 00:37:10 --> 00:37:14 have 13 functions here. 571 00:37:14 --> 00:37:18 I'm going to choose the v's to be the same as the phis. 572 00:37:18 --> 00:37:23 And then, I'm working then in 13 dimensions instead 573 00:37:23 --> 00:37:26 of infinite dimensions. 574 00:37:26 --> 00:37:29 So what do I do? 575 00:37:29 --> 00:37:33 For this limited subspace, this finite element subspace, this 576 00:37:33 --> 00:37:38 piecewise polynomial, piecewise linear subspace, I plug that 577 00:37:38 --> 00:37:44 into the weak form and I test it against 13 V's, 578 00:37:44 --> 00:37:45 which are phis. 579 00:37:45 --> 00:37:53 So I plug that in, so now what is K? 580 00:37:53 --> 00:38:00 Now let me just say, so I now have the integral of, yeah I 581 00:38:00 --> 00:38:03 guess I'd better plug it in. 582 00:38:03 --> 00:38:07 K_ij would then be the integral. 583 00:38:07 --> 00:38:09 I'm just copying the weak form in. 584 00:38:09 --> 00:38:22 Of dU/dx, no, sorry I'd better just plug it in first. 585 00:38:22 --> 00:38:32 dU/dx*dV/dx plus dU/dy*dV/dy, those are the integrals 586 00:38:32 --> 00:38:33 I have to do. 587 00:38:33 --> 00:38:37 And on the right hand side I have to do the fV. 588 00:38:37 --> 00:38:40 589 00:38:40 --> 00:38:44 OK, plug that in. 590 00:38:44 --> 00:38:48 That's the integral over the whole domain. 591 00:38:48 --> 00:38:54 When I plug it in this U is a combination of known 592 00:38:54 --> 00:39:05 functions and the V's will be the same guys. 593 00:39:05 --> 00:39:08 So what am I going to get here? 594 00:39:08 --> 00:39:10 It's just as in 1-D. 595 00:39:10 --> 00:39:14 So no new ideas entering here. 596 00:39:14 --> 00:39:20 The new idea's going to enter when I construct these phis. 597 00:39:20 --> 00:39:23 Let me just say, though, one thing. 598 00:39:23 --> 00:39:29 In 1-D, we've pretty much had a choice of, when 599 00:39:29 --> 00:39:31 it was one dimension. 600 00:39:31 --> 00:39:34 Just remember that. 601 00:39:34 --> 00:39:40 In one dimension, when I had these hat functions, when I had 602 00:39:40 --> 00:39:44 these guys, integrated against these guys, I pretty much had a 603 00:39:44 --> 00:39:48 choice of did I want to think about integrating that hat 604 00:39:48 --> 00:39:50 function against that one. 605 00:39:50 --> 00:39:53 Or actually it was their derivatives. 606 00:39:53 --> 00:39:58 It was the integral of U, yeah. 607 00:39:58 --> 00:40:02 Of phi, what I needed was all the integrals 608 00:40:02 --> 00:40:04 of phi_i', phi_j'. 609 00:40:06 --> 00:40:12 Those are what I needed, these go into K. 610 00:40:12 --> 00:40:13 Into the matrix K. 611 00:40:13 --> 00:40:16 In fact, that's what equals K_ij, the 612 00:40:16 --> 00:40:18 integral of phi prime. 613 00:40:18 --> 00:40:20 In 1-D. 614 00:40:20 --> 00:40:21 OK. 615 00:40:21 --> 00:40:26 Now, what I was going to say, I could do it 616 00:40:26 --> 00:40:28 this way if I wanted. 617 00:40:28 --> 00:40:30 But you remember the other way to do it? 618 00:40:30 --> 00:40:33 Was elements at a time. 619 00:40:33 --> 00:40:36 So this was one method here. 620 00:40:36 --> 00:40:43 That found the entries of K separately, one by one. 621 00:40:43 --> 00:40:47 The other way was take the elements, one by one. 622 00:40:47 --> 00:40:52 So the other way was take an element like this element. 623 00:40:52 --> 00:40:56 It's got two functions, two trial functions 624 00:40:56 --> 00:40:57 are involved there. 625 00:40:57 --> 00:41:02 There's a little two by two, so this is four. 626 00:41:02 --> 00:41:06 Two by two element matrices. 627 00:41:06 --> 00:41:08 K equals. 628 00:41:08 --> 00:41:12 And the quiz recalled that part. 629 00:41:12 --> 00:41:13 That approach. 630 00:41:13 --> 00:41:16 So what I want to say is that's the right way to 631 00:41:16 --> 00:41:18 do it in two dimensions. 632 00:41:18 --> 00:41:20 A triangle at a time. 633 00:41:20 --> 00:41:22 That's the way the code will do it. 634 00:41:22 --> 00:41:26 It creates these little element matrices, and then it stamps 635 00:41:26 --> 00:41:30 them into the big matrix K. 636 00:41:30 --> 00:41:32 Alright. 637 00:41:32 --> 00:41:42 So I want to do this integral one triangle at a time. 638 00:41:42 --> 00:41:45 Is the good way. 639 00:41:45 --> 00:41:47 OK, and that's what the code will do. 640 00:41:47 --> 00:41:52 Actually, I think that the best way to learn these 641 00:41:52 --> 00:41:55 steps is just to read the lines of the code. 642 00:41:55 --> 00:41:59 You can read them in the book, Page 303 or something. 643 00:41:59 --> 00:42:04 And you'll see it just doing all the steps 644 00:42:04 --> 00:42:05 that need to be done. 645 00:42:05 --> 00:42:07 One triangle at a time. 646 00:42:07 --> 00:42:11 So, now. 647 00:42:11 --> 00:42:12 Now comes the fun. 648 00:42:12 --> 00:42:15 I get to answer what do these piecewise linear 649 00:42:15 --> 00:42:16 elements look like. 650 00:42:16 --> 00:42:18 What do the quadratic elements look like. 651 00:42:18 --> 00:42:24 What do the Q_1 quad elements look like? 652 00:42:24 --> 00:42:28 This was the golden age of finite elements, when people 653 00:42:28 --> 00:42:35 invented these ways to create piecewise polynomials. 654 00:42:35 --> 00:42:37 And it continues. 655 00:42:37 --> 00:42:41 People are still inventing, I had a email this week, 656 00:42:41 --> 00:42:44 somebody says I've got spectral elements. 657 00:42:44 --> 00:42:47 People are going higher and higher degrees. 658 00:42:47 --> 00:42:51 You, know sixth degree, eighth degree. 659 00:42:51 --> 00:42:53 In order to get more accuracy. 660 00:42:53 --> 00:42:55 OK, let's start with P_1. 661 00:42:57 --> 00:43:02 How do I describe a P_1 element inside a triangle? 662 00:43:02 --> 00:43:11 So in a triangle, the unknowns will be the value, this has a 663 00:43:11 --> 00:43:14 height U_1, this has a height U_2, and a height 664 00:43:14 --> 00:43:17 U_3 at those nodes. 665 00:43:17 --> 00:43:24 Inside the triangle, the function U is linear. a+bx+cy. 666 00:43:24 --> 00:43:31 667 00:43:31 --> 00:43:37 Then, you see that if I know these three values, then I 668 00:43:37 --> 00:43:39 know these three numbers. 669 00:43:39 --> 00:43:40 And vice versa. 670 00:43:40 --> 00:43:43 There's a three by three matrix, right? 671 00:43:43 --> 00:43:44 There has to be a three by 672 00:43:44 --> 00:43:47 - any time you see pictures like this, this is like the 673 00:43:47 --> 00:43:51 good part of 18.085 is to realize that if I have three 674 00:43:51 --> 00:43:55 numbers here, three values and I've got three coefficients, 675 00:43:55 --> 00:43:58 that there's some three by three matrix that connects them 676 00:43:58 --> 00:43:59 that you're going to need. 677 00:43:59 --> 00:44:04 That's like a meta-message of this course. 678 00:44:04 --> 00:44:13 Is, you've got to translate between the node values 679 00:44:13 --> 00:44:15 and the coefficients. 680 00:44:15 --> 00:44:19 Because the node values are the unknowns, right? 681 00:44:19 --> 00:44:22 These are the guys that are multiplying the pyramid 682 00:44:22 --> 00:44:25 function, this is multiplying a pyramid function 683 00:44:25 --> 00:44:26 with height one. 684 00:44:26 --> 00:44:31 At that point, going down to zero, so this one will be a 685 00:44:31 --> 00:44:36 pyramid function of height U_2 times one, going down to zero. 686 00:44:36 --> 00:44:37 And U_3. 687 00:44:38 --> 00:44:42 So we've got a flat function in here. 688 00:44:42 --> 00:44:44 And it looks exactly like that. 689 00:44:44 --> 00:44:46 OK? 690 00:44:46 --> 00:44:50 So what do I want to say? 691 00:44:50 --> 00:44:54 When we know the positions of these three nodes 692 00:44:54 --> 00:44:57 from our list, P, right? 693 00:44:57 --> 00:45:00 These were the crucial things we did. 694 00:45:00 --> 00:45:05 The positions of all the nodes, we know where they are. 695 00:45:05 --> 00:45:10 Then there has to be a three by three matrix that will now 696 00:45:10 --> 00:45:13 connect to the coefficients. 697 00:45:13 --> 00:45:15 Why do we want the coefficients? 698 00:45:15 --> 00:45:18 Because those are what we do when we integrate. 699 00:45:18 --> 00:45:21 The coefficients are what we need, we need to integrate 700 00:45:21 --> 00:45:21 dU/dx, dU/dy, dU/dz. 701 00:45:23 --> 00:45:27 Sorry, dU/dx, dU/dy. 702 00:45:27 --> 00:45:31 Are you visualizing this overall solution 703 00:45:31 --> 00:45:36 capital U, yeah. 704 00:45:36 --> 00:45:40 So what the overall solution capital U, you should visualize 705 00:45:40 --> 00:45:44 with a combination of all the little u's, is zero here and 706 00:45:44 --> 00:45:48 then it's going to go up and these triangles and bend around 707 00:45:48 --> 00:45:51 and, I don't know, maybe down again. 708 00:45:51 --> 00:45:53 Or maybe, no, maybe it keeps going up. 709 00:45:53 --> 00:45:58 This is probably the largest value, because it's the largest 710 00:45:58 --> 00:46:00 value and the correct solution. 711 00:46:00 --> 00:46:11 So is this is probably going to be the highest point of this. 712 00:46:11 --> 00:46:14 What's the Forbidden City, right? 713 00:46:14 --> 00:46:20 In China, is in Beijing is like, or a single, 714 00:46:20 --> 00:46:23 do pagodas have flat? 715 00:46:23 --> 00:46:24 No. 716 00:46:24 --> 00:46:29 We we will meet pagoda functions. 717 00:46:29 --> 00:46:34 But this would be just an ordinary western roof, I guess. 718 00:46:34 --> 00:46:35 Just flat pieces. 719 00:46:35 --> 00:46:36 Yeah. 720 00:46:36 --> 00:46:40 OK, see, you've got to see the whole thing and then 721 00:46:40 --> 00:46:42 you look at each piece. 722 00:46:42 --> 00:46:47 Each piece looks like that, and the integrals are doable. 723 00:46:47 --> 00:46:54 OK, so while I'm going here, I want to do quadratics. 724 00:46:54 --> 00:46:55 You'll get the idea right away. 725 00:46:55 --> 00:46:59 So, same triangle, now I'm going to have quadratics. 726 00:46:59 --> 00:47:02 So I'm now going to have, so this won't be the arrow, this 727 00:47:02 --> 00:47:04 arrow will now go this way. 728 00:47:04 --> 00:47:10 I'm going to have dx squared, exy, and f y squared. 729 00:47:10 --> 00:47:12 So now how many coefficients have I got 730 00:47:12 --> 00:47:15 to determine a quadratic? 731 00:47:15 --> 00:47:18 Six, right? a, b, c, d, e, f. 732 00:47:18 --> 00:47:20 How many nodes do I need? 733 00:47:20 --> 00:47:21 Six. 734 00:47:21 --> 00:47:22 Where are they? 735 00:47:22 --> 00:47:29 Well, the natural positions are those guys in the mid-point. 736 00:47:29 --> 00:47:33 So now, those are all nodes now. 737 00:47:33 --> 00:47:38 Some nodes are at vertices of triangles, some 738 00:47:38 --> 00:47:39 nodes are at midpoint. 739 00:47:39 --> 00:47:44 But remember, we've got other triangles hooking on here, many 740 00:47:44 --> 00:47:48 other triangles, all with their own six nodes. 741 00:47:48 --> 00:47:51 Well, not their own, because they share. 742 00:47:51 --> 00:47:53 That's a big point. 743 00:47:53 --> 00:47:59 So there's a grid of triangles, with nodes for quadratic. 744 00:47:59 --> 00:48:02 And we've got one, two, three, four, five, six, seven, eight, 745 00:48:02 --> 00:48:09 nine, ten, 11, 12, 13, 14, 15, 16 nodes, I think. 746 00:48:09 --> 00:48:13 And within each triangle, this is what we've got. 747 00:48:13 --> 00:48:17 So there's a six by six matrix for each triangle. 748 00:48:17 --> 00:48:21 A six by six matrix which will connect the values U_1, U_2, 749 00:48:21 --> 00:48:29 U_3, U_4, U_5, U_6 for this triangle. 750 00:48:29 --> 00:48:33 Connect those six heights with these six numbers. 751 00:48:33 --> 00:48:42 And what will the roof look like within that triangle? 752 00:48:42 --> 00:48:44 Well, sort of curved. 753 00:48:44 --> 00:48:45 A parabola, right? 754 00:48:45 --> 00:48:49 A parabola somehow in 2-D, it'll look like this, yeah. 755 00:48:49 --> 00:48:49 Yeah. 756 00:48:49 --> 00:48:52 And here's the key question. 757 00:48:52 --> 00:48:59 Will that roof, that curvy roof, fit the one over there? 758 00:48:59 --> 00:49:01 Because if it didn't fit, we're in trouble. 759 00:49:01 --> 00:49:04 This derivative would have a delta function, and we've got 760 00:49:04 --> 00:49:07 delta functions, and integral squaring them would 761 00:49:07 --> 00:49:09 give infinite. 762 00:49:09 --> 00:49:10 So here's the question. 763 00:49:10 --> 00:49:16 Why does this roof, using these six points, fit on to the roof 764 00:49:16 --> 00:49:23 that uses U_7, U_8, U_9, and U_3 U_4 and U_6? 765 00:49:23 --> 00:49:26 Why do those two roofs fit together? 766 00:49:26 --> 00:49:30 This one piecewise polynomials? 767 00:49:30 --> 00:49:33 Of course, the slope will change. 768 00:49:33 --> 00:49:35 But the roof won't have a gap. 769 00:49:35 --> 00:49:37 Water won't go through it. 770 00:49:37 --> 00:49:38 Why's that? 771 00:49:38 --> 00:49:41 Do you see why? 772 00:49:41 --> 00:49:43 Because what do they share, what do those 773 00:49:43 --> 00:49:46 two curvy roofs share? 774 00:49:46 --> 00:49:48 They share a side. 775 00:49:48 --> 00:49:53 They share the same values along the side. 776 00:49:53 --> 00:49:57 And are those three values that are shared along the side 777 00:49:57 --> 00:50:03 sufficient to make it match all along the side? 778 00:50:03 --> 00:50:03 Yes. 779 00:50:03 --> 00:50:05 That's the important question. 780 00:50:05 --> 00:50:08 Finite elements lives or dies on that question. 781 00:50:08 --> 00:50:14 The answer is yes, because along that side, if I just 782 00:50:14 --> 00:50:20 focus on that side, where these three values are shared on both 783 00:50:20 --> 00:50:23 sides, by the triangle on both sides. 784 00:50:23 --> 00:50:28 Along that edge, what kind of a function have I got? 785 00:50:28 --> 00:50:31 It's second degree. 786 00:50:31 --> 00:50:34 This is whatever, when I restrict this to just run along 787 00:50:34 --> 00:50:37 a line, it's a parabola. 788 00:50:37 --> 00:50:40 And the parabola is determined by those three values. 789 00:50:40 --> 00:50:42 So having it right at three points means I have it 790 00:50:42 --> 00:50:44 right the whole way. 791 00:50:44 --> 00:50:44 Yeah. 792 00:50:44 --> 00:50:49 So there you see what quadratic elements would look like, and 793 00:50:49 --> 00:50:55 you could extend the code in the book and on the CSE site to 794 00:50:55 --> 00:50:57 work for quadratic elements. 795 00:50:57 --> 00:51:01 And you want to just guess what cubic elements could look like? 796 00:51:01 --> 00:51:03 I'm sorry, we've run five minutes over, but maybe 797 00:51:03 --> 00:51:06 finite elements is worth it. 798 00:51:06 --> 00:51:13 So if I had cubic elements, any idea how many? 799 00:51:13 --> 00:51:18 So I'm now going up to, I'm adding g x cubed, h, i, 800 00:51:18 --> 00:51:25 j, any idea how many coefficients I now have? 801 00:51:25 --> 00:51:28 Four new ones plus these six is ten. 802 00:51:28 --> 00:51:29 I need ten nodes. 803 00:51:29 --> 00:51:33 Where I am I going to put ten nodes in this triangle? 804 00:51:33 --> 00:51:36 I want to put them, I'd like to have some on the edges. 805 00:51:36 --> 00:51:39 Because the edges help me make triangles match each other. 806 00:51:39 --> 00:51:42 They'll just be like bowling balls. 807 00:51:42 --> 00:51:52 So here's six, oops, that wouldn't be believable. 808 00:51:52 --> 00:51:54 Is that right? 809 00:51:54 --> 00:51:55 Four, three, two, and one. 810 00:51:55 --> 00:51:56 Yeah. 811 00:51:56 --> 00:51:57 Yeah. 812 00:51:57 --> 00:51:58 OK. 813 00:51:58 --> 00:52:06 So, now I've got a bubble node inside and I've got four nodes 814 00:52:06 --> 00:52:13 of vertices and two points, at two 1/3 points, and that 815 00:52:13 --> 00:52:16 will then match the triangle next to it. 816 00:52:16 --> 00:52:19 Because four points determine a cubic. 817 00:52:19 --> 00:52:23 There you go, I hope you have fun, I hope you 818 00:52:23 --> 00:52:24 have a great holiday. 819 00:52:24 --> 00:52:30 I'll see you Wednesday for Fourier and always open for 820 00:52:30 --> 00:52:32 questions on the MATLAB.