| 1 |
% vanallenbelt.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2004 |
| 4 |
|
| 5 |
input featpost3Dplus2D; |
| 6 |
|
| 7 |
def magnfield( expr pos ) = |
| 8 |
begingroup |
| 9 |
save dist, anga, angb, angp, bv, bh, br, bx, by, bz, fin; |
| 10 |
numeric dist, anga, angb, bv, bh, br, bx, by, bz; |
| 11 |
pair angp; |
| 12 |
color fin; |
| 13 |
dist = conorm( pos ); |
| 14 |
angp = getanglepair( pos ); |
| 15 |
anga = xpart( angp ); |
| 16 |
angb = ypart( angp ); |
| 17 |
bh = 0.5*cosd( angb )/dist**3; |
| 18 |
bv = sind( angb )/dist**3; |
| 19 |
br = bv*cosd( angb ) - bh*sind( angb ); |
| 20 |
bz = bv*sind( angb ) + bh*cosd( angb ); |
| 21 |
bx = br*cosd( anga ); |
| 22 |
by = br*sind( anga ); |
| 23 |
fin = ( bx, by, bz ); |
| 24 |
( 25*fin ) |
| 25 |
endgroup |
| 26 |
enddef; |
| 27 |
|
| 28 |
def pmf( expr pos ) = |
| 29 |
(2*red/(((greenpart pos) ++ (bluepart pos))**2)) |
| 30 |
enddef; |
| 31 |
|
| 32 |
beginfig(1); |
| 33 |
color vel; |
| 34 |
vel = 1.1*(-0.25,0.0,0.1); |
| 35 |
cartaxes(1,1,1); |
| 36 |
draw magnetictrajectorypath(200, red, vel, 0.22, magnfield ); |
| 37 |
% draw magnetictrajectorypath(400, red,-vel, 0.22, magnfield ); |
| 38 |
endfig; |
| 39 |
|
| 40 |
beginfig(2); |
| 41 |
f := 2*red; |
| 42 |
Spread := 200; |
| 43 |
numeric ang; |
| 44 |
color vel; |
| 45 |
ang = 145; |
| 46 |
vel = 0.8*( 0, cosd( ang ), sind( ang ) ); |
| 47 |
draw magnetictrajectorypath(200, green, vel, 0.1, pmf ); |
| 48 |
drawarrow reverse (rp(blue)--rp(black)--rp(green)); |
| 49 |
endfig; |
| 50 |
|
| 51 |
end. |