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

Adding 3D isosurface visualization #1076

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

Conversation

panalluri
Copy link

@panalluri panalluri commented Feb 28, 2022

Currently, Trixi does not support plotting 3D isosurfaces. These changes will support this functionality. Currently, the way to create a 3D isosurface is to create a pd = ScalarPlotData3D(some_scalar_array, semi) and then use iplot(pd). The idea is that iplot can have the i stand for either "interactive" or "isosurface". We have also added documentation.

Here is an example plot for the Taylor-Green vortex at time t=2.5.
Screen Shot 2022-04-26 at 1 49 40 PM

The one downside to this implementation (due to the packages we use for isosurface extraction) is that we cannot color the isosurface by another value yet. This should be added in a future release of GridVisualize.jl WIAS-PDELib/GridVisualize.jl#13.

@panalluri panalluri changed the title adding 3D isosurface visualization WIP: adding 3D isosurface visualization Feb 28, 2022
@codecov
Copy link

codecov bot commented Apr 15, 2022

Codecov Report

Merging #1076 (1f19432) into main (03240fa) will increase coverage by 13.75%.
The diff coverage is 100.00%.

❗ Current head 1f19432 differs from pull request most recent head ad1efbc. Consider uploading reports for the commit ad1efbc to get more accurate results

@@             Coverage Diff             @@
##             main    #1076       +/-   ##
===========================================
+ Coverage   83.01%   96.75%   +13.75%     
===========================================
  Files         303      303               
  Lines       23906    23968       +62     
===========================================
+ Hits        19844    23190     +3346     
+ Misses       4062      778     -3284     
Flag Coverage Δ
unittests 96.75% <100.00%> (+13.75%) ⬆️

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

Impacted Files Coverage Δ
...les/dgmulti_3d/elixir_euler_taylor_green_vortex.jl 100.00% <ø> (ø)
src/Trixi.jl 66.67% <ø> (ø)
src/visualization/recipes_makie.jl 96.77% <100.00%> (+0.41%) ⬆️
src/visualization/types.jl 95.17% <100.00%> (+0.30%) ⬆️
src/visualization/utilities.jl 91.15% <100.00%> (+0.30%) ⬆️
src/callbacks_step/summary.jl 94.55% <0.00%> (+0.91%) ⬆️
src/callbacks_step/analysis.jl 96.27% <0.00%> (+1.24%) ⬆️
src/meshes/p4est_mesh.jl 99.33% <0.00%> (+1.35%) ⬆️
src/meshes/tree_mesh.jl 87.32% <0.00%> (+1.41%) ⬆️
src/callbacks_step/amr_dg3d.jl 99.21% <0.00%> (+1.57%) ⬆️
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03240fa...ad1efbc. Read the comment docs.

@jlchan jlchan changed the title WIP: adding 3D isosurface visualization Adding 3D isosurface visualization Apr 26, 2022
@jlchan jlchan marked this pull request as ready for review April 26, 2022 18:59
@jlchan jlchan requested review from ranocha and sloede April 26, 2022 18:59
@jlchan
Copy link
Contributor

jlchan commented Apr 27, 2022

I should note that the isosurface looks significantly fancier even if it's just colored according to a random quantity, such as the z-coordinate. Right now, the isosurfaces are all just colored by their level, which makes for fairly "plain" isosurface plots.

Copy link
Member

@sloede sloede left a comment

Choose a reason for hiding this comment

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

It's great to see additional plotting functionality coming to Trixi! However, I have a few questions regarding the feasibility of this addition, and some minor comments. Please also note that this is not a full review, for which I currently do not have the resources.

@@ -10,6 +10,7 @@ EllipsisNotation = "1.0"
FillArrays = "0.13.2"
ForwardDiff = "0.10.18"
GeometryBasics = "0.3, 0.4"
GridVisualize = "0.5"
Copy link
Member

Choose a reason for hiding this comment

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

It seems to me like this feature adds a lot of plotting related dependencies (each of which have their own dependencies). I wonder if this is getting out of hand somewhat, but I don't have a good solution to it either. Maybe we should start thinking about a "TrixiVisualize.jl" or "TrixiPlots.jl" package?
cc @ranocha @jlchan

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like a good idea. We should probably discuss this further also at one of the next meetings.

Comment on lines +359 to +362
using Pkg; Pkg.activate(temp=true);
Pkg.add("OrdinaryDiffEq");
Pkg.develop("Trixi");
Pkg.add("GLMakie")
Copy link
Member

Choose a reason for hiding this comment

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

I do not think this belongs in the visualization docs.

examples/dgmulti_3d/elixir_euler_taylor_green_vortex.jl Outdated Show resolved Hide resolved
test_visualization.jl Show resolved Hide resolved
@@ -1406,6 +1406,47 @@ function global_plotting_triangulation_makie(pds::PlotDataSeries{<:PlotData2DTri
return plotting_mesh
end

# 3D isosurface case for global_plotting_triangulation_makie function
function global_plotting_triangulation_makie(plot_data::PlotData3DTriangulated{<:ScalarData}, level)
Copy link
Member

Choose a reason for hiding this comment

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

This comment is not very descriptive to me - I think it would be good to elaborate at least a little

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.

I'm stretched a bit too thin this week - please work on the comments of @sloede and re-request our review (his and mine) again afterwards

@DanielDoehring DanielDoehring marked this pull request as draft April 24, 2024 15:05
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.

4 participants