Simulation

Metatypes for configuring and running a simulation.

Description

A stationary muon (tau) flux can be approximated by a finite number of independent Monte Carlo particles (events). Let us assume that the primary (initial) flux density is known on a surface bounding the simulation space. Let us consider another surface of interest (detector) inside the simulation space. The flux density on the detector surface is estimated by Monte Carlo transport of particles from (to) the primary surface.

Running a Monte Carlo simulation with PUMAS is usually done in three steps as illustrated in the example below.

  • First one creates and configure a simulation Context. This requires a set of materials tabulations e.g. computed beforehand with the build function, as well as a Geometry description of the simulation space. The simulation can be configured by selecting a specific transport algorithm (Mode), specifying a stop Event e.g. a Medium change and / or an external Limit, e.g. a minimal kinetic energy.

  • Secondly a Monte Carlo particle State is created an initialised, e.g. according to the Primary flux density.

  • Last the Monte Carlo particle is transported (updated) using the Context.transport method.

The two last steps are usually repeated in a loop and some property of interest is accumated, e.g. the flux on a detector surface.

In order to get more insight on the Monte Carlo transport one can attach a Recorder object to the simulation context. The recorder allows to supply a callback function that is executed at each Monte Carlo step.

Examples

-- Create a simulation context using the 'hybrid longitudinal' algorithm and a
-- uniform medium of infinite extension made of standard rock
local simulation = pumas.Context{
    physics = 'share/materials/standard',
    mode = 'hybrid longitudinal',
    geometry = 'StandardRock'
}

-- Create a Monte Carlo muon state with 100 GeV initial kinetic energy
local state = pumas.State{energy = 100}

-- Propagate the muon through the standard rock medium
simulation:transport(state)

See also

Context, Event, Limit, Mode, Recorder, State.