openmc.CompiledSource

class openmc.CompiledSource(library: Optional[str] = None, parameters: Optional[str] = None, strength: float = 1.0, constraints: Optional[Dict[str, Any]] = None)[source]

A source based on a compiled shared library

New in version 0.14.0.

Parameters
  • library (str or None) – Path to a compiled shared library

  • parameters (str) – Parameters to be provided to the compiled shared library function

  • strength (float) – Strength of the source

  • 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
  • library (str or None) – Path to a compiled shared library

  • parameters (str) – Parameters to be provided to the compiled shared library function

  • strength (float) – Strength of the source

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

  • 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) CompiledSource[source]

Generate a compiled 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.CompiledSource

populate_xml_element(element)[source]

Add necessary compiled source information to an XML element

Returns

element – XML element containing source data

Return type

lxml.etree._Element