% !TEX root = ../thesis.tex % !TEX useTabs %% LaTeX2e class for student theses %% sections/montecarlo.tex %% %% Karlsruhe Institute of Technology %% Institute for Program Structures and Data Organization %% Chair for Software Design and Quality (SDQ) %% %% Dr.-Ing. Erik Burger %% burger@kit.edu %% %% Version 1.3.3, 2018-04-17 \chapter{Monte Carlo and computation techniques} \label{ch:mon} In Physics, Monte Carlo simulations are used to emulate complex physical problems on computers by dismantling them into their underlying basic processes. These basic processes follow probability distributions, which can in general be gained from experiment or theory. In Monte Carlo simulations these probability distributions are imitated using random numbers. The creation of uniform pseudo random numbers on computers is covered in \autoref{sec:mon:rng}. The sampling of arbitrary statistical distributions from these uniform random numbers is treated in \autoref{sec:mon:sample}. In physics Monte Carlo simulations are often used to determine the properties of a complex system by repetitive simulation of single particles in this system. A common approach is a semi-classical Monte Carlo simulation, where particle propagation and interactions between particles is separated. Particle interactions are treated quantum mechanically and are therefore described by probability distributions. The statistical description of particle interactions is covered in \autoref{sec:mon:interactions}. Following an interaction the particle will be deflected by a certain scattering angle. The calculation of the final direction of motion after an interaction is treated in \autoref{sec:mon:dir}. Propagation of particles is treated classically in semi classical Monte Carlo simulations and is therefore definite. Free propagation without external forces is trivial and determined by conservation of momentum. The trajectory of charged particles in electric and magnetic fields is complex and usually not analytically solvable. Two algorithms for numerical trajectory calculation of charged particles in electric and magnetic field are presented in \autoref{sec:mon:boris} and \autoref{sec:mon:drift}. Analogous to real physical experiments, Monte Carlo simulations need high statistics for good results. This requires high wall times. A good way to reduce the computation time is parallel computation. In section \ref{sec:mon:mpi} the \ac{mpi} for parallel computing is introduced. \section{Random number generation} \label{sec:mon:rng} Random numbers are essential for the quality of a Monte Carlo simulation. Real random numbers can only be obtained from real physical experiments. Thus using these is possible but often not practicable. Typically, Monte Carlo simulations use \acp{prng}, which create numbers using special algorithms. The numbers are random in good approximation. The randomness depends on the algorithm implemented and often scales with computation effort. The first \ac{prng} was the congruential generator proposed in 1951 \cite{Lehmer:1951aa}. New elements are calculated by \begin{equation} \label{eq:mon:con} x_{k+1} = (a \cdot x_k + b)\bmod M \, \end{equation} where $x_0$, $a$, $b$ and $M$ are initial integer values for the \ac{prng} and $b