Skip to content

Plot fv 2d for issue #2998#3033

Open
MagalieHeinrich wants to merge 20 commits into
trixi-framework:mainfrom
MagalieHeinrich:plot_fv_2d
Open

Plot fv 2d for issue #2998#3033
MagalieHeinrich wants to merge 20 commits into
trixi-framework:mainfrom
MagalieHeinrich:plot_fv_2d

Conversation

@MagalieHeinrich
Copy link
Copy Markdown

Marius Nickels (https://github.com/nickki-m) and I worked on issue #2998: "Improve plotting for 2D/3D simulations with polydeg = 0 on the TreeMesh (finite volume case)". With our additions the test example given in issue #2998 shows no red bars any more.

I used an AI assistant to help me get through some Git remote issues regarding the branch publishing/upload process.
I dont know whats wrong with Project.toml. I didnt touch it.

@github-actions
Copy link
Copy Markdown
Contributor

Review checklist

This checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging.

Purpose and scope

  • The PR has a single goal that is clear from the PR title and/or description.
  • All code changes represent a single set of modifications that logically belong together.
  • No more than 500 lines of code are changed or there is no obvious way to split the PR into multiple PRs.

Code quality

  • The code can be understood easily.
  • Newly introduced names for variables etc. are self-descriptive and consistent with existing naming conventions.
  • There are no redundancies that can be removed by simple modularization/refactoring.
  • There are no leftover debug statements or commented code sections.
  • The code adheres to our conventions and style guide, and to the Julia guidelines.

Documentation

  • New functions and types are documented with a docstring or top-level comment.
  • Relevant publications are referenced in docstrings (see example for formatting).
  • Inline comments are used to document longer or unusual code sections.
  • Comments describe intent ("why?") and not just functionality ("what?").
  • If the PR introduces a significant change or new feature, it is documented in NEWS.md with its PR number.

Testing

  • The PR passes all tests.
  • New or modified lines of code are covered by tests.
  • New or modified tests run in less then 10 seconds.

Performance

  • There are no type instabilities or memory allocations in performance-critical parts.
  • If the PR intent is to improve performance, before/after time measurements are posted in the PR.

Verification

  • The correctness of the code was verified using appropriate tests.
  • If new equations/methods are added, a convergence test has been run and the results
    are posted in the PR.

Created with ❤️ by the Trixi.jl community.

Copy link
Copy Markdown
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clean up the code as discussed offline.

@MagalieHeinrich
Copy link
Copy Markdown
Author

@ranocha I've added the requested comments and removed the debug command.

@ranocha ranocha marked this pull request as ready for review May 28, 2026 06:44
Copy link
Copy Markdown
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first round of review comments to show you the next steps in class.

Comment thread examples/tree_2d_dgsem/elixir_advection_finite_volume.jl
Comment thread examples/tree_2d_dgsem/elixir_advection_finite_volume.jl Outdated
Comment thread examples/tree_2d_dgsem/elixir_advection_finite_volume.jl Outdated
Comment thread examples/tree_2d_dgsem/elixir_advection_finite_volume.jl Outdated
Comment thread src/visualization/recipes_plots.jl
Comment thread src/visualization/types.jl Outdated
Comment thread src/visualization/types.jl
Comment thread examples/tree_1d_block_FV/elixir_advection_block_FV.jl Outdated
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Copy link
Copy Markdown
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check whether it works correctly for polydeg = 0 and polydeg > 0 also for locally refined meshes?

Comment thread src/visualization/recipes_plots.jl Outdated
Comment on lines +14 to +15
# Convert centers to edges to prevent heatmap from clipping boundary cells.
if length(x) == size(data[variable_id], 1) && length(y) == size(data[variable_id], 2)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is problematic since this check will also be true for the standard DG case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I unpack the solver in the first line where things are unpacked (unpack plot_data, variable_id, solver =pds).
I then use it in the if loop (if nnodes(solver)==1 && the things that were there before).
This works with the example from the issue.

Comment thread src/visualization/types.jl Outdated
Comment thread src/visualization/types.jl
@ranocha
Copy link
Copy Markdown
Member

ranocha commented May 28, 2026

To check the current behavior for DG methods, you can use code along the lines of

(@v1.10) pkg> activate --temp

(jl_kge4bE) pkg> add Trixi OrdinaryDiffEqLowStorageRK Plots

julia> using Trixi, Plots

julia> trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_basic.jl"), initial_refinement_level = 1); plot(sol)

and run the same commands except the package manager code on your branch for this PR to compare the results.

MagalieHeinrich and others added 4 commits May 30, 2026 14:12
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
@MagalieHeinrich
Copy link
Copy Markdown
Author

I tested with
"(@v1.10) pkg> activate --temp

(jl_kge4bE) pkg> add Trixi OrdinaryDiffEqLowStorageRK Plots

julia> using Trixi, Plots

julia> trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_basic.jl"), initial_refinement_level = 1); plot(sol)"

and it didnt throw an error.
Bild_2026-05-30_163920963

Comment on lines +23 to +32
xlims --> (x_edges[begin], x_edges[end])
ylims --> (y_edges[begin], y_edges[end])
aspect_ratio --> :equal

legend --> :none
title --> variable_names[variable_id]
colorbar --> :true
xguide --> _get_guide(orientation_x)
yguide --> _get_guide(orientation_y)
seriestype --> :heatmap
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this --> operator? I could only find documentation for the -> operator

https://docs.julialang.org/en/v1/base/base/#-%3E

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is special for plot recipes for Plots.jl, see https://docs.juliaplots.org/stable/RecipesBase/syntax/.

Comment thread src/visualization/recipes_plots.jl Outdated
@ranocha ranocha added the bug Something isn't working label Jun 2, 2026
@MagalieHeinrich MagalieHeinrich requested a review from ranocha June 7, 2026 16:03
@MagalieHeinrich
Copy link
Copy Markdown
Author

Hi @ranocha, I have removed the length checks in recipes_plots.jl. They are not necessary. I verified that both the FV (from the issue description) and DG (the one you sent me) examples are plotting correctly. The DG example works in Julia version 11 (not only in version 10 like a had thought last week).

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 7, 2026

Codecov Report

❌ Patch coverage is 16.00000% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.76%. Comparing base (80dc6c5) to head (14e5595).
⚠️ Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
src/visualization/recipes_plots.jl 12.50% 14 Missing ⚠️
src/visualization/types.jl 12.50% 14 Missing ⚠️
src/visualization/utilities.jl 6.67% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3033      +/-   ##
==========================================
- Coverage   96.92%   96.76%   -0.16%     
==========================================
  Files         635      637       +2     
  Lines       49338    49624     +286     
==========================================
+ Hits        47818    48016     +198     
- Misses       1520     1608      +88     
Flag Coverage Δ
unittests 96.76% <16.00%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working visualization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants