Skip to content

Conversation

@bennibolm
Copy link
Contributor

@bennibolm bennibolm commented Sep 24, 2025

This PR contains 3D subcell limiting for P4estMesh:

  • only positivity limiter for conservative variables
  • no support for equations with nonconservative terms yet

Convergence test with polynomial degree of 4:

####################################################################################################
l2
rho                 rho_v1              rho_v2              rho_v3              rho_e               
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
3.97e-03  -         4.22e-03  -         4.31e-03  -         3.99e-03  -         8.09e-03  -         
1.96e-04  4.34      2.24e-04  4.24      2.23e-04  4.27      1.40e-04  4.83      4.12e-04  4.30      
6.63e-06  4.89      7.37e-06  4.92      7.36e-06  4.92      4.32e-06  5.02      1.38e-05  4.90      
1.71e-07  5.28      1.78e-07  5.37      1.76e-07  5.39      1.20e-07  5.17      3.51e-07  5.29      

mean      4.83      mean      4.84      mean      4.86      mean      5.01      mean      4.83      
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_v2              rho_v3              rho_e               
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC       
3.91e-02  -         3.21e-02  -         4.75e-02  -         4.77e-02  -         1.00e-01  -         
1.77e-03  4.46      1.91e-03  4.07      1.98e-03  4.58      1.63e-03  4.87      4.33e-03  4.53      
6.36e-05  4.80      6.22e-05  4.94      7.62e-05  4.70      5.85e-05  4.80      1.44e-04  4.91      
3.71e-06  4.10      3.46e-06  4.17      4.42e-06  4.11      3.58e-06  4.03      7.92e-06  4.18      

mean      4.45      mean      4.39      mean      4.46      mean      4.57      mean      4.54      
----------------------------------------------------------------------------------------------------

used the following mesh
image

Example of the sedov blast (adapted from the 3d blast in the new elixir to mimic a 2d blast) : I used a easier setup with pressure 0.1 since only positivity limiting of density can be used.
On the left: Simulation in 3d. I adapted the initial condition such that nothing happens in the third direction.
On the right: Simulation in 2d

video.mp4

There are very small differences between the simulations, but I would say that this is expected.

@github-actions
Copy link
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.

@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 98.09160% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.84%. Comparing base (4e39264) to head (6afc75d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/solvers/dgsem_p4est/subcell_limiters_3d.jl 92.86% 2 Missing ⚠️
...llbacks_stage/subcell_limiter_idp_correction_3d.jl 97.30% 1 Missing ⚠️
src/solvers/dgsem_p4est/dg_3d_subcell_limiters.jl 99.24% 1 Missing ⚠️
src/solvers/dgsem_tree/containers_3d.jl 97.92% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2582      +/-   ##
==========================================
+ Coverage   96.83%   96.84%   +0.01%     
==========================================
  Files         540      544       +4     
  Lines       42885    43145     +260     
==========================================
+ Hits        41527    41782     +255     
- Misses       1358     1363       +5     
Flag Coverage Δ
unittests 96.84% <98.09%> (+0.01%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DanielDoehring DanielDoehring added the enhancement New feature or request label Sep 24, 2025
@bennibolm bennibolm marked this pull request as ready for review October 6, 2025 12:28
@bennibolm bennibolm requested a review from amrueda October 6, 2025 13:33
@DanielDoehring
Copy link
Member

I will take a closer look at the code this afternoon.

Could you maybe run one more refinement step of the convergence test (If it takes not too much time)?

DanielDoehring
DanielDoehring previously approved these changes Oct 27, 2025
@DanielDoehring
Copy link
Member

DanielDoehring commented Oct 30, 2025

We should keep an eye on #2632

Maybe it makes sense to define

abstract struct AbstractContainerAntidiffusiveFlux <: AbstractContainer end
nvariables(fluxes::AbstractContainerAntidiffusiveFlux) = size(fluxes.antidiffusive_flux1_L, 1)
nnodes(fluxes::AbstractContainerAntidiffusiveFlux) = size(fluxes.antidiffusive_flux1_L, 3)

which is the same as

nvariables(fluxes::ContainerAntidiffusiveFlux2D) = size(fluxes.antidiffusive_flux1_L, 1)
nnodes(fluxes::ContainerAntidiffusiveFlux2D) = size(fluxes.antidiffusive_flux1_L, 3)

Then

mutable struct ContainerAntidiffusiveFlux2D{uEltype <: Real} <: AbstractContainerAntidiffusiveFlux
end

to make the code slightly more self-documenting?

@bennibolm bennibolm requested review from amrueda and removed request for amrueda October 31, 2025 15:46
Copy link
Contributor

@amrueda amrueda left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together, @bennibolm!

A couple of minor comments:

Copy link
Contributor

@amrueda amrueda left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!
There are some CI failures that do not seem to be related...

@bennibolm
Copy link
Contributor Author

Because of the unrelated CI failure, we'd need a force push. Can you do it @amrueda

@amrueda
Copy link
Contributor

amrueda commented Nov 12, 2025

Because of the unrelated CI failure, we'd need a force push. Can you do it @amrueda

I'm merging this PR with a failing Documentation build, which is unrelated to the PR itself. See issue #2645.

@amrueda amrueda merged commit 2e61748 into trixi-framework:main Nov 12, 2025
66 of 69 checks passed
@bennibolm bennibolm deleted the 3d-subcell-limiting-first branch November 13, 2025 08:53
@bennibolm bennibolm restored the 3d-subcell-limiting-first branch November 13, 2025 09:14
@bennibolm bennibolm deleted the 3d-subcell-limiting-first branch November 13, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants