Exercise 12

As with all of the exercises you will complete in this course, you will be expected to turn your *.nb file in to the course TA before the next lecture.  Please do so by e-mailing your completed exercise file to Lan Yu (ece329.uiuc@gmail.com), make sure you name the file using the following notation: “Exn_Last_First.nb”, where n is the Exercise number (in this case, 12), and First and Last would be your first and last name.  So my submission to Lan for this exercise would be titled “Ex12_Dan_Wasserman.nb”.  You will receive full credit for your exercise if it turned in before the next lecture (Lecture n+1).  No late submissions will be accepted.

Objective/Overview:

In today’s exercise, we are going to investigate the relationship between current and magnetic field.  In lecture, we learned about two ways to determine the electric field from a current distribution.  The first was a brute force method, the Biot Savart Law, which allows us to determine B from an arbitrarity shaped current-carrying wire.  The second is Ampere’s Law, which is the magnetic equivalent of Gauss’s Law, and allows us to determine the B field from current distributions with certain symmetries.

ClearAll[dbsegment1,bzsegment1]

Biot-Savart Law

In class we already determined that we can find the magnetic field from an arbitrarily-shaped current-carrying wire by integrating over all of the little elements of the wire.  
d(OverVector[B])=(((Subscript[μ, o])I)/(4π))((d(OverVector[l])×(OverHat[r]))/(r^2))=(((Subscript[μ, o])I)/(4π))((d(OverVector[l])×(OverVector[r]))/(r^3))
This is a painstaking process, for all but the most simple of current configurations (if done by hand), but perhaps Mathematica can actually make using the Biot-Savart law a little less painful!
Let’s say we have a wire segment carrying current I, going from {0,0,0} to {1,0,0}.  Let’s calculate the magnetic field from this segment.  For now, let’s make things easy by only looking at the field in the xy plane.

dbsegment1=Cross[{1,0,0},{xo-x, yo,0}]/(Dot[{xo-x, yo,0},{xo-x, yo,0}])^1.5

bzsegment1=Integrate[(yo/((((((-x+xo))^2)+(yo^2)))^1.5)),{x,0,1},Assumptions->{{x,xo,yo}∈Reals, yo≠0}]

ContourPlot[bzsegment1,{xo,-.5,1.5},{yo,-1,1},PlotLegends->Automatic]

We can add another segment with current going in the -(OverHat[x]) direction, from {1,1,0} to {0,1,0}

dbsegment2=Cross[{-1,0,0},{xo-x, yo-1,0}]/(Dot[{xo-x, yo-1,0},{xo-x, yo-1,0}])^1.5

bzsegment2=Integrate[((1-yo)/((((((-x+xo))^2)+(((-1+yo))^2)))^1.5)),{x,0,1},Assumptions->{{x,xo,yo}∈Reals, yo≠1}]

ContourPlot[bzsegment1+bzsegment2,{xo,-1,2},{yo,-1,2},PlotLegends->Automatic, ColorFunction->"Rainbow"]

We can complete the current square by adding currents in the +/- y directions at x=1 and x=0

dbsegment3=Cross[{0,1,0},{xo-1, yo-y,0}]/(Dot[{xo-1, yo-y,0},{xo-1, yo-y,0}])^1.5

bzsegment3=Integrate[((1-xo)/((((((-1+xo))^2)+(((-y+yo))^2)))^1.5)),{y,0,1},Assumptions->{{x,xo,yo}∈Reals, xo≠1}]

dbsegment4=Cross[{0,-1,0},{xo, yo-y,0}]/(Dot[{xo, yo-y,0},{xo, yo-y,0}])^1.5

bzsegment4=Integrate[(xo/((((xo^2)+(((-y+yo))^2)))^1.5)),{y,0,1},Assumptions->{{x,xo,yo}∈Reals, xo≠0}]

ContourPlot[bzsegment1+bzsegment2+bzsegment3+bzsegment4,{xo,-1,2},{yo,-1,2},PlotLegends->Automatic, ColorFunction->"Rainbow", PlotRange->100]

This is kind of interesting...we see that inside the loop we have basically a constant magnetic field in the z direction (except at the wires, where the field diverges), and outside of the loop we basically no magnetic field!
Use the Biot Savart Law to calculate the magnetic field from this structure along the z axis.  In other words, plot B(z) for x=y=0:

Using the Biot-Savart law is computationally intensive, and oftentimes next to impossible analytically, which is why in this class, we tend to use Ampere’s Law.  Our next exercise will focus on using Ampere’s Law.  For the rest of this exercise, we will focus on the super-position principle.

Superposition Principle with Magnetic Fields from Infinite Wires

In class we stated that the Magnetic field from an infinite wire carrying a current I was given by (OverVector[B])=(((Subscript[μ, o])I)/(2πr))(OverHat[θ]). Where (OverHat[θ]) is the unit vector associated the azimuthal direction ‘curling’ around the current carrying wire.  Let’s see in we can plot this, assuming (((Subscript[μ, o])I)/(2π))=1.

bwire={0,1/r}

bwirexyz=TransformedField["Polar"->"Cartesian",bwire,{r,θ}->{x,y}]

VectorPlot[Boole[x^2+y^2≥0.1]bwirexyz,{x,-1,1},{y,-1,1},VectorScale->Automatic]

Here I just excluded the region where r<0.1 from the vector plot since the magnitude of the B field diverges at r=0 and this will make the vector field very difficult to visualize.
Let’s add a second wire, carrying the same current in the same direction, at x=0.5.

b2wire={-(y/((x^2)+(y^2))),(x/((x^2)+(y^2)))}+{-(y/((((x-.5))^2)+(y^2))),((x-.5)/((((x-.5))^2)+(y^2)))}

VectorPlot[Boole[Abs[y]≥ 0.05]b2wire,{x,-1,1.5},{y,-1,1},VectorScale->Automatic]

Continue adding wires, playing with the number of wires and the density of wires along the x-axis.  What do you notice about the magnetic field above and below the wires as you increase wire density and the number of wires?  It might help to plot the region above y=0 and the region below y=0, as we did above.  What you are doing here is nothing more than what we did intuitively in the lecture.  You are numerically showing that you can model a current sheet using a combination of current-carrying wires.  Plot the amplitude of the B-field ((Subscript[B, x])(y)) as a function of y from your results: