1
00:00:01,140 --> 00:00:01,740
So.

2
00:00:02,990 --> 00:00:10,760
Now what we will do is to we are going to solve burgers equations by basically updating the solution

3
00:00:10,760 --> 00:00:11,930
every time step.

4
00:00:12,170 --> 00:00:18,020
So to do so, let's start by well, write the code basically.

5
00:00:18,020 --> 00:00:22,190
And it's for N in range.

6
00:00:24,100 --> 00:00:25,480
In range two.

7
00:00:26,390 --> 00:00:29,150
In this is we're talking about the time.

8
00:00:29,390 --> 00:00:32,510
So the first thing is we need to loop through the time.

9
00:00:32,510 --> 00:00:37,280
This is again, it's explicit means every every time step we need to update the solution every time

10
00:00:37,280 --> 00:00:41,170
step and we march like this until the end of will.

11
00:00:41,180 --> 00:00:46,790
The numerical time the end of time is not good way to say it, but at the end of numerical time, UN

12
00:00:46,790 --> 00:00:49,340
equals u dot copy.

13
00:00:51,480 --> 00:00:55,440
A copy and v.

14
00:00:55,440 --> 00:00:56,010
N.

15
00:00:56,100 --> 00:00:56,490
V.

16
00:00:56,490 --> 00:01:01,050
N equals equals v dot copy.

17
00:01:01,810 --> 00:01:02,650
This way.

18
00:01:02,950 --> 00:01:08,940
So the first thing is what we did is we need to keep the last time step.

19
00:01:09,150 --> 00:01:17,200
Now, of course, the last time step we have is only U, which is the current and v, n and u n for

20
00:01:17,200 --> 00:01:17,890
and v n.

21
00:01:17,920 --> 00:01:23,080
This is what the basically the initial condition in the first run.

22
00:01:23,080 --> 00:01:28,510
And as we go we keep adding the last time step here.

23
00:01:28,510 --> 00:01:33,160
So after that what we need to do for I in range.

24
00:01:33,880 --> 00:01:39,220
Between one and n x minus one.

25
00:01:40,650 --> 00:01:48,330
And what we are basically doing here is we need to go through the whole mesh.

26
00:01:48,930 --> 00:01:56,820
And in order to go to in the the whole mesh, we need to go from I and scan all the X.

27
00:01:57,270 --> 00:02:02,620
So basically at X and we go from all the points in the in the Y.

28
00:02:02,640 --> 00:02:05,580
So this is in Y minus one.

29
00:02:06,580 --> 00:02:08,710
And we start from.

30
00:02:09,400 --> 00:02:12,070
Well, start from not zero from one.

31
00:02:12,190 --> 00:02:13,960
And why we need to start from one.

32
00:02:13,960 --> 00:02:17,770
Because if we start from zero, then we don't have initial condition.

33
00:02:18,250 --> 00:02:21,430
We see start from one because we already know zero.

34
00:02:21,460 --> 00:02:23,110
Zero is our initial condition.

35
00:02:23,320 --> 00:02:26,590
And this is why here we put zero.

36
00:02:29,500 --> 00:02:30,870
The what is the solution?

37
00:02:30,880 --> 00:02:38,950
This one we put zero because we need to start from the from one because we don't know the the solution

38
00:02:38,950 --> 00:02:39,490
at one.

39
00:02:40,710 --> 00:02:41,550
Is sorry.

40
00:02:42,570 --> 00:02:48,240
This is I'm talking about here is basically one, two and three.

41
00:02:48,450 --> 00:02:52,500
But here is like basically, it's.

42
00:02:52,800 --> 00:02:56,160
Sorry, I just this is not correct.

43
00:02:56,160 --> 00:02:58,170
It's just we don't start.

44
00:02:58,170 --> 00:03:02,130
Also, we should not start from from zero.

45
00:03:02,610 --> 00:03:03,690
It's different reason.

46
00:03:03,690 --> 00:03:06,090
But this is the for the time.

47
00:03:06,090 --> 00:03:16,710
But for this one, we should not start from zero because we we we have a boundary condition.

48
00:03:16,710 --> 00:03:18,210
The zero is boundary condition.

49
00:03:18,210 --> 00:03:24,810
So we don't start from zero because simply we cannot have any boundary condition at that point.

50
00:03:25,050 --> 00:03:32,010
And sometimes we need to start even from two or more because we are using a the central difference scheme.

51
00:03:32,010 --> 00:03:38,370
We have only one point, but if we use a scheme that requires more points around the the point we need

52
00:03:38,370 --> 00:03:40,420
to calculate, we have to be careful.

53
00:03:40,420 --> 00:03:46,750
So here the reason we start from one is simply because the boundary condition is exist at zero.

54
00:03:46,960 --> 00:03:51,440
And, and if we start from zero, the boundary condition, there is no boundary behind it.

55
00:03:51,460 --> 00:03:55,000
It's just there is nothing like the whole mesh is outside the mesh.

56
00:03:55,000 --> 00:04:02,140
But but for the time, of course, we have to start from one because zero is a initial condition.

57
00:04:03,790 --> 00:04:07,720
So here is the update.

58
00:04:07,720 --> 00:04:16,870
And here I will basically copy paste the discretized form of the equations and why I'm copying pasting

59
00:04:16,870 --> 00:04:18,190
because it's there are a lot.

60
00:04:18,220 --> 00:04:24,040
It's a central difference scheme and there are a lot of basically.

61
00:04:25,960 --> 00:04:26,190
The.

62
00:04:32,730 --> 00:04:42,360
There are a lot of variables that I'm sure if I type them, I will have mistakes and this class will

63
00:04:42,360 --> 00:04:43,440
be very long.

64
00:04:43,440 --> 00:04:49,860
So it is just these are only, um, basically.

65
00:04:51,620 --> 00:04:54,780
Discretized form of the two equations.

66
00:04:54,800 --> 00:05:02,210
It's a central difference scheme applied for for both diffusion and convection term that is will show

67
00:05:02,210 --> 00:05:02,810
on this.

68
00:05:03,770 --> 00:05:12,490
So this term, this one basically DVD, DVD, Dee Dee Dee Dee, why all of this?

69
00:05:12,500 --> 00:05:16,490
This is we call it convection, convection, convection term.

70
00:05:16,490 --> 00:05:18,350
And this is we call diffusion term.

71
00:05:18,350 --> 00:05:24,410
So they both use central difference and this is the time update So time.

72
00:05:24,410 --> 00:05:24,800
Yeah.

73
00:05:24,950 --> 00:05:29,300
Temporal difference or the temporal factor.

74
00:05:29,300 --> 00:05:36,260
So this is the the the all of this is just the discretized form of the equation.

75
00:05:36,260 --> 00:05:40,550
We already discretized an equation in the previous class.

76
00:05:40,550 --> 00:05:45,050
So if you want to know how to discretize the equations, please.

77
00:05:45,930 --> 00:05:48,180
Go back and see how we did.

78
00:05:48,450 --> 00:05:50,390
Smaller equation.

79
00:05:50,400 --> 00:05:55,620
So now what we do is if we need to update our.

80
00:05:57,610 --> 00:05:59,680
A like we need to save our solution.

81
00:05:59,680 --> 00:06:03,880
So in and I and J.

82
00:06:04,970 --> 00:06:05,960
Equals.

83
00:06:06,860 --> 00:06:11,690
This one, the current one, and we do the same and we take it.

84
00:06:11,960 --> 00:06:16,970
Here is the and this is here is the same thing.

85
00:06:17,900 --> 00:06:19,110
And see.

86
00:06:19,130 --> 00:06:20,690
Yeah, it's just.

87
00:06:20,690 --> 00:06:21,860
Yeah, it's just something.

88
00:06:22,880 --> 00:06:24,980
Is it finished?

89
00:06:25,220 --> 00:06:29,600
Not no, it's not finished because we didn't.

90
00:06:29,780 --> 00:06:31,700
I said before, it's the boundary condition.

91
00:06:31,700 --> 00:06:34,190
We have to update the boundary condition.

92
00:06:34,280 --> 00:06:37,430
We should not allow any of this.

93
00:06:37,820 --> 00:06:40,670
What, like to, to update the boundary condition.

94
00:06:40,670 --> 00:06:47,720
So to do that, every time step, we have to keep the boundary condition the same or if you like, maybe

95
00:06:47,720 --> 00:06:53,720
later, if you want to change the code to have a changing boundary, you can also do it from here,

96
00:06:53,720 --> 00:06:55,460
from this place.

97
00:06:55,580 --> 00:06:59,900
So here you at zero.

98
00:07:02,190 --> 00:07:09,780
At the beginning and you at minus one means at the last point is going to be one.

99
00:07:11,220 --> 00:07:12,470
I write it this way.

100
00:07:13,200 --> 00:07:14,100
And.

101
00:07:17,870 --> 00:07:20,840
The same thing for in the Y direction.

102
00:07:20,840 --> 00:07:28,250
So this is the in the all this is you put zero and all the X line.

103
00:07:29,060 --> 00:07:35,330
So u is zero and you go for all the X lines and you put them one one, one one and this is here the

104
00:07:35,330 --> 00:07:40,280
same thing, but you just opens like reverse the thing.

105
00:07:41,230 --> 00:07:42,160
And.

106
00:07:43,000 --> 00:07:44,680
Take the same thing here.

107
00:07:45,470 --> 00:07:47,930
And this one minus one.

108
00:07:48,830 --> 00:07:51,080
And basically this is everything.

109
00:07:53,650 --> 00:07:56,890
This is, of course, the you we need to repeat.

110
00:07:57,500 --> 00:07:59,120
The thing's the same.

111
00:07:59,120 --> 00:08:02,180
It's just same thing with v v v.

112
00:08:02,450 --> 00:08:03,590
And.

113
00:08:04,630 --> 00:08:05,980
It seems.

114
00:08:06,400 --> 00:08:08,920
Seems looks good.

115
00:08:10,670 --> 00:08:11,030
Zero.

116
00:08:11,030 --> 00:08:11,540
Minus one.

117
00:08:11,570 --> 00:08:11,810
Zero.

118
00:08:11,810 --> 00:08:12,640
Minus one zero.

119
00:08:12,650 --> 00:08:13,370
Minus one zero.

120
00:08:13,370 --> 00:08:13,850
Minus one.

121
00:08:14,210 --> 00:08:14,780
Okay.

122
00:08:14,900 --> 00:08:16,670
So basically, this is.

123
00:08:16,760 --> 00:08:17,780
This is it.

124
00:08:18,670 --> 00:08:20,620
And we just.

125
00:08:21,780 --> 00:08:31,200
Need to compute this and hopefully it will converge again because this is a little bit basic course

126
00:08:31,200 --> 00:08:41,220
for all delivers converge mean is we get a final answer diverge means the numerical like the computation

127
00:08:41,220 --> 00:08:47,670
will will never reach to a either it will give us error or the values become very high like.

128
00:08:48,950 --> 00:08:53,030
Very high, like ten to the power, 110 to the power more.

129
00:08:53,150 --> 00:08:54,740
It's a numerical number.

130
00:08:54,740 --> 00:08:57,350
So it will it can go very far, very high.

131
00:08:57,350 --> 00:09:01,310
And sometimes it's just never finish or just keep on going.

132
00:09:01,310 --> 00:09:04,250
But nothing has happening for some reason, of course.

133
00:09:04,250 --> 00:09:12,050
So so this is now is calculated and the next class, what we are going to do is we are going to check

134
00:09:12,050 --> 00:09:12,740
our solution.

135
00:09:12,740 --> 00:09:17,420
And of course, if there are a problem, we have to know how to solve it.
