course_planning:184_projects:s18_project_3

The abnormal storm fronts and epic lightning storms continue across the Earth but the eye of this activity has been the area surrounding the town of Lakeview. A few months have passed and your colleagues at HQ have designed and constructed a new age measurement and prediction device called the Mapping N$\vec{E}$twork Sensory Array (MNSA) to try and understand the source of these storms. This sophisticated measuring equipment works off of a large number of golf ball sized sensors buried in the ground in the surrounding area by HQ. These sensors send signals back to the main relay, located atop Stormchaser HQ. The MNSA was designed for predicting lightning strikes in the surrounding area as well as calibrating instrumentation used by field teams. This is a process you and your team are very familiar with, so your colleagues showed no hesitation calling you and asking for your inputs.

Using your existing knowledge of electric field computer modeling, your Lakeview colleagues have commissioned your team to help with the maiden voyage of the MNSA. In the sky on this strangely calm but partly cloudy day, are three clouds: a large cloud (Q = -150C), a small cloud (q = -50C), and an even smaller cloud (qq = 50 C). Your colleagues have insisted that this is the perfect day to launch their new network because the weather is calm. Some of their programmers have started to work on the model, but due to their inexperience with this type of work, they were unable to finish. So far, this is what they have:

##Scene Setup
scene = display(width=1000, length=1000, height = 500)

## Parameters and Initial Conditions
k = 9e9
Q = -150 ##C
q = -50 ##C
qq = 50 ##C
cloud_height = 600 ##m

## Objects
ground = box(pos = vec(0,0,0), width=5000, length=5000, height=0.1, color=color.green)
mountains = [cone(pos=vec(-1800,0,0), axis=vec(0,1000,0), radius=700, color=vec(1,0.7,0.2)),
            cone(pos=vec(-1800,0,-1600), axis=vec(0,1000,0), radius=700, color=vec(1,0.7,0.2)), 
            cone(pos=vec(-1800,0,1600), axis=vec(0,1000,0), radius=700, color=vec(1,0.7,0.2))]
HQ = box(pos = vec(-100,100,0), width = 15, length = 15, height= 200, color = color.blue)
large_cloud = sphere(pos = vec(-1000,cloud_height,0), radius = 100, color = color.white)
small_cloud = sphere(pos = vec(900,cloud_height,100), radius = 40, color = color.white)
smaller_cloud = sphere(pos = vec(800, cloud_height, 800), radius = 25, color = color.white)

##Calculation
E = vec(0,0,0)
point = vec(HQ.pos.x,HQ.pos.y,0)
field = arrow(pos = point, axis = E, color=color.yellow)

##Calculation Loop
x = -200
dx = 20
xmax = 200
while x<= xmax:
    z = -200
    dz = 20
    zmax = 200
    point = vec(x,0,z)
    E = vec(0,0,0)
    field = arrow(pos = point, axis = E, color=color.yellow)
    x = x + dx

Before you can start calibrating the field sensors, the main relay needs to be adjusted to the electric fields caused by the nearby clouds. The main sensor relay is located at the top of the HQ. Once the main relay is programmed properly, you and your team will need to complete this program to map out the electric field on the surface of the ground.

Learning Goals

  • Understand how a calculation loop works (either a while loop or a for loop)
  • Explain what a “nested” loop does and why you would want to nest loops in the first place
  • Use superposition to calculate the electric field at one point (by hand) and at many points (using the computer)
  • Be able to articulate what should go into the calculation loop (and what should go outside the calculation loop)

Everything is getting pretty hairy in the town of Lakeview. The town and surrounding landscape are almost under a constant barrage of storms. The number of deaths due to lightning strikes in Lakeview in one week is larger than the amount the whole world has seen in the last 5 years. Jo Harding, a crazy local scientist who has had a few run-ins with storms before has an idea of putting up giant metal T's, with the base of the T inserted into the ground to try and stop the townspeople from being struck with lightning. Jo wants the base of the T to be made of wood and the horizontal top of the T to be a metal. Mayor Rachel Wando is up for reelection and is willing to listen to any ideas to stop deaths but ever since the lightning storms started she has been in non-stop meetings in which electric fields are being constantly talked about. Rachel reaches out to her friends at the storm chaser HQ for a model of what the electric field will be for one of these T's after it has been struck by lightning. The code below is the beginnings of your teams work on modeling the electric field from the giant T.

## Creating the scene for the code to run in
scene.range = 2

## Constants
TotalCharge = 15 #C
pointcharge = TotalCharge/7  
k = 9e9  
vscale = 1e-4

## Objects
charge1 = sphere(pos=vec(-3,0,0), Q=pointcharge,  color=color.red,  size=5e-1*vec(1,1,1))
charge2 = sphere(pos=vec(-2,0,0), Q=pointcharge,  color=color.red,  size=5e-1*vec(1,1,1))
charge3 = sphere(pos=vec(-1,0,0), Q=pointcharge,  color=color.red,  size=5e-1*vec(1,1,1))
charge4 = sphere(pos=vec(0,0,0), Q=pointcharge,  color=color.red,  size=5e-1*vec(1,1,1))
charge5 = sphere(pos=vec(1,0,0), Q=pointcharge,  color=color.red,  size=5e-1*vec(1,1,1))
charge6 = sphere(pos=vec(2,0,0), Q=pointcharge,  color=color.red,  size=5e-1*vec(1,1,1))
charge7 = sphere(pos=vec(3,0,0), Q=pointcharge,  color=color.red,  size=5e-1*vec(1,1,1))
charges = [charge1, charge2, charge3, charge4, charge5, charge6, charge7]

## Calculation Loop 1
E = vec(0,0,0)
point = vec(0,0,0)
for c in charges:
    r = point - c.pos
field = arrow(pos=point, axis=vscale*E, color = color.cyan)

## Calculation Loop 2
x = -5
dx = 0.5
xmax = 5
while x<=xmax:
    theta = 0
    dtheta = 0.1
    R = 0
    while theta < 2*pi:
        E = vec(0,0,0)
        point = vec(x, R*sin(theta), R*cos(theta))
        field = arrow(pos=point, axis = E*vscale, color = color.green)
        theta += dtheta
    x+=dx

Complete the program above to first represent the total electric field just to the right and left of the line of charges. Then, calculate the total electric field surrounding the line of charges.

Learning Goals

  • Understand what a list (or an array) does in the code and why you would want to use one
  • Understand how a “for” loop works and how it is similar/different from a “while” loop
  • Make a model of a line of charge using point charges and be able to describe how you would improve your model
  • Use superposition to calculate and visualize the electric field around a line of charge
  • course_planning/184_projects/s18_project_3.txt
  • Last modified: 2018/01/25 17:42
  • by dmcpadden