openmc.FileSource

class openmc.FileSource(path: Optional[Union[str, PathLike]] = None, strength: float = 1.0, constraints: Optional[Dict[str, Any]] = None)[source]

A source based on particles stored in a file

New in version 0.14.0.

Parameters
  • path (str or pathlib.Path) – Path to the source file from which sites should be sampled

  • strength (float) – Strength of the source (default is 1.0)

  • constraints (dict) – Constraints on sampled source particles. Valid keys include ‘domains’, ‘time_bounds’, ‘energy_bounds’, ‘fissionable’, and ‘rejection_strategy’. For ‘domains’, the corresponding value is an iterable of openmc.Cell, openmc.Material, or openmc.Universe for which sampled sites must be within. For ‘time_bounds’ and ‘energy_bounds’, the corresponding value is a sequence of floats giving the lower and upper bounds on time in [s] or energy in [eV] that the sampled particle must be within. For ‘fissionable’, the value is a bool indicating that only sites in fissionable material should be accepted. The ‘rejection_strategy’ indicates what should happen when a source particle is rejected: either ‘resample’ (pick a new particle) or ‘kill’ (accept and terminate).

Variables
  • path (Pathlike) – Source file from which sites should be sampled

  • strength (float) – Strength of the source

  • type (str) – Indicator of source type: ‘file’

  • constraints (dict) – Constraints on sampled source particles. Valid keys include ‘domain_type’, ‘domain_ids’, ‘time_bounds’, ‘energy_bounds’, ‘fissionable’, and ‘rejection_strategy’.

classmethod from_xml_element(elem: Element) FileSource[source]

Generate file source from an XML element

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

  • meshes (dict) – Dictionary with mesh IDs as keys and openmc.MeshBase instances as values

Returns

Source generated from XML element

Return type

openmc.FileSource

populate_xml_element(element)[source]

Add necessary file source information to an XML element

Returns

element – XML element containing source data

Return type

lxml.etree._Element