# Questions about negative ion velocity when using AvalancheMC

**URL:** <https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176>\
**Category:** Garfield++\
**Created:** [June 5, 2023, 4:15am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176 "2023-06-05T04:15:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [June 5, 2023, 4:15am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/1 "2023-06-05T04:15:48Z")

</div>

Hello!  
When I open avalMC-\>EnableDebugging( ) ;I get the following information. I’m curious how to calculate the velocity, especially 0.0001.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/e/7/e7155ec023329c9540128121088192c2b1e3e6be.png)

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/3/8/38d1d3429d5d5e72bba63e6142464103c9cd4077.png)

In my code,the temperature is 293.15K,the pressure is 760torr,and the electric field is uniform.

```auto
double wid=6;
double height = 6;
double vAnode = 0;
double vCathode = -2000; // V
cmp.AddPlaneY(0, vCathode, "cathode");
cmp.AddPlaneY(height, vAnode, "anode");

```

This is the mobility of negative ions I loaded.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/5/d/5de59ca5b303cffaec56fe3b33bfcf6bf6d7161b.png)

I found the reduced electric field in my programme is smaller than 5Td (the minimum in mobility data)

So can you tell me:

1. **how to calculate the velocity?**
2. **how AvalancheMC add Diffusion for negative ions ?**  
Although I read the source code, I still do not understand. I really need to understand these,look forward to your reply.Thanks in advance.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [June 5, 2023, 11:49am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/2 "2023-06-05T11:49:59Z")

</div>

Ok, that is indeed strange. If you have a uniform field the drift velocity should be the same everywhere. When reading in the mobility file, the mobility values are scaled to the pressure and temperature in the gas. The velocity is then simply given by mobility times electric field.  
The diffusion step is calculated the same way as for electrons. After every “drift step” (along the direction of the drift velocity vector), a random diffusion step is added (sampled from a Gaussian distribution). The width of the Gaussian is given by the diffusion coefficient. For ions, the diffusion coefficient is calculated according to the Einstein relation.

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [June 5, 2023, 12:55pm UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/3 "2023-06-05T12:55:57Z")

</div>

I did a test, the result was very strange. I **loaded different negative ions mobility data respectively,** ,turn on debug (avalMC-\>EnableDebugging() ), found the velocity information is the same( 0.000841 and 0.000001 were found)

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/8/c/8cc5450d5b380a8bf65b67a9c7a1d2519cb3c957.png)  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/4/8/48e9ae17eaf94b9048691ff1eff45accca210deb.png)

this is the mobility data I loaded respectively,.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/6/7/673934f15059b2242cbc511f9cc0d187e0157d83.png)

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/b/3/b30d91a2f063c1eb8fb950b36ad96140a003d0ed.png)

the uniform eletric field is 333V/cm. So why can’t get the right velocity information? Looking forward your reply.Thanks a lot

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [June 7, 2023, 12:53am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/4 "2023-06-07T00:53:49Z")

</div>

Dear @hschindl, Could you help me have a look?Thank you in advance!

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [June 8, 2023, 8:58am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/5 "2023-06-08T08:58:41Z")

</div>

I think there is an issue with the truncation of the numbers in the debug printout. The calculation of the velocity seems correct though. I ran a little test (see the attached program) and the drift time is consistent with what you would expect.

[test.C](https://root-forum.cern.ch/uploads/short-url/xwvgX7lWVAw6zxyK4yWUpedR3dE.C) (1.2 KB)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [June 8, 2023, 8:59am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/6 "2023-06-08T08:59:26Z")

</div>

I noticed that `AvalancheMC` currently stores the trajectories of the negative ions in the same container as the positive ones. Will fix that…

---

<div class="post-metadata">

**Author:** ![zql21](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/zql21/32/33487_2.png) [@zql21](https://root-forum.cern.ch/u/zql21)\
**Post date:** [June 9, 2023, 8:14am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/7 "2023-06-09T08:14:41Z")

</div>

yes, I understand. Thank you very much and look forward to your fix.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [June 23, 2023, 8:15am UTC](https://root-forum.cern.ch/t/questions-about-negative-ion-velocity-when-using-avalanchemc/55176/8 "2023-06-23T08:15:11Z")

</div>

Closed on June 23, 2023, 8:15am UTC

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