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

L2 Mortars for Parabolic Terms on TreeMeshes #1571

Merged
merged 64 commits into from
Aug 10, 2023

Conversation

DanielDoehring
Copy link
Contributor

Following #1147 I looked into mortars for 2D DGSEM on Tree meshes.

While I am relatively confident about the part for the viscous fluxes inserted here

@assert nmortars(dg, cache) == 0

I have questions regarding the mortar actions in calc_gradient!

# TODO: parabolic; mortars

(See the comments in the files)

@DanielDoehring DanielDoehring mentioned this pull request Jul 17, 2023
35 tasks
@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Merging #1571 (28ebfac) into main (ce81702) will decrease coverage by 2.77%.
Report is 1 commits behind head on main.
The diff coverage is 98.50%.

@@            Coverage Diff             @@
##             main    #1571      +/-   ##
==========================================
- Coverage   92.90%   90.13%   -2.77%     
==========================================
  Files         402      402              
  Lines       33034    33327     +293     
==========================================
- Hits        30690    30039     -651     
- Misses       2344     3288     +944     
Flag Coverage Δ
unittests 90.13% <98.50%> (-2.77%) ⬇️

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

Files Changed Coverage Δ
src/solvers/dgsem_tree/dg_2d_parabolic.jl 95.90% <97.98%> (+0.73%) ⬆️
src/solvers/dgsem_tree/dg_3d_parabolic.jl 92.58% <98.31%> (+2.19%) ⬆️
src/solvers/dgsem_p4est/dg_2d_parabolic.jl 96.11% <100.00%> (+0.38%) ⬆️
src/solvers/dgsem_p4est/dg_3d_parabolic.jl 97.80% <100.00%> (+0.19%) ⬆️

... and 130 files with indirect coverage changes

@DanielDoehring DanielDoehring changed the title First try mortars for parabolic terms First try L2 Mortars for Parabolic Terms Jul 18, 2023
@DanielDoehring DanielDoehring changed the title First try L2 Mortars for Parabolic Terms First try L2 Mortars for Parabolic Terms on TreeMeshes (no P4est) Jul 18, 2023
@DanielDoehring DanielDoehring changed the title First try L2 Mortars for Parabolic Terms on TreeMeshes (no P4est) First try L2 Mortars for Parabolic Terms on TreeMeshes Jul 18, 2023
@DanielDoehring
Copy link
Contributor Author

DanielDoehring commented Jul 18, 2023

I ran a first small convergence study for the 2D Navier-Stokes Convergence Elixir
for a fixed timestep of dt = 5e-4 by passing adaptive=false to the integrator

sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, dt = 1e-5,
ode_default_options()..., callback=callbacks)

One quarter of the mesh is refined once, "Ref" denotes the initial refinement of the mesh

Errors
  Ref: 3
  
  L2 error:       2.42970015e-04   2.09325060e-04   5.39057437e-04   2.67516565e-04
  Linf error:     1.62100269e-03   2.59325895e-03   2.95390894e-03   2.07741249e-03
  
  Ref: 4
  
  L2 error:       3.66499309e-06   7.97913777e-06   1.20897192e-05   4.40234164e-06
  Linf error:     2.40483342e-05   1.44484365e-04   7.92111352e-05   5.64718938e-05
  
  Ref: 5
  
  L2 error:       3.13692528e-08   7.87977372e-08   7.40638328e-08   1.25181359e-07
  Linf error:     2.10090485e-07   1.89761591e-06   6.65344699e-07   1.06838605e-06
  
  Ref: 6
  
  L2 error:       1.14216609e-09   9.45032663e-10   8.83707914e-10   5.40570956e-09
  Linf error:     7.52437157e-09   1.25224838e-08   8.08031981e-09   3.55402783e-08

There is clearly some superconvergence (Linf errors should only reduce by a factor 16), probably due to the diffusive nature of the testcase.

@sloede
Copy link
Member

sloede commented Jul 18, 2023

I ran a first small convergence study

Great work so far! Note that you can also use the convergence_test function to simplify convergence testing and EOC computation. It's also much easier to process the results of you post them in fixed width font (especially when looking at it on a phone screen).

@DanielDoehring
Copy link
Contributor Author

I ran a first small convergence study

Great work so far! Note that you can also use the convergence_test function to simplify convergence testing and EOC computation. It's also much easier to process the results of you post them in fixed width font (especially when looking at it on a phone screen).

Yeah, I tried to format that, but I somehow did not manage to get this to work in the spoiler HTML environment.

@sloede
Copy link
Member

sloede commented Jul 18, 2023

I ran a first small convergence study

Great work so far! Note that you can also use the convergence_test function to simplify convergence testing and EOC computation. It's also much easier to process the results of you post them in fixed width font (especially when looking at it on a phone screen).

Yeah, I tried to format that, but I somehow did not manage to get this to work in the spoiler HTML environment.

I've updated your post above, I hope that's OK for you.

@DanielDoehring
Copy link
Contributor Author

Aside the 2D Navier-Stokes Convergence Test I also conducted a small study for the 3D version, this time with fixed timestep dt=1e-3 and base refinement 2, where 1/16th of the entire mesh is refined once.

Convergence with Refinement
l2
rho                 rho_v1              rho_v2              rho_v3              rho_e
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC
3.56e-03  -         6.02e-03  -         5.08e-03  -         5.89e-03  -         1.22e-02  -
3.99e-04  3.15      8.85e-04  2.76      1.07e-03  2.25      8.79e-04  2.74      1.40e-03  3.12
2.33e-05  4.10      5.16e-05  4.10      6.01e-05  4.15      5.15e-05  4.09      9.50e-05  3.89

mean      3.63      mean      3.43      mean      3.20      mean      3.42      mean      3.50
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_v2              rho_v3              rho_e
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC
2.40e-02  -         1.06e-01  -         3.57e-02  -         1.06e-01  -         1.47e-01  -
3.53e-03  2.77      1.51e-02  2.82      8.86e-03  2.01      1.51e-02  2.82      3.04e-02  2.27
2.11e-04  4.07      1.17e-03  3.69      6.45e-04  3.78      1.17e-03  3.69      2.83e-03  3.43

mean      3.42      mean      3.25      mean      2.90      mean      3.25      mean      2.85
----------------------------------------------------------------------------------------------------
Convergence without Refinement
l2
rho                 rho_v1              rho_v2              rho_v3              rho_e
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC
3.71e-03  -         6.50e-03  -         5.26e-03  -         6.50e-03  -         1.31e-02  -
4.15e-04  3.16      9.51e-04  2.77      1.13e-03  2.22      9.51e-04  2.77      1.45e-03  3.17
2.43e-05  4.09      5.56e-05  4.10      6.33e-05  4.15      5.56e-05  4.10      9.83e-05  3.89

mean      3.63      mean      3.43      mean      3.19      mean      3.43      mean      3.53
----------------------------------------------------------------------------------------------------
linf
rho                 rho_v1              rho_v2              rho_v3              rho_e
error     EOC       error     EOC       error     EOC       error     EOC       error     EOC
2.08e-02  -         1.06e-01  -         2.65e-02  -         1.06e-01  -         1.49e-01  -
3.52e-03  2.56      1.51e-02  2.81      8.86e-03  1.58      1.51e-02  2.81      3.04e-02  2.29
2.11e-04  4.06      1.17e-03  3.69      6.45e-04  3.78      1.17e-03  3.69      2.83e-03  3.43

mean      3.31      mean      3.25      mean      2.68      mean      3.25      mean      2.86
----------------------------------------------------------------------------------------------------

@DanielDoehring DanielDoehring marked this pull request as ready for review July 18, 2023 11:53
@ranocha
Copy link
Member

ranocha commented Jul 18, 2023

Can you go one (or two) steps further in the convergence study? The first refinement does not seem to be in the asymptotic regime

Copy link
Member

@andrewwinters5000 andrewwinters5000 left a comment

Choose a reason for hiding this comment

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

Just a small suggestion to adjust the wording. Also, I have lost track on the new capability. This PR only allows for mortars on TreeMesh but no AMR capability, right? To get the AMR working we (maybe) need to do the prologation / restriction of the gradient variables as well. I am not so familiar with the AMR + TreeMesh infrastructure.

NEWS.md Outdated Show resolved Hide resolved
@jlchan
Copy link
Contributor

jlchan commented Aug 2, 2023

Just a small suggestion to adjust the wording. Also, I have lost track on the new capability. This PR only allows for mortars on TreeMesh but no AMR capability, right? To get the AMR working we (maybe) need to do the prologation / restriction of the gradient variables as well. I am not so familiar with the AMR + TreeMesh infrastructure.

Yes - I think the reshaping of arrays upon refinement/unrefinement required some changes. I think there is another PR which deals with the technical details of reshaping some of the temporary arrays used in rhs_parabolic!.

Co-authored-by: Andrew Winters <[email protected]>
@DanielDoehring
Copy link
Contributor Author

This PR only allows for mortars on TreeMesh but no AMR capability, right? To get the AMR working we (maybe) need to do the prologation / restriction of the gradient variables as well. I am not so familiar with the AMR + TreeMesh infrastructure.

Yes, for AMR more changes are required that I plan to submit once this is merged.

Copy link
Member

@andrewwinters5000 andrewwinters5000 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jlchan
Copy link
Contributor

jlchan commented Aug 7, 2023

@DanielDoehring I believe you added CI tests - does this mean @ranocha's requested changes are addressed? That's blocking merging at the moment.

@DanielDoehring
Copy link
Contributor Author

@DanielDoehring I believe you added CI tests - does this mean @ranocha's requested changes are addressed? That's blocking merging at the moment.

Yes, I added some tests with manually refined meshes.

jlchan
jlchan previously approved these changes Aug 7, 2023
@jlchan jlchan enabled auto-merge (squash) August 7, 2023 18:21
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!

Yes - I also double checked that there are no allocations due to the mortars.

Could you please add some CI checks for allocations like we do in

@trixi_testset "elixir_advection_mortar.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_mortar.jl"),
# Expected errors are exactly the same as in the parallel test!
l2 = [0.0015188466707237375],
linf = [0.008446655719187679])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

src/solvers/dgsem_p4est/dg_2d_parabolic.jl Show resolved Hide resolved
src/solvers/dgsem_p4est/dg_3d_parabolic.jl Show resolved Hide resolved
auto-merge was automatically disabled August 8, 2023 06:36

Head branch was pushed to by a user without write access

@DanielDoehring
Copy link
Contributor Author

DanielDoehring commented Aug 8, 2023

Could you please add some CI checks for allocations

Done in 1caa657 (except for the Navier-Stokes convergence tests, which are still allocating until #1594 is merged)

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 8, 2023 07:35
@ranocha ranocha merged commit 3ca93af into trixi-framework:main Aug 10, 2023
30 of 31 checks passed
@DanielDoehring DanielDoehring deleted the MortarsParabolic branch August 11, 2023 06:31
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