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.
DistributionFunction(name, data, grid, output, momentumgrid=None, attr=)¶
__init__(name, data, grid, output, momentumgrid=None, attr=)¶
Calculates the current density carried by the electrons of this distribution function.
Calculates the total density of this distribution function.
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
a value for
pc is not explicitly given, it is taken as either the
other.fluid.pCrit if available, or as the
pc = 1/sqrt(E/Ec-1).
pc may be a scalar or a fluid quantity, varying in
time and space.
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)¶
plot2D(t=- 1, r=0, ax=None, show=None, logarithmic=True, coordinates=None, **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
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().
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.
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
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).