trixi-framework / trixi-framework/Trixi.jl

Plot element variables with Plots.jl

Open
#2,767 1 comment 0 reactions 0 assignees View on GitHub
enhancement possible student project visualization
Dominant language
Julia
Stars
731
Forks
166
Avg merge
2d 18h
Merged PRs (30d)
25

Description

As discussed on Slack, it would be nice to be able to use Plots.jl or Makie to natively visualize element variables.

From @ranocha, the following can be used to visualize element variables over a uniform `TreeMesh`. However, it would be nice to enable more general visualization.

```julia
function get_element_variables(u_ode, semi)
element_variables = Dict{Symbol, Any}()

Trixi.get_element_variables!(element_variables, u_ode, semi)

if semi.mesh isa TreeMesh
cell_ids = semi.cache.elements.cell_ids
x = semi.mesh.tree.coordinates[1, cell_ids]
y = semi.mesh.tree.coordinates[2, cell_ids]
element_variables[:x] = x
element_variables[:y] = y
end

return element_variables
end

function do_cool_stuff()
# ...

element_variables = get_element_variables(integrator.u, semi)
hm_ind = heatmap!(ax_ind,
element_variables[:x],
element_variables[:y],
element_variables[:indicator_shock_capturing],
colorrange = (0.0, alpha_max),
colormap = :inferno)
Colorbar(fig[1, 2], hm_ind; vertical = false,
label = "Shock capturing indicator",
width = Relative(0.85))

# ...
end
```

Contributor guide

Open the contributing guide

Research direction

Start with Trixi.get_element_variables! and the shown TreeMesh coordinate handling, then compare how Plots.jl or Makie could consume element variables on nonuniform meshes. Done means element variables can be visualized natively beyond the uniform TreeMesh case, with the supported generality and verification approach agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.