Skip to content

Non-Uniform WENO7 #743

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

Merged
merged 21 commits into from
Nov 20, 2024
Merged

Non-Uniform WENO7 #743

merged 21 commits into from
Nov 20, 2024

Conversation

ChrisZYJ
Copy link
Contributor

@ChrisZYJ ChrisZYJ commented Nov 19, 2024

Description

#665 MFC now supports stretched grids for 7th order WENO (-JS, -M, -Z).
(Stretched grids for TENO7 are not ready yet)

Closes #665

Implementation Details

The WENO7 golden files were regenerated, which was necessary due to machine errors introduced by the large number of operations. The consistency of the new non-uniform formulas with the uniform formulas in uniform grid cases is demonstrated in the 1D Shu-Osher Uniform Grid plot. The old test suites also passed with increased tolerance.

The code contains ridiculously long equations, which have already reached their simplest form. I made a controversial decision to keep the lines long, as it improves code aesthetics (avoiding having pages of equations displayed while scrolling through) and because the equations are not human-readable anyway. Please let me know if alternative methods are preferred.

Equation Derivation

None of the equations from published papers are applicable. They are either approximations, don't solve the problems we need, or lack explicit forms. MFC also uses a very specific form that requires the coefficients to be for cell value differences rather than for the cell values themselves (this reduces computational costs). I had to derive the equations myself.

Non-uniform TENO7 requires different ideal weight formulas, which I need to derive. They aren't too complex, but I will complete them in another PR in the coming days.

Type of change

  • New feature (non-breaking change which adds functionality)

Scope

  • This PR comprises a set of related changes with a common goal

How Has This Been Tested?

  • Old Test Suites (with increased tolerance)

  • 1D Shu-Osher Uniform Grid
    weno7_uniform_grid

  • 1D Shu-Osher Non-Uniform Grid
    weno7_nonuniform_grid

  • 2D_hardcodied_ic in examples (has grid stretching)
    2D_hardcoded_ic_compare
    ** WENO5 is the default case (same result on documentation)

Checklist

  • I have added comments for the new code
  • I added Doxygen docstrings to the new code
  • I have made corresponding changes to the documentation (docs/)
  • I have added regression tests to the test suite so that people can verify in the future that the feature is behaving as expected
  • I have added example cases in examples/ that demonstrate my new feature performing as expected.
    They run to completion and demonstrate "interesting physics"
  • I ran ./mfc.sh format before committing my code
  • New and existing tests pass locally with my changes, including with GPU capability enabled (both NVIDIA hardware with NVHPC compilers and AMD hardware with CRAY compilers) and disabled
  • This PR does not introduce any repeated code (it follows the DRY principle)
  • I cannot think of a way to condense this code and reduce any introduced additional line count

If your code changes any code source files (anything in src/simulation)

To make sure the code is performing as expected on GPU devices, I have:

  • Checked that the code compiles using NVHPC compilers
  • Checked that the code compiles using CRAY compilers
  • Ran the code on either V100, A100, or H100 GPUs and ensured the new feature performed as expected (the GPU results match the CPU results)
  • Ran the code on MI200+ GPUs and ensure the new features performed as expected (the GPU results match the CPU results)
  • Enclosed the new feature via nvtx ranges so that they can be identified in profiles
  • Ran a Nsight Systems profile using ./mfc.sh run XXXX --gpu -t simulation --nsys, and have attached the output file (.nsys-rep) and plain text results to this PR nsys.txt
  • Ran an Omniperf profile using ./mfc.sh run XXXX --gpu -t simulation --omniperf, and have attached the output file and plain text results to this PR.
  • Ran my code using various numbers of different GPUs (1, 2, and 8, for example) in parallel and made sure that the results scale similarly to what happens if you run without the new code/feature

@ChrisZYJ ChrisZYJ changed the title Weno7 nonuniform Non-Uniform WENO7 Nov 19, 2024
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 41.08527% with 76 lines in your changes missing coverage. Please review.

Project coverage is 42.97%. Comparing base (ff6e3e0) to head (5d1b373).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/simulation/m_weno.fpp 41.08% 76 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #743      +/-   ##
==========================================
- Coverage   42.98%   42.97%   -0.01%     
==========================================
  Files          61       61              
  Lines       16384    16492     +108     
  Branches     1889     1890       +1     
==========================================
+ Hits         7042     7087      +45     
- Misses       8293     8356      +63     
  Partials     1049     1049              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@sbryngelson
Copy link
Member

This is well done, I can already tell. I will do code review soon.

Copy link
Member

@sbryngelson sbryngelson left a comment

Choose a reason for hiding this comment

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

Are stretched grids included in the test suite? It seems perhaps not. Would be good to have. Codecov also seems to thing many lines of code are not tested. [update: mind you, codecov could be wrong. it isn't a perfect tool and I'm still learning its limits]

@ChrisZYJ
Copy link
Contributor Author

Are stretched grids included in the test suite? It seems perhaps not. Would be good to have. Codecov also seems to thing many lines of code are not tested.

I think all added lines are covered; removing any line will cause the test suites to fail.

My guess is that Codecov has trouble correctly identifying lines in m_weno.fpp. In the past, Codecov has misidentified many covered lines as uncovered. You can see it here.

There is only one set of equations for both non-uniform and uniform grids (same as WENO3/5). The non-uniform coefficients simplify to the uniform grid coefficients when the grids are uniform. Therefore, the existing test suites cover all the new equations.

@sbryngelson
Copy link
Member

Are stretched grids included in the test suite? It seems perhaps not. Would be good to have. Codecov also seems to thing many lines of code are not tested.

I think all added lines are covered; removing any line will cause the test suites to fail.

My guess is that Codecov has trouble correctly identifying lines in m_weno.fpp. In the past, Codecov has misidentified many covered lines as uncovered. You can see it here.

There is only one set of equations for both non-uniform and uniform grids (same as WENO3/5). The non-uniform coefficients simplify to the uniform grid coefficients when the grids are uniform. Therefore, the existing test suites cover all the new equations.

🫡 you are correct on all counts. Thanks for your continued high-quality PRs!

@sbryngelson sbryngelson merged commit e362dc9 into MFlowCode:master Nov 20, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support stretched grids for 7th-order reconstructions
2 participants