openmc.SourceBase

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

Base class for external sources

Parameters
  • 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
  • type ({'independent', 'file', 'compiled', 'mesh'}) – Indicator of source type.

  • strength (float) – Strength of the source

  • 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, meshes=None) SourceBase[source]

Generate 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.SourceBase

abstract populate_xml_element(element)[source]

Add necessary source information to an XML element

Returns

element – XML element containing source data

Return type

lxml.etree._Element

to_xml_element() Element[source]

Return XML representation of the source

Returns

element – XML element containing source data

Return type

xml.etree.ElementTree.Element