plot module

Small wrappers aroung matplotlib to gather and plot parts of a waLBerla domain

waLBerla.plot.alongLine(blocks, name, sliceDef, fCoord=0, targetRank=0, **kwargs)

Plot a field value along a one dimensional slice through the domain

Parameters:
  • blocks – the blockstorage

  • name – Name of the block data to be plotted. Has to be a scalar field

  • sliceDef – a one dimensional slice through the domain. Can be created with waLBerla.makeSlice()

  • fCoord – value of the forth field coordinate (f)

  • targetRank – rank that gathers and plots the data

  • kwargs – further keyword arguments are passed to matplotlib.pyplot.plot()

waLBerla.plot.alongLineAnimation(blocks, name, sliceDef, runFunction, plotSetupFunction=<function <lambda>>, fCoord=0, targetRank=0, interval=30, frames=180, **kwargs)

Animated version of alongLine()

For parameter documentation see scalarFieldAnimation() and alongLine()

waLBerla.plot.scalarField(blocks, name, sliceDef, fCoord=0, targetRank=0, **kwargs)

Plots a 2D slice through the global domain as an image

Parameters:
  • blocks – the blockstorage

  • name – Name of the block data to be plotted. Has to be a scalar field

  • sliceDef – a two dimensional slice through the domain. Can be created with waLBerla.makeSlice

  • fCoord – value of the forth field coordinate (f)

  • targetRank – rank that gathers and plots the data

  • kwargs – further keyword arguments are passed to matplotlib.pyplot.imshow

waLBerla.plot.scalarFieldAnimation(blocks, name, sliceDef, runFunction, plotSetupFunction=<function <lambda>>, plotUpdateFunction=<function <lambda>>, fCoord=0, targetRank=0, interval=30, frames=180, **kwargs)

Creates animation of 2D slices through the global domain

Parameters:
  • runFunction – function without arguments which is run between frames (should move simulation forward)

  • plotSetupFunction – function without arguments that is called after the plot was initially created. Can be used to configure plot (set title etc.)

  • plotUpdateFunction – function without arguments that is called when figure is updated

  • interval – passed to matplotlib.animation.FuncAnimation: milliseconds between two frames

  • frames – passed to matplotlib.animation.FuncAnimation number of frames

for other params see scalarField()

waLBerla.plot.vectorField(blocks, name, sliceDef, xComponent=0, yComponent=1, targetRank=0, xStep=1, yStep=1, **kwargs)

Plots a vector field slice using matplotlib quiver

Parameters:
  • blocks – the blockstorage

  • name – Name of the block data to be plotted. Has to be a scalar field

  • sliceDef – a two dimensional slice through the domain. Can be created with waLBerla.makeSlice

  • xComponent – which component of the vector field (0,1 or 2) to take as the horizontal value for the quiver arrows

  • yComponent – which component of the vector field (0,1 or 2) to take as the vertical value for the quiver arrows

  • xStep – take only every xStep’s cell/arrow in x direction

  • yStep – take only every yStep’s cell/arrow in y direction

  • targetRank – rank that gathers and plots the data

  • kwargs – further keyword arguments are passed to matplotlib.pyplot.quiver