logo

mc321.c


Simple steady-state Monte Carlo program in spherical, cylindrical and planar coordinates (using ANSI standard C). Used in the article:

SL Jacques, Light distributions from point, line and plane sources for photochemical reactions and fluorescence in turbid biological tissues. Photochem. Photobiol. 67:23-32, 1998.

Download the program: mc321.c

Compile the program:

cc -o mc321 mc321.c

Run the program:

./mc321

The output is: mc321.out, which yields the fluence rate (F [W/cm2]) for 3 types of sources:

  1. for a point source: Fsph [W/cm2 per W delivered]

  2. for a cylindrical source: Fcyl [W/cm2 per W/cm delivered]

  3. for a planar source: Fpla [W/cm2 per W/cm2 delivered]

The output file mc321.out can be plotted by the MATLAB program, lookmc321.m, yielding the following figure:


An introductory short-course on the Monte Carlo method discusses mc321.c. tutorial


Other Monte Carlo programs: omlc.org/software/mc