Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads

Artificially killing particles

For example for doing cylindrically symmetric simulations of an H- extraction, where electrons are dumped at some location, you can artificially kill the particles at some location. For that you need to define a callback functor:

class THCallback : public TrajectoryHandlerCallback {
public:

    THCallback() {}

    virtual ~THCallback() {}

    virtual void operator()( ParticleBase *particle, ParticlePBase *xcur, ParticlePBase *xend ) const {
        ParticlePCyl *pcur = (ParticlePCyl *)( xcur );
        ParticlePCyl *pend = (ParticlePCyl *)( xend );
        // Kill particles with mass less than 0.5 atomic mass and x-coordinate more than 3 mm.
        if( particle->m() < 0.5*MASS_U && (*pcur)[PARTICLE_X] >= 3.0e-3 ) {
            *pend = *pcur;
            particle->set_status( PARTICLE_COLL );
        }
    }
};

Then you need to add this callback to the particle database:

THCallback thc;
pdb.set_trajectory_handler_callback( &thc );


Copyright © 2010-2011 Taneli Kalvas
Last modified: Mon Jun 23 15:31:16 EEST 2014