Good Evening,

   It was a good week; my to do list could not keep up with me. I think it was the sun.  Mix in a little rain and you get a lot more flowers.  And hummingbirds.  The sun also sent more ions.  We are currently inside a stream of solar wind.  There was an X class flare a few days ago.  The ionosphere should be ready for us tomorrow.  QSB will add interest.

Please join us on (or near):

14050 kHz at 2200z Sunday (3 PM PDT Sunday)
 7047 kHz at 0000z Monday (5 PM PDT Sunday)

   73,
      Kevin. KD5ONS






-





I am modeling the motion of a charged particle through a magnetic field, by implementing the Lorentz Force equation.  Only the magnetic portion for now, the electric part comes later.  Using vectors makes the code more readable and compact.

This is a rough draft of a streak pattern to display charged particle motion:

void streak( void )
    {
    struct spark F;          // Force field
    float q = 1.6e-19;       // Electron charge Ampere*second
    float Me = 9.1e-31;      // Electron mass in kilograms
    struct vt ptC;           // Screen point
    struct pt Fm;            // Magnetic component of Lorentz Force in Newtons
    struct pt Vv = vector( 5e5, 0.0, 0.0 );     // 500 km/second
    float dt = 1e-2;         // Seconds

    F.B = vector( 0.0, 1e-5, 0.0 );             // Vertical 1 Gauss field
    Fm = vecMult( vecCrossVec( Vv, F.B ), q );  // Magnetic component of the Lorentz Force

    for(int i=0; i<rcount; i++) // Move the ray across display
        {
        SelectObject( bkhdc, pn[ ray[ i ].col ] );     // Choose preset pen color

        if(( ray[i].X.x > 100.0 ) && ( ray[i].X.x < 400.0 ))  // In the field
            {                                          // F/m = a
            ray[i].X = vecPlusVec( ray[i].X, vecMult( vecDiv( Fm, Me ), dt*dt ));
            Vv = vecPlusVec( Vv, vecMult( vecDiv( Fm, Me ), dt );
            }
        else
            ray[ i ].X = vecPlusVec( ray[ i ].X, Vv ); // Move ray to the right

        if( ray[i].X.x > 500.0 ) ray[i].X.x = -100.0;  // Arbitrary endpoint choices

        ptC = perspective( matrixMultiply( Transform, matTvec( Rot, ray[i].X ), View ) );
        Ellipse( bkhdc, ptC.x-1, ptC.y+1, ptC.x+1, ptC.y-1 );
        }
    SelectObject( bkhdc, hpen );                       // Restore standard black pen
    }


When this works I will generalize it to animate charged particles in a toroidal magnetic field.



______________________________________________________________
Elecraft mailing list
Home: http://mailman.qth.net/mailman/listinfo/elecraft
Help: http://mailman.qth.net/mmfaq.htm
Post: mailto:Elecraft@mailman.qth.net

This list hosted by: http://www.qsl.net
Please help support this email list: http://www.qsl.net/donate.html
Message delivered to arch...@mail-archive.com 

Reply via email to