Ampere's law
Gauss' law relates the integral over a closed surface of the electric field vector to the charge contained in the volume bounded by the surface. Ampere's law represents the equivalent for magnetic fields generated by electric currents. It is based on the Lorentz force, which forms the basis of understanding the force between two parallel wires that carry electric currents.
The law states that the integral of the magnetic field B over a closed contour that encloses a current is proportional to the current. The proportionality constant is the permeability which is related to the permittivity (the product ). In MKSA units equals Tm/A .
The right-hand rule that underlies the Lorentz force determines also the orientation of the generated B field with respect to the current.
As with Gauss' law, the usefulness of Ampere's law is restricted by the fact that a high degree of symmetry must be present, so that simple contours can be found on which the magnetic field is constant. If this is the case, the field can be brought outside the line integral and a simple product of its strength times the length of the contour results.
For a straight wire it is apparent that the right contour is given by concentric circles in the plane perpendicular to the wire. Thus
> Ampere:=B*2*Pi*r=mu[0]*I[0];
Outside of the conductor we have for the field:
> Brout:=solve(Ampere,B);
The strength of the magnetic field decreases with the distance from the wire. As before with Gauss' law we can also use Ampere's law inside the current distribution.
Suppose the cylindrically shaped wire has radius R and the current density inside the wire is constant. What is the magnetic field inside the wire?
We use a circle with radius r < R , which encloses a fraction of the current. The constant current density is given as total current divided by the total cross-sectional area:
> j:=I[0]/(Pi*R^2);
The amount of current enclosed by a cross-section of radius r is called Ip (partial current):
> Ip:=j*Pi*r^2;
Ampere's law now provides a statement about the constant magnetic field strength on the circle surrounding the enclosed area, which is permeated by the current Ip .
> Ampere:=B*2*Pi*r=mu[0]*Ip;
We observe that the magnetic field strength inside the conductor grows with the radius (of the circle on which it is constant):
> Brin:=solve(Ampere,B);
> P1:=plot(subs(mu[0]=1,I[0]=1,R=1,Brin),r=0..1):
> P2:=plot(subs(mu[0]=1,I[0]=1,R=1,Brout),r=1..5):
> with(plots):
> display({P1,P2});
Experimentally no sources or sinks of magnetism, i.e., no magnetic monopoles are known to exist. Magnetic field lines are always closed. One can formulate Gauss' law for magnetism, but given that there is no equivalent of charges (permanent magnets are always dipoles), the magnetic flux through closed surfaces always vanishes.
>
Gauss' law for magnetism
We can use Gauss' law for magnetic fields to calculate the magnetic flux through a square wire loop that is placed between the poles of a permanent magnet (or an electromagnet). The magnet produces a constant field, e.g., of B = 0.01 T (Tesla). The square wire loop with sides l = 0.01 m is tilted with an angle of 20 degrees w.r. to the field.
We need to find the oriented surface element and calculate its scalar product with the field. The vectorial surface element d A is perpendicular to the loop, and thus stands at an angle of theta=90-20 degrees w.r. to the field. Thus, we have:
> theta:=(90-20)*Pi/180;
> l:=0.01;
> Phi:=B*cos(theta)*l^2;
> B:=0.01;
> evalf(Phi);
The magnetic flux is calculated in Tesla*m^2, a unit which carries the name Weber (Wb).
>
Magnetic field of a solenoid
Ampere's law permits to calculate approximately the magnetic field strength inside a solenoid. Many turns are contributing their identical magnetic fields to add up (superposition principle for magnetic fields). We consider an ideal solenoid, i.e., a long coil for which we ignore edge effects.
Consider a cross section through the length of the solenoid and observe how the top and bottom parts of each turn contribute with their circular B fields to the overall magnetic field inside and outside of the coil. The net result is a very strong nearly homogeneous field inside the solenoid, with diverging field lines at the two ends to close in large loops around the length of the solenoid, i.e., a very weak field outside the coil.
To calculate the magnetic field inside the coil we imagine a rectangular loop with one long side inside the solenoid, the other outside with the two short legs making the connection. The solenoid consists of a single layer and the rectangular loop encloses N turns of wire carrying a current I . The line integral along the rectangular loop has to be carried out in a specific direction consistent with the right-hand rule. Only the long leg inside the solenoid contributes to the line integral over the magnetic field: outside the solenoid the field is weak. The short legs are perpendicular to the B field, and therefore do not contribute at all.
The enclosed current equals N I , and therefore:
> B:='B': l:='l':
> Ampere:=B*l=mu[0]*N*I[0];
> B:=solve(Ampere,B);
This is the magnetic field strength inside the coil.
One can also introduce a number of turns per unit length n , and eliminate l upon substitution N = n l .
Note that the field is homogeneous inside the coil. This result follows from the fact that the short legs do not contribute at all to the line integral, i.e., the same result is obtained independent of the location of the contributing leg of length l inside the coil.
We can use the above finding together with some basics about conductivity to understand the design of electromagnets. We consider a single-layer coil with wire of thickness (diameter) d . Obviously, N d = l.
> l:=N*d;
> B;
Now suppose a wire with diameter d =0.6 mm can carry at most a current of 30 mA. We can calculate the maximum possible field strength inside the electromagnet:
> evalf(subs(I[0]=0.03,d=0.0006,mu[0]=4*Pi*10^(-7),B));
The field of 0.06 mT is rather weak. How can we increase it? The amount of current that one can pass through the wire depends on its cross sectional area, i.e., the square of the diameter. On the other hand the number of turns for a given length l decreases with the diameter. We find that the maximum value of B is proportional to the diameter as follows:
> subs(I[0]=c1*d^2,B);
Exercise: an interesting variation of the above is the toroidal coil: a torus defined by the big radius R (diameter) and small radius r (cross section) has no edge effects due to the circular hsape. However, the field is not constant inside the coil.
Calculate the variation in B with the radius R' for R - r < R' < R + r using Ampere's law. Again, ignore the field outside the coil.
A semi-realistic solenoid:
We can use Maple's graphing capabilities to draw the magnetic field vectors for a solenoid with a finite number of turns in a cross section through the center of the coil. We make use of the result of the dependence of the magnetic field strength on the radial distance from the wire obtained above. We use the fact that the sign of the field lines around the cross sections of the wires in the top half is opposite to the bottom half, since the current enters the plane in one half and exits from the plane for the other half.
We use arbitrary units.
> B:='B':
> Ampere:=B*2*Pi*r=mu[0]*I[0];
> Brout:=solve(subs(I[0]=1,mu[0]=1,Ampere),B);
The following procedure takes a point in the plane with coordinates ( x , y ) and performs a sum over the contributions to the magnetic field at that point that originate from 15 turns of the coil. Note that the expression derived from Ampere's law provides the field strength at radial distance r from the wire. The direction of the field is tangential to the circle of radius r at that point. The direction of the field is taken into account by either adding positive or negative 90 degrees (Pi/2) to the angle of the line connecting point ( x , y ) with the point where the wire intersects the plane. Maple's arctangent function with two arguments covers a range of 2 Pi! The procedure returns a 2dimensional 'vector' with the x and y components of the total magnetic field at location ( x , y ).
Imagine that the coil is placed horizontally: in a cross-sectional diagram the top row of current crossing through the plane corresponds to current going 'into', and the bottom row to current coming 'out' of the plane. Note that the sign of the current has been picked together with the orientation of the winding. To switch either of the two one would switch the convention of adding/subtracting for the top and bottom rows of intersection points.
The resulting field vector consist of a significant number of 'cancellations': imagine a location directly between two intersections of the wire in the top (or bottom) half and what the effect of circular field lines associated with the two wires is at that point.
> Field:=proc(x,y) local i,B,xi,yi,phi,Bbotx,Bboty,Btopx,Btopy; global Brout;
> Btopx:=0: Btopy:=0: #top wires first:
> for i from 1 to 15 do:
> xi:=i*0.2: yi:=0.5:
> B:=evalf(subs(r=sqrt((x-xi)^2+(y-yi)^2),Brout));
> phi:=arctan(yi-y,xi-x);
> Btopx:=evalf(Btopx+B*cos(phi+Pi/2));
> Btopy:=evalf(Btopy+B*sin(phi+Pi/2));
> od:
> Bbotx:=0: Bboty:=0: #bottom wires now:
> for i from 1 to 15 do:
> xi:=i*0.2: yi:=-0.5:
> B:=evalf(subs(r=sqrt((x-xi)^2+(y-yi)^2),Brout));
> phi:=arctan(yi-y,xi-x);
> Bboty:=evalf(Bboty+B*sin(phi-Pi/2));
> Bbotx:=evalf(Bbotx+B*cos(phi-Pi/2));
> od: [Btopx+Bbotx,Btopy+Bboty]; end:
> Field(1,0);
> with(plots):
> fieldplot(Field(x,y),x=-1..4,y=-2..2,color=blue,arrows=thick,axes=boxed);
>
The homogeneity of the magnetic field inside the coil is apparent. The fieldplot shows also very clearly how the field weakens outside the solenoid.
Exercises:
1) Vary the dimensions of the coil, i.e., number, diameter and spacing of windings.
2) Do the results change if the top and bottom rows of intersections are shifted by one half of the spacing (as is the case in a real coil)?
3) Draw a fieldplot for a single-turn coil.
4) Write a procedure that allows to vary these parameters through the argument list or by modifiaction of global variables.
In another worksheet a more accurate calculation of the magnetic field is performed by summing the exact magnetic field components for current loops (Currentloop.mws), and constructing magnetic field lines from these.