-
Notifications
You must be signed in to change notification settings - Fork 119
EC mortars: Tree 2D #2302
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
base: main
Are you sure you want to change the base?
EC mortars: Tree 2D #2302
Conversation
Review checklistThis 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 ❤️ by the Trixi.jl community. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2302 +/- ##
==========================================
- Coverage 96.91% 96.91% -0.00%
==========================================
Files 496 497 +1
Lines 41140 41267 +127
==========================================
+ Hits 39870 39993 +123
- Misses 1270 1274 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What exactly does not work? IIRC (though that's from >4 years ago), the final version of the original PR was fully functional for at least one test setup and did show proper convergence behavior as well as EC properties. |
Not sure, the current version seems to be correct - (although there are some allocations that need to be removed). My first try did not work, this is why I have not touched this for a long time. I believe #2134 resolved this. |
MA3d = MArray{Tuple{nvariables(equations), nnodes(mortar_ec), nnodes(mortar_ec)}, | ||
uEltype, 3, | ||
nvariables(equations) * nnodes(mortar_ec) * nnodes(mortar_ec)} | ||
fstar_upper_correction_threaded = MA3d[MA3d(undef) for _ in 1:Threads.nthreads()] | ||
fstar_lower_correction_threaded = MA3d[MA3d(undef) for _ in 1:Threads.nthreads()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only true difference to the L2 mortar.
src/solvers/dgsem_tree/dg_2d.jl
Outdated
for i in 1:nnodes(dg) | ||
# Loop over all variables | ||
for v in eachvariable(equations) | ||
# Calculate flux corrections for i'th node | ||
flux_correction = zero(eltype(fstar_upper_correction)) | ||
|
||
# Loop over inner-element nodes (see Fig. 3) of | ||
# Chan, Bencomo, Del Rey Fernández (2021). | ||
# Mortar-based Entropy-Stable Discontinuous Galerkin Methods on | ||
# Non-conforming Quadrilateral and Hexahedral Meshes. | ||
# https://doi.org/10.1007/s10915-021-01652-3 | ||
for j in 1:nnodes(dg) | ||
# j-local flux: "Forward" flux | ||
f_j_upper = fstar_upper_correction[v, i, j] | ||
f_j_lower = fstar_lower_correction[v, i, j] | ||
|
||
# Subtract "forward" flux | ||
for k in 1:nnodes(dg) | ||
f_j_upper -= mortar_ec.forward_upper[j, k] * | ||
fstar_upper_correction[v, k, j] | ||
f_j_lower -= mortar_ec.forward_lower[j, k] * | ||
fstar_lower_correction[v, k, j] | ||
end | ||
|
||
# Add to flux correction involving "reverse" flux | ||
flux_correction += mortar_ec.reverse_upper[i, j] * f_j_upper | ||
flux_correction += mortar_ec.reverse_lower[i, j] * f_j_lower | ||
end | ||
|
||
# Finally, add to surface flux values | ||
surface_flux_values[v, i, direction, large_element_id] += flux_correction | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this can be made more efficient using multiply_dimensionwise!
?
Convergence test: ####################################################################################################
l2
rho rho_v1 rho_v2 rho_e
error EOC error EOC error EOC error EOC
6.13e-04 - 2.49e-02 - 2.64e-02 - 5.80e-02 -
8.40e-05 2.87 3.43e-03 2.86 3.74e-03 2.82 8.20e-03 2.82
2.98e-06 4.82 1.58e-04 4.44 1.52e-04 4.62 3.19e-04 4.68
7.15e-08 5.38 4.71e-06 5.06 3.94e-06 5.27 7.94e-06 5.33
mean 4.35 mean 4.12 mean 4.24 mean 4.28
----------------------------------------------------------------------------------------------------
linf
rho rho_v1 rho_v2 rho_e
error EOC error EOC error EOC error EOC
1.15e-02 - 3.02e-01 - 2.88e-01 - 1.04e+00 -
1.68e-03 2.77 4.73e-02 2.67 5.28e-02 2.45 1.69e-01 2.63
7.23e-05 4.54 2.67e-03 4.15 2.42e-03 4.45 7.14e-03 4.57
2.35e-06 4.95 1.28e-04 4.38 1.21e-04 4.32 2.61e-04 4.78
mean 4.08 mean 3.73 mean 3.74 mean 3.99
---------------------------------------------------------------------------------------------------- I suspect that the superconvergence is due to the refinement patch. For the standard L2 mortar: ####################################################################################################
l2
rho rho_v1 rho_v2 rho_e
error EOC error EOC error EOC error EOC
6.11e-04 - 2.48e-02 - 2.61e-02 - 5.78e-02 -
8.47e-05 2.85 3.49e-03 2.83 3.75e-03 2.80 8.30e-03 2.80
2.86e-06 4.89 1.52e-04 4.52 1.46e-04 4.68 3.03e-04 4.78
5.60e-08 5.68 3.57e-06 5.41 3.19e-06 5.52 6.13e-06 5.63
mean 4.47 mean 4.25 mean 4.33 mean 4.40
----------------------------------------------------------------------------------------------------
linf
rho rho_v1 rho_v2 rho_e
error EOC error EOC error EOC error EOC
1.14e-02 - 3.02e-01 - 2.85e-01 - 1.04e+00 -
1.70e-03 2.75 4.86e-02 2.64 5.22e-02 2.45 1.70e-01 2.61
7.21e-05 4.56 2.67e-03 4.19 2.33e-03 4.48 6.95e-03 4.62
1.89e-06 5.25 7.37e-05 5.18 6.75e-05 5.11 1.62e-04 5.42
mean 4.19 mean 4.00 mean 4.01 mean 4.22
---------------------------------------------------------------------------------------------------- To test the entropy-conservation property I probably need to run this with an EC integrator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is just a quick first review. I leave reviewing the details of the algorithm to the others.
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! This is a very initial pass through; I'll take a closer look (in particular at the 3d and p4est parts) afterwards.
A broader question - why are the parabolic routines modified? the mortars should only impact the hyperbolic interface flux computations?
Yes, but an arguably easier test would be to have a refined mesh and use it with an entropy-generating setup, and to then verify that a call to For example, the weak blast wave is usually such a test, since it does want to produce entropy. Another option for an initial condition is to just randomly initialize the conservative variables (in a physically valid state of course) such that you get small jumps - that would ordinarily produce entropy - everywhere. |
Yeah that looks a bit odd. The reason is that the |
So something is not quite working yet. I do not yet get entropy conservation, but more importantly, conservation of cons. variables is violated. |
The current implementation of the mortars has |
I tried to port #247 to Trixi's current state. Does currently not work - not sure if I did a mistake or if the original draft was flawed.
@amrueda