openmc.CompiledSource¶
- class openmc.CompiledSource(library: str | os.PathLike, parameters: str | None = None, strength: float = 1.0, constraints: dict[str, Any] | None = None)[source]¶
A source based on a compiled shared library
New in version 0.14.0.
- Parameters
library (path-like) – 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
, oropenmc.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 (pathlib.Path) – 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