Problem about simulate the drift electron by using neBEM + AvalancheMicroscopic

Dear Garfieldpp experts:
I am doing some numerical calculation of field distortion nearly the TPC detector readout modules edge. I build my simplified model in Comsol and export the field map to Garfiled++, than simulate the drift electron using the AvalancheMicroscopic class.It works very well and can get the result very quickly.
But When I use the neBEM to calculate the electrostastic field(the field results are almost consistent with Comsol ) and simulate the drift electron(also using the AvalancheMicroscopic class), it becomes very slow. Furthermore, when I change AvalancheMicroscopic calss to the DriftLineRKF calss, the speed also improved a lot.
May I ask what is the possible reason?

Here is part of my code:

    //Define Sensor
    Sensor sensor;
    sensor.AddComponent(&neBEM);
    sensor.SetArea(-24,-24,0,24,24,20.4);

    //Simulate drift electron 
    ViewDrift driftView;
    
    AvalancheMicroscopic driftElectron;
    //DriftLineRKF driftElectron;
    driftElectron.SetSensor(&sensor);
    //driftElectron.EnableMagneticField();

    constexpr int nEvents=1;
    constexpr bool plotDrift=false;

    double x0,y0,z0,t0(0.),e0(1.);
    double x1,y1,z1(0),t1,e1,velocity;
    int Stat(1);

    for(int i=0;i<nEvents;++i){
        if(i%100==0){ 
            std::cout<<i<<" / "<<nEvents<<std::endl;
            std::cout<<"===>>>> "<<i<<" zend= "<<z1<<" status "<<Stat<<std::endl;
        }
        y0=rnd.Uniform(-15,15);x0=-6.75;z0=2.4;
        driftElectron.DriftElectron(x0,y0,z0,t0,e0);
        //driftElectron.DriftElectron(x0,y0,z0,t0);
        driftElectron.GetElectronEndpoint(0,x0,y0,z0,t0,e0,x1,y1,z1,t1,e1,Stat);
        //driftElectron.GetEndPoint(x1,y1,z1,t1,Stat);
        if(plotDrift) driftElectron.EnablePlotting(&driftView);
    }

Thanks a lot for your message!

AvalancheMicroscopic uses a Monte Carlo technique, following every electron in an avalanche from collision to collision. It is the method of choice if you are interested in fluctuations of the signal. If the distance over which the electrons drift is large (and/or if the avalanche size is large, but I think that’s not applicable to your example) the simulation can become quite slow. DriftLineRKF on the other hand calculates the average path of an electron based on the macroscopic drift velocity and is therefore faster.
How much faster depends (among other things) on the time it takes to evaluate the electric field at a given point in space. In AvalancheMicroscopic the field is probed many, many times (at every microscopic free-flight step of every electron in the avalanche). DriftLineRKF requires fewer evaluations of the electric field (the numerical integration uses an adaptive step size).

It’s great/reassuring that you got consistent results with neBEM and COMSOL. neBEM can indeed be slow in some cases. You can try to increase the number of threads it uses internally (using the function SetNumberOfThreads of ComponentNeBem3d) but I fear it will probably still be slower than the Comsol field map.

Thans for replying!
It is indeed that when I increase the number of threads,it is still slower than Comsol field map.
I will use Magboltz to generate more detailed gas files, and use DriftLineRKF for my simulation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.