1
00:00:00,360 --> 00:00:05,760
So the good results of the last lecture was that we have now at the back to potential and we know that

2
00:00:05,760 --> 00:00:11,580
it's correct and we have the vector potential in terms of an array, we have an array capital eight,

3
00:00:12,000 --> 00:00:15,630
which includes points in space that you show that you see here.

4
00:00:15,630 --> 00:00:19,290
And then we have the corresponding value of the vector potential.

5
00:00:19,290 --> 00:00:24,780
And we've also seen that only to Z component of the vector potential is different from zero.

6
00:00:25,140 --> 00:00:30,690
So it only has this a z value that we plot here and what we will consider in the following.

7
00:00:30,990 --> 00:00:36,810
So according to the Maxwell equation, we can calculate the magnetic fields based on the kernel of the

8
00:00:36,810 --> 00:00:41,070
vector potential, and we have our vector potential readily available.

9
00:00:41,460 --> 00:00:46,020
And if you remember in the previous section, we have also learned about the kernel.

10
00:00:46,530 --> 00:00:51,960
So this was the section about the derivatives and we have introduced another operator and we have even

11
00:00:51,960 --> 00:00:55,080
programmed to call for a continuous function.

12
00:00:55,770 --> 00:01:02,640
So now here, it's a tiny bit different because we have an array and so we must reprogram this kernel,

13
00:01:02,640 --> 00:01:04,769
but it's not really that much different.

14
00:01:05,099 --> 00:01:10,200
And if you remember, I told you back in this lecture that we will have an exercise later on.

15
00:01:10,680 --> 00:01:11,540
And now is the time.

16
00:01:11,550 --> 00:01:15,630
Now you will calculate really a kernel which has a physical meaning.

17
00:01:16,350 --> 00:01:18,570
And so you know how to calculate the kernel.

18
00:01:18,870 --> 00:01:26,580
And the only thing that we can use now that we have to consider is that we have considered here basically

19
00:01:26,590 --> 00:01:33,960
an infinitely long wire, which therefore has the same vector potential in all the layers.

20
00:01:34,620 --> 00:01:41,400
This is a bit tricky here because in our example, when the wire is not infinitely long, it's not actually

21
00:01:41,400 --> 00:01:45,150
constant with Z, but it's only very tiny changes here.

22
00:01:45,690 --> 00:01:50,850
So we will consider that these are zero here because we have only considered a single layer, so we

23
00:01:50,850 --> 00:01:57,000
wouldn't be able to calculate these derivatives with our current version of the code and principle.

24
00:01:57,030 --> 00:02:02,010
It's possible, but then you would have to calculate a for different layers.

25
00:02:02,250 --> 00:02:05,520
And then in the end, you will see that it's just very, very close to zero.

26
00:02:06,240 --> 00:02:10,880
So this means using this approximation, these two terms here will be zero.

27
00:02:10,889 --> 00:02:13,410
And so this is what we have to calculate.

28
00:02:14,160 --> 00:02:24,720
And first, we have to create an empty list like we did before for the vector potential for the magnetic

29
00:02:24,720 --> 00:02:25,050
field.

30
00:02:26,310 --> 00:02:33,390
And this will be B is equal to and now I will, of course, save a bit of typing and scroll up to this

31
00:02:33,390 --> 00:02:39,330
point where we have to vector potential and it will be exactly the same thing here.

32
00:02:39,660 --> 00:02:39,960
Oops.

33
00:02:40,470 --> 00:02:41,010
Like this?

34
00:02:42,510 --> 00:02:48,120
OK, so now we have the empty magnetic field and now we could, of course, loop again over all the

35
00:02:48,120 --> 00:02:48,780
positions.

36
00:02:48,780 --> 00:02:52,860
But actually here it's pretty, pretty easy to just work with the arrays.

37
00:02:53,670 --> 00:02:58,860
So let us get started and let us first program the X component, which would be something like this

38
00:02:58,860 --> 00:03:05,520
X component, all the values in X, all the values and Y and of course, only two single value in Z.

39
00:03:06,450 --> 00:03:14,310
And now if you remember how we calculate a derivative, there was always a good compromise, I would

40
00:03:14,310 --> 00:03:19,920
say, when we use the central difference as methods, because if you remember, this had a better order

41
00:03:19,920 --> 00:03:23,220
of the error than the forward or backward differences.

42
00:03:23,220 --> 00:03:28,860
And also it was quite easy to program because it only contains a single term.

43
00:03:29,610 --> 00:03:34,950
In this case, we go one step in the right direction, forward and backward, and we subtract two terms

44
00:03:34,950 --> 00:03:38,580
and divide by the difference in space.

45
00:03:39,630 --> 00:03:46,110
So this means we run into a bit of a problem here at the edge of our list, which is why I will just

46
00:03:46,110 --> 00:03:51,150
disregard the edge and I will just start from the second value, which is the index one.

47
00:03:51,150 --> 00:03:54,600
And I go to the second last because this one is excluded.

48
00:03:54,600 --> 00:03:58,500
It will be the second last and the same for the wider region.

49
00:03:59,550 --> 00:04:04,410
So we could, of course, also program an equation for the last and the first values.

50
00:04:04,410 --> 00:04:08,640
But then we would have to use them forward and backwards differences methods.

51
00:04:09,180 --> 00:04:15,570
But I will just disregard these values and we don't care here because as you will see, the magnetic

52
00:04:15,570 --> 00:04:18,269
fields will be very close to zero at these values anyway.

53
00:04:19,620 --> 00:04:21,630
So now comes the central differences methods.

54
00:04:21,990 --> 00:04:29,490
So we need to use here A and the Z components, and this will be a two and then we will use here all

55
00:04:29,490 --> 00:04:37,650
the so basically the same indices along the X direction and for the Y direction we go one step forward.

56
00:04:38,220 --> 00:04:44,520
So basically, we take this one, but we go one step forward, which means like this, we start from

57
00:04:44,520 --> 00:04:46,560
the third value, which is in X two.

58
00:04:47,010 --> 00:04:57,540
And yes, and then we go to the very last one, which is programmed like this and also take the only

59
00:04:57,870 --> 00:04:59,040
value on the Z direction.

60
00:05:00,030 --> 00:05:06,090
Now we must subtract from here the same thing where we go into the negative direction, which will be

61
00:05:06,570 --> 00:05:08,580
programmed like this.

62
00:05:09,060 --> 00:05:15,240
We go start from the first and go to the third last year because minus two means here, it's excluded.

63
00:05:15,480 --> 00:05:17,490
It's not included in the list anymore.

64
00:05:18,690 --> 00:05:24,330
And then we just have to divide by the total difference, which will be on the difference and risk base,

65
00:05:24,330 --> 00:05:25,560
which will be two times.

66
00:05:27,210 --> 00:05:31,520
OK, so this is already this term and the other terms, of course, very similar.

67
00:05:31,530 --> 00:05:33,930
So I will just copy and then fixed the indices.

68
00:05:34,290 --> 00:05:40,320
So here it will be now the X sorry, not the X, but the Y coordinates so index one.

69
00:05:40,770 --> 00:05:47,640
And we have to consider here again the Z component, but the derivative along the X direction and a

70
00:05:47,640 --> 00:05:48,360
minus sign.

71
00:05:49,050 --> 00:05:56,130
So first of all, add here the minus sign and then I basically just have to swap these indices here

72
00:05:58,950 --> 00:06:00,430
and also here.

73
00:06:02,880 --> 00:06:04,380
OK, that's already it.

74
00:06:04,860 --> 00:06:07,840
And now we must use the Z component.

75
00:06:07,860 --> 00:06:12,240
This one is a bit more to write because they are now two terms.

76
00:06:12,690 --> 00:06:22,650
So the Z component considers the X derivative of a Y, so we can basically take this one, but we must

77
00:06:22,650 --> 00:06:23,740
use a Y.

78
00:06:23,760 --> 00:06:30,780
So we change to two, two to one here in the first index, and then we must subtract the Y derivative

79
00:06:30,780 --> 00:06:39,270
of X so we can take this one and change the index to zero for eight X.

80
00:06:40,290 --> 00:06:41,460
And that's already it.

81
00:06:41,610 --> 00:06:46,060
Now we have calculated all the B values except for the outermost values of our.

82
00:06:46,230 --> 00:06:50,100
But as I told you, we simply do not care about this.

83
00:06:50,580 --> 00:06:54,690
We could, as I told you, just use central differences, but we do not care here.

84
00:06:55,740 --> 00:07:00,690
Now I want to pull up the individual coordinates and so we can just copy this code because I want to

85
00:07:01,050 --> 00:07:04,110
use again a control plot.

86
00:07:05,130 --> 00:07:12,600
So I use here now instead be and this will be the magnetic fields and magnetic fields.

87
00:07:13,290 --> 00:07:20,430
And the first one will be the X, which has the index zero, of course, and we can just plot it.

88
00:07:21,270 --> 00:07:22,980
And though I want to plot also the others.

89
00:07:23,430 --> 00:07:28,170
So now you could make subplots right next to each other, which which would look a bit nicer.

90
00:07:28,170 --> 00:07:32,460
But I want to do it really quickly and save a bit of time.

91
00:07:32,460 --> 00:07:39,390
So I just try to appeal to shows so know I can use several plot commands in this cell and I just copy

92
00:07:39,400 --> 00:07:40,140
this twice.

93
00:07:40,800 --> 00:07:43,950
Use here do Y components or index one.

94
00:07:44,160 --> 00:07:47,630
B Y and index to be easy.

95
00:07:49,050 --> 00:07:57,330
And so now you see we have here magnetic field in the X direction, which is basically very small or

96
00:07:57,330 --> 00:07:59,970
close to zero everywhere, except close to the middle.

97
00:08:00,510 --> 00:08:02,910
And same for B y.

98
00:08:02,910 --> 00:08:10,230
But you see there is some sign change going on here and there is a rotation of this funny looking thing.

99
00:08:11,790 --> 00:08:14,200
And you do see component is just zero.

100
00:08:15,150 --> 00:08:23,370
So if you have already worked with such quantum plots, then maybe you can already imagine what the

101
00:08:23,370 --> 00:08:24,600
solution looks like.

102
00:08:24,900 --> 00:08:32,640
But if not, I want to show you here another way of plotting, and this will be, first of all, the

103
00:08:32,640 --> 00:08:33,450
absolute value.

104
00:08:33,900 --> 00:08:39,230
And for this, I will just copy once again such a code here and here.

105
00:08:39,230 --> 00:08:46,860
I will use now the absolute value, and for this we must use, of course, and p towards square root

106
00:08:47,640 --> 00:08:48,000
of

107
00:08:51,090 --> 00:08:53,700
B X squared plus.

108
00:08:54,060 --> 00:09:02,760
And then I copied this b y squared plus p z squared.

109
00:09:05,270 --> 00:09:08,540
And you see, this is now the absolute value of the magnetic fields.

110
00:09:09,020 --> 00:09:16,220
And even though there is a tiny artifact here from the plotting or for the from the from the letters

111
00:09:16,340 --> 00:09:22,070
from the coordinate grid that we are using, I can tell you that actually when you saw that analytically,

112
00:09:22,070 --> 00:09:27,950
it is radial, symmetric and despite these points here, also in our numeric solution, it is radial,

113
00:09:27,950 --> 00:09:31,610
symmetric and it has quite a large value in the middle.

114
00:09:31,880 --> 00:09:38,240
And then it declines when you go away from the wire and then you can look at the individual components

115
00:09:38,240 --> 00:09:38,530
here.

116
00:09:38,870 --> 00:09:46,760
You see, the X component is positive and here at the bottom and it's negative here and the Y component

117
00:09:46,760 --> 00:09:49,020
is positive here and negative here.

118
00:09:49,790 --> 00:09:56,270
So you can already imagine that we really have such a scenario here where the current rotates, because

119
00:09:56,270 --> 00:10:04,070
here also in the negative y direction, the magnetic field is along a positive X and so on is exactly

120
00:10:04,070 --> 00:10:13,310
the same situation as in the image, and we will now go ahead and create such an arrow plots that you

121
00:10:13,310 --> 00:10:14,540
have just seen in this figure.

122
00:10:14,960 --> 00:10:19,160
And we will also compare our result to the analytical solution.

123
00:10:19,400 --> 00:10:25,100
So for the analytical solution, I have basically taken this vector potential that I've shown you earlier

124
00:10:25,100 --> 00:10:31,430
that I have derived in the course and then I have just analytically calculated the curl.

125
00:10:31,790 --> 00:10:34,280
So Knobloch cross the vector potential.

126
00:10:34,520 --> 00:10:37,340
So this is what the analytical solution looks like.

127
00:10:37,760 --> 00:10:41,660
It is, in a sense, similar to the vector potential.

128
00:10:41,660 --> 00:10:48,080
But instead of the logarithm, you have now won over the square root of x squared plus y square and

129
00:10:48,080 --> 00:10:56,960
you have not the vector potential along the Z direction, but along this particular, you call it the

130
00:10:56,960 --> 00:11:03,290
toroidal orientation, which means that the magnetic field circulates around the z axis.

131
00:11:03,830 --> 00:11:05,810
So this is really what you can also see above.

132
00:11:06,170 --> 00:11:13,790
So the X component is proportional to minus Y and the Y component is proportional to positive X.

133
00:11:14,390 --> 00:11:21,050
So you see Y component proportional to positive x x component proportionate to negative y.

134
00:11:22,460 --> 00:11:32,240
And if I program this and compare it with our solution here, I have chosen to show B y and cut along

135
00:11:32,240 --> 00:11:33,080
the x axis.

136
00:11:33,500 --> 00:11:37,130
So this will be B y cut along this axis.

137
00:11:37,680 --> 00:11:41,780
Then we will get the following profile this one.

138
00:11:42,650 --> 00:11:49,970
And I think we have once again a nice agreement of our calculated the numerical solution and blue points

139
00:11:50,210 --> 00:11:51,920
and the analytical result and ret.

140
00:11:53,120 --> 00:11:53,510
Sorry.

141
00:11:54,170 --> 00:11:59,650
The only problem that we see here is that the outermost point looks a bit odd.

142
00:11:59,690 --> 00:12:04,970
This is for the reason that I have explained to you that I did not consider these for either of a tiff.

143
00:12:05,450 --> 00:12:10,360
So they are just chosen to be zero here and we have not actually calculated them.

144
00:12:10,370 --> 00:12:13,520
We could fix this by forward or backward differences.

145
00:12:13,530 --> 00:12:16,360
Then it would probably go here closer to the red line.

146
00:12:16,910 --> 00:12:23,000
And there's another problem pretty close to the center, which is basically due to the fact that here

147
00:12:23,000 --> 00:12:25,970
we would need more points to get a better result.

148
00:12:26,900 --> 00:12:33,650
So if you want, you can try to get a better results by improving the parameters and improving the convergence

149
00:12:33,650 --> 00:12:34,520
of the integral.

150
00:12:34,970 --> 00:12:38,360
But I think it's not really necessary because as a result looks really good.

151
00:12:39,470 --> 00:12:45,530
So now the last thing I want to show you is that we want to recreate such a figure in a sense, so we

152
00:12:45,530 --> 00:12:50,900
will generate such an arrow plot for the magnetic fields around our charged wire.

