### Assignment NP 5.04: Magnets Unlimited - Project #1

```

```

Statement of the Problem

Solution to the Problem

I began the task at hand by running my predecessor's version of the code which utilizes the relaxation method. After 20 iterations, the non-uniformity is 29 parts per thousand. I need to improve this to 1 part per thousand.

First, I changed the pole potentials from 10V to 5V on the upper polepiece and from 0V to -5V on the lower polepiece. If the lower polepiece is -5V and the upper polepiece is 5V, it doesn't make sense that the rest of the boundary be at 0V. So I adjusted the boundary conditions. I varied it so that for the left side, the boundary begins at 5V and as one moves downward the voltage goes to zero at the half way point and then to -5V by the time it reaches the lower polepiece. If you are interested in the code... After running the program for 20 iterations, the non-uniformity is 21 parts per thousand. This is slightly better than before.

The next step is to increase the resolution. This is accomplished by increasing both arrays and the number of iterations. Let's try increasing the array size from 11x11 to 21x21 and the number of iterations from 20 to 200. (Therefore, adjustment in the itype and phi cells were made.) Now the uniformity is 29 parts per thousand - again. The graph looks close to being uniform. (The code has now changed if you are interested...)

Okay, time to try shimming the polepieces beginning with the addition of one piece to each side of both the upper and lower polepieces. This results in a non-uniformity of 18 parts per thousand and a better looking graph. Now let's add another piece directly below the earlier pieces added to the upper polepiece and directly above the earlier pieces added to the lower polepiece. Yes!! Now the lower line of the graph looks like it is almost a straigh line. The non-uniformity is 4 parts per thousand. Okay, what about adding another piece directly below the earlier two pieces added to the upper polepiece and directly above the earlier two pieces added to the lower polepiece. In addition, I will add a piece to the side of the first piece. The magnest now look like

```                        xxxxxxxxxxxxx
13         31
2           2
3           3

3           3
2           2
13         31
xxxxxxxxxxxxx
```

The result is not good. I even tried adding only one of the two new pieces to the magnet at a time. Neither one of the pieces seems to help. I think I will try increasing the arrays to 25x25 keeping the first two pieces (1 and 2 in the above diagram) that were added. (Yes, when you see my code, you will laugh. I did.I just realized that I should have written a little program to determine the boundary condition voltages instead of doing them by hand.) Hmmm... the results are not too good but there is potential here. After trying out more pieces, I decided upon the following configuration.

```                        xxxxxxxxxxxxx
144       441
24         42

24         42
144       441
xxxxxxxxxxxxx
```

Although I improved my graph so that it looks nifty, I still could only reach a 4 parts per thousand. I did notice that if I reduce the number of iterations to 61, then I obtained the sought after goal of 1 part per thousand. Could the method of relaxation be the problem. If there is more time, I will investigate this and other options such as increasing the arrays even further.