# Cannot open file He.gas

**URL:** <https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061>\
**Category:** Garfield++\
**Created:** [December 14, 2021, 1:25pm UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061 "2021-12-14T13:25:09Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 14, 2021, 1:25pm UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/1 "2021-12-14T13:25:09Z")

</div>

I have generated a gas file, then When I want to use it , I type the code "  
MediumMagboltz gas;  
gas.LoadGasFile(“He.gas”);"  
but the running results notice that:Cannot open file He.gas.

```auto
MediumMagboltz::LoadGasFile:
    Cannot open file He.gas.
ComponentAnsys123::Initialise:
    Read properties of 2 materials from file MPLIST.lis.
ComponentAnsys123::Initialise:
    Read 2159067 elements from file ELIST.lis,
    highest node number: 3124105,
    background elements skipped: 0
ComponentAnsys123::Initialise:
    Read 3124105 nodes from file NLIST.lis.
ComponentAnsys123::Initialise:
    Read 3124105 potentials from file PRNSOL.lis.
ComponentAnsys123::Prepare:
    Caching the bounding boxes of all elements... done.
ComponentAnsys123::InitializeTetrahedralTree: Success.
ComponentAnsys123::PrintRange:
        Dimensions of the elementary block
                  -0.167044 < x < -0.0670436 cm,
                   0.172927 < y < 0.205927 cm,
                  -0.115321 < z < -0.0353211 cm,
                          0 < V < 1500 V.
        Periodicities
            x: none
            y: none
            z: none
ComponentAnsys123::PrintMaterials:
    Currently 2 materials are defined.
      Index Permittivity Resistivity Notes
          0 1 -1 (drift medium)
          1 4.25 1e+10

```

---

<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:** [December 15, 2021, 6:35am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/2 "2021-12-15T06:35:17Z")

</div>

Are you sure that there is a file “He.gas” in the directory from which you run this program?

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 15, 2021, 8:29am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/3 "2021-12-15T08:29:18Z")

</div>

Hi,  
thanks for your reply, I put the He.gas in the GasFile directory, and didn’t run the example in the directory. That would be the reason. Besides, I changed the gas pressure from 760 Torr to 10 Torr, then the generation of the gas became so slow, and always stopped like the screen shot in the below, and maybe suddenly it moved on.

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/6/9/69fed02edde953b17e25d32aa45f1d14fe345ab2.png)

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 15, 2021, 11:09am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/4 "2021-12-15T11:09:22Z")

</div>

Hi,  
after several hours generating the gas file, it stopped. I inputted the “ulimit -s unlimited”. It still didn’t proceed.

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

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [December 15, 2021, 1:40pm UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/5 "2021-12-15T13:40:10Z")

</div>

You need to execute [“`ulimit -s unlimited`”](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-ulimit) BEFORE you start your executable.

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 16, 2021, 3:05am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/6 "2021-12-16T03:05:22Z")

</div>

Hi,  
ah, thanks for your help, my misunderstanding, I have tried again.

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 16, 2021, 4:15am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/7 "2021-12-16T04:15:43Z")

</div>

Hi,  
I have executed “`ulimit -s unlimited`” before I started my executable for hours. Is that normal?

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

---

<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:** [December 16, 2021, 6:14am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/8 "2021-12-16T06:14:26Z")

</div>

Magboltz can take quite a long time to run, especially if you have many electric fields (or many combinations of electric fields, magnetic fields, and angles) and/or if the Townsend coefficient is high.

You mentioned in an earlier post that you changed the gas pressure from 760 Torr to 10 Torr. Did you also change the range of electric fields accordingly? If not the reduced electric field E/p will be very (unrealistically) high.

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 16, 2021, 10:43am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/9 "2021-12-16T10:43:01Z")

</div>

Hi,  
I didn’t change the range of electric fields accordingly, are the two related with each other? I will try to modify again,Thanks again. that’s my code in the below.

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

  const double pressure = 10.;
  const double temperature = 293.15;
 
  // Setup the gas.
  MediumMagboltz gas;
  gas.SetComposition("N2", 100.);
  gas.SetTemperature(temperature);
  gas.SetPressure(pressure);
  //gas.Initialise(true);

  // Set the field range to be covered by the gas table. 
  const size_t nE = 20;
  const double emin = 100.;
  const double emax = 100000.;
  // Flag to request logarithmic spacing.
  constexpr bool useLog = true;
  gas.SetFieldGrid(emin, emax, nE, useLog); 

  const int ncoll = 10;
  // Run Magboltz to generate the gas table.
  gas.GenerateGasTable(ncoll);
  // Save the table. 
  gas.WriteGasFile("N2.gas");

```

---

<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:** [December 16, 2021, 11:05am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/10 "2021-12-16T11:05:41Z")

</div>

If you change the pressure, you normally also need to adjust of range of electric fields (and in general you should choose a range of fields that is realistic for the detector you are simulating). 100 kV/cm at 10 Torr is extremely high.

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 16, 2021, 11:21am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/11 "2021-12-16T11:21:34Z")

</div>

Hi,  
Thanks for your reply. my realistic range of field in my detector is about 0.05-0.03V/mm/mbar.  
I have changed the code to these data in the below.  
const double emin = 0.005;  
const double emax = 0.05;  
Besides, what’s the meaning about const size\_t nE = 20;?

---

<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:** [December 16, 2021, 1:31pm UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/12 "2021-12-16T13:31:57Z")

</div>

> [@XiCheng](#):
>
> Besides, what’s the meaning about const size\_t nE = 20;?

Number of electric field points.

[https://garfieldpp.web.cern.ch/garfieldpp/examples/gasfiles/](https://garfieldpp.web.cern.ch/garfieldpp/examples/gasfiles/)

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [December 17, 2021, 9:45am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/13 "2021-12-17T09:45:59Z")

</div>

Hi,  
Thanks a lot for your reply.Now I have solved the problem with your help.I generated the gas file I wanted, and can loaded it when I needed it. Next step I want to gain some plots about the field lines ,the track of protons , and drift of the electronics etc.  
Thanks for your help again.

---

<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:** [December 31, 2021, 9:46am UTC](https://root-forum.cern.ch/t/cannot-open-file-he-gas/48061/14 "2021-12-31T09:46:13Z")

</div>

Closed on December 31, 2021, 9:46am UTC

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