Python API#

The MC/DC public API is centered on mcdc.Simulation. A simulation owns the model geometry and material, sources, tallies, settings, transport techniques, and runtime state needed for one calculation.

Build the model with the public objects listed below, attach its root cells, sources, and tallies to a simulation, and then visualize or run that simulation:

simulation = mcdc.Simulation(name="Example")
simulation.set_model([cell])
simulation.set_sources([source])
simulation.set_tallies([tally])
simulation.settings.N_particle = 10_000
simulation.run()

The complete public interfaces and additional examples are documented on each linked API page. For a task-oriented explanation of how these objects move through construction, compilation, execution, and output, see Simulation Lifecycle.

Simulation#

mcdc.Simulation

The complete model and configuration for one MC/DC calculation.

Model building blocks#

Materials#

Materials describe the physical media that fill cells. A native composition connects mcdc.Material to MC/DC’s data libraries, while optional particle-specific data augments native interaction data or supports specialized and reduced transport treatments. mcdc.NeutronMultigroupData represents neutron energy with discrete groups and stores groupwise macroscopic cross sections and related production data. mcdc.Material.multigroup() provides its convenient material interface.

mcdc.Material

Particle-interaction properties assigned to simulation cells.

mcdc.NeutronMultigroupData

Groupwise macroscopic interaction data for neutron multigroup transport.

Geometry#

Surfaces bound spatial regions, cells pair those regions with materials or universes, and universes and lattices organize repeated geometry.

mcdc.Surface

Geometric boundaries of simulation cells.

mcdc.Cell

Material- or universe-filled regions of the simulation geometry.

mcdc.Universe

Reusable collections of cells in the simulation geometry.

mcdc.Lattice

Repeated arrangements of universes in the simulation geometry.

Sources#

Sources describe the distribution of the initial particle population in the simulation.

mcdc.Source

Distributions of particles introduced into the simulation.

Tallies#

Tallies define the quantities to score and the filters over which those scores are accumulated.

mcdc.Tally

Quantities measured during the simulation.

Meshes#

Meshes provide spatial bins for mesh-filtered tallies and transport techniques.

mcdc.MeshUniform

Uniform spatial bins for simulation tallies and transport techniques.

mcdc.MeshStructured

Structured spatial bins for simulation tallies and transport techniques.

Configuration and execution#

Simulation settings#

Each mcdc.Simulation owns its settings at simulation.settings. Settings control particle histories, batches, random-number generation, transport modes, census times, particle banks, output, and GPU execution. Specialized modes are configured through methods such as simulation.settings.set_eigenmode(...) and simulation.settings.set_time_census(...). See mcdc.Simulation for the complete settings interface.

Transport techniques#

Transport techniques are grouped under simulation.technique. For example, enable implicit capture with simulation.technique.implicit_capture() or configure weight windows with simulation.technique.weight_windows(...). See mcdc.Simulation for the ownership model and examples.

Compiling and running#

Calling simulation.run() compiles the current Python object graph when needed, executes particle transport, and writes the configured output. simulation.visualize_model(...) similarly compiles when needed before rendering the model. Use simulation.compile() when an explicit compiled snapshot is required before either operation.

The internal compilation and packing stages are documented in Simulation Compilation and Runtime Data Layout.