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:
atomic_relaxation (bool) – Whether to simulate the atomic relaxation cascade (fluorescence photons and Auger electrons) following photoelectric and incoherent scattering interactions.
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.
collision_track (dict) –
Options for writing collision information. Acceptable keys are:
- max_collisions:
Maximum number of collisions to be banked per file. (int)
- max_collision_track_files:
Maximum number of collision_track files. (int)
- mcpl:
Output in the form of an MCPL-file. (bool)
- cell_ids:
List of cell IDs to define cells in which collisions should be banked. (list of int)
- universe_ids:
List of universe IDs to define universes in which collisions should be banked. (list of int)
- material_ids:
List of material IDs to define materials in which collisions should be banked. (list of int)
- nuclides:
List of nuclides to define nuclides in which collisions should be banked. (ex: [“I135m”, “U233”] ). (list of str)
- reactions:
List of reaction to define specific reactions that should be banked (ex: [“(n,fission)”, 2, “(n,2n)”] ). (list of str or int)
- deposited_E_threshold:
Number to define the minimum deposited energy during per collision to trigger banking. (float)
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 the following keys, ‘weight’, ‘weight_avg’, ‘survival_normalization’, ‘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. Value for ‘survival_normalization’ is a bool indicating whether or not the weight cutoff parameters will be applied relative to the particle’s starting weight or to its current weight.
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.
Added 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.
Added in version 0.12.
free_gas_threshold (float) – Energy multiplier (in units of \(kT\)) below which the free gas scattering treatment is applied for elastic scattering. If not specified, a value of 400.0 is used.
generations_per_batch (int) – Number of generations per batch
ifp_n_generation (int) – Number of generations to consider for the Iterated Fission Probability method.
max_lost_particles (int) –
Maximum number of lost particles
Added in version 0.12.
rel_max_lost_particles (float) –
Maximum number of lost particles, relative to the total number of particles
Added 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.
Added in version 0.12.
max_particles_in_flight (int) –
Number of neutrons to run concurrently when using event-based parallelism.
Added in version 0.12.
max_particle_events (int) –
Maximum number of allowed particle events per source particle.
Added in version 0.15.0.
max_order (None or int) – Maximum scattering order to apply globally when in multi-group mode.
max_history_splits (int) –
Maximum number of times a particle can split during a history
Added in version 0.13.
max_secondaries (int) –
Maximum secondary bank size
Added in version 0.15.3.
max_tracks (int) –
Maximum number of tracks written to a track file (per MPI process).
Added in version 0.13.1.
max_write_lost_particles (int) –
Maximum number of particle restart files (per MPI process) to write for lost particles.
Added 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.
properties_file (PathLike) – Location of the properties file to load cell temperatures/densities and material densities
random_ray (dict) –
Options for configuring the random ray solver. Acceptable keys are:
- distance_inactive:
Indicates the total inactive distance in [cm] a ray should travel
- distance_active:
Indicates the total active distance in [cm] a ray should travel
- ray_source:
Starting ray distribution (must be uniform in space and angle) as specified by a
openmc.SourceBaseobject.- volume_estimator:
Choice of volume estimator for the random ray solver. Options are ‘naive’, ‘simulation_averaged’, or ‘hybrid’. The default is ‘hybrid’.
- source_shape:
Assumed shape of the source distribution within each source region. Options are ‘flat’ (default), ‘linear’, or ‘linear_xy’.
- volume_normalized_flux_tallies:
Whether to normalize flux tallies by volume (bool). The default is ‘False’. When enabled, flux tallies will be reported in units of cm/cm^3. When disabled, flux tallies will be reported in units of cm (i.e., total distance traveled by neutrons in the spatial tally region).
- adjoint:
Whether to run the random ray solver in adjoint mode (bool). The default is ‘False’.
- sample_method:
Sampling method for the ray starting location and direction of travel. Options are prng (default), halton, or s2. s2 modifies the prng sampling method such that rays are sampled with directions (-1, 0, 0) or (1, 0, 0). This is used for verification against analytic transport benchmarks which are often derivied with a reduced angular domain.
- source_region_meshes:
List of tuples where each tuple contains a mesh and a list of domains. Each domain is an instance of openmc.Material, openmc.Cell, or openmc.Universe. The mesh will be applied to the listed domains to subdivide source regions so as to improve accuracy and/or conform with tally meshes.
- diagonal_stabilization_rho:
The rho factor for use with diagonal stabilization. This technique is applied when negative diagonal (in-group) elements are detected in the scattering matrix of input MGXS data, which is a common feature of transport corrected MGXS data. The default is 1.0, which ensures no negative diagonal elements are present in the iteration matrix and thus stabilizes the simulation. A value of 0.0 will disable diagonal stabilization. Values between 0.0 and 1.0 will apply a degree of stabilization, which may be desirable as stronger diagonal stabilization also tends to dampen the convergence rate of the solver, thus requiring more iterations to converge.
- adjoint_source:
Source object used to define localized adjoint source/detector response function.
Added in version 0.15.0.
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
stride (int) – Number of random numbers allocated for each source particle history
source (Iterable of openmc.SourceBase) – Distribution of source sites in space, angle, and energy
source_rejection_fraction (float) – Minimum fraction of source sites that must be accepted when applying rejection sampling based on constraints. If not specified, the default value is 0.05.
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)
- max_source_files:
Maximum number of surface source files to be created (int)
- mcpl:
Output in the form of an MCPL-file (bool)
- cell:
Cell ID used to determine if particles crossing identified surfaces are to be banked. Particles coming from or going to this declared cell will be banked (int)
- cellfrom:
Cell ID used to determine if particles crossing identified surfaces are to be banked. Particles coming from this declared cell will be banked (int)
- cellto:
Cell ID used to determine if particles crossing identified surfaces are to be banked. Particles going to this declared cell will be banked (int)
surface_grazing_cutoff (float) – Surface flux cosine cutoff. If not specified, the default value is 0.001. For more information, see the surface tally section in the theory manual.
surface_grazing_ratio (float) – Surface flux cosine substitution ratio. If not specified, the default value is 0.5. For more information, see the surface tally section in the theory manual.
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
batchesis interpreted as the minimum number of batchesuniform_source_sampling (bool) – Whether to sampling among multiple sources uniformly, applying their strengths as weights to sampled particles.
ufs_mesh (openmc.RegularMesh) – Mesh to be used for redistributing source sites via the uniform fission site (UFS) method.
use_decay_photons (bool) – Produce decay photons from neutron reactions instead of prompt
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 (WeightWindowsList) –
Weight windows to use for variance reduction
Added 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.
Added in version 0.14.0.
weight_window_generators (WeightWindowGenerator or iterable of WeightWindowGenerator) –
Weight windows generation parameters to apply during simulation
Added in version 0.14.0.
create_delayed_neutrons (bool) –
Whether delayed neutrons are created in fission.
Added in version 0.13.3.
weight_windows_on (bool) –
Whether weight windows are enabled
Added 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: 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: str | PathLike = 'settings.xml')[source]
Generate settings from XML file
Added in version 0.13.0.
- Parameters:
path (str, optional) – Path to settings XML file
- Returns:
Settings object
- Return type:
- 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: