# Problem with O2 at low electric field

**URL:** <https://root-forum.cern.ch/t/problem-with-o2-at-low-electric-field/46019>\
**Category:** Garfield++\
**Created:** [July 27, 2021, 8:01am UTC](https://root-forum.cern.ch/t/problem-with-o2-at-low-electric-field/46019 "2021-07-27T08:01:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JosePaz25](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/josepaz25/32/26969_2.png) [@JosePaz25](https://root-forum.cern.ch/u/JosePaz25)\
**Post date:** [July 27, 2021, 8:01am UTC](https://root-forum.cern.ch/t/problem-with-o2-at-low-electric-field/46019/1 "2021-07-27T08:01:35Z")

</div>

Hello, I have been trying to perform some simulations of electronic transport parameters in air. First I would like to start with dry air. The code I am using is quite similar to the one in Garfield’s examples. It is attached below:

```auto
#include <iostream>

#include "Garfield/MediumMagboltz.hh"
#include "Garfield/FundamentalConstants.hh"

using namespace Garfield;

int main(int argc, char * argv[]) {

  const double pressure = AtmosphericPressure;
  const double temperature = (273.15 + 20);

  MediumMagboltz gas;
  gas.SetComposition("N2", 75.5392, "O2", 23.1781, "Ar", 1.2827);
  gas.SetTemperature(temperature);
  gas.SetPressure(pressure);

  gas.EnableThermalMotion(true);

  gas.SetFieldGrid(100. , 20000., 1000, true);

  gas.GenerateGasTable(10);

  gas.WriteGasFile("Air_20C_760mmHg_NoHumid.gas");

}

```

However, when the electric field is low (\<1000 V/cm, approximately) I get a message from which the program does not progress. I attach below the message:

 ![Error](https://root-forum.cern.ch/uploads/default/original/3X/4/4/44b44e0de7cd17dd8f819dd33269737eeb4728f5.png)

This happens with Magboltz version 11.11 (not with version 11.9). However, in this version the attachment coefficient is not null (something that happens in version 11.9) and I think it describes better its behavior. However, due to the above mentioned problem I am not able to do a complete simulation.

I am not sure if the problem comes from my code or the latest version has a bug.

Thanks for your help !

---

<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:** [July 29, 2021, 4:32pm UTC](https://root-forum.cern.ch/t/problem-with-o2-at-low-electric-field/46019/2 "2021-07-29T16:32:27Z")

</div>

Hi,  
thanks for reporting this issue! The problem doesn’t come from your code, I can also reproduce with the standalone version of Magboltz. It seems to happen in the Magboltz subroutine that does the time-of-flight calculation of the Townsend coefficient. I’ll contact the author of Magboltz to see if we can implement a fix (it’s probably quite straightforward).

In the meantime, as a workaround you could start the calculation at 1000 V/cm or so and skip the lower fields.

By the way, I saw that in your program you set a grid with 1000 electric field points. That’s really a lot (too much). The relevant transport parameters like drift velocity, attachment coefficient, etc. typically don’t have features that require such a high resolution (and the calculation will take a long time).

---

<div class="post-metadata">

**Author:** ![JosePaz25](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/josepaz25/32/26969_2.png) [@JosePaz25](https://root-forum.cern.ch/u/JosePaz25)\
**Post date:** [August 2, 2021, 10:18am UTC](https://root-forum.cern.ch/t/problem-with-o2-at-low-electric-field/46019/3 "2021-08-02T10:18:01Z")

</div>

Thank you for your response. I take note of the recommendation

Regards !

---

<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:** [August 16, 2021, 10:18am UTC](https://root-forum.cern.ch/t/problem-with-o2-at-low-electric-field/46019/4 "2021-08-16T10:18:30Z")

</div>

Closed on August 16, 2021, 10:18am UTC

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