Unstructured plot sampling#

Sampling of unstructured-mesh processed variables for plotting.

Unstructured processed variables only interpolate at requested points; the regular visualisation grid and quiver sampling that pybamm.QuickPlot draws are display choices and live here.

pybamm.plotting.unstructured_plot_grid.plot_grid(variable: ProcessedVariableUnstructuredFVM | ProcessedVariableVectorFieldUnstructuredFVM, n_points: int = 200) → dict[str, ndarray[tuple[Any, ...], dtype[float64]]][source]#

Regular grid over a 2D variable’s mesh bounding box.

Parameters:
  • variable (ProcessedVariableUnstructuredFVM or ProcessedVariableVectorFieldUnstructuredFVM) – The 2D variable to plot.

  • n_points (int, optional) – Points per axis. Default is 200.

Returns:

One 1D array per axis, keyed "x" then "z".

Return type:

dict

pybamm.plotting.unstructured_plot_grid.quiver_data(variable: ProcessedVariableVectorFieldUnstructuredFVM, t: float, grid: dict[str, ndarray[tuple[Any, ...], dtype[float64]]], n_points: int = 20) → tuple[ndarray[tuple[Any, ...], dtype[float64]], ...][source]#

Vector components of a 2D variable on a coarse grid at time t.

Returns (X, Z, U, W): the meshgrid of sample points and the x and z components there.