xBOUT icon indicating copy to clipboard operation
xBOUT copied to clipboard

Extend `poloidal_plot` option in `animate_list()` to support polygon plotting.

Open mrhardman opened this issue 10 months ago • 1 comments

Mike Kryjak improved the poloidal plotting in https://github.com/boutproject/xBOUT/pull/280, by introducing a function https://github.com/boutproject/xBOUT/blob/64408ea26de5751f6104fcd8598ab250e237b049/xbout/plotting/plotfuncs.py#L852-L872 , so that unphysical artefacts of plotting do not appear. This feature has not been extended to support animate_list, used in examples in Hermes-3, e.g.,

ds.bout.animate_list(
    ["Nd"],
    poloidal_plot=True,
    show=True,
    save_as="hermes_animation",
)

This appears to affect nonorthogonal grids particularly badly. The figures below are generated from two simulations of neutral diffusion on orthogonal and nonorthogonal grids for the same physics case.

Orthogonal output: Image Nonorthogonal output showing fictitious artefacts: Image

mrhardman avatar Jan 31 '25 15:01 mrhardman

Further notes:

It looks like the function that requires upgrading is https://github.com/boutproject/xBOUT/blob/64408ea26de5751f6104fcd8598ab250e237b049/xbout/plotting/animate.py#L93, with changes to lines https://github.com/boutproject/xBOUT/blob/64408ea26de5751f6104fcd8598ab250e237b049/xbout/plotting/animate.py#L263-L271 needed to replace Pcolormesh.

Unfortunately it looks like animatplot does not support a plot option like plot2d_polygon, i.e., it is not clear if we can supply a list of frames make by a homemade plotting function to the animator. https://animatplot.readthedocs.io/en/stable/api.html.

mrhardman avatar Feb 10 '25 10:02 mrhardman