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

Compressible Navier-Stokes on TreeMesh3D #1239

Merged
merged 48 commits into from
Feb 2, 2023
Merged

Compressible Navier-Stokes on TreeMesh3D #1239

merged 48 commits into from
Feb 2, 2023

Conversation

andrewwinters5000
Copy link
Member

@andrewwinters5000 andrewwinters5000 commented Oct 18, 2022

This implements the three dimensional compressible Navier-Stokes equations on Cartesian meshes for TreeMesh{3}. It was quite straightforward to extend the 2D methods for gradients and get things up an running in 3D. Below is a laundry list of what needs done before merging.

  • Write tests for new elixirs, probably requires a new test/test_parabolic_3d.jl set
  • Create a MMS convergence test that exercises the boundary conditions
  • Get things up and running on DGMulti{3} as well
  • [ ] Viscous shock tube test? Save for 1D Navier-Stokes, it would be a good student project
  • [ ] Compute kinetic energy dissipation rate (as an analysis quantity) Compute in postprocessing from the integrated kinetic energy values and times available when analysis quantities are saved in an output file.
  • Compute enstrophy (as an analysis quantity)

The points above address a few of the list items from #1147 .

@codecov
Copy link

codecov bot commented Oct 19, 2022

Codecov Report

Merging #1239 (d7c31a7) into main (15e2627) will increase coverage by 0.16%.
The diff coverage is 94.90%.

❗ Current head d7c31a7 differs from pull request most recent head bc4382d. Consider uploading reports for the commit bc4382d to get more accurate results

@@            Coverage Diff             @@
##             main    #1239      +/-   ##
==========================================
+ Coverage   88.71%   88.87%   +0.16%     
==========================================
  Files         328      334       +6     
  Lines       25138    25785     +647     
==========================================
+ Hits        22300    22914     +614     
- Misses       2838     2871      +33     
Flag Coverage Δ
unittests 88.87% <94.90%> (+0.16%) ⬆️

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

Impacted Files Coverage Δ
src/Trixi.jl 70.00% <ø> (ø)
src/callbacks_step/analysis_dgmulti.jl 80.65% <0.00%> (-18.04%) ⬇️
src/equations/compressible_navier_stokes_2d.jl 98.96% <ø> (ø)
src/equations/equations_parabolic.jl 100.00% <ø> (ø)
src/solvers/dgsem_tree/dg.jl 100.00% <ø> (ø)
src/equations/compressible_euler_3d.jl 97.34% <83.33%> (-0.28%) ⬇️
src/solvers/dgsem_tree/dg_3d_parabolic.jl 94.72% <94.72%> (ø)
src/equations/compressible_navier_stokes_3d.jl 99.12% <99.12%> (ø)
...ples/dgmulti_3d/elixir_navierstokes_convergence.jl 100.00% <100.00%> (ø)
...ulti_3d/elixir_navierstokes_taylor_green_vortex.jl 100.00% <100.00%> (ø)
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@andrewwinters5000
Copy link
Member Author

Two questions to @jlchan @ranocha @sloede:

  1. The co-rotating Euler test failed due to some exception. Have y'all had this happen before?
  2. The new parabolic tests all pass in 57m; should I modify them to be shorter to not extend the automatic testing?

@ranocha ranocha mentioned this pull request Oct 20, 2022
@ranocha
Copy link
Member

ranocha commented Oct 20, 2022

1. The co-rotating Euler test failed due to some exception. Have y'all had this happen before?

I haven't seen that before. I opened #1242 to test main.

2. The new parabolic tests all pass in 57m; should I modify them to be shorter to not extend the automatic testing?

No, we have some CI jobs running longer than that, so it's fine.

@andrewwinters5000
Copy link
Member Author

I haven't seen that before. I opened #1242 to test main.

The test fails there as well with the same error.

@ranocha
Copy link
Member

ranocha commented Oct 21, 2022

@sloede Any ideas?

@andrewwinters5000
Copy link
Member Author

I have been trying to work out the best way to create an enstrophy callback for the 3D compressible Navier-Stokes. I have written the necessary routines that live in src/equations/compressible_navier_stokes_3d.jl with my thought process being that it can reuse the gradients already computed and stored in cache_parabolic. This, though, proves a bit unwieldy because the analyse and integrate routines are designed to only dispatch on the advective cache (within semidiscretization) so the callbacks do not have access to the cache_parabolic that I want access to. Do y'all have any good suggestions on how to give the integrate (or integrate_by_indices) routines access to the gradients information?

@jlchan
Copy link
Contributor

jlchan commented Oct 22, 2022

This sounds similar to the issue we had with initial conditions and parameters that depend on the equation type.

I had experimented with a "combined" equation type for dispatch in #1160 but I think this would basically necessitate rewriting a bunch of the callback codes.

@jlchan
Copy link
Contributor

jlchan commented Oct 22, 2022

What if we introduced a separate set of callbacks that dispatch on the viscous cache and viscous equations?

Alternatively...is reusing computed gradients worth it?

@ranocha
Copy link
Member

ranocha commented Oct 23, 2022

You could try to intersect the call chain at

function analyze(quantity, du, u, t, semi::AbstractSemidiscretization)

There, the semidiscretization is passed as an argument - which should hopefully be the hyperbolic-parabolic semidiscretization in this case.

@andrewwinters5000
Copy link
Member Author

Alternatively...is reusing computed gradients worth it?

I was hoping to reuse the gradients because then the callback would not be solver specific. If we re-compute the gradients on the fly, which I am open to doing, then the callback would (maybe) need two version; one for DGSEM and another for DGMulti

@jlchan
Copy link
Contributor

jlchan commented Oct 24, 2022

Would we need two versions anyways since the interfaces are different? DGMulti accesses the array indices directly while TreeMesh, ... use accessor functions like get_node_vars?

If you see a way to define a unified callback, then we could probably use multiple dispatch to specialize on gradient calculation.

@andrewwinters5000
Copy link
Member Author

@andrewwinters5000 mind if I mark this ready for review?

Sure that works for me. I am not sure why the coverage drops.

@jlchan jlchan marked this pull request as ready for review November 24, 2022 09:19
@jlchan
Copy link
Contributor

jlchan commented Nov 24, 2022

I think it's a spurious drop. The coverage report is showing drops in areas that we didn't touch.

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.

This is just the first part of the review, where I only looked at some small files. It would be great if no non-essential merges or edits were to be made to this PR (except for addressing the comments) until the review is finished, such that I do not lose track of which files I have already looked at 😬

@andrewwinters5000 andrewwinters5000 mentioned this pull request Nov 30, 2022
35 tasks
@SimonCan SimonCan requested a review from ranocha January 20, 2023 14:18
@ranocha ranocha removed their request for review January 20, 2023 14:51
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.

I have made a final review and left a few comments. Besides that, I think we are good to merge this.

We should keep an eye on the duration of the parabolic tests in GitHub though. It seems like they are already taking quite a long time, thus if we're adding more systems/tests, we need to redistribute.

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.

I think this should be ready to merge

@ranocha ranocha requested review from jlchan and sloede February 2, 2023 06:36
Copy link
Contributor

@jlchan jlchan 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 @andrewwinters5000 for spearheading this!

@sloede sloede merged commit 3f48f64 into main Feb 2, 2023
@sloede sloede deleted the ns-treemesh-3d branch February 2, 2023 15:13
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.

4 participants