Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
repository:magnetic_field_deflection [2020/09/08 18:36]
porcaro1 created
repository:magnetic_field_deflection [2021/04/07 23:06]
porcaro1
Line 18: Line 18:
 ====Activity==== ====Activity====
 ===Handout=== ===Handout===
-** Magnetic Field Deflection **  
  
 +{{ :​repository:​magnetic_field_deflection.png?​nolink&​600|}}
 +
 +** Magnetic Field Deflection **
 + 
 In this activity you will be simulating the effect of a charged particle moving perpendicularly through a uniform magnetic field. The starter code assumes a positive particle moving to the right (+x direction) moving through a magnetic field oriented out of the screen (+z direction). Load the [[https://​www.glowscript.org/#/​user/​plough/​folder/​StarterCode/​program/​MagFieldDeflectionStart | provided code]] into your GlowScript workspace. ​ In this activity you will be simulating the effect of a charged particle moving perpendicularly through a uniform magnetic field. The starter code assumes a positive particle moving to the right (+x direction) moving through a magnetic field oriented out of the screen (+z direction). Load the [[https://​www.glowscript.org/#/​user/​plough/​folder/​StarterCode/​program/​MagFieldDeflectionStart | provided code]] into your GlowScript workspace. ​
  
Line 37: Line 40:
   - What effect does the influence of the magnetic field have on the particle velocity? How can you check this with the program code?   - What effect does the influence of the magnetic field have on the particle velocity? How can you check this with the program code?
 ===Code=== ===Code===
-[[https://​www.glowscript.org/#/​user/​plough/folder/StarterCode/program/MagFieldDeflectionStart ​| Link]]+[[https://​www.glowscript.org/#/​user/​porcaro1/folder/RepositoryPrograms/program/MagneticFieldDeflection-Incomplete ​| Link]]
 <code Python [enable_line_numbers="​true"​]>​ <code Python [enable_line_numbers="​true"​]>​
 GlowScript 2.8 VPython GlowScript 2.8 VPython
Line 47: Line 50:
 field = box(pos=vector(0,​0,​0),​ size=vector(200,​200,​10),​ axis=vector(1,​0,​0),​ color=color.white,​ opacity=0.3) field = box(pos=vector(0,​0,​0),​ size=vector(200,​200,​10),​ axis=vector(1,​0,​0),​ color=color.white,​ opacity=0.3)
 charge = sphere(pos=vector(-150,​90,​0),​ radius=2, color=color.red,​ make_trail=True) charge = sphere(pos=vector(-150,​90,​0),​ radius=2, color=color.red,​ make_trail=True)
 +qval = 2E-4
 vcharge = vector(5,​0,​0) vcharge = vector(5,​0,​0)
 +mass = 0.1
 +mom = mass*vcharge
 +B = vector (0,0,30.0)
  
 dt = .1 dt = .1
Line 59: Line 65:
 ====Answer Key==== ====Answer Key====
 ===Handout=== ===Handout===
 +{{ :​repository:​magfielddeflect.png?​nolink&​600|}}
 +  - Increasing the initial speed of the charged particle results in a curved path with a larger radius,
 +  - Increasing the magnitude of the charge of the particle results in a curved path with a smaller radius,
 +  - Increasing the mass of the charged particle results in a curved path with a larger radius,
 +  - Increasing the strength of the magnetic field results in a curved path with a smaller radius
 +  - The relationship between the radius of curvature and:
 +    - speed: positive
 +    - charge: negative (inverse)
 +    - mass: positive
 +    - field strength: negative (inverse)
 +  - If you make the charge of the particle negative, than the radius of the path stay the same, but the direction changes; instead of curving downward (in the -y direction) the particle'​s path curves upwards (in the +y direction)
 +  - Generally, the stronger the magnetic field, the higher the magnitude of the particle velocity. You can check this by using the "​print"​ command to display the magnitude of the particle'​s velocity at the end of the program (line 29)
 ===Code=== ===Code===
-<code Python [enable_line_numbers="​true",​ highlight_lines_extra=""​]>​ +[[https://​www.glowscript.org/#/​user/​porcaro1/​folder/​RepositoryPrograms/​program/​MagneticFieldDeflection-Solution | Link]] 
-</​code>​+<code Python [enable_line_numbers="​true",​ highlight_lines_extra="​18,​19,​20,​21,​22,​23,​24,​25,​26,​27,​29,​31"​]>​ 
 +GlowScript 2.8 VPython 
 +  
 +scene.width = 824 
 +scene.height = 568 
 +  
 +#consider the charge to be positive and the magnetic field to be in the positive z direction--out of the screen. 
 +field = box(pos=vector(0,​0,​0),​ size=vector(200,​200,​10),​ axis=vector(1,​0,​0),​ color=color.white,​ opacity=0.3) 
 +charge = sphere(pos=vector(-150,​90,​0),​ radius=2, color=color.red,​ make_trail=True) 
 + 
 +qval = 2E-4 
 +vcharge = vector(5,​0,​0) 
 +mass = 0.1 
 +mom = mass*vcharge 
 +B = vector (0,​0,​30.0) 
 +  
 +dt = .1 
 +  
 +while charge.pos.y > -150 and charge.pos.x >= -150: 
 +  rate(120) 
 +  if charge.pos.x < -100: 
 +      charge.pos = charge.pos + vcharge*dt 
 +  else: 
 +    if charge.pos.x < 100 and charge.pos.y > -100: 
 +      force = qval*cross(vcharge,​B) 
 +      mom = mom + force*dt 
 +      charge.pos = charge.pos +mom/​mass*dt 
 +      vcharge = mom/mass 
 +    else: 
 +      charge.pos = charge.pos + vcharge*dt 
 +  
 +print(mag(vcharge))</​code>​ 
 + 
  
 ---- ----
 ====See Also==== ====See Also====
-  *+  *[[forces_on_current_carrying_wire | Forces on Current Carrying Wire]]
   ​   ​
  • repository/magnetic_field_deflection.txt
  • Last modified: 2021/04/07 23:06
  • by porcaro1