Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mrhardman opened this issue Jan 31, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@mrhardman
Copy link
Collaborator

Mike Kryjak improved the poloidal plotting in #280, by introducing a function

def plot2d_polygon(
da,
ax=None,
cax=None,
cmap="viridis",
norm=None,
logscale=False,
antialias=False,
vmin=None,
vmax=None,
extend="neither",
add_colorbar=True,
colorbar_label=None,
separatrix=True,
separatrix_kwargs={"color": "white", "linestyle": "-", "linewidth": 2},
targets=False,
add_limiter_hatching=False,
grid_only=False,
linewidth=0,
linecolor="black",
):

, 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 mrhardman added the enhancement New feature or request label Jan 31, 2025
@mrhardman
Copy link
Collaborator Author

mrhardman commented Feb 10, 2025

Further notes:

It looks like the function that requires upgrading is

def animate_poloidal(
, with changes to lines
amp.blocks.Pcolormesh(
da_region.coords[x].values,
da_region.coords[y].values,
da_region.values,
ax=ax,
cmap=cmap,
norm=norm,
**kwargs,
)
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant