plot module

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

waLBerla.plot.along_line(blocks, name, slice_definition, f_coordinate=0, target_rank=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

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

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

  • target_rank – rank that gathers and plots the data

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

waLBerla.plot.along_line_animation(blocks, name, slice_definition, run_function, plot_setup_function=<function <lambda>>, f_coordinate=0, target_rank=0, interval=30, frames=180, **kwargs)

Animated version of alongLine()

Parameters:
  • blocks – the blockforest

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

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

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

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

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

  • target_rank – rank that gathers and plots the data

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

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

waLBerla.plot.scalar_field(blocks, name, slice_definition, f_coordinate=0, target_rank=0, **kwargs)

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

Parameters:
  • blocks – the blockforest

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

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

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

  • target_rank – rank that gathers and plots the data

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

waLBerla.plot.scalar_field_animation(blocks, name, slice_definition, run_function, plot_setup_function=<function <lambda>>, plot_update_function=<function <lambda>>, f_coordinate=0, target_rank=0, interval=30, frames=180, **kwargs)

Creates animation of 2D slices through the global domain

Parameters:
  • blocks – the blockforest

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

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

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

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

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

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

  • target_rank – rank that gathers and plots the data

  • 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.vector_field(blocks, name, slice_definition, x_component=0, y_component=1, target_rank=0, x_step=1, y_step=1, **kwargs)

Plots a vector field slice using matplotlib quiver

Parameters:
  • blocks – the blockforest

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

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

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

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

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

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

  • target_rank – rank that gathers and plots the data

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