## Forces on Current-Carrying Wire

### Activity Information

#### Learning Goals

• Understand the relationship of current direction and magnetic field direction in a current-carrying wire
• current and magnetic field in parallel wires
• Use mathematical representations of Coulomb's Law to describe the electrostatic forces between objects ( HS-PS2-4)

#### Prior Knowledge Required

• Right-Hand Rule
• Magnetic force
• Biot-Savart Law
• Lorenz Force

#### Code Manipulation

• Modify existing code
• Create arrows showing magnetic force
• Create sphere to represent movement of charge within the wire

—-

### Activity

#### Handout

ACME Corporation Needs You! You have been hired by the Acme Corporation to develop a new detector for locating Road Runners (Accelleratti incredibus). A key portion of the detector has two wires that must run past each other for the length of the apparatus. However, it is important that they do not touch as that would cause an explosion, thereby harming the detector's only qualified user, Wile E. Coyote (Carnivorous vulgaris). Your job is to assess the force acting on each of the wires as a result of a current passing through them. Here are the specifications of the apparatus:

• Wires are 100 cm ling
• Wires are 2.0 cm apart
• Maximum permissible current is 4.5 A.
• Current can run in the same direction or in the opposite direction through both wires

#### Code

GlowScript 2.7 VPython scene.width = 1000 #set the width of the windowscene.height = 600 #set the height of the windowscene.range = 30 #set the range of the scene - bigger to zoom out #some constants that might be usefulu = 2e-7 #location, location, locationy1 = 10 #vertical location of wire 1y2 = -10 #vertical location of wire 2wirelength = 100 #define the wires objectswire1 = cylinder(pos = vec(-(wirelength/2),y1,0), length = (wirelength), color = vector(1,1,1), opacity = .2, radius = 1)wire2 = cylinder(pos = vec(-(wirelength/2),y2,0), length = (wirelength), color = vector(1,1,1), opacity = .2, radius = 1)

#### Handout In order to determine the force that each wire exerts on the other, the magnetic field $B$ must first be calculated. This can be done using the Biot-Savart Law: $$\vec{B}=\dfrac{\mu_0}{4\pi}\dfrac{\vec{I}\times\hat{r}}{r^2}$$ where $\dfrac{\mu_0}{4\pi}$ is a constant represented by $u$ in the code (line 8), $I$ is the current, and $r$ is the distance between wires. When inputting this into the code, it is important to create two separate variables for current and magnetic field, one for each wire.

The magnetic force acting on each wire can then be calculated using the Lorentz force equation: $$\vec{F}=L*\vec{I}\times\vec{B}$$ where $L$ is the length of the wire. From here, the rest is just a matter of creating arrows (lines 34-37), showing the direction of the magnetic field (lines 39-60), and modelling a charge travelling through the wires (lines 62-75).

Based on the above calculations, the maximum magnetic force acting on each wire for a 4.5 A current is $2.03*10^-5$ N. Using the right-hand rule, or checking the signs of the calculated forces, you'll find that the wires attract each other when the current goes in the same direction, and the wires will repel each other when the current goes in opposite directions.

See the completed code below, with the physics-specific lines highlighted.

#### Code

GlowScript 2.7 VPython scene.width = 1000 #set the width of the windowscene.height = 600 #set the height of the windowscene.range = 30 #set the range of the scene - bigger to zoom out #some constants that might be usefulu = 2e-7 #location, location, locationy1 = 10 #vertical location of wire 1y2 = -10 #vertical location of wire 2wirelength = 100 #define the wires objectswire1 = cylinder(pos = vec(-(wirelength/2),y1,0), length = (wirelength), color = vector(1,1,1), opacity = .2, radius = 1)wire2 = cylinder(pos = vec(-(wirelength/2),y2,0), length = (wirelength), color = vector(1,1,1), opacity = .2, radius = 1) #determine the distance between the wiresr = wire1.pos - wire2.pos #current and B-field calculation for wire 1I1 = vec(1,0,0)  #current in amps - positive value means current is left to right - only change the x-fieldL = wirelength #length of wiresB1 = (u*cross(I1,r))/(mag(r)**2) #magnetic field strength for current carrying wire 1 at the position of wire 2 #current and B-field calculation for wire 2I2 = vec(-1,0,0) #current in amps - positive value means current is left to right - only change the x-fieldB2 = (u*cross(I2,-r))/(mag(r)**2) #magnetic field strength for current carrying wire 2 at the position of wire 1 #F=ILB or more correctly L*IxBforcew2w1 = L*(cross(I2,B1))forcew1w2 = L*(cross(I1,B2))arrow(pos=wire1.pos+vec(wirelength/2,0,0), axis=(forcew2w1)*1e7, color=color.blue) #edit the axis multiplier to scale for current changesarrow(pos=wire2.pos+vec(wirelength/2,0,0), axis=(forcew1w2)*1e7, color=color.red) #edit the axis multiplier to scale for current changesarrow(pos=vec(0,y1,0), axis=(I1)*10) #arrows to indicate direction of currentarrow(pos=vec(0,y2,0), axis=(I2)*10) #arrows to indicate direction of current #define chargeswirestartleft = -wirelength/2wirestartright = wirelength/2 if I1.x>0:    start1 = wirestartleft    x1=1else:     start1 = wirestarright    x1=-1if I2.x>0:    start2 = wirestartleft    x2=1else:     start2= wirestartright    x2=-1 Tin1 = text(pos = vec((start1),y1+(-5*x1),0),text='X                  X                 X                   X                     X                    X                       X                    X                          X                           X                          X                           X                           X')Tout1 = text(pos = vec((start1),y1+(5*x1),0),text='O                  O                 O                   O                     O                    O                       O                    O                          O                           O                          O                           O                           O') Tin2 = text(pos = vec((start1),y2+(-5*x2),0),text='X                  X                 X                   X                     X                    X                       X                    X                          X                           X                          X                           X                           X')Tout2 = text(pos = vec((start1),y2+(5*x2),0),text='O                  O                 O                   O                     O                    O                       O                    O                          O                           O                          O                           O                           O') counter = 0 while counter < 1000:    charge1 = sphere(pos=vec((start1),y1,0), radius = .5, color = vec(1,0,0))    charge2 = sphere(pos=vec((start2),y2,0), radius = .5, color = vec(1,0,0))    while abs(charge1.pos.x) <= 50:        rate(100)        charge1.pos.x = (charge1.pos.x + (.5*x1))        charge2.pos.x = (charge2.pos.x + (.5*x2))        if charge1.pos.x >= 50:            charge1.color = vector(0,0,0)            charge2.color = vector(0,0,0)     counter = counter+1