Skip to content

Plot fv 2d for issue #2998#3033

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

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

Conversation

@MagalieHeinrich

Copy link
Copy Markdown
Contributor

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.

@ranocha ranocha left a comment

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.

Please clean up the code as discussed offline.

@MagalieHeinrich

Copy link
Copy Markdown
Contributor 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

@ranocha ranocha left a comment

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 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>

@ranocha ranocha left a comment

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.

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 thread src/visualization/types.jl Outdated
Comment thread src/visualization/types.jl Outdated
@ranocha

ranocha commented May 28, 2026

Copy link
Copy Markdown
Member

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
Contributor 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 thread src/visualization/recipes_plots.jl
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
Contributor 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

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

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.

@ranocha ranocha left a comment

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.

Can you please also check a non-uniform case? For example, the output of

julia> using Trixi, Plots

julia> trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_amr.jl"), polydeg = 0); plot(sol)

with the release version of Trixi.jl and this branch? Please also add some regression test involving AMR.

# Map the continuous spatial coordinates from [-1, 1] to discrete matrix indices [1, true_resolution].
# The +0.5 shift combined with round() acts as a floor-like cell assignment.
ix = round(Int, (cx + 1) / 2 * true_resolution + 0.5)
iy = round(Int, (cy + 1) / 2 * true_resolution + 0.5)

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.

The spell checker complains about iy. While this is kind of a false positive, we use the indices i, j, k for x, y, z elsewhere in the code. Could you please adapt this?


# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks
sol = solve(ode, Euler();
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback

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.

Suggested change
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
dt = 1, # solve needs some value here but it will be overwritten by the stepsize_callback

We recently changed the default values to improve GPU support.

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