# error in direct-simulation Monte Carlo method

**URL:** <https://molflow-forum.web.cern.ch/t/error-in-direct-simulation-monte-carlo-method/209>\
**Category:** General discussion\
**Created:** [May 15, 2019, 3:37pm UTC](https://molflow-forum.web.cern.ch/t/error-in-direct-simulation-monte-carlo-method/209 "2019-05-15T15:37:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![10187173966221302116](https://molflow-forum.web.cern.ch/user_avatar/molflow-forum.web.cern.ch/10187173966221302116/32/64_2.png) [@10187173966221302116](https://molflow-forum.web.cern.ch/u/10187173966221302116)\
**Post date:** [May 15, 2019, 3:37pm UTC](https://molflow-forum.web.cern.ch/t/error-in-direct-simulation-monte-carlo-method/209/1 "2019-05-15T15:37:53Z")

</div>

&nbsp;

Hi Marton,

&nbsp;

Page 191 in

&nbsp;

Ref: Lucas, C. B. (2013). Atomic and molecular beams: production and collimation. CRC press.

&nbsp;

At the end of section 8.3.4, it seems that Monte Carlo simulations are unfavorable under certain circumstances because of its statistical error, while alternative analytical solutions exist.

&nbsp;

My question appears to be quite general, because I couldn't be specific due to less of expertise in numerical calculations and the machinery behind Molflow+. &nbsp;

&nbsp;

Any comments for that section?

&nbsp;

Thanks,

&nbsp;

Chao

---

<div class="post-metadata">

**Author:** ![maarton](https://molflow-forum.web.cern.ch/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@maarton](https://molflow-forum.web.cern.ch/u/maarton)\
**Post date:** [May 16, 2019, 1:22pm UTC](https://molflow-forum.web.cern.ch/t/error-in-direct-simulation-monte-carlo-method/209/2 "2019-05-16T13:22:00Z")

</div>

Hello Chao,

Unfortuantely I don't have the book you referenced, so I can't have a look.

All simulation methods have pros and cons. Monte Carlo simulations can have high statistical errors, especially if several orders of magnitude need to be modeled, although there are mitigation techniques (series of simulations at each pressure drop, see section 1.2.4.3 and Fig. 1.35&nbsp;of [my thesis](http://cds.cern.ch/record/2157666?ln=en)).

Analytic methods provide exact results, in exchange apart from simple geometries (tubes) they are very hard to apply for real-life structures.

In CERN we use both, even at the same time (conductance calculation of parts by Monte Carlo then analytic solution by electric circuit solvers)

---

<div class="post-metadata">

**Author:** ![rkerseva](https://molflow-forum.web.cern.ch/user_avatar/molflow-forum.web.cern.ch/rkerseva/32/15_2.png) [@rkerseva](https://molflow-forum.web.cern.ch/u/rkerseva)\
**Post date:** [July 16, 2019, 2:08pm UTC](https://molflow-forum.web.cern.ch/t/error-in-direct-simulation-monte-carlo-method/209/3 "2019-07-16T14:08:00Z")

</div>

Hello Chao:

&nbsp; The Test-Particle Monte Carlo method employed&nbsp; by Molflow+ is certainly affected by statistical noise and related errors, but usually the speed of the code is such that the statistical noise smooths down quite rapidly.

&nbsp; For instance, when calculating the transmission probability of a tube, alfa,, it scales as

&nbsp; &nbsp;sqrt(alfa\*(1-alfa)/N\_tr)

&nbsp; ... where N\_tr is the number of transmitted molecules.

&nbsp; So, the convergence is rather slow, only as 1/sqrt(N), but nevertheless Molflow+ can typically generate millions of molecules in reasonably short times, so that unless alfa is EXTREMELY small, the statistical error is also small.

&nbsp; For cases when alfa is small, some "tricks" may be used... see for instance the excellent paper on the calculation of the transmission probability for one part of the KATRIN neutrino experiment (transport of tritium molecules towards the spectrometer) here:

&nbsp; "Time-dependent simulation of the flow reduction of D2 and T2 in the KATRIN experiment", Vacuum 159 (2019) p161-172

&nbsp;&nbsp;[https://doi.org/10.1016/j.vacuum.2018.10.002](https://doi.org/10.1016/j.vacuum.2018.10.002 "Persistent link using digital object identifier")

&nbsp;

&nbsp; ... and reference [19] where the statistical errors are discussed and quantified.

&nbsp; &nbsp; That's all for now, hope it helps clarify this issue.

&nbsp; &nbsp; Roberto

&nbsp;&nbsp;
