openmc.Settings

class openmc.Settings(**kwargs)[source]

Settings used for an OpenMC simulation.

Parameters

**kwargs (dict, optional) – Any keyword arguments are used to set attributes on the instance.

Variables
  • batches (int) – Number of batches to simulate

  • confidence_intervals (bool) – If True, uncertainties on tally results will be reported as the half-width of the 95% two-sided confidence interval. If False, uncertainties on tally results will be reported as the sample standard deviation.

  • create_fission_neutrons (bool) – Indicate whether fission neutrons should be created or not.

  • cutoff (dict) – Dictionary defining weight cutoff, energy cutoff and time cutoff. The dictionary may have ten keys, ‘weight’, ‘weight_avg’, ‘energy_neutron’, ‘energy_photon’, ‘energy_electron’, ‘energy_positron’, ‘time_neutron’, ‘time_photon’, ‘time_electron’, and ‘time_positron’. Value for ‘weight’ should be a float indicating weight cutoff below which particle undergo Russian roulette. Value for ‘weight_avg’ should be a float indicating weight assigned to particles that are not killed after Russian roulette. Value of energy should be a float indicating energy in eV below which particle type will be killed. Value of time should be a float in seconds. Particles will be killed exactly at the specified time.

  • delayed_photon_scaling (bool) –

    Indicate whether to scale the fission photon yield by (EGP + EGD)/EGP where EGP is the energy release of prompt photons and EGD is the energy release of delayed photons.

    New in version 0.12.

  • electron_treatment ({'led', 'ttb'}) – Whether to deposit all energy from electrons locally (‘led’) or create secondary bremsstrahlung photons (‘ttb’).

  • energy_mode ({'continuous-energy', 'multi-group'}) – Set whether the calculation should be continuous-energy or multi-group.

  • entropy_mesh (openmc.RegularMesh) – Mesh to be used to calculate Shannon entropy. If the mesh dimensions are not specified, OpenMC assigns a mesh such that 20 source sites per mesh cell are to be expected on average.

  • event_based (bool) –

    Indicate whether to use event-based parallelism instead of the default history-based parallelism.

    New in version 0.12.

  • generations_per_batch (int) – Number of generations per batch

  • max_lost_particles (int) –

    Maximum number of lost particles

    New in version 0.12.

  • rel_max_lost_particles (float) –

    Maximum number of lost particles, relative to the total number of particles

    New in version 0.12.

  • inactive (int) – Number of inactive batches

  • keff_trigger (dict) – Dictionary defining a trigger on eigenvalue. The dictionary must have two keys, ‘type’ and ‘threshold’. Acceptable values corresponding to type are ‘variance’, ‘std_dev’, and ‘rel_err’. The threshold value should be a float indicating the variance, standard deviation, or relative error used.

  • log_grid_bins (int) – Number of bins for logarithmic energy grid search

  • material_cell_offsets (bool) –

    Generate an “offset table” for material cells by default. These tables are necessary when a particular instance of a cell needs to be tallied.

    New in version 0.12.

  • max_particles_in_flight (int) –

    Number of neutrons to run concurrently when using event-based parallelism.

    New in version 0.12.

  • max_order (None or int) – Maximum scattering order to apply globally when in multi-group mode.

  • max_splits (int) –

    Maximum number of times a particle can split during a history

    New in version 0.13.

  • max_tracks (int) –

    Maximum number of tracks written to a track file (per MPI process).

    New in version 0.13.1.

  • max_write_lost_particles (int) –

    Maximum number of particle restart files (per MPI process) to write for lost particles.

    New in version 0.14.0.

  • no_reduce (bool) – Indicate that all user-defined and global tallies should not be reduced across processes in a parallel calculation.

  • output (dict) –

    Dictionary indicating what files to output. Acceptable keys are:

    path

    String indicating a directory where output files should be written

    summary

    Whether the ‘summary.h5’ file should be written (bool)

    tallies

    Whether the ‘tallies.out’ file should be written (bool)

  • particles (int) – Number of particles per generation

  • photon_transport (bool) – Whether to use photon transport.

  • plot_seed (int) – Initial seed for randomly generated plot colors.

  • ptables (bool) – Determine whether probability tables are used.

  • resonance_scattering (dict) – Settings for resonance elastic scattering. Accepted keys are ‘enable’ (bool), ‘method’ (str), ‘energy_min’ (float), ‘energy_max’ (float), and ‘nuclides’ (list). The ‘method’ can be set to ‘dbrc’ (Doppler broadening rejection correction) or ‘rvs’ (relative velocity sampling). If not specified, ‘rvs’ is the default method. The ‘energy_min’ and ‘energy_max’ values indicate the minimum and maximum energies above and below which the resonance elastic scattering method is to be applied. The ‘nuclides’ list indicates what nuclides the method should be applied to. In its absence, the method will be applied to all nuclides with 0 K elastic scattering data present.

  • run_mode ({'eigenvalue', 'fixed source', 'plot', 'volume', 'particle restart'}) – The type of calculation to perform (default is ‘eigenvalue’)

  • seed (int) – Seed for the linear congruential pseudorandom number generator

  • source (Iterable of openmc.SourceBase) – Distribution of source sites in space, angle, and energy

  • sourcepoint (dict) –

    Options for writing source points. Acceptable keys are:

    batches

    list of batches at which to write source

    overwrite

    bool indicating whether to overwrite

    separate

    bool indicating whether the source should be written as a separate file

    write

    bool indicating whether or not to write the source

    mcpl

    bool indicating whether to write the source as an MCPL file

  • statepoint (dict) –

    Options for writing state points. Acceptable keys are:

    batches

    list of batches at which to write statepoint files

  • surf_source_read (dict) –

    Options for reading surface source points. Acceptable keys are:

    path

    Path to surface source file (str).

  • surf_source_write (dict) –

    Options for writing surface source points. Acceptable keys are:

    surface_ids

    List of surface ids at which crossing particles are to be banked (int)

    max_particles

    Maximum number of particles to be banked on surfaces per process (int)

    mcpl

    Output in the form of an MCPL-file (bool)

  • survival_biasing (bool) – Indicate whether survival biasing is to be used

  • tabular_legendre (dict) – Determines if a multi-group scattering moment kernel expanded via Legendre polynomials is to be converted to a tabular distribution or not. Accepted keys are ‘enable’ and ‘num_points’. The value for ‘enable’ is a bool stating whether the conversion to tabular is performed; the value for ‘num_points’ sets the number of points to use in the tabular distribution, should ‘enable’ be True.

  • temperature (dict) – Defines a default temperature and method for treating intermediate temperatures at which nuclear data doesn’t exist. Accepted keys are ‘default’, ‘method’, ‘range’, ‘tolerance’, and ‘multipole’. The value for ‘default’ should be a float representing the default temperature in Kelvin. The value for ‘method’ should be ‘nearest’ or ‘interpolation’. If the method is ‘nearest’, ‘tolerance’ indicates a range of temperature within which cross sections may be used. If the method is ‘interpolation’, ‘tolerance’ indicates the range of temperatures outside of the available cross section temperatures where cross sections will evaluate to the nearer bound. The value for ‘range’ should be a pair of minimum and maximum temperatures which are used to indicate that cross sections be loaded at all temperatures within the range. ‘multipole’ is a boolean indicating whether or not the windowed multipole method should be used to evaluate resolved resonance cross sections.

  • trace (tuple or list) – Show detailed information about a single particle, indicated by three integers: the batch number, generation number, and particle number

  • track (tuple or list) – Specify particles for which track files should be written. Each particle is identified by a tuple with the batch number, generation number, and particle number.

  • trigger_active (bool) – Indicate whether tally triggers are used

  • trigger_batch_interval (int) – Number of batches in between convergence checks

  • trigger_max_batches (int) – Maximum number of batches simulated. If this is set, the number of batches specified via batches is interpreted as the minimum number of batches

  • ufs_mesh (openmc.RegularMesh) – Mesh to be used for redistributing source sites via the uniform fission site (UFS) method.

  • verbosity (int) – Verbosity during simulation between 1 and 10. Verbosity levels are described in <verbosity> Element.

  • volume_calculations (VolumeCalculation or iterable of VolumeCalculation) – Stochastic volume calculation specifications

  • weight_windows (WeightWindows or iterable of WeightWindows) –

    Weight windows to use for variance reduction

    New in version 0.13.

  • weight_window_checkpoints (dict) –

    Indicates the checkpoints for weight window split/roulettes. Valid keys include “collision” and “surface”. Values must be of type bool.

    New in version 0.14.0.

  • weight_window_generators (WeightWindowGenerator or iterable of WeightWindowGenerator) –

    Weight windows generation parameters to apply during simulation

    New in version 0.14.0.

  • create_delayed_neutrons (bool) –

    Whether delayed neutrons are created in fission.

    New in version 0.13.3.

  • weight_windows_on (bool) –

    Whether weight windows are enabled

    New in version 0.13.

  • weight_windows_file (Pathlike) –

    Path to a weight window file to load during simulation initialization

  • write_initial_source (bool) – Indicate whether to write the initial source distribution to file

export_to_xml(path: Union[str, PathLike] = 'settings.xml')[source]

Export simulation settings to an XML file.

Parameters

path (str) – Path to file to write. Defaults to ‘settings.xml’.

classmethod from_xml(path: Union[str, PathLike] = 'settings.xml')[source]

Generate settings from XML file

New in version 0.13.0.

Parameters

path (str, optional) – Path to settings XML file

Returns

Settings object

Return type

openmc.Settings

classmethod from_xml_element(elem, meshes=None)[source]

Generate settings from XML element

Parameters
  • elem (lxml.etree._Element) – XML element

  • meshes (dict or None) – A dictionary with mesh IDs as keys and mesh instances as values that have already been read from XML. Pre-existing meshes are used and new meshes are added to when creating tally objects.

Returns

Settings object

Return type

openmc.Settings

to_xml_element(mesh_memo=None)[source]

Create a ‘settings’ element to be written to an XML file.

Parameters

mesh_memo (set of ints) – A set of mesh IDs to keep track of whether a mesh has already been written.