1
00:00:01,030 --> 00:00:09,160
So now we need to evaluate our model as we have, of course, now the model if we want to well, see

2
00:00:09,160 --> 00:00:14,770
how the model is just this is a kind of we already wrote it here.

3
00:00:14,770 --> 00:00:16,300
So model.

4
00:00:17,240 --> 00:00:18,590
Evaluation.

5
00:00:26,000 --> 00:00:29,030
We can see the model we have is a sequential model.

6
00:00:29,060 --> 00:00:32,900
Of course, like two input and one output feature.

7
00:00:32,900 --> 00:00:38,810
And this is the all of the well, the sizes of the model.

8
00:00:38,960 --> 00:00:39,770
So.

9
00:00:40,380 --> 00:00:43,320
The network we have is supposed to work like this.

10
00:00:43,350 --> 00:00:47,880
We give it X and we give it time and it will give us u.

11
00:00:47,880 --> 00:00:49,980
So let's do it first.

12
00:00:50,010 --> 00:00:58,770
We make another computational domain and this time we make it smaller like H equals 0.01.

13
00:00:59,550 --> 00:01:03,720
In the past it was 0.1, I think.

14
00:01:04,290 --> 00:01:04,710
Yeah.

15
00:01:04,740 --> 00:01:05,370
0.1.

16
00:01:05,370 --> 00:01:06,930
So we don't really care.

17
00:01:07,050 --> 00:01:10,470
Or the of course our our.

18
00:01:11,460 --> 00:01:12,240
Why is that?

19
00:01:12,570 --> 00:01:12,870
Yeah.

20
00:01:16,130 --> 00:01:23,870
Our training model is is only trained on a very specific boundary and initial condition.

21
00:01:23,870 --> 00:01:25,040
And this is a problem.

22
00:01:25,040 --> 00:01:32,540
But in general, if you want a model that works in a wide range of boundary conditions and initial conditions,

23
00:01:32,540 --> 00:01:38,150
you have to train it on much more boundary conditions and initial conditions.

24
00:01:38,150 --> 00:01:46,070
However, let's change a little bit to just to make it more exciting, just to change it, the computational

25
00:01:46,070 --> 00:01:46,640
domain.

26
00:01:46,850 --> 00:01:51,920
But of course, in your case you have to consider the initial condition, boundary condition to get

27
00:01:51,920 --> 00:01:56,330
a very quick results from this model in the training part of it.

28
00:01:56,720 --> 00:02:04,580
So here or like a good result like now it will we will only change one thing which is the the grid.

29
00:02:05,710 --> 00:02:15,550
But in Pence, the general dream or like motivation of Pence is we need a model that is capable to give

30
00:02:15,550 --> 00:02:17,980
us approximation on a wide range of.

31
00:02:19,870 --> 00:02:21,640
Initial conditions and boundary conditions.

32
00:02:21,700 --> 00:02:24,670
So this is actually why we do it.

33
00:02:24,670 --> 00:02:27,670
But other than, you know, the fun of it.

34
00:02:28,610 --> 00:02:34,010
Arrange is we just keep it the same boundary condition to make it work well.

35
00:02:34,550 --> 00:02:39,170
You can of course change the boundary condition and see how your model behaves.

36
00:02:39,770 --> 00:02:42,290
T is from 0 to 1.

37
00:02:42,290 --> 00:02:43,370
For me, it just.

38
00:02:43,370 --> 00:02:44,870
I will just put it as is.

39
00:02:44,870 --> 00:02:47,930
And yeah, this is the the.

40
00:02:48,990 --> 00:02:53,190
I'm like, I'm not going to train it on different boundary conditions and initial conditions and so

41
00:02:53,190 --> 00:02:53,310
on.

42
00:02:53,310 --> 00:02:59,010
But it it if you to get a good answers, we always have to consider this kind of thing.

43
00:02:59,190 --> 00:03:03,330
So here torch dot um stack.

44
00:03:04,640 --> 00:03:08,450
And torch dot mesh the same thing.

45
00:03:08,660 --> 00:03:11,360
Grid X and T.

46
00:03:12,690 --> 00:03:14,730
And reshape.

47
00:03:15,510 --> 00:03:17,910
Two minus one.

48
00:03:18,670 --> 00:03:20,020
Transpose it.

49
00:03:20,860 --> 00:03:23,200
And x equals x.

50
00:03:23,970 --> 00:03:24,750
To.

51
00:03:26,180 --> 00:03:28,430
Net dot x dot.

52
00:03:31,870 --> 00:03:32,840
Device.

53
00:03:32,850 --> 00:03:34,030
Device.

54
00:03:34,130 --> 00:03:35,410
Device.

55
00:03:37,580 --> 00:03:42,530
And of course the X will be this way.

56
00:03:42,530 --> 00:03:45,320
It's already put on cuda.

57
00:03:46,740 --> 00:03:50,640
And if you want to see the shape.

58
00:03:52,010 --> 00:04:01,280
It's 2000 by two, 2000 points by, of course, X, just two, 2000 different rows, and then two is

59
00:04:01,280 --> 00:04:04,520
X and T.

60
00:04:04,700 --> 00:04:10,100
So so basically now what we need is to predict it.

61
00:04:11,150 --> 00:04:11,450
And.

62
00:04:12,820 --> 00:04:13,480
A model.

63
00:04:15,020 --> 00:04:18,190
Is equals to net dot.

64
00:04:19,210 --> 00:04:20,020
Model.

65
00:04:23,280 --> 00:04:24,270
And.

66
00:04:25,530 --> 00:04:26,460
Model.

67
00:04:28,200 --> 00:04:28,950
Noel.

68
00:04:30,140 --> 00:04:31,940
Evaluation.

69
00:04:33,370 --> 00:04:34,720
And with.

70
00:04:35,640 --> 00:04:36,660
Torch?

71
00:04:36,690 --> 00:04:37,710
No.

72
00:04:39,060 --> 00:04:39,780
Grad.

73
00:04:42,190 --> 00:04:44,050
Why predict?

74
00:04:46,120 --> 00:04:50,230
Predict equals model.

75
00:04:51,120 --> 00:04:54,180
X dot reshape.

76
00:04:57,030 --> 00:05:00,480
If or just we can put it like this.

77
00:05:00,480 --> 00:05:01,170
Why?

78
00:05:02,670 --> 00:05:04,740
The dict equals.

79
00:05:09,850 --> 00:05:12,040
Dot reshape.

80
00:05:12,990 --> 00:05:17,200
The shape length of X.

81
00:05:18,580 --> 00:05:20,080
And length of T.

82
00:05:22,510 --> 00:05:25,900
So we will get a kind of beautiful.

83
00:05:28,340 --> 00:05:32,840
A matrix that we can plot numpy.

84
00:05:34,140 --> 00:05:34,890
Shift into.

85
00:05:36,280 --> 00:05:41,800
And then why predict we can see the shape of it?

86
00:05:42,410 --> 00:05:46,700
And then we can see the actual values of this.

87
00:05:46,700 --> 00:05:55,280
And let's now of course, contour plot it so it's in s dot set.

88
00:05:58,410 --> 00:06:00,180
This style.

89
00:06:02,670 --> 00:06:03,630
No white.

90
00:06:04,650 --> 00:06:06,210
P l t dot.

91
00:06:07,530 --> 00:06:08,190
Bigger.

92
00:06:09,980 --> 00:06:10,520
Big.

93
00:06:11,440 --> 00:06:13,270
Size equals.

94
00:06:14,200 --> 00:06:16,030
Five and three.

95
00:06:17,570 --> 00:06:18,230
DPI.

96
00:06:22,630 --> 00:06:23,920
And just the.

97
00:06:25,270 --> 00:06:29,320
The solution is in s dot heat.

98
00:06:30,300 --> 00:06:30,980
Map.

99
00:06:31,200 --> 00:06:33,030
Y predict.

100
00:06:33,830 --> 00:06:38,810
C map equals jet.

101
00:06:39,080 --> 00:06:39,830
Oh, sorry.

102
00:06:44,990 --> 00:06:46,250
Git shift.

103
00:06:46,250 --> 00:06:46,640
Enter.

104
00:06:48,380 --> 00:06:50,540
And we look at the drawing.

105
00:06:52,610 --> 00:07:03,080
So basically we start by having a sine wave and it will converge to something that looks like a step

106
00:07:03,080 --> 00:07:05,480
and actually we can look at it.

107
00:07:05,570 --> 00:07:07,010
PLT dot.

108
00:07:08,720 --> 00:07:14,420
We will print this part and this part so the left side and the right side.

109
00:07:14,990 --> 00:07:18,800
And of course, you can in between like plot.

110
00:07:19,680 --> 00:07:20,460
Why?

111
00:07:21,660 --> 00:07:22,560
Predict.

112
00:07:23,610 --> 00:07:26,740
All of it and zero shift enter.

113
00:07:28,470 --> 00:07:38,100
So start will be a wave, which is this swipe predict we're printing all the values at time equals zero.

114
00:07:38,190 --> 00:07:40,770
We can see it looks like this.

115
00:07:41,800 --> 00:07:45,730
And at the end of it, just let's take it.

116
00:07:46,870 --> 00:07:49,210
Uh, like, minus one.

117
00:07:50,080 --> 00:08:00,580
We can see the step function if you want in between like you have to put like I think this is 20,000.

118
00:08:01,000 --> 00:08:04,690
Uh, the shape is 100 steps.

119
00:08:04,690 --> 00:08:09,910
So like, we can consider like 50.

120
00:08:10,700 --> 00:08:12,770
It gives us something in between.

121
00:08:13,040 --> 00:08:14,360
We see.

122
00:08:15,240 --> 00:08:15,990
At ten.

123
00:08:17,030 --> 00:08:20,930
It's still it's it didn't converge into this step.

124
00:08:21,730 --> 00:08:22,750
A 40.

125
00:08:23,680 --> 00:08:24,730
It's more.

126
00:08:27,750 --> 00:08:28,260
100.

127
00:08:28,260 --> 00:08:28,710
We cannot.

128
00:08:28,740 --> 00:08:29,280
99.

129
00:08:29,280 --> 00:08:29,670
We can.

130
00:08:30,600 --> 00:08:35,950
So this is the last one and maybe just put it 40.

131
00:08:37,060 --> 00:08:41,020
But for a little bit too already kind of converged.

132
00:08:41,170 --> 00:08:41,710
30.

133
00:08:42,670 --> 00:08:44,440
Yeah, it's a little bit.

134
00:08:44,470 --> 00:08:49,450
We can see the kind of wavy shape still and here is more sharp.

135
00:08:50,380 --> 00:08:56,290
So this is how to solve burgers equation using PyTorch.
