The DistributionFunction
encapsulates the output of a distribution function
from DREAM, and is the base class from which the more specific
HotElectronDistributionFunction and RunawayElectronDistributionFunction classes are derived.
DREAM.Output.DistributionFunction.
DistributionFunction
(name, data, grid, output, momentumgrid=None, attr=[])¶Bases: DREAM.Output.KineticQuantity.KineticQuantity
__init__
(name, data, grid, output, momentumgrid=None, attr=[])¶Constructor.
currentDensity
(t=None, r=None)¶Calculates the current density carried by the electrons of this distribution function.
density
(t=None, r=None)¶Calculates the total density of this distribution function.
kineticEnergy
(t=None, r=None)¶Calculates the kinetic energy contained in the distribution function. (energy in Joule).
partialDensity
(t=None, r=None, pc=None)¶Calculate the density of electrons contained above a momentum pc
. If
a value for pc
is not explicitly given, it is taken as either the
critical momentum other.fluid.pCrit
if available, or as the
approximation pc = 1/sqrt(E/Ec-1)
.
The parameter pc
may be a scalar or a fluid quantity, varying in
time and space.
plasmaCurrent
(t=None)¶Calculates the total plasma current carried by the electrons of this distribution function.
plot
(t=- 1, r=0, moment='distribution', p2=None, ax=None, show=None, logy=True, **kwargs)¶Alias for semilogy()
henceforth.
plot2D
(t=- 1, r=0, ax=None, show=None, logarithmic=True, coordinates=None, interpolateCylindrical=False, **kwargs)¶Make a contour plot of this quantity.
t (int) – Time index to plot.
r (int) – Radial index to plot.
ax – Matplotlib axes object to use for plotting.
show (bool) – If True
, or None
and ax
is NOT provided, calls matplotlib.pyplot.show()
just before returning.
logarithmic (bool) – If True
, uses a logarithmic colour scale.
coordinates (str) – Name of coordinates to use (either ‘spherical’ (p/xi) or ‘cylindrical’ (ppar/pperp)).
kwargs – Keyword arguments passed on to matplotlib.contourf().
pressure
(t=None, r=None)¶Evaluates the parallel and perpendicular pressure moments of the distribution function according to
where <…> denotes an integral over all of momentum space. The pressure is returned in units of Pa.
Tuple consisting of parallel and perpendicular pressures.
runawayRate
(t=None, r=None, pc=None)¶Calculate the runaway rate, with the given definition of critical momentum, as a moment of the distribution function.
semilog
(t=- 1, r=0, p2=None, ax=None, show=None, **kwargs)¶Alias for semilogy()
.
semilogy
(t=- 1, r=0, moment='distribution', p2=None, ax=None, show=None, **kwargs)¶Plot this distribution function on a semilogarithmic scale. If ‘p2’ is None, the distribution function is first angle-averaged. Otherwise, ‘p2’ is interpreted as an index into the distribution function (second momentum dimension, i.e. xi or pperp).
t (int) – Integer, or list of integers, specifying the time indices of the distributions to plot.
r (int) – Integer, or list of integers, specifying the radial indices of the distributions to plot.
moment (str) – String (or array) speciyfing the angle averaged moment of the distribution to plot. See DREAM.Output.KineticQuantity.KineticQuantity.angleAveraged()
for possible values.
p2 (int) – Index into second momentum parameter (xi or pperp) of distribution to plot.
ax (matplotlib.Axes) – Axes object to draw on.
show (bool) – If True
, show the figure after plotting.
synchrotron
(model='spectrum', B=3.1, wavelength=7e-07, t=None, r=None)¶Returns the synchrotron radiation emitted by this distribution function
as a DREAM.Output.KineticQuantity.KineticQuantity
.
model (str) – Model to use for synchrotron moment. Either ‘spectrum’ (for synchrotron spectrum at specified wavelength and magnetic field) or ‘total’ (for total emitted power).
B (float) – Magnetic field strength to use with ‘spectrum’ model.
wavelength (float) – Wavelength to use with ‘spectrum’ model (in meters).