trixi-framework / Trixi.jl

Trixi.jl: Adaptive high-order numerical simulations of conservation laws in Julia
https://trixi-framework.github.io/Trixi.jl
MIT License
505 stars 98 forks source link

Add subcell limiting support for StructuredMesh #1942

Closed bennibolm closed 1 month ago

bennibolm commented 1 month ago

This PR adds subcell limiting support for Structuredmesh.

Getting the inverse Jacobian makes this PR a bit longer. That's because for TreeMesh, inverse_jacobian is fixed within one element, while it is different for each node for StructuredMesh. To avoid something like

if mesh isa TreeMesh
    inverse_jacobian = cache.elements.inverse_jacobian[element]
end
for j in eachnode(dg), i in eachnode(dg)
    if mesh isa StructuredMesh
        inverse_jacobian = cache.elements.inverse_jacobian[i, j, element]
    end
    [...]
end

and also avoid unnecessary calls of inverse jacobian in TreeMesh simulations, I dispatched for the mesh type and extracted the code [...] to an inner function (This is also done for e.g. the routine apply_jacobian!).

After this PR, it will be straight forward to add support for P4estMesh.

For now, there is no support for non-conservative systems.

TODO:

github-actions[bot] commented 1 month ago

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

Code quality

Documentation

Testing

Performance

Verification

Created with :heart: by the Trixi.jl community.

codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 75.26%. Comparing base (9b64eab) to head (98c2144). Report is 1 commits behind head on main.

Files Patch % Lines
...rc/solvers/dgsem_structured/subcell_limiters_2d.jl 40.62% 76 Missing :warning:
src/solvers/dgsem_tree/subcell_limiters_2d.jl 93.69% 7 Missing :warning:
...llbacks_stage/subcell_limiter_idp_correction_2d.jl 95.24% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1942 +/- ## =========================================== - Coverage 89.49% 75.26% -14.23% =========================================== Files 453 457 +4 Lines 36474 36681 +207 =========================================== - Hits 32640 27606 -5034 - Misses 3834 9075 +5241 ``` | [Flag](https://app.codecov.io/gh/trixi-framework/Trixi.jl/pull/1942/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trixi-framework) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/trixi-framework/Trixi.jl/pull/1942/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trixi-framework) | `75.26% <73.75%> (-14.23%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trixi-framework#carryforward-flags-in-the-pull-request-comment) to find out more.

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

bennibolm commented 1 month ago

Due to issues with the code coverage test, continue this PR with a branch on upstream Trixi and not on my fork. https://github.com/trixi-framework/Trixi.jl/pull/1946