Skip to content
jessicahunter24 edited this page Apr 17, 2013 · 18 revisions

After all the regions are created, geometry puts it all together. Not only is geometry the highest level in the hierarchy, but it also contains the Monte Carlo kernel and its options for running.

Geometry is initialized with the Geometry() constructor that takes in two arguments. The first is a spatial type that reflects the type of regions used (INFINITE_HOMOGENEOUS, HOMOGENEOUS_EQUIVALENCE, or HETEROGENEOUS) and a name/title of the geometry. The spatialType variable describes how the geometry is to be treated in the Monte Carlo simulation. When initialized, the Geometry() constructor automatically sets a default for the simulation settings: 10,000 neutrons per batch, 10 batches and one thread. It also sets the source sampling radius to 10 cm by default.

Regions can then be added to the geometry using addRegion(), in which the argument is the name the region was assigned to.

Infinite Homogeneous Case

>>> geometry = Geometry(INFINITE_HOMOGENEOUS)
>>> geometry.addRegion(region_mix)
>>> num_batches = 100
>>> geometry.setNumBatches(num_batches)
>>> num_neutrons_per_batch = 1000
>>> geometry.setNeutronsPerBatch(num_neutrons_per_batch)
>>> num_threads = 12
>>> geometry.setNumThreads(num_threads)
>>> setOutputDirectory('infinite_homogeneous_output')

##Batches and Threads Users have flexibility in determining how many neutrons are run in the simulation in the form of the number of batches and the number of neutrons per batch. Batch statistics are used in PINSPEC to provide the option of using confidence intervals. To set these parameters, use setNumBatches() and setNeutronsPerBatch(). It is also possible to define the number of threads for the run using setNumthreads(). All of these functions take an integer value. The setSourceSamplingRadius() command sets the source sampling radius (float) used for rejection sampling of random fission emission source sites.

It is important to note here that PINSPEC is not written for distributed memory applications. It is recommended for optimization purposes that the number of batches should be a multiple of the number of threads, and 1 thread per core is used. If the number of threads is greater than the number of batches, the number of threads will be rounded down to the number of batches.

The run parameters can be set in any part of the file before being assigned to geometry for quick edits later, or they can simply be entered as arguments in the geometry section. The command setOutputDirectory() allows users to set the name of the folder in which all output will be directed.

Homogeneous Equivalence (Pin Cell) Case

As shown in the example, fuel radius and pitch must be set for a HOMOGENEOUS_EQUIVALENCE geometry. These functions, setFuelPinRadius() and setPinCellPitch(), take in the fuel radius and pitch in units of cm. To check to see of they have been set corectly, or to retrieve them at a later time, the getFuelPinRadius() and getPinCellPitch() can be used.

>>> geometry = Geometry(HOMOGENEOUS_EQUIVALENCE)
>>> geometry.addRegion(region_mod)
>>> geometry.addRegion(region_fuel)
>>> geometry.setFuelRadius(radius_fuel)
>>> geometry.setPinCellPitch(pitch)
>>> geometry.getFuelRadius()
2.0
>>> geometry.getPinCellPitch()
1.0
>>> geometry.setNumBatches(10)
>>> geometry.setNeutronsPerBatch(100,000)
>>> geometry.setNumThreads(4)
>>> dancoff = 1.5
>>> geometry.setDancoffFactor(dancoff)
>>> setOutputDirectory('pin_cell_output')

##Running Monte Carlo simulation The geometry class also contains the command for running the simulation, but this command should be after the tally section, which is the next tutorial.

# After tallies, run simulation
>>> geometry.runMonteCarloSimulation

More of the geometry designation can be explored in the documentation.

Next: Tallies

Tutorials

Home