SPISardRadii

The SPIShardRadii class encapsulates the output of the SPI shard radii \(Y_\mathrm{p}=r_\mathrm{p}^{5/3}\) obtained from DREAM, and is derived from the ScalarQuantity class. While the ordinary ScalarQuantity-functions treats \(Y_\mathrm{p}\) rather than \(r_\mathrm{p}\), this class contains wrappers for using the functionality in ScalarQuantity for \(r_\mathrm{p}\), and also for the total volume of all shards. For instance, the shard radii for all shards at all time steps can be extracted as follows:

from DREAM.DREAMOutput import DREAMOutput
...

do=DREAMOutput('output.h5')
rp=do.eqsys.Y_p.calcRadii()

A convenient way to illustrate an SPI simulation is to plot the shards in the poloidal cross section at different time frames, perhaps on top of a contour plot of another FluidQuantity, similar to the cover page of O. Vallhagens MSc thesis. This can be done with the plotPoloidal() method (using functionality from SPIShardPositions to calculate the radial coordinates). Moreover, support is included for making animations based on such plots. For example, an animation of an entire simulation with the background showing a contour plot of the total electron density can be created as follows:

do.eqsys.Y_p.animatePoloidal(backgroundQuantity=do.eqsys.n_tot)

Note

This class does currently not have access to the geometry used in the simulation, and hence the FluidQuantity background data is plotted on cylindrical flux surfaces regardless of the actual geometry.

Class documentation

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

Bases: DREAM.Output.ScalarQuantity.ScalarQuantity

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

Constructor.

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

Make an animation of poloidal plots of the SPI shards, including the specified time steps. It is also possible to include poloidal contours of a fluid quantity specified by the backgroudQuantity argument

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

  • backgroundQuantity (DREAM.Output.FluidQuantity.FluidQuantity) – FluidQuantity object for which the poloidal contours should be included in the background

calcRadii(shards=None, t=None)

calculates the actual shard radii (instead of r_p**(5/3) as used in the c++ core)

Parameters
  • shards (slice) – Shards wose radii should be calculated

  • t (slice) – time steps at whoch the radii should be calculated

Returns

shard radii

calcTotalVolume(shards=None, t=None)

calculates the total volume of the specified shards

shards: Shards whose volume should be calculated t: time steps at which the radii should be calculated

Returns

Total volume of all specified shards combined

plotPoloidal(ax=None, show=None, t=- 1, displayGrid=False, sizeFactor=5000.0, backgroundQuantity=None, **kwargs)

Plot the position and size of the pellet shards, possibly together with a background poloidal contour plot of another fluid quantity 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

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

  • sizeFactor (float) – factor used to scale up the shard radii (in meters) to make them visible in the plot

  • backgroundQuantity (DREAM.Output.FluidQuantity.FluidQuantity) – FluidQuantity object for which the poloidal contours should be included in the background

Returns

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

plotRadii(shards=None, **kwargs)

Wrapper for ScalarQuantity.plot(), calculating the actual shard radii (instead of r_p**(5/3) as used in the c++ core), and also allowing the user to select which shards’ radii to plot

Parameters

shards (slice) – Shards wose radii should be plotted

Returns

Axis object containing the plot

plotTotalVolume(shards=None, **kwargs)

Wrapper for ScalarQuantity.plot(), calculating the total volume of the specified shards,

Parameters

shards (slice) – Shards wose volume should be plotted