reactor_simulation


reactor_simulation, a Python code which simulates the shielding effect of a slab intended to absorb or reflect most of the radiation from a neutron source. This code is intended as a simple demonstration of Monte Carlo simulation as applied to the analysis of complicated probabilistic systems.

The code was developed in the book "Numerical Methods and Software".

The reactor is modeled as a point source, located at (0,0,0).

A particle emitted from the reactor has a random initial direction, and an energy selected from [Emin,Emax] with a 1/Sqrt(E) distribution.

The shield is modeled as a wall of thickness THICK, extending from 0 to THICK in the X direction, and extending forever in the Y and Z directions.

Based on the particle energy, a distance D is computed which measures how far the particle could travel through the shield before colliding.

Based on the particle direction, the position is updated by D units.

If the particle is now to the left of the shield, it is counted as being REFLECTED.

If the particle is to the right of the shield, it is counted as being ABSORBED.

If the particle is inside the shield, it has COLLIDED. A particle that collides is either absorbed (end of story) or SCATTERED with a new random direction and a new (lower) energy.

Every particle is followed from origin to its final fate, which is reflection, transmission, or absorption. At the end, a summary is printed, giving the number of particles with each fate, and the average energy of each group of particles.

Increasing NTOT, the number of particles used, will improve the expected reliability of the results.

Increasing THICK, the thickness of the shield, should result in more absorptions and reflections.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

reactor_simulation is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and codes:

reactor_simulation_test

python_simulation, a Python code which uses simulation to study card games, contests, and other processes which have a random element. Usually, the purpose is to try to predict the average behavior of the system over many trials.

Reference:

  1. David Kahaner, Cleve Moler, Steven Nash,
    Numerical Methods and Software,
    Prentice Hall, 1989,
    ISBN: 0-13-627258-4,
    LC: TA345.K34.

Source Code:


Last revised on 26 November 2022.