-
Notifications
You must be signed in to change notification settings - Fork 117
Refactor m_riemann_solvers
Module (HLL Solver)
#910
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
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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.
Pull Request Overview
This PR refactors the HLL Riemann solver logic within the m_riemann_solvers module to improve math-critical routines and streamline flux computations. Key changes include the addition of new variables for tau fluxes, consolidation and vectorization of loops for performance improvements (including OpenACC directives), and rewriting flux computations using array slicing and loops.
Comments suppressed due to low confidence (4)
src/simulation/m_riemann_solvers.fpp:464
- Consider adding inline comments explaining the rationale for combining Re_L and Re_R computations within a single loop, which will aid future maintainers in understanding the symmetry and performance benefits of this refactor.
Re_R(i) = dflt_real
src/simulation/m_riemann_solvers.fpp:536
- [nitpick] Confirm that the vectorized array-slice operations replicate the intended element‐by‐element computation accurately, and consider adding a brief comment to clarify this design choice for future readers.
b4%L(1:3) = B%L(1:3)/Ga%L + Ga%L*vel_L(1:3)*vdotB%L
src/simulation/m_riemann_solvers.fpp:962
- Verify that looping from 0 to 2 and accessing array elements as (i + 1) is consistent with the rest of the module’s 1-indexed conventions to avoid any potential off-by-one indexing errors.
do i = 0, 2
src/simulation/m_riemann_solvers.fpp:752
- Ensure that the newly introduced !$acc loop seq directives in the flux computations are benchmarked to confirm that they provide the expected GPU performance benefits without introducing overhead.
if (mhd .and. (.not. relativity)) then
PR Code Suggestions ✨No code suggestions found for the PR. |
For the loop bounds, I basically combined identical flux terms with incrementally different indexing, so just making a do loop instead of hardcoding calcs for each flux term. |
flux_rs${XYZ}$_vf(j, k, l, B_idx%beg + i) = (1 - dir_flg(i + 1))*( &
s_M*(vel_R(dir_idx(1))*B%R(i + 1) - vel_R(i + 1)*B%R(norm_dir)) - &
s_P*(vel_L(dir_idx(1))*B%L(i + 1) - vel_L(i + 1)*B%L(norm_dir)) + &
s_M*s_P*(B%L(i + 1) - B%R(i + 1)))/(s_M - s_P)
|
Pushing for the GitHub CI testing to catch any errors after verifying the pass of HLL specific tests locally. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #910 +/- ##
==========================================
+ Coverage 45.98% 46.01% +0.03%
==========================================
Files 68 68
Lines 18629 18591 -38
Branches 2239 2238 -1
==========================================
- Hits 8566 8555 -11
+ Misses 8711 8685 -26
+ Partials 1352 1351 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
User description
Description
Reduced PR from (#855),
Essentially, I refactored math-critical items in s_hll_riemann_solver subroutine.
PR Type
Enhancement
Description
Refactored HLL Riemann solver for improved code efficiency
Consolidated repetitive loops into vectorized operations
Simplified hypoelasticity energy flux calculations
Optimized magnetic field flux computations
Changes diagram
Changes walkthrough 📝
m_riemann_solvers.fpp
HLL solver optimization and code consolidation
src/simulation/m_riemann_solvers.fpp
operations
unified loop