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

Subcell positivity IDP limiting for conservative variables #1476

Merged
merged 46 commits into from
Aug 18, 2023

Conversation

bennibolm
Copy link
Contributor

@bennibolm bennibolm commented May 16, 2023

This PR provides the very basic subcell positivity limiting feature using the IDP limiting.
Conservative variables can be limited with a one-sided Zalesak-type limiter. We pass these in positivity_variables_cons.
Only the mesh type TreeMesh2D is supported.

TODOs:

There are more PRs to come. All implemented features can be found in the branch subcell-limiting and PR #1502.

@bennibolm bennibolm requested a review from amrueda May 17, 2023 10:48
@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Merging #1476 (0fca290) into main (a4283e1) will decrease coverage by 1.53%.
The diff coverage is 93.90%.

@@            Coverage Diff             @@
##             main    #1476      +/-   ##
==========================================
- Coverage   96.17%   94.64%   -1.53%     
==========================================
  Files         406      414       +8     
  Lines       33532    33942     +410     
==========================================
- Hits        32248    32123     -125     
- Misses       1284     1819     +535     
Flag Coverage Δ
unittests 94.64% <93.90%> (-1.53%) ⬇️

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

Files Changed Coverage Δ
src/Trixi.jl 43.48% <ø> (ø)
src/solvers/dgsem_tree/dg.jl 94.12% <ø> (ø)
src/time_integration/time_integration.jl 100.00% <ø> (ø)
src/solvers/dgsem_tree/subcell_limiters.jl 83.87% <83.87%> (ø)
src/time_integration/methods_SSP.jl 84.62% <84.62%> (ø)
src/solvers/dg.jl 91.63% <92.31%> (+0.05%) ⬆️
...llbacks_stage/subcell_limiter_idp_correction_2d.jl 94.12% <94.12%> (ø)
src/solvers/dgsem_tree/subcell_limiters_2d.jl 94.44% <94.44%> (ø)
src/solvers/dgsem_tree/dg_2d_subcell_limiters.jl 98.85% <98.85%> (ø)
...ee_2d_dgsem/elixir_euler_shockcapturing_subcell.jl 100.00% <100.00%> (ø)
... and 3 more

... and 2 files with indirect coverage changes

Copy link
Contributor Author

@bennibolm bennibolm left a comment

Choose a reason for hiding this comment

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

In my opinion, this PR is now ready so far. I have still noted a few small things.

src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/time_integration/methods_SSP.jl Outdated Show resolved Hide resolved
@bennibolm bennibolm requested a review from sloede June 3, 2023 09:07
@bennibolm bennibolm changed the title WIP: Subcell positivity IDP limiting for conservative variables Subcell positivity IDP limiting for conservative variables Jun 3, 2023
src/time_integration/methods_SSP.jl Outdated Show resolved Hide resolved
src/time_integration/methods_SSP.jl Outdated Show resolved Hide resolved
src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
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.

Overall this LGTM! I've looked at most of the PR and left some comments. Most of them are suggestions, but especially the consistent variable name formatting (snake_case) would be great if it were addressed.

src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/dg_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/dg_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/dg_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/indicators.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/containers_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/containers_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/indicators_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/indicators_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/indicators_2d.jl Outdated Show resolved Hide resolved
@sloede
Copy link
Member

sloede commented Jun 4, 2023

In my opinion, this PR is now ready so far.

Then please mark this PR as "Ready for review" - this will let us know that a) it can and should get a reivew and b) once a reviewer is happy, this can be merged immediately
image

@sloede
Copy link
Member

sloede commented Jun 4, 2023

Do you have any allocations? E.g, can you post the output of the final timer summary?

@ranocha
Copy link
Member

ranocha commented Jun 5, 2023

Feel free to request a review when you're ready for it

@bennibolm bennibolm marked this pull request as ready for review June 5, 2023 11:14
@bennibolm
Copy link
Contributor Author

Do you have any allocations? E.g, can you post the output of the final timer summary?

It does not look like it. (This is the output of elixir_euler_shockcapturing_subcell.)

────────────────────────────────────────────────────────────────────────────────────────────────────
 Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
 #timesteps:                340                run time:       3.63036940e+00 s
 Δt:             2.26626523e-03                └── GC time:    0.00000000e+00 s (0.000%)
 sim. time:      1.00000000e+00                time/DOF/rhs!:  2.16431976e-07 s
                                               PID:            2.40560150e-07 s
 #DOF:                    16384                alloc'd memory:       1359.705 MiB
 #elements:                1024

 Variable:       rho              rho_v1           rho_v2           rho_e
 L2 error:       8.50814791e-02   4.51029902e-02   4.51030198e-02   6.93070434e-01
 Linf error:     3.11235465e-01   5.61627487e-01   5.61969271e-01   2.88670199e+00
 ∑∂S/∂U ⋅ Uₜ :  -3.04430445e-01
────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
Trixi.jl simulation finished.  Final time: 1.0  Time steps: 340 (accepted), 340 (total)
────────────────────────────────────────────────────────────────────────────────────────────────────

 ───────────────────────────────────────────────────────────────────────────────────────
               Trixi.jl                        Time                    Allocations
                                      ───────────────────────   ────────────────────────
           Tot / % measured:               4.00s /  91.0%           30.0MiB /  26.9%

 Section                      ncalls     time    %tot     avg     alloc    %tot      avg
 ───────────────────────────────────────────────────────────────────────────────────────
 main loop                         1    3.63s   99.7%   3.63s   6.43MiB   79.9%  6.43MiB
   Runge-Kutta stage           1.02k    3.21s   88.2%  3.15ms   10.1KiB    0.1%    10.1B
     rhs!                      1.02k    3.20s   87.9%  3.14ms   9.33KiB    0.1%    9.36B
       volume integral         1.02k    2.83s   77.8%  2.78ms     0.00B    0.0%    0.00B
       interface flux          1.02k    176ms    4.8%   172μs     0.00B    0.0%    0.00B
       prolong2interfaces      1.02k    121ms    3.3%   119μs     0.00B    0.0%    0.00B
       surface integral        1.02k   53.5ms    1.5%  52.5μs     0.00B    0.0%    0.00B
       Jacobian                1.02k   7.92ms    0.2%  7.76μs     0.00B    0.0%    0.00B
       reset ∂u/∂t             1.02k   6.90ms    0.2%  6.77μs     0.00B    0.0%    0.00B
       ~rhs!~                  1.02k   1.70ms    0.0%  1.66μs   9.33KiB    0.1%    9.36B
       prolong2boundaries      1.02k   78.8μs    0.0%  77.3ns     0.00B    0.0%    0.00B
       prolong2mortars         1.02k   75.0μs    0.0%  73.5ns     0.00B    0.0%    0.00B
       mortar flux             1.02k   70.2μs    0.0%  68.8ns     0.00B    0.0%    0.00B
       boundary flux           1.02k   32.2μs    0.0%  31.6ns     0.00B    0.0%    0.00B
       source terms            1.02k   30.8μs    0.0%  30.2ns     0.00B    0.0%    0.00B
     ~Runge-Kutta stage~       1.02k   11.0ms    0.3%  10.8μs      752B    0.0%    0.74B
   antidiffusive_stage!        1.02k    326ms    8.9%   319μs   1.47KiB    0.0%    1.47B
     alpha calculation         1.02k    188ms    5.2%   185μs      752B    0.0%    0.74B
       positivity              1.02k    141ms    3.9%   138μs     0.00B    0.0%    0.00B
       ~alpha calculation~     1.02k   47.5ms    1.3%  46.6μs      752B    0.0%    0.74B
     ~antidiffusive_stage!~    1.02k    137ms    3.8%   135μs      752B    0.0%    0.74B
   analyze solution                4   29.7ms    0.8%  7.42ms   70.3KiB    0.9%  17.6KiB
   ~main loop~                     1   28.0ms    0.8%  28.0ms    285KiB    3.5%   285KiB
   calculate dt                  340   27.1ms    0.7%  79.7μs     0.00B    0.0%    0.00B
   I/O                             4   9.23ms    0.3%  2.31ms   6.08MiB   75.4%  1.52MiB
     save solution                 4   9.19ms    0.3%  2.30ms   6.06MiB   75.2%  1.52MiB
     get element variables         4   30.8μs    0.0%  7.70μs   10.8KiB    0.1%  2.69KiB
     ~I/O~                         4   10.5μs    0.0%  2.62μs   4.20KiB    0.1%  1.05KiB
     save mesh                     4    600ns    0.0%   150ns     0.00B    0.0%    0.00B
 analyze solution                  1   6.75ms    0.2%  6.75ms   17.6KiB    0.2%  17.6KiB
 I/O                               2   3.17ms    0.1%  1.58ms   1.60MiB   19.9%   822KiB
   save solution                   1   1.81ms    0.0%  1.81ms   1.52MiB   18.8%  1.52MiB
   ~I/O~                           2   1.35ms    0.0%   676μs   88.5KiB    1.1%  44.2KiB
   get element variables           1   10.9μs    0.0%  10.9μs   2.69KiB    0.0%  2.69KiB
   save mesh                       1   0.00ns    0.0%  0.00ns     0.00B    0.0%    0.00B
 calculate dt                      1   80.8μs    0.0%  80.8μs     0.00B    0.0%    0.00B
 ───────────────────────────────────────────────────────────────────────────────────────

But this becomes more interesting later with all the analysis routines.

@bennibolm bennibolm requested a review from ranocha June 5, 2023 12:45
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.

Thanks

src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/callbacks_stage/antidiffusive_stage.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/indicators_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/indicators_2d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/indicators_2d.jl Outdated Show resolved Hide resolved
src/time_integration/methods_SSP.jl Outdated Show resolved Hide resolved
src/time_integration/methods_SSP.jl Outdated Show resolved Hide resolved
@bennibolm bennibolm marked this pull request as ready for review July 10, 2023 14:21
@bennibolm
Copy link
Contributor Author

bennibolm commented Jul 10, 2023

This PR is now ready so far.

@bennibolm bennibolm requested review from ranocha and removed request for sloede, ranocha and amrueda July 18, 2023 12:14
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.

Thanks a lot! I just have a few minor comments. I guess you just need to resolve conflicts and we can merge this soon

src/Trixi.jl Outdated Show resolved Hide resolved
src/callbacks_stage/subcell_limiter_idp_correction.jl Outdated Show resolved Hide resolved
src/callbacks_stage/subcell_limiter_idp_correction_2d.jl Outdated Show resolved Hide resolved
@bennibolm bennibolm requested a review from ranocha August 9, 2023 11:30
ranocha
ranocha previously approved these changes Aug 9, 2023
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.

Thanks!

@ranocha ranocha enabled auto-merge (squash) August 9, 2023 11:32
@ranocha
Copy link
Member

ranocha commented Aug 9, 2023

If CI passes, this should be merged automatically. If not, we need to watch out for #1590 etc.

@ranocha ranocha requested a review from sloede August 17, 2023 11:38
sloede
sloede previously approved these changes Aug 17, 2023
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.

LGTM! I noticed a few things/questions but nothing that would stop a merge once the tests have passed. Great work!

src/solvers/dgsem_tree/dg_2d_subcell_limiters.jl Outdated Show resolved Hide resolved
@sloede
Copy link
Member

sloede commented Aug 17, 2023

IMHO it would be good to add a NEWS.md item for this addition (just for our own record)

auto-merge was automatically disabled August 18, 2023 08:28

Head branch was pushed to by a user without write access

@bennibolm bennibolm dismissed stale reviews from sloede and ranocha via 0fca290 August 18, 2023 08:28
@ranocha ranocha merged commit 4da5c53 into trixi-framework:main Aug 18, 2023
31 of 33 checks passed
@bennibolm bennibolm deleted the IDPlimiting-positivity-cons branch February 20, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants