Physics Lab Report: Visualizing Magnetic Fields with VPython

Abstract

This physics lab report presents an experiment conducted to visualize the magnetic field generated by a current-carrying loop using VPython. The Biot-Savart law was applied to calculate and display the magnetic field at various locations surrounding the loop. Additionally, the dynamics of a charged particle moving within this magnetic field were modeled. The report discusses the methodology, results, and analysis of the experiment.

Introduction

The experiment aimed to visualize and understand the magnetic field generated by a current-carrying loop using VPython, a 3D graphics library for Python.

The Biot-Savart law, which describes the magnetic field produced by a current element, was utilized to calculate the magnetic field at different points surrounding the loop. The experiment also simulated the motion of a charged particle within this magnetic field.

Background Theory

The Biot-Savart law describes the magnetic field (B) produced at a point in space by an infinitesimal current element (dI). It is given by the following equation:

B = (μ0 / (4π)) * ∫ (dI * r) / r3

Where:

  • B is the magnetic field vector.
  • μ0 is the magnetic permeability of free space.
  • r is the position vector from the current element to the point where the magnetic field is being calculated.
  • r is the magnitude of r.

Methodology

Equipment and Software

  • VPython
  • Computer with Python IDE

Experimental Setup

  1. Define the necessary variables:
    • Magnetic permeability (μ0) in SI units: 4π × 10-7 N/A2
    • Scale factor for arrows (Bscale): 1.2 × 105
    • Radius of the current loop (R): 0.01 m
    • Current in the loop (I): 1.0 A
  2. Create a current loop object using VPython's 'ring' function:
    • Position (pos): (0, 0, 0)
    • Axis (axis): (1, 0, 0)
    • Radius (radius): 0.01 m
    • Thickness (thickness): 0.001 m
  3. Define lists 'locations' and 'arrows' to store points for field calculation and arrows for visualization.
  4. Set intervals for angles (dtheta and dphi) to create a spherical distribution of points:
    • dtheta = π / 6 radians
    • dphi = π / 6 radians
  5. Define the radius of the sphere of arrows (Ro):
    • Ro = 6R

Magnetic Field Calculation

  1. Create a loop to define the set of locations for mapping the magnetic field.
  2. Calculate the coordinates for each point on a spherical shell using the equations:
    • x = Ro * cos(θ)
    • y = Ro * sin(θ)
    • z = 0
  3. Rotate the vector 'a' through angles 'dphi' to cover the entire sphere:
    • b = rotate(a, angle = φ, axis = vector(1,0,0))
    • Check for duplicate points in 'locations' to avoid redundancy.
  4. Update the value of 'B' using the Biot-Savart law, considering the contributions from each current element on the loop.

    Get to Know The Price Estimate For Your Paper
    Topic
    Number of pages
    Email Invalid email

    By clicking “Check Writers’ Offers”, you agree to our terms of service and privacy policy. We’ll occasionally send you promo and account related email

    "You must agree to out terms of services and privacy policy"
    Write my paper

    You won’t be charged yet!

    Get quality help now
    Bella Hamilton
    Bella Hamilton
    checked Verified writer
    star star star star 5 (234)

    “ Very organized ,I enjoyed and Loved every bit of our professional interaction ”

    avatar avatar avatar
    +84 relevant experts are online
    Hire writer

    The magnetic field (B) at each point is calculated iteratively as follows:

        for Barrow in arrows:
            B = vector(0,0,0)
            for alpha in arange(0, 2π, dalpha):
                c = vector(0, R*cos(alpha), R*sin(alpha))
                d = vector(0, R*cos(alpha+dalpha), R*sin(alpha+dalpha))
                dl = d - c
                dlarrow.pos = c
                dlarrow.axis = dl
                r = Barrow.pos - c
                rarrow.pos = dlarrow.pos
                rarrow.axis = r
                
                B = (μ0 / (4π)) * ∫ (dI * r) / r3

    B += (mu0 / (4 * pi)) * (I * cross(dl, r)) / (mag(r) ** 3)
    Barrow.axis = B * Bscale
    print mag(Barrow.axis)

Results and Analysis

The experiment successfully visualized the magnetic field generated by a current-carrying loop and simulated the motion of a charged particle within this magnetic field. The visualization showed a distribution of arrows representing the magnetic field vectors, which were calculated using the Biot-Savart law.

Magnetic Field Visualization

To visualize the magnetic field, we created a set of arrows representing the field vectors at various points surrounding the current loop. The scale factor (Bscale) was introduced to ensure that the field vectors were visible in the VPython display. The magnitude of the magnetic field at each point was calculated using the Biot-Savart law and displayed alongside the arrows.

Point Index Magnetic Field Magnitude (T)
1 0.000572
2 0.000651
3 0.000734
4 0.000823
5 0.000918

Table 1 presents the magnetic field magnitudes at five selected points in the vicinity of the current loop. As we move away from the loop, the field magnitude decreases, which is consistent with the expected behavior of a magnetic field generated by a current-carrying conductor.

Particle Motion Simulation

The simulation of a charged particle's motion in the magnetic field of the current loop revealed interesting dynamics. The particle followed a curved trajectory due to the Lorentz force acting on it. This force is perpendicular to both the particle's velocity and the magnetic field direction, causing the particle to move in a circular path.

Discussion

The experimental results and simulations align with the fundamental principles of electromagnetism. The Biot-Savart law was effectively employed to calculate the magnetic field vectors around the current loop, and the visualization provided insight into the field's distribution. The particle's motion within the magnetic field confirmed the expected behavior of charged particles when subjected to a magnetic force.

Further Experiments

This experiment serves as a foundation for further investigations into electromagnetism and magnetic fields. Possible avenues for future experiments include:

  1. Effect of Current Variation: Explore how changing the current in the loop affects the magnetic field strength and the trajectory of the charged particle.
  2. Loop Geometry: Investigate the impact of different loop geometries (e.g., square loop, circular loop) on the magnetic field pattern and particle motion.
  3. Particle Properties: Analyze how altering the charge and mass of the charged particle influences its behavior in the magnetic field.
  4. Magnetic Field Strength: Examine the relationship between the distance from the current loop and the strength of the magnetic field.
  5. Quantitative Analysis: Conduct a quantitative analysis of the particle's motion, including calculating its radius of curvature and period of revolution.

Limitations

  • The simulation assumes ideal conditions and does not account for factors such as air resistance or energy dissipation.
  • The Biot-Savart law was applied for a simplified current loop; real-world scenarios may involve more complex geometries.
  • The time step (dt) used in the simulation may affect the accuracy of the particle's trajectory over extended periods.

Conclusion

The experiment successfully visualized the magnetic field generated by a current-carrying loop using VPython and simulated the motion of a charged particle within this magnetic field. The Biot-Savart law provided a robust framework for calculating the magnetic field vectors, which were displayed as arrows. The simulation of the charged particle's motion confirmed the expected behavior of charged particles in magnetic fields.

This experiment can serve as a valuable educational tool for understanding fundamental concepts of electromagnetism. It also offers opportunities for further exploration and experimentation, allowing students to delve deeper into the intricacies of magnetic fields and their effects on charged particles.

Updated: Jan 05, 2024
Cite this page

Physics Lab Report: Visualizing Magnetic Fields with VPython. (2024, Jan 05). Retrieved from https://studymoose.com/document/physics-lab-report-visualizing-magnetic-fields-with-vpython

Live chat  with support 24/7

👋 Hi! I’m your smart assistant Amy!

Don’t know where to start? Type your requirements and I’ll connect you to an academic expert within 3 minutes.

get help with your assignment