ComponentAnalyticField and ComponentElmer2d give different results


I am trying to calculate the signals and charges created by alpha particles in a gas tube, but I got different results when I replaced ComponentAnalyticField with ComponentElmer2d.

The tube radius is 0.2 cm and the wire radius is 0.01 cm. The ion tracks were calculated by TRIM and imported into Garfield++ using TrackTrim. The wire voltage is 700V and the tube wall is grounded. I set up the electric field map using two different methods: in the first method I used ComponentAnalyticField, and in the second method I used ComponentElmer2d to import the field calculated by Elmer.

However, the current signals and integrated charges calculated by these two methods were very different. Below are plots of track/drift lines and current signal from the same alpha. The first one was calculated using ComponentAnalyticField, and the second one using ComponentElmer2d. The last figure is the histogram of the integrated charge for a number of alphas, which shows clearly using ComponentElmer2d resulted in much smaller charges.

I am not sure why I got inconsistent results. The ion track file and gas file are the same, and the electric field calculated by Elmer agrees well with the analytic one. The code and input files can be downloaded from here. I am inclined to think something went wrong when I imported the field using ComponentElmer2d. Could you please help me fix this?

Thank you,


Many thanks for your message. I’ll try to take a look in the coming days…

Hi, thanks for your reply. I wanted to share an update on this issue. So I tried to replace ComponentElmer2D with ComponentAnsys121, and the result is close to ComponentElmer2D. I then looked into the drift of a single electron and compared the signals I got with ComponentAnalyticField and ComponentAnsys121. And finally, I found the problem was that the time step was too coarse in the analytic case. Below are the current signals passed into Sensor::FillSignal function, where the discretized signal is first linearly interpolated and integrated using Simpson integration to get the charge in a time bin. And you can see that in the last time bin (light blue region), there are only two samples in the Analytic signal, and this procedure led to overestimated integral. It’s not clear to me how this step can be controlled, but the ANSYS one looks okay so I will probably just use that.

apologies for my late reply and thanks a lot for your thorough investigation/debugging!

DriftLineRKF checks at every step whether the electron is in the vicinity (i. e. within a distance R) of a wire (this check is implemented only for ComponentAnalyticField but not for field maps). If it is then it is considered “trapped” by the wire and a dedicated algorithm takes over for the last steps towards the wire. This algorithm ignores the max. step size set by the user (this is something I need to fix).

By default, the distance R is set to five times the physical wire radius. If you set it to be identical to the physical wire radius, that is if you replace the line

cmp.AddWire(0, 0, 2 * rWire, vWire, "s");


cmp.AddWire(0, 0, 2 * rWire, vWire, "s", 100., 50., 19.3, 1);

(the “trap radius” is the last argument of the function AddWire) then the electron trajectory obtained using ComponentAnalyticField should be very close to the one obtained using ComponentElmer2d or ComponentAnsys121.

There is another thing though that I noticed running the example. There seems to be a significant difference in the signal depending on whether the weighting field or the weighting potential are used for calculating the induced current. Will look more closely into that…

Hi many thanks for your reply. Setting R to the physical wire radius solved the issue. The two distributions are now in better agreement.

I also noticed the difference between using weighting potential and weighting field. Below are the charge distributions calculated using weighting potential. Also not sure what’s causing the difference, but according to the manual, I will use weighting potential to make sure the charge is correct.

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