Trixi.jl icon indicating copy to clipboard operation
Trixi.jl copied to clipboard

Added 3D to 2D plotting along an axis/curve for general meshes

Open FelipeSantillan opened this issue 2 years ago • 4 comments

This PR introduces the possibility to create 2D-plots from 3D-solutions when using a general mesh. It works similar to the Tree-mesh version. Here are some examples:

  1. elixir: "structured_3d_dgsem\elixir_advection_basic" (with Gauss intitial condition)

Run simulation and use following lines to get a plot: using Plots; pd = PlotData2D(sol, slice=:yz, point=(0.1, 0.2, 0.3), nvisnodes=33); plot(pd); basic

  1. elixir: "structured_3d_dgsem\elixir_advection_basic" (with Gauss intitial condition)

In the example above a "yz"-plane is used. The plane is give by x, y and z coordinates, which are each stored as a matrix. The y and z coordinates are bound to an equidistant grid and the x coordinates are all set to x=point[1]=0.1 . The x coordinates can be change by the additional input of a 'elevations' matrix. See the example below:

I want to slice the 3D-solution on a plane, which is deformed to a semi-sphere like this: sphere-plane

To do so, I use a small function to create a matrix 'elevations'. It holds the heights of the plot above and looks like this: matrix

Finally, I just do: using Plots; pd = PlotData2D(sol, slice=:yz, elevetions=elevations); plot(pd); plot

As expected the plot is constant on the inside and is identical to the first examples in the corners.

FelipeSantillan avatar Mar 24 '22 18:03 FelipeSantillan

Codecov Report

Attention: Patch coverage is 91.54930% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 96.73%. Comparing base (6d303b3) to head (5a03eec). Report is 604 commits behind head on main.

Files Patch % Lines
src/visualization/utilities.jl 86.67% 4 Missing :warning:
src/visualization/types.jl 95.12% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1099      +/-   ##
==========================================
- Coverage   96.75%   96.73%   -0.02%     
==========================================
  Files         303      303              
  Lines       23897    23939      +42     
==========================================
+ Hits        23120    23156      +36     
- Misses        777      783       +6     
Flag Coverage Δ
unittests 96.73% <91.55%> (-0.02%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 24 '22 20:03 codecov[bot]

For some reason StrideArrays fails to precompile. Other than that, I think this PR is ready to review.

FelipeSantillan avatar Mar 28 '22 11:03 FelipeSantillan

For some reason StrideArrays fails to precompile. Other than that, I think this PR is ready to review.

Yeah, there is an upstream issue for this (https://github.com/JuliaSIMD/StrideArrays.jl/issues/48).

ranocha avatar Mar 28 '22 13:03 ranocha

Thanks for reviewing my PR @ranocha . I will request another review once I have answered everything.

FelipeSantillan avatar Mar 28 '22 14:03 FelipeSantillan