nbi
Input data representing NBI.
Neutral beam injectors are used by BBNBI to generate NBI-ion source and calculate shinethrough.
Object representing a bundle of injectors used as an input in BBNBI. |
- class a5py.ascot5io.nbi.NBI(root, path, **kwargs)
Bases:
DataGroupObject representing a bundle of injectors used as an input in BBNBI.
An injector bundle means that the particles generated from those with BBNBI are not separable. If your work requires that the different NBI sources are kept separate, then use different bundles for those (a bundle can consists of a single injector). Otherwise it is more convenient to combine injectors in a single bundle since it then produces a single BBNBI output.
- static create_dummy()
Create dummy data that has correct format and is valid, but can be non-sensical.
This method is intended for testing purposes or to provide data whose presence is needed but which is not actually used in simulation.
The dummy output is a very large rectangular wall.
- Returns:
- data
dict Input data that can be passed to
write_hdf5method of a corresponding type.
- data
- static generate(r, phi, z, tanrad, focallen, dgrid, nbeamlet, anum, znum, mass, energy, efrac, power, div, tilt=None, tanz=None, divhalofrac=None, divhalo=None, ids=1, desc=None)
Generate a generic injector.
The injector grid can be either circular or rectangular, and will be randomly populated with beamlets with a common focus point.
The contents of this function can be used as a template for implementing machine-specific injectors with an actual geometry.
- Parameters:
- r
float Injector center point R-coordinate [m].
- phi
float Injector center point phi-coordinate [deg].
- z
float Injector center point z-coordinate [m].
- tanrad
float Tangency radius of the injector centerline [m].
- focallen
float Distance to the focus point from the center of the grid
- dgrid
floator array_like (2,) Diameter of circular grid or width and height of rectangular grid
- nbeamlet
int Number of beamlets in this injector
- anum
int Mass number of injected species
- znum
int Nuclear charge number of injected species
- mass
float Mass of the injected species [amu]
- energy
float Full injection energy [eV]
- efracarray_like (3,)
Particle fractions for full, 1/2 and 1/3 energies
- power
float Injected power [W]
- divarray_like (2,)
Horizontal and vertical divergences [rad]
- tilt
float,optional Vertical tilt angle of the beam centerline [deg]
- tanz
float,optional Vertical shift of the tangency radius point [m]
- divhalofrac
float,optional Fraction of particles with halo divergence
- divhalo
float,optional Horizontal and vertical divergences [rad]
- ids
int,optional Unique numerical identifier for this injector.
- r
- Returns:
- inj
Injector A single injector.
- inj
- read()
Read data from HDF5 file.
- Returns:
- data
dict Data read from HDF5 stored in the same format as is passed to
write_hdf5().
- data
- static write_hdf5(fn, ninj, injectors, desc=None)
Write input data to the HDF5 file.
- class a5py.ascot5io.nbi.Injector(ids, anum, znum, mass, energy, efrac, power, divh, divv, divhalofrac, divhaloh, divhalov, nbeamlet, beamletx, beamlety, beamletz, beamletdx, beamletdy, beamletdz)
Bases:
objectA single injector made up of beamlets
- Attributes:
- ids
int Numerical identifier for this injector which should be unique in an input bundle.
- anum
int Mass number of injected species.
- znum
int Nuclear charge number of injected species.
- mass
float Mass of the injected species [amu].
- energy
float Full injection energy [eV].
- efracarray_like (3,)
Particle fractions for full, 1/2 and 1/3 energies.
- power
float Injected power [W].
- divh
float Horizontal divergence [rad].
- divv
float Vertical divergence [rad].
- divhalofrac
float Fraction of particles with halo divergence.
- divhaloh
float Horizontal divergence in halo [rad].
- divhalov
float Vertical divergence in halo [rad].
- nbeamlet
int Number of beamlets.
- beamletxarray_like, (nbeamlet,)
x coordinates of beamlets [m].
- beamletyarray_like, (nbeamlet,)
y coordinates of beamlets [m].
- beamletzarray_like, (nbeamlet,)
z coordinates of beamlets [m].
- beamletdxarray_like, (nbeamlet,)
x components of the unit direction vector of beamlets.
- beamletdyarray_like, (nbeamlet,)
y components of the unit direction vector of beamlets.
- beamletdzarray_like, (nbeamlet,)
z components of the unit direction vector of beamlets.
- ids
- plotbeamlets(view='3d', direction=True, axes=None)
Plot the beamlets of this injector.
- Parameters:
- view{“rz”, “xy”, “3d”},
optional Control whether the plot is shown in (R,z) or (x,y) plane or in 3D.
- directionbool,
optional Flag for showing the beam direction with arrows originating from beamlets.
If False, only the beamlet locations are shown.
- axes
Axes,optional The axes where figure is plotted or otherwise new figure is created.
- view{“rz”, “xy”, “3d”},