# Garfield++ examples

**URL:** <https://root-forum.cern.ch/t/garfield-examples/39953>\
**Category:** Garfield++\
**Created:** [June 17, 2020, 5:19pm UTC](https://root-forum.cern.ch/t/garfield-examples/39953 "2020-06-17T17:19:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xdoll](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/3ab097/32.png) [@xdoll](https://root-forum.cern.ch/u/xdoll)\
**Post date:** [June 17, 2020, 5:19pm UTC](https://root-forum.cern.ch/t/garfield-examples/39953/1 "2020-06-17T17:19:43Z")

</div>

Hi,  
I’m new to Garfield++ and I’m trying to run the first examples (like the gem or the drift tube one). I tried to follow these instructions  
[http://garfieldpp.web.cern.ch/garfieldpp/examples/tube/](http://garfieldpp.web.cern.ch/garfieldpp/examples/tube/)  
but after the first line it just says MediumMagboltz: command not found.

Can anyone tell me why?

Thanks!

---

<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:** [June 17, 2020, 5:49pm UTC](https://root-forum.cern.ch/t/garfield-examples/39953/2 "2020-06-17T17:49:04Z")

</div>

Links to some example source files are present in the bottom of the web page which you reference.

---

<div class="post-metadata">

**Author:** ![xdoll](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/3ab097/32.png) [@xdoll](https://root-forum.cern.ch/u/xdoll)\
**Post date:** [June 17, 2020, 7:02pm UTC](https://root-forum.cern.ch/t/garfield-examples/39953/3 "2020-06-17T19:02:21Z")

</div>

Thanks for your reply. I cloned the source files and tried with other examples too. They seem to all start running but then randomly stop, like for the Gem example I get this:

Heed:  
Database path: /home/hep/cm417/garfield/Heed/heed++/database  
ComponentAnsys123::Initialise:  
Read properties of 3 materials from file MPLIST.lis.  
ComponentAnsys123::Initialise:  
Read 8758 elements from file ELIST.lis,  
highest node number: 14066,  
background elements skipped: 0  
ComponentAnsys123::Initialise:  
Read 14066 nodes from file NLIST.lis.  
ComponentAnsys123::Initialise:  
Read 14066 potentials from file PRNSOL.lis.  
ComponentAnsys123::PrintRange:  
Dimensions of the elementary block  
0 \< x \< 0.007 cm,  
0 \< y \< 0.0121244 cm,  
-0.1 \< z \< 0.1 cm,  
-200 \< V \< 350 V.  
Periodicities  
x: mirror with length 0.007 cm  
y: mirror with length 0.0121244 cm  
z: none  
ComponentAnsys123::FindElement13:  
Caching the bounding boxes of all elements… done.  
ComponentAnsys123::InitializeTetrahedralTree: Success.  
MediumMagboltz::SetComposition:  
Ar/CO2 (80/20)  
MediumMagboltz::Mixer:  
4000 linear energy steps between 0 and 40 eV.  
ARGON ANISOTROPIC 2014  
mass: 39.948 amu  
ionisation threshold: 15.7596 eV  
44 inelastic terms (44 excitations, 0 superelastic, 0 other)  
CO2 2018 ANISOTROPIC  
mass: 44.0095 amu  
ionisation threshold: 13.776 eV  
144 inelastic terms (0 excitations, 35 superelastic, 109 other)  
MediumMagboltz::Mixer:  
Lowest ionisation threshold in the mixture: 13.776 eV (CO2)  
MediumMagboltz::Mixer:  
Energy [eV] Collision Rate [ns-1]  
2.50 1068.85  
7.50 2892.41  
12.50 5363.62  
17.50 8777.02  
22.50 11300.56  
27.50 12660.82  
32.50 12521.53  
37.50 12101.91  
MediumMagboltz::ComputePhotonCollisionTable:  
Energy [eV] Mean free path [um]  
1.00 ------------  
3.00 ------------  
5.00 ------------  
7.00 288302.9619  
9.00 3279.0618  
11.00 23.1076  
13.00 31.4118  
15.00 145.1898  
17.00 13.2429  
19.00 11.1775  
MediumMagboltz::EnablePenningTransfer:  
Warning: present gas table has no ionisation rates.  
Ignore this message if you are using microscopic tracking only.  
MediumMagboltz::EnablePenningTransfer:  
Penning transfer parameters for 44 excitation levels set to:  
r = 0.51  
lambda = 0 cm  
MediumMagboltz::LoadIonMobility:  
Read 26 values from file /home/hep/cm417/garfield/Data/IonMobility\_Ar+\_Ar.txt  
ComponentAnsys123::PrintMaterials:  
Currently 3 materials are defined.  
Index Permittivity Resistivity Notes  
0 1e+10 0  
1 1 -1 Ar/CO2, drift medium, ionisable (drift medium)  
2 4 -1  
AvalancheMicroscopic::EnablePlotting:  
Enabling storage of drift line.  
9/10  
8/10  
7/10  
6/10  
5/10  
4/10  
3/10  
2/10  
1/10  
0/10

And it seems to keep running without any outputs. I’m not sure what to do.

Thanks.

---

<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:** [June 17, 2020, 7:04pm UTC](https://root-forum.cern.ch/t/garfield-examples/39953/4 "2020-06-17T19:04:53Z")

</div>

You need to study their source code, in order to learn what they do and how.

Looking at the “[`${GARFIELD_HOME}/Examples/Gem/gem.C`](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Examples/Gem/gem.C)”, when running [the “./gem” executable](http://garfieldpp.web.cern.ch/garfieldpp/getting-started/), it should display two canvases.

---

<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 17, 2020, 7:24pm UTC](https://root-forum.cern.ch/t/garfield-examples/39953/5 "2020-06-17T19:24:20Z")

</div>

Hi,  
the GEM example program simulates 10 avalanches, starting from different positions in the drift gap. It produces two plots: one of the equipotential contours, and one of the electron and ion drift lines.

 ![driftlines](https://root-forum.cern.ch/uploads/default/original/3X/e/5/e5a872acf72f10cd90c0399314ac51036d70abe2.png) ![cf](https://root-forum.cern.ch/uploads/default/original/3X/f/e/feb7092c561d0498ca101e48ed6e11577cc0cf3f.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:** [June 23, 2020, 9:37am UTC](https://root-forum.cern.ch/t/garfield-examples/39953/6 "2020-06-23T09:37:18Z")

</div>

Just for reference:

> [@Fatal error when trying to run the Gem example](https://root-forum.cern.ch/t/fatal-error-when-trying-to-run-the-gem-example/39995/7):
>
> Below, you can find simple instructions on how to build Garfield++ (with examples) from scratch. Try (in case of problems, inspect the three created “\*.out.txt” files): # ... assuming you are using a bash like shell ... source /full/path/to/your/root/bin/thisroot.sh # setup your ROOT export GARFIELD\_HOME=${PWD}/garfieldpp # where to build Garfield++ rm -rf ${GARFIELD\_HOME} # make sure you start with an empty directory git clone --depth=1 https://gitlab.cern.ch/garfield/garfieldpp.git ${GARFIEL…

---

<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 23, 2020, 11:47am UTC](https://root-forum.cern.ch/t/garfield-examples/39953/7 "2020-06-23T11:47:01Z")

</div>

Thanks!

---

<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:** [July 7, 2020, 11:47am UTC](https://root-forum.cern.ch/t/garfield-examples/39953/8 "2020-07-07T11:47:02Z")

</div>

Closed on July 7, 2020, 11:47am UTC

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