Why do I use garfield++ to simulate the drift of electrons generated by avalanches very slow?

hello,
I am trying to use garfield++ to simulate the drift track of electron ions generated by an electron avalanche amplification, and then draw the induced signal according to the drift track, so as to judge the contribution of electrons and ions to the signal of the amplifier. But I found that when I use the member function DriftElectron() in the AvalancheMC class to draw the drift track of electrons, the calculation speed is very, very slow, but the avalanche magnification at this time is very small; if I only draw the drift track speed of ions, it is still very slow. Fast. I’m wondering if this is the reason for my code or if the program is just that fast; is there a way I can make it run faster?Below is my program:
GridIonization-srim4.zip (265.0 KB)

I think @hschindl can help.

Hi,
it would be helpful if you could provide a minimal working example to illustrate what you mean. The program you attached does not use AvalancheMC::DriftElectron but AvalancheMicroscopic::AvalancheElectron, and something like half of the lines in the program are commented out.

I’m sorry the previous code was too cluttered. This is my modified code. What I mean is that I want to simulate an electron amplifying in the avalanche region to generate electrons and ions, and then use the member functions DriftElectron() and DriftIon() in the AvalancheMC class to draw the drift tracks of the electrons and ions respectively, so as to get them in the amplification The induced signal generated on the pole; I mainly want to know how much the ions contribute to the total induced signal; but I found that the calculation is very, very slow when I use DriftElectron() to draw the electron drift track; but according to the voltage avalanche I set The magnification is small.So I want to know what is causing this, is it a problem with my code?
Grid.zip (255.1 KB)

I ran a simplified and slightly modified version of your program (which you can find attached) and it doesn’t seem particularly slow to me.
Note that there is no point to call AvalancheMC::DriftElectron in the loop over the electron trajectories simulated using AvalancheMicroscopic.
Can you try to narrow down which part of the program is slow for you?
signal.C (5.0 KB)

I have one more question, are the induced signals from electron and ion drift related to my chosen method of charge transport? Is there a big gap between the induced signals simulated by the three methods, DriftLineRKF(), AvalancheMicroscopic(), and AvalancheMC()?Do I have to plot the tracks of the amplified electrons and ions before I can get a sensed signal on an electrode?

The average signals computed using DriftLineRKF, AvalancheMicroscopic and AvalancheMC should be compatible. With AvalancheMicroscopic and AvalancheMC the signal induced by an electron starting from a given point in space will fluctuate from call to call, while with DriftLineRKF it will always be the same.

No, not at all. You can safely switch off plotting of the drift lines, it has no effect on the induced signal.

ok i got it, thank you very much for your answer

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