Trixi.jl icon indicating copy to clipboard operation
Trixi.jl copied to clipboard

Contours via Plots.jl are supported for TreeMesh

Open MarcoArtiano opened this issue 11 months ago • 5 comments

Contour plots can be easily done as follows pd = PlotData2D(sol), contour(pd["var_name"])

but the correct visualization is given only if the chosen mesh was TreeMesh. As an example: image

For all the other cases the image displayed is image

MarcoArtiano avatar Jan 13 '25 14:01 MarcoArtiano

This is very cool that it works with the contour plots. Any idea why it does not work for P4estMesh?

sloede avatar Jan 16 '25 12:01 sloede

This is very cool that it works with the contour plots. Any idea why it does not work for P4estMesh?

It looks like when the function PlotData2D is called, the mesh is structured as vectors for TreeMesh. That allows the correct visualization for contours.

On the other hand I saw that Makie.jl has recently came out with a feature to make contours also for unstructured/curvilinear grid, taking as inputs matrices of the spatial coordinates x and y. See Enable curvilinear contour . That will enable contours for all the other cases. However I'm having some issues with this feature.

ps: it looks like that the minimum version of CairoMakie that is compatible with Trixi is v.0.11.11, which doesn't include the above linked PR. And this looks related to Test CairoMakie 0.13

MarcoArtiano avatar Jan 23 '25 13:01 MarcoArtiano

When working on the visualization callback (#2225 ) I only recently realized that PlotData2D is specialized for TreeMesh. It produces a PlotData2DCartesian object in this case, while there will be PlotData2DTriangulated in all the other cases.

benegee avatar Jan 23 '25 14:01 benegee

ps: it looks like that the minimum version of CairoMakie that is compatible with Trixi is v.0.11.11, which doesn't include the above linked PR. And this looks related to Test CairoMakie 0.13

Updated on main

ranocha avatar Jan 28 '25 12:01 ranocha

ps: it looks like that the minimum version of CairoMakie that is compatible with Trixi is v.0.11.11, which doesn't include the above linked PR. And this looks related to Test CairoMakie 0.13

Updated on main

Thank you! Now it is possible to visualize contours, but there are errors in the interpolation.

For example:

Image

Image

I think this is due to the fact that PlotData2D for all mesh types (except TreeMesh) returns all the DOFs of the DG grid points. For this type of grid the coordinates values are not unique. We may assume, just for visualization purposes, a "CG" structure maybe, where the values on the discontinuous interfaces are interpolated (e.g. simply averaging).

MarcoArtiano avatar Feb 03 '25 14:02 MarcoArtiano