Skip to content
Projects

freeofcharge.beam

Neutral beam markers: fast hydrogen atoms on straight lines.

A marker is a stream of atoms: a position and a velocity (Cartesian, z vertical) and a weight in atoms per second, held in a :class:plasmacoll.ParticleArrays. With MPI every rank holds its own share of the markers.

Classes

NameDescription
NeutralBeamNeutral markers of one isotope (positions (N, 3), weights in atoms/s).

Functions

NameDescription
tangential_injectionReturn the start point and direction of a horizontal beam axis.

NeutralBeamclassdataclass#

class NeutralBeam(markers: ParticleArrays, mass_number: int)

Neutral markers of one isotope (positions (N, 3), weights in atoms/s).

markersattributeinstance attribute#

markers: ParticleArrays

mass_numberattributeinstance attribute#

mass_number: int

Atomic mass number of the beam atoms (1 H, 2 D, 3 T).

directionsproperty#

directions

Return the unit directions (N, 3).

energiesproperty#

energies

Return the marker energies [eV].

massproperty#

mass: float

Return the atom mass [kg].

sizeproperty#

size: int

Return the number of local markers.

speedsproperty#

speeds

Return the marker speeds [m/s].

concatenatemethodclassmethod#

def concatenate(beams: Sequence[NeutralBeam]) -> NeutralBeam

Join beams of one isotope (e.g. energy components).

gaussianmethodclassmethod#

def gaussian(origin, direction, energy: float, power: float, *, mass_number: int = 2, width: float | tuple[float, float] = 0.0, divergence: float | tuple[float, float] = 0.0, halo_fraction: float = 0.0, halo_divergence: float | tuple[float, float] = 0.0, markers: int = 10000, seed: int | None = None, comm: MPI.Comm | None = None) -> NeutralBeam

Return a mono-energetic beam with Gaussian width and divergence.

The marker positions spread about origin with standard deviation width [m] across the axis, and their directions with standard deviations divergence [rad] in the two planes containing the axis: each a scalar or (horizontal, vertical), horizontal being the plane of the axis and z-normal. A share halo_fraction of the markers has the halo_divergence instead (core and halo, as BBNBI describes a beamlet). The markers are split between the ranks of comm; the weights give power [W] over all of them.

Parameters

NameTypeDefaultDescription
originrequiredCentre of the source plane [m].
directionrequiredBeam axis (any length).
energyfloatrequiredAtom energy [eV].
powerfloatrequiredBeam power [W].
mass_numberint2Isotope.
widthfloat | tuple[float, float]0.0Source half-width (standard deviation) [m].
divergencefloat | tuple[float, float]0.0Core divergence (standard deviation) [rad].
halo_fractionfloat0.0Share of markers in the halo.
halo_divergencefloat | tuple[float, float]0.0Halo divergence [rad].
markersint10000Number of markers over all ranks.
seedint | NoneNoneSeed of the random streams (per rank).
commMPI.Comm | NoneNoneCommunicator; serial if None.

powermethod#

def power(comm: MPI.Comm | None = None) -> float

Return the beam power over all ranks [W].

tangential_injectionfunction#

def tangential_injection(tangency_radius: float, start_radius: float, *, height: float = 0.0, toroidal_angle: float = 0.0, sense: int = 1) -> tuple[np.ndarray, np.ndarray]

Return the start point and direction of a horizontal beam axis.

The axis is tangent to the circle R = tangency_radius at the toroidal angle toroidal_angle and starts at R = start_radius, at Z = height; sense = +1 points along +phi at the tangency point.