ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/multipole/Quadrupole.py
(Generate patch)

Comparing trunk/multipole/Quadrupole.py (file contents):
Revision 4410 by gezelter, Wed Mar 30 17:58:47 2016 UTC vs.
Revision 4411 by gezelter, Tue Apr 5 21:44:16 2016 UTC

# Line 12 | Line 12 | field = vfp.Field()
12   field = vfp.Field()
13   # add the qpole
14   # note, parameters are should be [ r_x, r_y, phi, q], where r is the position vector, phi is the angle of the quadrupole  in radians, and q is the charge magnitude
15 < field.add_element('quadrupoles' , [ [ 0, 0, 1.0, 100] ] )
15 > field.add_element('quadrupoles' , [ [ 0, 0, 0.0, 100] ] )
16  
17   # draw the charges for the field on the document
18   doc.draw_charges(field)
19  
20   # start drawing the field lines
21   # we are going to draw 20 field lines comming off of the quadrupole at uniformly spaced angles.
22 < N = 49
22 > N = 37
23   for i in range(N):
24      # compute the angle that the line will start off at
25 <    angle = i * 2.*math.pi / (N-1)
26 <    # generate the line
27 <    # this takes the initial position, the x and y components of the initial direction, and whether or not should go forward
28 <    # or backward.
29 <    line = vfp.FieldLine( field, [0.1*math.cos(angle),0.1*math.sin(angle)], start_v=[math.cos( angle ) , math.sin( angle )],directions='forward' )
25 >    angle = float(i) * 2.0* math.pi / float(N-1)
26 >    direction = 'forward'
27 >
28 >    if (math.fabs(angle - 0.0) < 1.0e-3):
29 >        direction = 'backwards'
30 >    if (math.fabs(angle - math.pi) < 1.0e-3):
31 >        direction = 'backwards'
32 >    
33 >    print angle, direction
34 >    # generate the line this takes the initial position, the x and y
35 >    # components of the initial direction, and whether or not should
36 >    # go forward or backward.
37 >    line = vfp.FieldLine( field, [0.15*math.cos(angle),0.15*math.sin(angle)], start_v=[math.cos( angle ) , math.sin( angle )],directions=direction )
38      # draw the lin on the document
39 <    doc.draw_line(line,arrows_style={'min_arrows':1,'scale':0.4,'max_arrows':3})
39 >    doc.draw_line(line,arrows_style={'min_arrows':1,'scale':0.5,'max_arrows':2})
40  
41   # write the document
42   doc.write()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines