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
| Name | Description |
|---|---|
NeutralBeam | Neutral markers of one isotope (positions (N, 3), weights in atoms/s). |
Functions
| Name | Description |
|---|---|
tangential_injection | Return 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: ParticleArraysmass_numberattributeinstance attribute#
mass_number: intAtomic mass number of the beam atoms (1 H, 2 D, 3 T).
directionsproperty#
directionsReturn the unit directions (N, 3).
energiesproperty#
energiesReturn the marker energies [eV].
massproperty#
mass: floatReturn the atom mass [kg].
sizeproperty#
size: intReturn the number of local markers.
speedsproperty#
speedsReturn the marker speeds [m/s].
concatenatemethodclassmethod#
def concatenate(beams: Sequence[NeutralBeam]) -> NeutralBeamJoin 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) -> NeutralBeamReturn 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
| Name | Type | Default | Description |
|---|---|---|---|
origin | required | Centre of the source plane [m]. | |
direction | required | Beam axis (any length). | |
energy | float | required | Atom energy [eV]. |
power | float | required | Beam power [W]. |
mass_number | int | 2 | Isotope. |
width | float | tuple[float, float] | 0.0 | Source half-width (standard deviation) [m]. |
divergence | float | tuple[float, float] | 0.0 | Core divergence (standard deviation) [rad]. |
halo_fraction | float | 0.0 | Share of markers in the halo. |
halo_divergence | float | tuple[float, float] | 0.0 | Halo divergence [rad]. |
markers | int | 10000 | Number of markers over all ranks. |
seed | int | None | None | Seed of the random streams (per rank). |
comm | MPI.Comm | None | None | Communicator; serial if None. |
powermethod#
def power(comm: MPI.Comm | None = None) -> floatReturn 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.