WEBVTT
00:00:00.499 --> 00:00:02.756
The following content is
provided under a Creative
00:00:02.756 --> 00:00:03.610
Commons license.
00:00:03.610 --> 00:00:05.450
Your support will help
MIT OpenCourseWare
00:00:05.450 --> 00:00:09.116
continue to offer high-quality
educational resources for free.
00:00:09.116 --> 00:00:11.240
To make a donation, or to
view additional materials
00:00:11.240 --> 00:00:15.710
from hundreds of MIT courses,
visit MIT OpenCourseWare
00:00:15.710 --> 00:00:19.390
at ocw.mit.edu.
00:00:19.390 --> 00:00:24.330
PROFESSOR STRANG: So,
let's see, you probably
00:00:24.330 --> 00:00:31.880
guessed on that quiz problem
three, it wasn't what I meant.
00:00:31.880 --> 00:00:34.680
I get a zero for that problem.
00:00:34.680 --> 00:00:36.550
But you'll get
probably good numbers,
00:00:36.550 --> 00:00:41.720
so that's an election gift
if it comes out that way.
00:00:41.720 --> 00:00:46.130
So they're all in the hands
of the TAs to be graded.
00:00:46.130 --> 00:00:48.560
We have a holiday
Monday, I think.
00:00:48.560 --> 00:00:52.910
We come back to Fourier.
00:00:52.910 --> 00:00:57.700
Now, so we just have a
concentrated shot at Fourier,
00:00:57.700 --> 00:01:01.550
just about eight or nine
lectures in November.
00:01:01.550 --> 00:01:04.990
So stay with it and
that'll be of course
00:01:04.990 --> 00:01:07.700
the subject of the third quiz.
00:01:07.700 --> 00:01:09.290
Which will have no mistakes.
00:01:09.290 --> 00:01:14.660
It'll be solved by the TAs in
advance and we'll spot things.
00:01:14.660 --> 00:01:19.090
So, and if we have the quizzes
to return to you by Wednesday
00:01:19.090 --> 00:01:20.030
that will be great.
00:01:20.030 --> 00:01:26.810
I hope so, but they
have a big job.
00:01:26.810 --> 00:01:29.650
A little bit, looking far
ahead, the end of Fourier,
00:01:29.650 --> 00:01:35.210
the quiz is December 4th,
I think that's a Thursday.
00:01:35.210 --> 00:01:39.420
And that's the
end of the course.
00:01:39.420 --> 00:01:40.440
So December 4th.
00:01:40.440 --> 00:01:45.940
So we'll be ending the
course a little bit early.
00:01:45.940 --> 00:01:52.130
Because I'll be in Hong
Kong, to tell the truth.
00:01:52.130 --> 00:01:55.960
And and we've done a lot,
and with the review sessions
00:01:55.960 --> 00:01:57.890
we're really doing well.
00:01:57.890 --> 00:02:04.740
So, that's the future, Fourier.
00:02:04.740 --> 00:02:10.900
Today is an important day
too, finite elements in 2-D,
00:02:10.900 --> 00:02:15.180
that's a major part of
computational science
00:02:15.180 --> 00:02:17.880
and engineering.
00:02:17.880 --> 00:02:21.660
The finite element idea, the
idea of using polynomials,
00:02:21.660 --> 00:02:24.620
you can find in
some early papers
00:02:24.620 --> 00:02:28.940
by Courant, a
mathematician in New York,
00:02:28.940 --> 00:02:34.890
and by a guy in China,
neat guy named Feng Kang.
00:02:34.890 --> 00:02:38.610
But those papers
were sort of, you
00:02:38.610 --> 00:02:41.440
could do it this
way if you wanted.
00:02:41.440 --> 00:02:46.110
It was really the structural
engineers in Berkeley
00:02:46.110 --> 00:02:50.910
and elsewhere who made it
happen ten years later.
00:02:50.910 --> 00:02:54.570
And the whole idea
has just blossomed.
00:02:54.570 --> 00:02:56.470
Continues to grow.
00:02:56.470 --> 00:03:00.190
So I had an early
book, in the '70s,
00:03:00.190 --> 00:03:08.900
actually, about the mathematical
underpinnings, the math basis
00:03:08.900 --> 00:03:11.460
for the finite element method.
00:03:11.460 --> 00:03:15.500
And many other finite
element books have come.
00:03:15.500 --> 00:03:19.520
Professor Bathe you know,
teaches a full of course
00:03:19.520 --> 00:03:20.460
on that.
00:03:20.460 --> 00:03:26.090
But, I think we can get the
idea of finite elements here.
00:03:26.090 --> 00:03:30.350
We did them in 1-D, and now
there's a MATLAB problem
00:03:30.350 --> 00:03:33.960
and I'd like to just describe
that particular problem
00:03:33.960 --> 00:03:36.530
if I can, as an example.
00:03:36.530 --> 00:03:39.600
And, of course, you
would use the code
00:03:39.600 --> 00:03:46.510
that's printed in the book, and
that's available on the website
00:03:46.510 --> 00:03:48.850
just to download.
00:03:48.850 --> 00:03:53.030
But the problem is not
on a square domain.
00:03:53.030 --> 00:03:58.570
It starts on a circle, so that
the first lines of the code,
00:03:58.570 --> 00:04:09.160
calling the MATLAB command
squaregrid, are not applicable.
00:04:09.160 --> 00:04:12.570
So you have to
create, then, a mesh.
00:04:12.570 --> 00:04:15.810
Well, I have a suggested
mesh so I'll draw that,
00:04:15.810 --> 00:04:18.480
and then from that
you want to make
00:04:18.480 --> 00:04:23.020
a list of all the node points.
00:04:23.020 --> 00:04:32.750
A list, P, of-- So what the
code needs is two lists.
00:04:32.750 --> 00:04:39.680
Well, let me draw a picture
of, well, it's a circle.
00:04:39.680 --> 00:04:43.100
And I'm going to be
solving Poisson's equation.
00:04:43.100 --> 00:04:51.360
The equation will be
-u_xx-u_yy=4, in the circle.
00:04:51.360 --> 00:04:54.350
So it's Poisson but with a
constant right-hand side.
00:04:54.350 --> 00:04:58.310
That will mean that
all the integrals of f
00:04:58.310 --> 00:05:04.870
times v, the right-hand side of
our discrete equation will be,
00:05:04.870 --> 00:05:09.500
the integrals are all easy
because we just have a constant
00:05:09.500 --> 00:05:11.670
there times the trial function.
00:05:11.670 --> 00:05:16.170
OK, and then on the boundary
it's going to be u=0.
00:05:16.170 --> 00:05:17.740
On the boundary.
00:05:17.740 --> 00:05:19.810
So it's a classic problem.
00:05:19.810 --> 00:05:23.020
And we can say what
the solution is.
00:05:23.020 --> 00:05:25.700
So it's one with
a known solution.
00:05:25.700 --> 00:05:30.020
I think it would be
x squared-- No, I
00:05:30.020 --> 00:05:34.020
guess one, one minus x
squared minus y squared.
00:05:34.020 --> 00:05:36.440
This should all be
on the .086 site.
00:05:36.440 --> 00:05:38.970
I just didn't have a
chance to look this morning
00:05:38.970 --> 00:05:40.700
to be sure it got up.
00:05:40.700 --> 00:05:42.380
So you can watch, here.
00:05:42.380 --> 00:05:44.940
So that, I hope, does
solve the problem.
00:05:44.940 --> 00:05:49.160
Two x derivatives give us a two,
two y derivatives another two,
00:05:49.160 --> 00:05:50.430
so we get four.
00:05:50.430 --> 00:05:53.700
So we know the answer;
the question is,
00:05:53.700 --> 00:06:00.110
and I'm interested in this
question, for research reasons
00:06:00.110 --> 00:06:10.250
too, is what's the error
when you go to a polygon?
00:06:10.250 --> 00:06:15.680
You go to a-- These
curved boundaries
00:06:15.680 --> 00:06:18.750
don't get correctly saved.
00:06:18.750 --> 00:06:22.520
You approximate them
by straight lines.
00:06:22.520 --> 00:06:24.430
That would be the first idea.
00:06:24.430 --> 00:06:27.610
And with this,
all this symmetry,
00:06:27.610 --> 00:06:31.250
let's keep the problem nice
and use a regular polygon.
00:06:31.250 --> 00:06:35.060
So maybe I'll try to draw
one with about eight sides,
00:06:35.060 --> 00:06:38.530
but-- OK.
00:06:38.530 --> 00:06:45.580
So we impose u=0 at these nodes.
00:06:45.580 --> 00:06:50.870
So u is zero at those nodes,
and then we have a mesh.
00:06:50.870 --> 00:06:53.000
So we want to create a mesh.
00:06:53.000 --> 00:06:57.420
OK, so with all
the symmetry here,
00:06:57.420 --> 00:07:09.980
the natural idea would be to
start with eight pieces, or M
00:07:09.980 --> 00:07:13.650
pieces if I have, this
is a regular M side,
00:07:13.650 --> 00:07:19.800
let's say, and I'll take M
to be eight in this picture.
00:07:19.800 --> 00:07:24.990
And I think we can work
on just one triangle.
00:07:24.990 --> 00:07:28.130
By rotational symmetry,
all those triangles
00:07:28.130 --> 00:07:29.520
are going to be the same.
00:07:29.520 --> 00:07:35.070
So I think our domain is
really this one triangle here.
00:07:35.070 --> 00:07:36.460
That's where we're working.
00:07:36.460 --> 00:07:43.200
And in that triangle, I think we
have zero boundary conditions.
00:07:43.200 --> 00:07:50.970
And across this edge I think
we have natural boundary
00:07:50.970 --> 00:07:51.620
conditions.
00:07:51.620 --> 00:07:55.420
Slope zero, if I see
the picture correctly.
00:07:55.420 --> 00:07:57.900
The rotational
symmetry would mean
00:07:57.900 --> 00:08:00.600
that things are not changing.
00:08:00.600 --> 00:08:02.450
That every triangle is the same.
00:08:02.450 --> 00:08:07.010
So I think on these boundaries
it's the Neumann condition,
00:08:07.010 --> 00:08:07.510
dU/dn=0.
00:08:10.490 --> 00:08:14.050
And I'm frankly not sure
what to do at the origin,
00:08:14.050 --> 00:08:18.410
so I'll maybe just
try both ways and see.
00:08:18.410 --> 00:08:22.790
OK, so there is a real problem.
00:08:22.790 --> 00:08:25.830
Of course, it's
artificial in the sense
00:08:25.830 --> 00:08:27.300
that we know the answer.
00:08:27.300 --> 00:08:34.720
But it's a real open question of
what does the error look like,
00:08:34.720 --> 00:08:36.480
from doing that.
00:08:36.480 --> 00:08:38.790
So that's the goal
and let me just
00:08:38.790 --> 00:08:42.340
say the problem
I'll ask you to do,
00:08:42.340 --> 00:08:47.910
and it probably is quite enough
to be ready for next Friday,
00:08:47.910 --> 00:08:51.320
is to use piecewise
linear elements.
00:08:51.320 --> 00:08:55.470
Which is what I'm going to do.
00:08:55.470 --> 00:09:00.010
What every discussion of finite
elements will begin with,
00:09:00.010 --> 00:09:00.910
linear elements.
00:09:00.910 --> 00:09:06.790
Those pyramids that I spoke
about at the end of last time.
00:09:06.790 --> 00:09:09.040
So that's what I
hope, but actually I
00:09:09.040 --> 00:09:14.570
would be highly interested, if
anybody got into the problem,
00:09:14.570 --> 00:09:16.990
to try quadratic elements.
00:09:16.990 --> 00:09:25.920
So I'll just say here,
second-degree quadratic
00:09:25.920 --> 00:09:34.100
polynomials would
be more accurate.
00:09:34.100 --> 00:09:36.830
Would be more accurate.
00:09:36.830 --> 00:09:42.670
So, in other words,
this is a first type
00:09:42.670 --> 00:09:48.120
of finite element called P_1,
for polynomials of degree one.
00:09:48.120 --> 00:09:52.990
These guys, I would call P_2,
for polynomials of degree two.
00:09:52.990 --> 00:09:59.280
And I've mentioned here the
possibility of using quads.
00:09:59.280 --> 00:10:04.270
Instead of triangles, if
I had squares for example,
00:10:04.270 --> 00:10:08.380
the simplest element
would be a Q_1.
00:10:08.380 --> 00:10:12.540
So these are-- If I
manage today to tell you
00:10:12.540 --> 00:10:19.050
about how to use P_1 and P_2
and Q_1, you're on your way.
00:10:19.050 --> 00:10:23.190
And for the requirements
of this course,
00:10:23.190 --> 00:10:27.410
P_1 is the first
point to understand.
00:10:27.410 --> 00:10:28.430
OK.
00:10:28.430 --> 00:10:30.810
While I'm speaking
about codes and meshes,
00:10:30.810 --> 00:10:38.310
let me draw the mesh I proposed
in the homework problem.
00:10:38.310 --> 00:10:42.860
So I thought OK, we just have
to have a simple mesh here.
00:10:42.860 --> 00:10:47.180
So let me draw that line in.
00:10:47.180 --> 00:10:48.840
I know all these points, right?
00:10:48.840 --> 00:10:52.300
This is (0, 0) here.
00:10:52.300 --> 00:10:57.800
And that point's on the circle.
00:10:57.800 --> 00:11:04.120
And so is this, that point might
be, so what's the angle there?
00:11:04.120 --> 00:11:09.330
That angle is probably pi/8.
00:11:09.330 --> 00:11:12.670
The whole angle would be
2pi/8, and eight of them
00:11:12.670 --> 00:11:14.470
would go all the way around.
00:11:14.470 --> 00:11:17.460
So I think that angle is pi/8.
00:11:17.460 --> 00:11:23.180
And so this point would
be (cos(pi/8), sin(pi/8)).
00:11:23.180 --> 00:11:29.790
We know where they are.
00:11:29.790 --> 00:11:32.470
But that's going to be
what we have to list.
00:11:32.470 --> 00:11:35.090
We have to list where are the
coordinates of all the mesh
00:11:35.090 --> 00:11:35.800
points.
00:11:35.800 --> 00:11:38.490
So let me describe the
rest of the mesh points
00:11:38.490 --> 00:11:43.440
and then see what that
list would look like.
00:11:43.440 --> 00:11:51.070
And once you've created the
list, the code will take over.
00:11:51.070 --> 00:11:55.960
And then you plot the results
and see what's going on.
00:11:55.960 --> 00:11:59.980
So let me suggest a mesh.
00:11:59.980 --> 00:12:01.800
It's pretty straightforward.
00:12:01.800 --> 00:12:09.030
I just divided this piece
into N, this center thing
00:12:09.030 --> 00:12:15.550
into N-- So I called
that distance h.
00:12:15.550 --> 00:12:20.820
So Nh gets me out to here.
00:12:20.820 --> 00:12:24.560
Whatever that is, that's
cos(pi/8), I guess,
00:12:24.560 --> 00:12:27.410
that's the x coordinate
of that line.
00:12:27.410 --> 00:12:31.850
So those are mesh points and
then let me keep drawing these.
00:12:31.850 --> 00:12:34.390
So these will be
mesh points too,
00:12:34.390 --> 00:12:37.990
and these will be
mesh points too.
00:12:37.990 --> 00:12:44.850
So at this point, I've got
probably 12 or 13 mesh points.
00:12:44.850 --> 00:12:47.460
But I've got quads, right?
00:12:47.460 --> 00:12:49.120
Well, I've got a
couple of triangles
00:12:49.120 --> 00:12:51.930
here that I'm not going
to touch, those are fine.
00:12:51.930 --> 00:12:56.460
But these are quads
and they could
00:12:56.460 --> 00:13:00.430
be used with the Q_1
element, but I'm thinking
00:13:00.430 --> 00:13:02.340
let's stay with triangles.
00:13:02.340 --> 00:13:05.490
So I just suggested
to put in triangles,
00:13:05.490 --> 00:13:10.060
put in these diagonals,
keeping symmetry.
00:13:10.060 --> 00:13:13.590
And so there's the mesh.
00:13:13.590 --> 00:13:15.130
There's the mesh.
00:13:15.130 --> 00:13:19.200
And then what does
the code ask for?
00:13:19.200 --> 00:13:22.220
So I've got 13 mesh points.
00:13:22.220 --> 00:13:24.380
And the code, first
of all it wants
00:13:24.380 --> 00:13:27.360
a list of the coordinates
of all those mesh points.
00:13:27.360 --> 00:13:32.440
So that the code will-- And I
better number them, of course.
00:13:32.440 --> 00:13:35.230
So let me number them
one, shall I number
00:13:35.230 --> 00:13:41.380
them the center guys first,
one, two, three, four, five,
00:13:41.380 --> 00:13:43.430
and then up here six,
seven, eight, nine, now
00:13:43.430 --> 00:13:45.760
I don't know if this
is a good numbering.
00:13:45.760 --> 00:13:48.410
10, 11, 12, 13.
00:13:48.410 --> 00:13:57.830
Why don't we, just to have
some consistency within plans,
00:13:57.830 --> 00:14:01.110
why don't you, you
don't have to take N=4.
00:14:01.110 --> 00:14:06.280
I hope you'll take, what did
I take N as four or five?
00:14:06.280 --> 00:14:08.160
Yeah, right.
00:14:08.160 --> 00:14:09.990
N is 4.
00:14:09.990 --> 00:14:13.370
But you'll want to
try different N's.
00:14:13.370 --> 00:14:18.000
N=4 would be a good crude
start to see what's going
00:14:18.000 --> 00:14:23.060
on, but then I hope you'll go
higher and get better accuracy.
00:14:23.060 --> 00:14:28.230
And you can see how the accuracy
improves, how you get closer
00:14:28.230 --> 00:14:31.620
to that, as N gets bigger.
00:14:31.620 --> 00:14:35.980
OK, we've got the
nodes numbered.
00:14:35.980 --> 00:14:38.250
Oh, I better number
the triangles.
00:14:38.250 --> 00:14:40.070
OK, how shall we
number the triangles?
00:14:40.070 --> 00:14:43.070
Shall we do along
the top, or this?
00:14:43.070 --> 00:14:44.610
I don't know.
00:14:44.610 --> 00:14:48.980
What do you want to do for the
numbering of the triangles?
00:14:48.980 --> 00:14:50.790
Maybe run along
the top, and then
00:14:50.790 --> 00:14:53.590
run along the bottom,
because then it'll
00:14:53.590 --> 00:14:55.160
practically be a copy.
00:14:55.160 --> 00:14:59.710
So I didn't leave myself much
space, but one, two, three,
00:14:59.710 --> 00:15:04.140
four, five, six, seven.
00:15:04.140 --> 00:15:07.950
Seven triangles along the top
and seven along the bottom,
00:15:07.950 --> 00:15:14.340
so I have 14 triangles
in this mesh.
00:15:14.340 --> 00:15:23.150
So it's a mesh with 14
triangles and 13 nodes.
00:15:23.150 --> 00:15:26.220
And I know the positions
of everyone, right?
00:15:26.220 --> 00:15:29.210
I know the x,y
coordinates of every one.
00:15:29.210 --> 00:15:34.740
So what the code will want is
a list of those coordinates.
00:15:34.740 --> 00:15:39.920
So a list p, p will be
a list of coordinates.
00:15:39.920 --> 00:15:50.810
The first guy will be-- Of the
nodes so 13 rows, 3 columns.
00:15:50.810 --> 00:15:53.830
So it's a little 13 by
3 matrix that tells you
00:15:53.830 --> 00:15:55.580
where all the nodes are.
00:15:55.580 --> 00:16:01.330
So the first one on that
list would be (0,0).
00:16:01.330 --> 00:16:03.330
That's for node one.
00:16:03.330 --> 00:16:06.800
And the second one would
be whatever the coordinates
00:16:06.800 --> 00:16:11.940
of that are, something,
zero. (h,0), I guess it is.
00:16:11.940 --> 00:16:18.610
The third one will be (2h,0),
and so on, and then complete
00:16:18.610 --> 00:16:21.000
the list of 13 positions.
00:16:21.000 --> 00:16:28.860
So you have then told the
code where all the nodes are.
00:16:28.860 --> 00:16:30.870
What else do you
have to tell it?
00:16:30.870 --> 00:16:32.370
Not much.
00:16:32.370 --> 00:16:35.350
You now have to tell
it about the triangles.
00:16:35.350 --> 00:16:39.620
So now for every, why
do I say three columns?
00:16:39.620 --> 00:16:44.010
Maybe only two, is it?
00:16:44.010 --> 00:16:46.460
You see the point already.
00:16:46.460 --> 00:16:53.580
I've forgotten, maybe, yeah.
00:16:53.580 --> 00:16:58.510
I don't see why.
00:16:58.510 --> 00:17:01.560
Well for triangles, I'm
going to need three,
00:17:01.560 --> 00:17:03.310
for nodes maybe
it's only got two.
00:17:03.310 --> 00:17:07.250
Maybe it's 13 by 2.
00:17:07.250 --> 00:17:10.380
I don't see why I need three.
00:17:10.380 --> 00:17:11.460
But, anyway.
00:17:11.460 --> 00:17:15.830
Then the other
list is triangles.
00:17:15.830 --> 00:17:19.890
So this will be the
list t, and so it
00:17:19.890 --> 00:17:22.450
takes triangle number one.
00:17:22.450 --> 00:17:24.990
Which is right here.
00:17:24.990 --> 00:17:26.760
That very first triangle.
00:17:26.760 --> 00:17:31.690
And what does it have to
tell us about triangle one?
00:17:31.690 --> 00:17:32.970
The three nodes.
00:17:32.970 --> 00:17:35.980
If it tells us the
three node numbers,
00:17:35.980 --> 00:17:40.810
and this list, p, gave their
positions, we've got it.
00:17:40.810 --> 00:17:45.380
So how many triangles
did that I have?
00:17:45.380 --> 00:17:46.310
14?
00:17:46.310 --> 00:17:53.830
So t will be 14 by 3,
and so the first guy
00:17:53.830 --> 00:18:00.750
will be just one, node
number one, node number two,
00:18:00.750 --> 00:18:02.930
and node number six.
00:18:02.930 --> 00:18:06.580
That will tell us which
is the first triangle.
00:18:06.580 --> 00:18:10.960
And the second triangle, I
guess I've drawn from two
00:18:10.960 --> 00:18:14.510
to seven to six, right?
00:18:14.510 --> 00:18:18.160
That's a very skinny
triangle up there
00:18:18.160 --> 00:18:21.240
but it's the one that started
at node two, went up to seven
00:18:21.240 --> 00:18:22.620
and back to six.
00:18:22.620 --> 00:18:26.960
So a list like that.
00:18:26.960 --> 00:18:32.850
And then the code
will do the rest.
00:18:32.850 --> 00:18:35.750
I hope.
00:18:35.750 --> 00:18:38.320
Almost all the rest.
00:18:38.320 --> 00:18:42.740
The code will create the matrix
K. It'll create the matrix
00:18:42.740 --> 00:18:47.950
K with, it'll be singular.
00:18:47.950 --> 00:18:51.500
Boundary conditions
won't yet be in there.
00:18:51.500 --> 00:18:54.480
And then a final
step after that, K,
00:18:54.480 --> 00:18:57.910
or maybe we could call
it K_0, is created,
00:18:57.910 --> 00:19:02.760
a final step will be to fix u.
00:19:02.760 --> 00:19:04.600
At least at these three points.
00:19:04.600 --> 00:19:08.370
So these three will
be boundary nodes.
00:19:08.370 --> 00:19:12.750
And as I say, I'm not too sure
about that one, I apologize.
00:19:12.750 --> 00:19:14.260
At those boundary
nodes I'm going
00:19:14.260 --> 00:19:16.890
to take the values to be zero.
00:19:16.890 --> 00:19:21.010
So this is going to be
zero along the whole edge,
00:19:21.010 --> 00:19:23.900
because if it's zero there,
zero there, zero there and zero
00:19:23.900 --> 00:19:27.950
there, and if it's
linear, it's zero.
00:19:27.950 --> 00:19:34.380
So the final sort of
subroutine in the code,
00:19:34.380 --> 00:19:39.720
the final group of commands you
want to impose, zeroes here,
00:19:39.720 --> 00:19:44.480
that should then make
the matrix K invertible,
00:19:44.480 --> 00:19:49.300
and then you've
got KU=F to solve.
00:19:49.300 --> 00:19:54.860
So what the code is doing
is creating K and F.
00:19:54.860 --> 00:19:57.590
You see the overall picture?
00:19:57.590 --> 00:20:00.320
I jumped right into
this particular mesh,
00:20:00.320 --> 00:20:06.540
particular problem, but
now I really should back up
00:20:06.540 --> 00:20:09.740
to where it starts.
00:20:09.740 --> 00:20:14.010
This is going to be the weak
form of Laplace, Poisson,
00:20:14.010 --> 00:20:24.420
maybe I'll make a little space
to put in Poisson's name too.
00:20:24.420 --> 00:20:29.770
You have a picture already of
what this weak form is about,
00:20:29.770 --> 00:20:32.550
so now I'm really
backing up to the start.
00:20:32.550 --> 00:20:36.660
I take the equation and
I get its weak form.
00:20:36.660 --> 00:20:39.140
And remember that's in
the continuous case,
00:20:39.140 --> 00:20:41.730
as it was in the quiz problem.
00:20:41.730 --> 00:20:44.940
The first step is the
continuous weak form,
00:20:44.940 --> 00:20:50.010
and then the second
step is choose
00:20:50.010 --> 00:20:56.890
test functions and trial-- I'm
sorry, gosh, I'm in bad shape
00:20:56.890 --> 00:20:59.620
here.
00:20:59.620 --> 00:21:02.360
Because they're the same.
00:21:02.360 --> 00:21:04.450
This isn't my
worst error, today.
00:21:04.450 --> 00:21:11.881
But those are trial functions,
and these are test functions.
00:21:11.881 --> 00:21:14.380
OK, questions at this point,
because I've-- Yeah, thank you.
00:21:14.380 --> 00:21:15.220
Good.
00:21:15.220 --> 00:21:16.590
Let's look at this picture.
00:21:16.590 --> 00:21:22.830
AUDIENCE: [INAUDIBLE]
00:21:22.830 --> 00:21:30.010
PROFESSOR STRANG:
Because-- We did.
00:21:30.010 --> 00:21:30.850
That's right.
00:21:30.850 --> 00:21:37.180
So because my
question is what is--
00:21:37.180 --> 00:21:42.560
The continuous problem I
would like to solve has u=0
00:21:42.560 --> 00:21:44.930
on the polygon.
00:21:44.930 --> 00:21:50.600
So in a way you can
forget the circle,
00:21:50.600 --> 00:21:52.490
where we know the answer.
00:21:52.490 --> 00:21:56.880
Now, we really are
looking on the polygon,
00:21:56.880 --> 00:21:59.330
and I would like to
know what's the solution
00:21:59.330 --> 00:22:01.810
like on that polygon.
00:22:01.810 --> 00:22:06.490
And then so there are
two steps, the first step
00:22:06.490 --> 00:22:09.130
was start with a circle,
we have the answer.
00:22:09.130 --> 00:22:14.180
Second step is go to a polygon,
continuous problem, Poisson's
00:22:14.180 --> 00:22:16.120
equation in the polygon.
00:22:16.120 --> 00:22:18.930
How different is that from this?
00:22:18.930 --> 00:22:23.010
Because this will not
satisfy the polygon
00:22:23.010 --> 00:22:24.480
boundary conditions.
00:22:24.480 --> 00:22:28.330
So that's the circle answer.
00:22:28.330 --> 00:22:32.460
Then the question is,
what's the polygon answer.
00:22:32.460 --> 00:22:36.070
And I don't know that.
00:22:36.070 --> 00:22:39.070
You may say a regular
polygon, you can't do that.
00:22:39.070 --> 00:22:41.270
I didn't think you can.
00:22:41.270 --> 00:22:44.490
It's amazing, but probably
a triangle or a square.
00:22:44.490 --> 00:22:49.780
So if M is three or four,
probably some formulas
00:22:49.780 --> 00:22:50.670
would be available.
00:22:50.670 --> 00:22:52.990
But I think once
we get higher, I
00:22:52.990 --> 00:22:55.990
don't know the answer to
the Dirichlet problem,
00:22:55.990 --> 00:23:00.890
to Poisson's equation on a
polygon, on a regular polygon.
00:23:00.890 --> 00:23:03.830
And that's what I would really
like to know more about.
00:23:03.830 --> 00:23:06.190
And how do I find
out more about it?
00:23:06.190 --> 00:23:08.670
By finite elements.
00:23:08.670 --> 00:23:11.780
With your help.
00:23:11.780 --> 00:23:16.070
Taking that polygon,
breaking it into a mesh,
00:23:16.070 --> 00:23:19.960
looking only at one triangle
just for simplicity,
00:23:19.960 --> 00:23:24.510
and getting u finite elements.
00:23:24.510 --> 00:23:26.350
Well, I should say u_(P_1).
00:23:30.750 --> 00:23:34.560
That's the finite element
solution using linear.
00:23:34.560 --> 00:23:39.130
I would really like
to know u_(P_2),
00:23:39.130 --> 00:23:43.470
the finite element solution
which will be better,
00:23:43.470 --> 00:23:45.260
if I use quadratics.
00:23:45.260 --> 00:23:47.420
So now I get the
fun of describing
00:23:47.420 --> 00:23:51.090
the linear elements, the
quadratic elements, the quads.
00:23:51.090 --> 00:23:53.080
But did I answer
that question OK?
00:23:53.080 --> 00:23:54.070
Yeah.
00:23:54.070 --> 00:23:59.630
So this is the problem I would
like to know the answer to.
00:23:59.630 --> 00:24:04.170
If I have this
equation, zero boundary
00:24:04.170 --> 00:24:07.970
conditions on a regular
polygon with M sides,
00:24:07.970 --> 00:24:09.780
what's the answer?
00:24:09.780 --> 00:24:13.270
And it's going to be close to
this, but it won't be the same.
00:24:13.270 --> 00:24:17.830
Because this does not
vanish on the polygon edges.
00:24:17.830 --> 00:24:22.740
And I would like to
compare the slopes, too.
00:24:22.740 --> 00:24:25.970
So the homework problem
asked you not only to compare
00:24:25.970 --> 00:24:32.820
u_circle with u_(P_1),
but also the slopes.
00:24:32.820 --> 00:24:35.380
The slopes here are
easy, slopes here
00:24:35.380 --> 00:24:39.420
are easy because it's a
bunch of flat functions.
00:24:39.420 --> 00:24:43.190
So the slopes are just
constant in each triangle.
00:24:43.190 --> 00:24:48.720
OK, I'm guessing that the error
gets smaller as you go in.
00:24:48.720 --> 00:24:50.810
I think that if
you plot the error,
00:24:50.810 --> 00:24:53.920
it'll be largest out
here and get small there.
00:24:53.920 --> 00:24:56.750
But remains to be seen.
00:24:56.750 --> 00:24:59.180
So I hope you
enjoy-- yeah, good.
00:24:59.180 --> 00:25:05.930
AUDIENCE: [INAUDIBLE]
00:25:05.930 --> 00:25:07.480
PROFESSOR STRANG:
Rather than seven.
00:25:07.480 --> 00:25:13.800
AUDIENCE: [INAUDIBLE]
00:25:13.800 --> 00:25:17.610
PROFESSOR STRANG:
No, the middle.
00:25:17.610 --> 00:25:21.670
There's nothing magic
about any particular mesh.
00:25:21.670 --> 00:25:24.750
I just chose this
mesh as pretty good,
00:25:24.750 --> 00:25:34.737
and actually, I'm imagining
M could get pretty big.
00:25:34.737 --> 00:25:35.820
That would be interesting.
00:25:35.820 --> 00:25:40.580
M=8 would be interesting,
M=16, M=1,024,
00:25:40.580 --> 00:25:42.760
now then I'd really
get interested.
00:25:42.760 --> 00:25:50.130
OK, but so if M is 1,024, then
this side would be very small.
00:25:50.130 --> 00:25:52.060
Right?
00:25:52.060 --> 00:25:55.590
And I just wanted
more triangles.
00:25:55.590 --> 00:25:58.590
Actually, I would like
more than I've got.
00:25:58.590 --> 00:26:04.760
I'd like, if M was
really big, then
00:26:04.760 --> 00:26:07.540
probably N should be
at least that big.
00:26:07.540 --> 00:26:09.570
So I should have a
thousand this way,
00:26:09.570 --> 00:26:11.100
if this is just a tiny bit.
00:26:11.100 --> 00:26:14.970
I just want little
tiny h, and then, yeah.
00:26:14.970 --> 00:26:18.040
Actually, that might
not be too bad.
00:26:18.040 --> 00:26:20.900
If M and N were
roughly comparable,
00:26:20.900 --> 00:26:26.460
then that length
would be roughly
00:26:26.460 --> 00:26:28.580
comparable to these lengths.
00:26:28.580 --> 00:26:33.610
And the triangles would
be pretty good shapes.
00:26:33.610 --> 00:26:36.780
And that's what
you're looking for.
00:26:36.780 --> 00:26:43.070
I think there's a lot of
experiments to be done here.
00:26:43.070 --> 00:26:46.160
So, I'm thinking
then of M and N. Here
00:26:46.160 --> 00:26:48.560
I took N to be just four.
00:26:48.560 --> 00:26:50.500
When M was eight.
00:26:50.500 --> 00:26:51.780
That's fine.
00:26:51.780 --> 00:26:55.240
But if you keep M and N
roughly the same size,
00:26:55.240 --> 00:27:00.600
then you've got triangles that
are not too long and skinny.
00:27:00.600 --> 00:27:04.130
I'll tell you when
you might want.
00:27:04.130 --> 00:27:07.590
So generally you want
nice shaped triangles.
00:27:07.590 --> 00:27:13.260
You don't want angles very
small or very large, usually.
00:27:13.260 --> 00:27:18.410
But there would be,
anybody in Course 16
00:27:18.410 --> 00:27:23.330
can imagine that if I
am computing the flow
00:27:23.330 --> 00:27:31.120
field past a wing, that long,
thin triangles in the direction
00:27:31.120 --> 00:27:33.030
of the wing are natural.
00:27:33.030 --> 00:27:41.390
I mean, somehow a problem
like true aerodynamics
00:27:41.390 --> 00:27:43.210
is by no means isotropic.
00:27:43.210 --> 00:27:44.940
I mean, the
direction of the wing
00:27:44.940 --> 00:27:49.410
is kind of critical to whether
the plane flies, right?
00:27:49.410 --> 00:27:54.670
So don't make the wing vertical.
00:27:54.670 --> 00:27:56.430
And if you want
accuracy, then you
00:27:56.430 --> 00:27:59.880
have long, thin triangles in
the direction of the flow.
00:27:59.880 --> 00:28:02.140
But here we're not
doing a flow problem.
00:28:02.140 --> 00:28:04.740
We haven't got shocks,
or trailing edges,
00:28:04.740 --> 00:28:10.080
and other horrible stuff
that makes planes fly.
00:28:10.080 --> 00:28:12.960
We just got Poisson's equation.
00:28:12.960 --> 00:28:13.720
OK.
00:28:13.720 --> 00:28:15.595
Thanks for those good
questions, another one.
00:28:15.595 --> 00:28:18.582
AUDIENCE: [INAUDIBLE]
00:28:18.582 --> 00:28:20.790
PROFESSOR STRANG: What would
the dimension look like?
00:28:20.790 --> 00:28:24.710
Ah, would you like me to show
you something about quadratics?
00:28:24.710 --> 00:28:27.030
Yeah.
00:28:27.030 --> 00:28:30.980
Shall I jump into
quadratics, it's kind of fun.
00:28:30.980 --> 00:28:36.700
Quadratics, so let
me just do-- So I'll
00:28:36.700 --> 00:28:40.630
come back to the weak
form, right it's totally--
00:28:40.630 --> 00:28:41.730
Oh, I'll do it now.
00:28:41.730 --> 00:28:44.110
It's so simple I don't
want to forget it.
00:28:44.110 --> 00:28:51.330
The weak form, so I write the
equation down, -u_xx-u_yy=f.
00:28:51.330 --> 00:28:57.920
This is the continuous weak
form, equal f(x,y), OK?
00:28:57.920 --> 00:29:00.400
So that's the strong form.
00:29:00.400 --> 00:29:04.780
And I've made it the Laplacian
here to keep it simple,
00:29:04.780 --> 00:29:06.640
and any right-hand side.
00:29:06.640 --> 00:29:09.560
OK, how do I get
to the weak form?
00:29:09.560 --> 00:29:14.940
Just remind me, I multiply
both sides by any test function
00:29:14.940 --> 00:29:17.680
v(x,y).
00:29:17.680 --> 00:29:23.180
Multiply by v(x,y),
and then what do I do?
00:29:23.180 --> 00:29:28.260
I integrate over
the whole region.
00:29:28.260 --> 00:29:36.780
So that's the weak form, dxdy,
this is for all v, all v(x,y),
00:29:36.780 --> 00:29:42.340
all, I'll say all
admissible v(x,y).
00:29:42.340 --> 00:29:45.830
So that's the weak form.
00:29:45.830 --> 00:29:51.420
If this holds for this great
family of v's, the idea behind
00:29:51.420 --> 00:29:56.060
it is, that if this holds for
all these trial functions,
00:29:56.060 --> 00:30:00.740
test functions, v(x,y), the only
way that can happen is for this
00:30:00.740 --> 00:30:03.560
to actually equal that.
00:30:03.560 --> 00:30:12.370
That's a fundamental lemma
in this part of math,
00:30:12.370 --> 00:30:15.630
and of course it has
to be spelled out
00:30:15.630 --> 00:30:17.280
more than I'm doing in words.
00:30:17.280 --> 00:30:22.120
But the idea is that if these
hold for such a large class
00:30:22.120 --> 00:30:25.520
of v(x,y), then the only
way that can happen is
00:30:25.520 --> 00:30:26.980
for the strong form to hold.
00:30:26.980 --> 00:30:29.260
For this to actually match this.
00:30:29.260 --> 00:30:31.290
OK, so that's the start.
00:30:31.290 --> 00:30:35.470
But then what's the next
step in the weak form?
00:30:35.470 --> 00:30:37.790
I like the right-hand
side but I'm not
00:30:37.790 --> 00:30:39.990
so crazy about the
left-hand side.
00:30:39.990 --> 00:30:41.820
I'm not crazy about
it because this
00:30:41.820 --> 00:30:47.940
has second derivatives of u,
and my little roof functions,
00:30:47.940 --> 00:30:51.640
pyramid functions, haven't
got second derivatives.
00:30:51.640 --> 00:30:54.150
So I would be dead in
the water without doing
00:30:54.150 --> 00:30:58.530
the natural step that makes
everything beautiful, which is?
00:30:58.530 --> 00:31:00.160
Integration by parts.
00:31:00.160 --> 00:31:01.320
Integrate by parts.
00:31:01.320 --> 00:31:07.540
Move derivatives off of u,
onto v. One derivative onto v,
00:31:07.540 --> 00:31:12.320
off of u, so then u and v
each have one derivative.
00:31:12.320 --> 00:31:17.180
I can use my piecewise
linear, piecewise quadratic,
00:31:17.180 --> 00:31:20.080
all my finite elements
are going to go fine.
00:31:20.080 --> 00:31:22.370
So I integrate by parts.
00:31:22.370 --> 00:31:28.000
So integrate by parts, and
what is that mean in 2-D?
00:31:28.000 --> 00:31:30.830
Of course I have a
double integral here.
00:31:30.830 --> 00:31:37.990
So integrate by parts, that mean
you use the Green's formula.
00:31:37.990 --> 00:31:47.230
That was the key point of this
Green, or Gauss-Green formula.
00:31:47.230 --> 00:32:01.630
Can I do it first in, this is
-div(grad u), times v dxdy,
00:32:01.630 --> 00:32:03.740
we can write out all the terms.
00:32:03.740 --> 00:32:05.750
We can use vector notation.
00:32:05.750 --> 00:32:09.770
I could use that nabla, that
upside down triangle notation,
00:32:09.770 --> 00:32:10.730
or whatever.
00:32:10.730 --> 00:32:13.710
But maybe good to see
it a few different ways.
00:32:13.710 --> 00:32:15.220
So what's the point?
00:32:15.220 --> 00:32:20.220
When I integrate by parts, that
minus disappears to a plus,
00:32:20.220 --> 00:32:26.080
I have a double integral then,
and these derivatives move
00:32:26.080 --> 00:32:31.360
off of-- I'm taking one
derivative off of here,
00:32:31.360 --> 00:32:35.540
the divergence moves over there,
but when the divergence moves
00:32:35.540 --> 00:32:38.140
onto v it becomes?
00:32:38.140 --> 00:32:39.890
The transpose.
00:32:39.890 --> 00:32:40.890
It becomes gradient.
00:32:40.890 --> 00:32:52.520
And so this is gradient
of u, gradient of v, dxdy.
00:32:52.520 --> 00:32:54.860
Plus boundary terms.
00:32:54.860 --> 00:32:58.700
The integral of,
what is, let's see.
00:33:02.730 --> 00:33:12.380
What do I have in this integral,
I have grad u dot n, times v
00:33:12.380 --> 00:33:14.090
around the boundary.
00:33:14.090 --> 00:33:19.140
And with my boundary conditions
that's going to be gone,
00:33:19.140 --> 00:33:20.720
so I can come back to that.
00:33:20.720 --> 00:33:25.410
Now, you all looked
a little uncertain
00:33:25.410 --> 00:33:29.090
when I wrote Green's
formula this way.
00:33:29.090 --> 00:33:33.630
For this problem I can
write it more easily.
00:33:33.630 --> 00:33:36.770
This is my left side.
00:33:36.770 --> 00:33:39.160
I want to write
the answer, I just
00:33:39.160 --> 00:33:44.960
want to write this weak
form in a much simpler form.
00:33:44.960 --> 00:33:49.970
So let me say, what
have I got here.
00:33:49.970 --> 00:33:53.390
Well, all I've got
is one derivative
00:33:53.390 --> 00:33:57.320
is moving off of u and
onto v. And the minus sign
00:33:57.320 --> 00:34:02.890
is disappearing, so I
have du/dx times dv/dx.
00:34:02.890 --> 00:34:03.940
Right?
00:34:03.940 --> 00:34:08.390
One off of u, onto
v. The other term,
00:34:08.390 --> 00:34:13.730
one y derivative, moving off
of this and onto v. Minus sign
00:34:13.730 --> 00:34:15.640
again going to a plus.
00:34:15.640 --> 00:34:19.700
du/dy, dv/dy.
00:34:19.700 --> 00:34:20.770
That's the integral.
00:34:20.770 --> 00:34:22.860
That's it, that's cool.
00:34:22.860 --> 00:34:24.910
Easy to do.
00:34:24.910 --> 00:34:29.270
And on the right-hand side
of course I have no change.
00:34:29.270 --> 00:34:34.410
The integral of
f(x,y) v(x,y) dy.
00:34:34.410 --> 00:34:36.101
Now, that's the weak form.
00:34:36.101 --> 00:34:36.600
dxdy.
00:34:44.420 --> 00:34:52.780
Here it is, weak form.
00:34:52.780 --> 00:34:55.210
That's pretty nice.
00:34:55.210 --> 00:34:58.050
Beautifully symmetric,
so the matrix
00:34:58.050 --> 00:35:03.660
that comes up when we plug in
finite specific trial functions
00:35:03.660 --> 00:35:06.310
and test functions is going
to be a symmetric matrix
00:35:06.310 --> 00:35:11.050
K. And the integrals are
of first derivatives,
00:35:11.050 --> 00:35:18.230
so as long as our functions,
our trial functions and test
00:35:18.230 --> 00:35:24.270
functions are continuous,
that is, they shouldn't jump.
00:35:24.270 --> 00:35:27.540
If the trial functions
or test functions jump,
00:35:27.540 --> 00:35:31.180
then if I have a jump, then the
derivative would be a delta.
00:35:31.180 --> 00:35:33.000
I'd have another
delta here, I'd have
00:35:33.000 --> 00:35:37.010
an integral delta, a delta times
delta, and I don't want that.
00:35:37.010 --> 00:35:39.720
That's infinite.
00:35:39.720 --> 00:35:44.960
Those discontinuous elements
would not be conforming,
00:35:44.960 --> 00:35:48.800
and that's a whole new world
of discontinuous Galerkin.
00:35:48.800 --> 00:35:50.940
I'd have to impose
penalty stuff,
00:35:50.940 --> 00:35:54.070
and Professor
Peraire I mentioned,
00:35:54.070 --> 00:36:00.720
and others, Professor Darmofal
in aero, are experts on this.
00:36:00.720 --> 00:36:02.900
We're doing continuous Galerkin.
00:36:02.900 --> 00:36:04.930
CG.
00:36:04.930 --> 00:36:07.480
Our piecewise linear,
piecewise quadratic,
00:36:07.480 --> 00:36:08.870
they'll be continuous.
00:36:08.870 --> 00:36:11.410
All I have to do is
these derivatives.
00:36:11.410 --> 00:36:14.690
Integrate those things and
that's what the code will do.
00:36:14.690 --> 00:36:19.980
OK, I've got to the weak form.
00:36:19.980 --> 00:36:22.650
That's the weak form.
00:36:22.650 --> 00:36:25.350
Now comes the
finite element idea.
00:36:25.350 --> 00:36:28.980
So there is our weak form, now
ready for the finite element
00:36:28.980 --> 00:36:31.310
idea.
00:36:31.310 --> 00:36:34.430
OK, so what was that idea?
00:36:34.430 --> 00:36:36.720
That's the continuous problem.
00:36:36.720 --> 00:36:47.600
Now, the finite element idea
is, plug in U as a combination--
00:36:47.600 --> 00:36:52.170
Let me write out the terms.
00:36:52.170 --> 00:36:55.160
You know what's coming here.
00:36:55.160 --> 00:36:57.260
If I'm using finite
elements, I'm
00:36:57.260 --> 00:37:07.650
going to choose nice
polynomials phi, say N of them.
00:37:07.650 --> 00:37:09.910
That would be like,
one for every node,
00:37:09.910 --> 00:37:14.990
so I would have
13 functions here.
00:37:14.990 --> 00:37:18.670
I'm going to choose the V's
to be the same as the phis.
00:37:18.670 --> 00:37:22.850
And then, I'm working
then in 13 dimensions
00:37:22.850 --> 00:37:26.380
instead of infinite dimensions.
00:37:26.380 --> 00:37:29.040
So what do I do?
00:37:29.040 --> 00:37:33.430
For this limited subspace,
this finite element subspace,
00:37:33.430 --> 00:37:37.290
this piecewise polynomial,
piecewise linear subspace,
00:37:37.290 --> 00:37:41.080
I plug that into the
weak form and I test it
00:37:41.080 --> 00:37:45.860
against 13 V's, which are phis.
00:37:45.860 --> 00:37:53.130
So I plug that in,
so now what is K?
00:37:53.130 --> 00:37:59.580
Now let me just say, so I
now have the integral of,
00:37:59.580 --> 00:38:03.430
yeah I guess I'd
better plug it in.
00:38:03.430 --> 00:38:07.630
K_ij would then
be the integral --
00:38:07.630 --> 00:38:16.910
I'm just copying the weak form
in -- Of dU/dx d-- no, sorry,
00:38:16.910 --> 00:38:22.360
I'd better just
plug it in first.
00:38:22.360 --> 00:38:32.730
dU/dx*dV/dx plus dU/dy*dV/dy,
those are the integrals I have
00:38:32.730 --> 00:38:33.270
to do.
00:38:33.270 --> 00:38:35.120
And on the right
hand side I have
00:38:35.120 --> 00:38:40.460
to do the f-integral. fV dxdy.
00:38:40.460 --> 00:38:44.760
OK, plug that in.
00:38:44.760 --> 00:38:48.950
That's the integral
over the whole domain.
00:38:48.950 --> 00:38:56.070
When I plug it in this U is a
combination of known functions
00:38:56.070 --> 00:39:05.230
and the V's will
be the same guys.
00:39:05.230 --> 00:39:08.850
So what am I going to get here?
00:39:08.850 --> 00:39:14.750
It's just as in 1-D. So no
new ideas entering here.
00:39:14.750 --> 00:39:20.680
The new idea's going to enter
when I construct these phis.
00:39:20.680 --> 00:39:23.230
Let me just say,
though, one thing.
00:39:23.230 --> 00:39:27.970
In 1-D, we pretty
much had a choice
00:39:27.970 --> 00:39:31.380
of-- When it was one dimension.
00:39:31.380 --> 00:39:34.600
Just remember that.
00:39:34.600 --> 00:39:39.540
In one dimension, when I
had these hat functions,
00:39:39.540 --> 00:39:43.210
when I had these guys,
integrated against these guys,
00:39:43.210 --> 00:39:45.410
I pretty much had
a choice of did
00:39:45.410 --> 00:39:48.210
I want to think about
integrating that hat
00:39:48.210 --> 00:39:50.390
function against that one.
00:39:50.390 --> 00:39:53.380
Or actually it was
their derivatives.
00:39:53.380 --> 00:39:58.280
It was the integral of U, yeah.
00:39:58.280 --> 00:40:02.080
Of phi, what I needed
was all the integrals
00:40:02.080 --> 00:40:06.530
of phi_i', phi_j'.
00:40:06.530 --> 00:40:13.700
Those are what I needed, these
go into K. Into the matrix K.
00:40:13.700 --> 00:40:16.880
In fact, that's
what equals K_ij,
00:40:16.880 --> 00:40:18.410
the integral of phi prime.
00:40:18.410 --> 00:40:21.950
In 1-D. OK.
00:40:21.950 --> 00:40:26.940
Now, what I was going
to say, I could do it
00:40:26.940 --> 00:40:28.690
this way if I wanted.
00:40:28.690 --> 00:40:30.860
But you remember the
other way to do it?
00:40:30.860 --> 00:40:33.890
Was element at a time.
00:40:33.890 --> 00:40:36.190
So this was one method here.
00:40:36.190 --> 00:40:43.980
That found the entries of
K separately, one by one.
00:40:43.980 --> 00:40:47.840
The other way was take
the elements, one by one.
00:40:47.840 --> 00:40:52.010
So the other way was take an
element like this element.
00:40:52.010 --> 00:40:56.970
It's got two functions,
two trial functions
00:40:56.970 --> 00:40:57.850
are involved there.
00:40:57.850 --> 00:41:02.530
There's a little two by
two, so this is four.
00:41:02.530 --> 00:41:08.090
Two by two element matrices K_e.
00:41:08.090 --> 00:41:12.040
And the quiz recalled that part.
00:41:12.040 --> 00:41:13.550
That approach.
00:41:13.550 --> 00:41:16.240
So what I want to say
is that's the right way
00:41:16.240 --> 00:41:18.510
to do it in two dimensions.
00:41:18.510 --> 00:41:20.240
A triangle at a time.
00:41:20.240 --> 00:41:22.710
That's the way the
code will do it.
00:41:22.710 --> 00:41:25.600
It creates these little
element matrices,
00:41:25.600 --> 00:41:32.500
and then it stamps them into
the big matrix K. Alright.
00:41:32.500 --> 00:41:42.150
So I want to do this integral
one triangle at a time.
00:41:42.150 --> 00:41:45.420
Is the good way.
00:41:45.420 --> 00:41:47.590
OK, and that's what
the code will do.
00:41:47.590 --> 00:41:50.070
Actually, I think
that the best way
00:41:50.070 --> 00:41:55.480
to learn these steps is just
to read the lines of the code.
00:41:55.480 --> 00:41:59.520
You can read them in the
book, page 303 or something.
00:41:59.520 --> 00:42:05.430
And you'll see it just doing all
the steps that need to be done.
00:42:05.430 --> 00:42:07.930
One triangle at a time.
00:42:07.930 --> 00:42:11.280
So, now.
00:42:11.280 --> 00:42:12.540
Now comes the fun.
00:42:12.540 --> 00:42:15.910
I get to answer, what do these
piecewise linear elements look
00:42:15.910 --> 00:42:16.410
like?
00:42:16.410 --> 00:42:18.750
What do the quadratic
elements look like?
00:42:18.750 --> 00:42:24.340
What do the Q_1, quad
elements look like?
00:42:24.340 --> 00:42:28.310
This was the golden
age of finite elements,
00:42:28.310 --> 00:42:33.290
when people invented
these ways to create
00:42:33.290 --> 00:42:35.490
piecewise polynomials.
00:42:35.490 --> 00:42:37.100
And it continues.
00:42:37.100 --> 00:42:41.680
People are still inventing,
I had a email this week,
00:42:41.680 --> 00:42:44.750
somebody says I've
got spectral elements.
00:42:44.750 --> 00:42:47.400
People are going higher
and higher degrees.
00:42:47.400 --> 00:42:51.840
You, know sixth
degree, eighth degree.
00:42:51.840 --> 00:42:53.700
In order to get more accuracy.
00:42:53.700 --> 00:42:57.400
OK, let's start with P_1.
00:42:57.400 --> 00:43:02.100
How do I describe a P_1
element inside a triangle?
00:43:02.100 --> 00:43:07.490
So in a triangle,
the unknowns will
00:43:07.490 --> 00:43:11.910
be the value-- This
has a height U_1,
00:43:11.910 --> 00:43:17.220
this has a height U_2, and
a height U_3 at those nodes.
00:43:17.220 --> 00:43:24.531
Inside the triangle, the
function U is linear.
00:43:24.531 --> 00:43:25.030
a+bx+cy.
00:43:31.410 --> 00:43:37.670
Then, you see that if I know
these three values, then
00:43:37.670 --> 00:43:39.770
I know these three numbers.
00:43:39.770 --> 00:43:40.820
And vice versa.
00:43:40.820 --> 00:43:43.550
There's a three by
three matrix, right?
00:43:43.550 --> 00:43:46.480
There has to be a three by--
Any time you see pictures
00:43:46.480 --> 00:43:49.510
like this, like the
good part of 18.085
00:43:49.510 --> 00:43:52.370
is to realize that if I
have three numbers here,
00:43:52.370 --> 00:43:55.210
three values and I've
got three coefficients,
00:43:55.210 --> 00:43:58.140
that there's some three by
three matrix that connects them
00:43:58.140 --> 00:43:59.650
that you're going to need.
00:43:59.650 --> 00:44:04.430
That's like a meta-message
of this course.
00:44:04.430 --> 00:44:13.550
Is, you've got to translate
between the node values
00:44:13.550 --> 00:44:15.500
and the coefficients.
00:44:15.500 --> 00:44:19.760
Because the node values
are the unknowns, right?
00:44:19.760 --> 00:44:22.260
These are the guys that
are multiplying the pyramid
00:44:22.260 --> 00:44:25.370
function, this is multiplying
a pyramid function
00:44:25.370 --> 00:44:30.920
with height one at that
point, going down to zero.
00:44:30.920 --> 00:44:34.240
So this one will be a pyramid
function of height U_2
00:44:34.240 --> 00:44:36.430
times one, going down to zero.
00:44:36.430 --> 00:44:38.080
And U_3.
00:44:38.080 --> 00:44:42.680
So we've got a flat
function in here.
00:44:42.680 --> 00:44:44.970
And it looks exactly like that.
00:44:44.970 --> 00:44:46.840
OK?
00:44:46.840 --> 00:44:51.220
So what do I want to say?
00:44:51.220 --> 00:44:57.010
We know the positions of these
three nodes from our list p,
00:44:57.010 --> 00:44:57.840
right?
00:44:57.840 --> 00:45:00.530
These were the crucial
things we needed.
00:45:00.530 --> 00:45:05.240
The positions of all the
nodes, we know where they are.
00:45:05.240 --> 00:45:10.960
Then there has to be a three
by three matrix that will now
00:45:10.960 --> 00:45:13.510
connect to the coefficients.
00:45:13.510 --> 00:45:15.450
Why do we want the coefficients?
00:45:15.450 --> 00:45:18.630
Because those are what
we do when we integrate.
00:45:18.630 --> 00:45:20.690
The coefficients
are what we need,
00:45:20.690 --> 00:45:23.460
we need to integrate
dU/dx, dU/dy, dU/dz.
00:45:23.460 --> 00:45:27.930
Sorry, dU/dx, dU/dy.
00:45:27.930 --> 00:45:36.870
Are you visualizing this overall
solution capital U, yeah.
00:45:36.870 --> 00:45:39.230
So the overall
solution capital U,
00:45:39.230 --> 00:45:41.820
you should visualize
with a combination of all
00:45:41.820 --> 00:45:45.100
the little U's, is
zero here and then
00:45:45.100 --> 00:45:48.700
it's going to go up in these
triangles and bend around
00:45:48.700 --> 00:45:51.580
and, I don't know,
maybe down again.
00:45:51.580 --> 00:45:53.690
Or maybe, no, maybe
it keeps going up.
00:45:53.690 --> 00:45:57.530
This is probably
the largest value,
00:45:57.530 --> 00:46:00.850
because it's the largest
value in the correct solution.
00:46:00.850 --> 00:46:11.060
So is this is probably going to
be the highest point of this,
00:46:11.060 --> 00:46:14.370
what's-- The
Forbidden City, right?
00:46:14.370 --> 00:46:21.770
In China, in Beijing is like,
or a single-- Do pagodas
00:46:21.770 --> 00:46:23.821
have flat--?
00:46:23.821 --> 00:46:24.320
No.
00:46:24.320 --> 00:46:29.360
We we will meet
pagoda functions.
00:46:29.360 --> 00:46:34.430
But this would be just an
ordinary western roof, I guess.
00:46:34.430 --> 00:46:35.830
Just flat pieces.
00:46:35.830 --> 00:46:36.570
Yeah.
00:46:36.570 --> 00:46:40.290
OK, see, you've got
to see the whole thing
00:46:40.290 --> 00:46:42.610
and then you look at each piece.
00:46:42.610 --> 00:46:47.450
Each piece looks like that,
and the integrals are doable.
00:46:47.450 --> 00:46:54.240
OK, so while I'm going here,
I want to do quadratics.
00:46:54.240 --> 00:46:55.880
You'll get the idea right away.
00:46:55.880 --> 00:46:59.040
So, same triangle, now I'm
going to have quadratics.
00:46:59.040 --> 00:47:01.810
So I'm now going to have,
so this won't be the arrow,
00:47:01.810 --> 00:47:04.000
this arrow will now go this way.
00:47:04.000 --> 00:47:10.530
I'm going to have d x
squared, exy, and f y squared.
00:47:10.530 --> 00:47:12.160
So now how many
coefficients have
00:47:12.160 --> 00:47:15.580
I got to determine a quadratic?
00:47:15.580 --> 00:47:18.240
Six, right? a, b, c, d, e, f.
00:47:18.240 --> 00:47:20.680
How many nodes do I need?
00:47:20.680 --> 00:47:21.700
Six.
00:47:21.700 --> 00:47:22.650
Where are they?
00:47:22.650 --> 00:47:29.710
Well, the natural positions are
those guys in the mid-points.
00:47:29.710 --> 00:47:33.310
So now, those are all nodes now.
00:47:33.310 --> 00:47:38.010
Some nodes are at
vertices of triangles,
00:47:38.010 --> 00:47:39.790
some nodes are at midpoints.
00:47:39.790 --> 00:47:42.320
But remember, we've
got other triangles
00:47:42.320 --> 00:47:45.180
hooking on here,
many other triangles,
00:47:45.180 --> 00:47:48.170
all with their own six nodes.
00:47:48.170 --> 00:47:51.310
Well, not their own,
because they share.
00:47:51.310 --> 00:47:53.730
That's a big point.
00:47:53.730 --> 00:47:59.970
So there's a grid of triangles,
with nodes for quadratic.
00:47:59.970 --> 00:48:02.750
And we've got one, two, three,
four, five, six, seven, eight,
00:48:02.750 --> 00:48:09.410
nine, ten, 11, 12, 13,
14, 15, 16 nodes, I think.
00:48:09.410 --> 00:48:13.370
And within each triangle,
this is what we've got.
00:48:13.370 --> 00:48:17.930
So there's a six by six
matrix for each triangle.
00:48:17.930 --> 00:48:20.440
A six by six matrix
which will connect
00:48:20.440 --> 00:48:29.260
the values U_1, U_2, U_3, U_4,
U_5, U_6 for this triangle.
00:48:29.260 --> 00:48:33.510
Connect those six heights
with these six numbers.
00:48:33.510 --> 00:48:42.100
And what will the roof look
like within that triangle?
00:48:42.100 --> 00:48:44.000
Well, sort of curved.
00:48:44.000 --> 00:48:45.200
A parabola, right?
00:48:45.200 --> 00:48:49.290
A parabola somehow in 2-D,
it'll look like this, yeah.
00:48:49.290 --> 00:48:49.790
Yeah.
00:48:49.790 --> 00:48:52.280
And here's the key question.
00:48:52.280 --> 00:48:59.350
Will that roof, that curvy
roof, fit the one over there?
00:48:59.350 --> 00:49:01.830
Because if it didn't
fit, we're in trouble.
00:49:01.830 --> 00:49:03.890
This derivative would
have a delta function,
00:49:03.890 --> 00:49:07.640
and we've got delta functions,
and integrals squaring them
00:49:07.640 --> 00:49:09.320
would give infinite.
00:49:09.320 --> 00:49:10.930
So here's the question.
00:49:10.930 --> 00:49:16.830
Why does this roof, using these
six points, fit onto the roof
00:49:16.830 --> 00:49:23.900
that uses U_7, U_8, U_9,
and U_3, U_4 and U_5?
00:49:23.900 --> 00:49:26.230
Why do those two
roofs fit together?
00:49:26.230 --> 00:49:30.990
This is the fun of
piecewise polynomials?
00:49:30.990 --> 00:49:33.200
Of course, the
slope will change.
00:49:33.200 --> 00:49:35.480
But the roof won't have a gap.
00:49:35.480 --> 00:49:37.050
Water won't go through it.
00:49:37.050 --> 00:49:38.560
Why's that?
00:49:38.560 --> 00:49:41.110
Do you see why?
00:49:41.110 --> 00:49:46.190
Because what do they share, what
do those two curvy roofs share?
00:49:46.190 --> 00:49:48.060
They share a side.
00:49:48.060 --> 00:49:53.680
They share the same
values along the side.
00:49:53.680 --> 00:49:56.010
And are those three
values that are
00:49:56.010 --> 00:49:59.660
shared along the side
sufficient to make
00:49:59.660 --> 00:50:03.040
it match all along the side?
00:50:03.040 --> 00:50:03.790
Yes.
00:50:03.790 --> 00:50:05.340
That's the important question.
00:50:05.340 --> 00:50:08.550
Finite elements lives or
dies on that question.
00:50:08.550 --> 00:50:14.350
The answer is yes, because
along that side, if I just
00:50:14.350 --> 00:50:18.130
focus on that side,
where these three
00:50:18.130 --> 00:50:23.150
values are shared on both sides,
by the triangle on both sides.
00:50:23.150 --> 00:50:28.250
Along that edge, what kind
of a function have I got?
00:50:28.250 --> 00:50:31.110
It's second degree.
00:50:31.110 --> 00:50:34.660
This is whatever, when I
restrict this to just run along
00:50:34.660 --> 00:50:37.030
a line, it's a parabola.
00:50:37.030 --> 00:50:40.060
And the parabola is determined
by those three values.
00:50:40.060 --> 00:50:41.940
So having it right
at three points
00:50:41.940 --> 00:50:44.170
means I have it
right the whole way.
00:50:44.170 --> 00:50:44.670
Yeah.
00:50:44.670 --> 00:50:48.850
So there you see what quadratic
elements would look like,
00:50:48.850 --> 00:50:52.500
and you could extend
the code in the book
00:50:52.500 --> 00:50:57.320
and on the CSE site to work
for quadratic elements.
00:50:57.320 --> 00:51:01.610
And you want to just guess what
cubic elements could look like?
00:51:01.610 --> 00:51:03.380
I'm sorry, we've run
five minutes over,
00:51:03.380 --> 00:51:06.340
but maybe finite
elements is worth it.
00:51:06.340 --> 00:51:13.900
So if I had cubic elements,
any idea how many?
00:51:13.900 --> 00:51:16.640
So I'm now going up to,
I'm adding g x cubed,
00:51:16.640 --> 00:51:25.070
h, i, j, any idea how many
coefficients I now have?
00:51:25.070 --> 00:51:28.630
Four new ones plus
these six is ten.
00:51:28.630 --> 00:51:29.920
I need ten nodes.
00:51:29.920 --> 00:51:33.310
Where I am I going to put
ten nodes in this triangle?
00:51:33.310 --> 00:51:36.430
I want to put them, I'd like
to have some on the edges.
00:51:36.430 --> 00:51:39.930
Because the edges help me make
triangles match each other.
00:51:39.930 --> 00:51:42.140
They'll just be
like bowling balls.
00:51:42.140 --> 00:51:52.400
So here's six, oops, that
wouldn't be believable.
00:51:52.400 --> 00:51:54.300
Is that right?
00:51:54.300 --> 00:51:55.790
Four, three, two, and one.
00:51:55.790 --> 00:51:56.450
Yeah.
00:51:56.450 --> 00:51:57.620
Yeah.
00:51:57.620 --> 00:51:58.120
OK.
00:51:58.120 --> 00:52:03.330
So, now I've got a
bubble node inside
00:52:03.330 --> 00:52:10.730
and I've got four nodes of
vertices and two points,
00:52:10.730 --> 00:52:14.420
at two 1/3 points,
and that will then
00:52:14.420 --> 00:52:16.260
match the triangle next to it.
00:52:16.260 --> 00:52:19.920
Because four points
determine a cubic.
00:52:19.920 --> 00:52:22.860
There you go, I
hope you have fun,
00:52:22.860 --> 00:52:24.680
I hope you have a great holiday.
00:52:24.680 --> 00:52:27.140
I'll see you
Wednesday for Fourier
00:52:27.140 --> 00:52:32.720
and always open for
questions on the MATLAB.