openmc.TokamakSource

class openmc.TokamakSource(major_radius: float, minor_radius: float, elongation: float, triangularity: float, shafranov_shift: float, r_over_a: Sequence[float], emission_density: Sequence[float], energy: Univariate | Sequence[Univariate], time: Univariate | None = None, phi_start: float = 0.0, phi_extent: float = 6.283185307179586, n_alpha: int = 101, vertical_shift: float = 0.0, strength: float = 1.0, constraints: dict[str, Any] | None = None)[source]

A source representing neutron emission from a tokamak plasma.

This source samples neutron positions from a tokamak plasma geometry using Miller-style flux surface parameterization. The user provides an emission profile S(r/a) as a function of normalized minor radius, along with one or more energy distributions.

The flux surface parameterization is

\[\begin{aligned} R &= R_0 + r \cos\left(\alpha + \delta \sin\alpha\right) + \Delta \left[1 - \left(\frac{r}{a}\right)^2\right] \\ Z &= Z_\mathrm{shift} + \kappa r \sin\alpha \end{aligned}\]

where \(R_0\) is major radius, \(a\) is minor radius, \(\kappa\) is elongation, \(\delta\) is triangularity, \(\Delta\) is the Shafranov shift, and \(Z_\mathrm{shift}\) is the vertical shift.

Added in version 0.15.4.

Parameters:
  • major_radius (float) – Major radius R0 in [cm]

  • minor_radius (float) – Minor radius a in [cm]

  • elongation (float) – Plasma elongation κ (must be > 0)

  • triangularity (float) – Plasma triangularity δ (must be in [-1, 1])

  • shafranov_shift (float) – Shafranov shift Δ in [cm] (must be >= 0 and < a/2)

  • r_over_a (numpy.ndarray) – Normalized minor radius grid points, must start at 0 and end at 1

  • emission_density (numpy.ndarray) – Emission density S(r) at each r/a point (arbitrary units, must be >= 0). Values are linearly interpolated between grid points and refined on an internal grid for radial sampling. Must have the same length as r_over_a and contain at least one positive value.

  • energy (openmc.stats.Univariate or Sequence[openmc.stats.Univariate]) – Energy distribution(s). Either a single distribution used at all radii, or one distribution per r_over_a grid point. When one distribution per grid point is given, the energy of a sampled particle is drawn from one of the two distributions bracketing its sampled radius, selected stochastically with probability proportional to the proximity of the radius to each grid point (stochastic interpolation).

  • time (openmc.stats.Univariate, optional) – Time distribution of the source. If None, particles are born at \(t=0\), matching the default behavior of openmc.IndependentSource.

  • phi_start (float) – Starting toroidal angle in [rad] (default: 0)

  • phi_extent (float) – Toroidal angle extent in [rad] (default: 2π)

  • n_alpha (int) – Number of poloidal angle grid points for CDF sampling (default: 101)

  • vertical_shift (float) – Vertical shift of the plasma center in [cm] (default: 0)

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

  • constraints (dict) – Constraints on sampled source particles. See SourceBase for valid keys and values.

Variables:
  • major_radius (float) – Major radius R0 in [cm]

  • minor_radius (float) – Minor radius a in [cm]

  • elongation (float) – Plasma elongation κ

  • triangularity (float) – Plasma triangularity δ

  • shafranov_shift (float) – Shafranov shift Δ in [cm]

  • r_over_a (numpy.ndarray) – Normalized minor radius grid points

  • emission_density (numpy.ndarray) – Emission density S(r) at each r/a point

  • energy (list of openmc.stats.Univariate) – Energy distribution(s)

  • time (openmc.stats.Univariate or None) – Time distribution of the source

  • phi_start (float) – Starting toroidal angle in [rad]

  • phi_extent (float) – Toroidal angle extent in [rad]

  • n_alpha (int) – Number of poloidal angle grid points

  • vertical_shift (float) – Vertical shift of the plasma center in [cm]

  • strength (float) – Strength of the source

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

  • constraints (dict) – Constraints on sampled source particles

classmethod from_xml_element(elem: Element) TokamakSource[source]

Generate tokamak source from an XML element

Parameters:

elem (lxml.etree._Element) – XML element

Returns:

Source generated from XML element

Return type:

openmc.TokamakSource

populate_xml_element(element)[source]

Add necessary tokamak source information to an XML element

Returns:

element – XML element containing source data

Return type:

lxml.etree._Element