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

In-situ visualization #0: Make Makie available in 2D VisualizationCallback #2225

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

benegee
Copy link
Contributor

@benegee benegee commented Jan 9, 2025

This is the first step in reintegrating @s6nistam's work on in-situ visualization.

As an alternative to Plots.jl it adds plotting with GLMakie for 2D TreeMesh setups.

Copy link
Contributor

github-actions bot commented Jan 9, 2025

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

codecov bot commented Jan 12, 2025

Codecov Report

Attention: Patch coverage is 12.82051% with 34 lines in your changes missing coverage. Please review.

Project coverage is 96.79%. Comparing base (72c0571) to head (8568bec).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ext/TrixiMakieExt.jl 0.00% 29 Missing ⚠️
..._dgsem/elixir_advection_amr_visualization_makie.jl 0.00% 4 Missing ⚠️
src/callbacks_step/visualization.jl 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2225      +/-   ##
==========================================
- Coverage   96.88%   96.79%   -0.08%     
==========================================
  Files         490      491       +1     
  Lines       39491    39524      +33     
==========================================
  Hits        38257    38257              
- Misses       1234     1267      +33     
Flag Coverage Δ
unittests 96.79% <12.82%> (-0.08%) ⬇️

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

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

@sloede
Copy link
Member

sloede commented Jan 16, 2025

Nice! Looking forward to this!

@benegee benegee marked this pull request as ready for review January 20, 2025 11:09
@benegee
Copy link
Contributor Author

benegee commented Jan 20, 2025

Ready for review @trixi-framework/developers .

This PR involves places I have not been before (visualization, packages extensions, ...). Any feedback or hints would be highly appreciated.

# prevents anyone from using other packages, given that appropriate `plot_creator`s are
# passed.

# TODO: rest of this comment?
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be resolved in the merged source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, definitely!
I just need some explanation about the Requires.jl stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sloede It's been a while since you added this note. Could you help with updating it?

Copy link
Member

Choose a reason for hiding this comment

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

What's the current status - isn't Plots still using Requires.jl? What do we need to update - isn't this comment still valid?

Copy link
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.

Nice! I just had a quick look. This definitely should get an entry in NEWS.md

ext/TrixiGLMakieExt.jl Outdated Show resolved Hide resolved
ext/TrixiGLMakieExt.jl Outdated Show resolved Hide resolved
@@ -166,7 +179,7 @@ function (visualization_callback::VisualizationCallback)(integrator)
end

"""
show_plot(plot_data, variable_names;
show_plot(visualization_callback, plot_data, variable_names;
Copy link
Member

Choose a reason for hiding this comment

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

There are changes to documented API, so this is breaking. We should either enable the previous behavior again or include this only in a breaking release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True!
In fact, I did not think about someone calling show_plot directly. For the callback it is only called internally.
Waiting for a breaking release would of course be fine.

Copy link
Member

Choose a reason for hiding this comment

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

I guess nobody is using it actively, but it's documented API.

Project.toml Outdated
@@ -55,11 +55,13 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[weakdeps]
Convex = "f65535da-76fb-5f13-bab9-19810c17039a"
ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Copy link
Member

Choose a reason for hiding this comment

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

Does it need to be GLMakie.jl, or could it be also one of the other backends?

Copy link
Contributor Author

@benegee benegee Jan 20, 2025

Choose a reason for hiding this comment

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

Having the 3D case in mind, it would be nice if you could interactively turn your plot around.

But I am not sufficiently familiar with Makie. Can you make the implementation independent of a certain backend?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently that is how it is supposed to work. I feel amazed...

I now removed the GLMakie extension and moved its content to our existing Makie extension. For the added elixir both using GLMakie and using CairoMakie work (although the latter might not be too useful).

Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍

@ranocha ranocha marked this pull request as draft January 21, 2025 12:28
@ranocha
Copy link
Member

ranocha commented Jan 21, 2025

I converted this to a draft PR so that nobody accidentally merges it.

@ranocha
Copy link
Member

ranocha commented Feb 7, 2025

Shall we include this in the breaking release scheduled for soon? If so, please update the PR accordingly.

@ranocha ranocha mentioned this pull request Feb 7, 2025
8 tasks
@benegee benegee changed the title In-situ visualization #0: Make GLMakie available in 2D TreeMesh VisualizationCallback In-situ visualization #0: Make Makie available in 2D VisualizationCallback Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants