FluidQuantity

The FluidQuantity encapsulates the output of a fluid quantity in DREAM, i.e. a quantity which has a radial (\(r\)) and a temporal (\(t\)) dimension.

Class documentation

class DREAM.Output.FluidQuantity.FluidQuantity(name, data, grid, output, attr=[])

Bases: DREAM.Output.UnknownQuantity.UnknownQuantity

__getitem__(index)

Direct access to data.

__init__(name, data, grid, output, attr=[])

Constructor.

__repr__()

Convert this object to an “official” string.

animate(keep=[], ax=None, repeat=False, repeat_delay=None, speed=None, blit=True, save=None, dpi=None, **kwargs)

Creates an animation of the time evolution of this fluid quantity.

Parameters
  • keep (list) – List of time indices to keep after plotting.

  • repeat (bool) – If True, repeats the animation.

animatePoloidal(t=None, repeat=False, repeat_delay=None, speed=None, dpi=100, save=None, **kwargs)

Make an animation of poloidal plots of the present quantity, including the specified time steps.

Parameters
  • t (slice) – time steps to include in the animation

  • repeat (bool) – If True, repeats the animation.

  • repeat_delay (int) – Time between consecutive animation runs in milliseconds

  • speed (int) – delay between frames in milliseconds

  • dpi (float) – animation resolution

  • save (str) – title of the file (if any) into which the animation is saved

dumps(r=None, t=None)
get(r=None, t=None)

Returns the data in the specified time or radial point. If neither r nor t are given, returns the full spatiotemporal evolution of the profile.

integral(t=None, w=1.0)

Evaluate the volume integral of this fluid quantity in the given time step using a trapezoidal rule.

Parameters
  • t – Time step to integrate over. If None, integrates over radius in every time step. May be a slice.

  • w – Weighting function.

plot(ax=None, show=None, r=None, t=None, log=False, colorbar=True, VpVol=False, weight=None, unit='s', **kwargs)

Generate a contour plot of the spatiotemporal evolution of this quantity.

Parameters
  • ax – Matplotlib axes object to use for plotting.

  • show – If ‘True’, shows the plot immediately via a call to matplotlib.pyplot.show() with block=False. If None, this is interpreted as True if ax is also None.

  • log – If True, plot on a logarithmic scale.

  • colorbar – If True, and a 2D plot is requested, also draw a colorbar.

  • VpVol – Weight quantity with grid.VpVol when plotting.

  • weight – Optional quantity to weight this quantity with when plotting.

Returns

a matplotlib axis object and a colorbar object (which may be ‘None’ if not used).

plotIntegral(ax=None, show=None, unit='s', time_shift=0, time_scale_factor=1.0, w=1.0, time_derivative=False, log=False, **kwargs)

Plot the time evolution of the radial integral of this quantity.

Parameters
  • ax – Matplotlib axes object to use for plotting.

  • show – If True, shows the plot immediately via a call to matplotlib.pyplot.show() with block=False. If None, this is interpreted as True if ax is also None.

Returns

a matplotlib axis object.

plotPoloidal(ax=None, show=None, t=- 1, colorbar=True, displayGrid=False, maxMinScale=True, logscale=False, **kwargs)

Plot the radial profile of this quantity revolved over a poloidal cross section at the specified time step. NOTE: Currently assumes a cylindrical flux surface geometry!

Parameters
  • ax (matplotlib.pyplot.Axis) – Matplotlib axes object to use for plotting.

  • show (bool) – If ‘True’, shows the plot immediately via a call to ‘matplotlib.pyplot.show()’ with ‘block=False’. If ‘None’, this is interpreted as ‘True’ if ‘ax’ is also ‘None’.

  • t (int) – Time index to plot.

  • colorbar (matplotlib.pyplot.Colorbar) – Specify wether or not to include a colorbar.

  • displayGrid (bool) – Specify wether or not to display a polar grid in the plot.

  • maxMinScale (bool) – If ‘True’, set tha max and min of the color scale to the maximum and minimum values of the data stored by this object over all time steps.

Returns

a matplotlib axis object and a colorbar object (which may be ‘None’ if not used).

plotRadialProfile(t=- 1, ax=None, show=None, VpVol=False, weight=None, log=False, **kwargs)

Plot the radial profile of this quantity at the specified time slice.

Parameters
  • t – Time index to plot.

  • ax – Matplotlib axes object to use for plotting.

  • show – If True, shows the plot immediately via a call to matplotlib.pyplot.show() with block=False. If None, this is interpreted as True if ax is also None.

  • VpVol – If True, weight the radial profile with the spatial jacobian V’.

  • weight – Optional quantity to weight this quantity with when plotting.

  • log – If True, plot on a logarithmic scale.

Returns

a matplotlib axis object.

plotTimeProfile(r=0, ax=None, show=None, VpVol=False, weight=None, log=False, **kwargs)

Plot the temporal profile of this quantity at the specified radius.

Parameters
  • r – Radial index to plot evolution for.

  • ax – Matplotlib axes object to use for plotting.

  • show – If True, shows the plot immediately via a call to matplotlib.pyplot.show() with block=False. If None, this is interpreted as True if ax is also None.

  • VpVol – If True, weight the radial profile with the spatial jacobian V’.

  • weight – Optional quantity to weight this quantity with when plotting.

  • log – If True, plot on a logarithmic scale.

Returns

a matplotlib axis object.

print(r=None, t=None)

Print the data in this quantity.