Skip to content

[SPH] Apply CFL multiplier at the end of the CFL computation#1883

Closed
tdavidcl wants to merge 2 commits into
Shamrock-code:mainfrom
tdavidcl:cfl_logs
Closed

[SPH] Apply CFL multiplier at the end of the CFL computation#1883
tdavidcl wants to merge 2 commits into
Shamrock-code:mainfrom
tdavidcl:cfl_logs

Conversation

@tdavidcl

Copy link
Copy Markdown
Member

No description provided.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks @tdavidcl for opening this PR!

You can do multiple things directly here:
1 - Comment pre-commit.ci run to run pre-commit checks.
2 - Comment pre-commit.ci autofix to apply fixes.
3 - Add label autofix.ci to fix authorship & pre-commit for every commit made.
4 - Add label light-ci to only trigger a reduced & faster version of the CI (need the full one before merge).
5 - Add label trigger-ci to create an empty commit to trigger the CI.

Once the workflow completes a message will appear displaying informations related to the run.

Also the PR gets automatically reviewed by gemini, you can:
1 - Comment /gemini review to trigger a review
2 - Comment /gemini summary for a summary
3 - Tag it using @gemini-code-assist either in the PR or in review comments on files

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CFL timestep calculation in Solver.cpp by moving the multiplication of cfl_multiplier from the individual particle-level calculations to the final next_cfl computation. A review comment highlights a regression caused by this change: the individual particle timesteps stored in cfl_dt remain unscaled, which leads to incorrect values being saved to the dt_part field if should_save_dt_to_fields() is enabled. It is recommended to scale these values before they are saved.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +2650 to +2651
next_cfl
= sham::min(hydro_cfl, sink_sink_cfl) * solver_config.time_state.cfl_multiplier;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

By moving the multiplication of cfl_multiplier to the very end of the CFL computation (i.e., only applying it to next_cfl), the individual particle timesteps stored in cfl_dt remain unscaled.

If solver_config.should_save_dt_to_fields() is enabled, these unscaled raw CFL timesteps are copied directly to the dt_part field (lines 2583-2594). This is a regression/bug, as dt_part should store the actual scaled timesteps used by the solver.

To fix this, the dt_part field (or cfl_dt after rank_dt is computed) should be scaled by solver_config.time_state.cfl_multiplier before being saved.

@tdavidcl tdavidcl closed this Jun 21, 2026
@tdavidcl
tdavidcl deleted the cfl_logs branch June 21, 2026 19:56
@github-actions

Copy link
Copy Markdown
Contributor

Workflow report

workflow report corresponding to commit d2e5fee
Commiter email is timothee.davidcleris@proton.me
GitHub page artifact URL GitHub page artifact link (can expire)

Pre-commit check report

Pre-commit check: ✅

trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check for merge conflicts................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check for broken symlinks................................................Passed
check yaml...............................................................Passed
detect private key.......................................................Passed
No-tabs checker..........................................................Passed
Tabs remover.............................................................Passed
cmake-format.............................................................Passed
Validate GitHub Workflows................................................Passed
clang-format.............................................................Passed
ruff check...............................................................Passed
ruff format..............................................................Passed
Check doxygen headers....................................................Passed
Check license headers....................................................Passed
Check #pragma once.......................................................Passed
Check SYCL #include......................................................Passed
No ssh in git submodules remote..........................................Passed
No UTF-8 in files (except for authors)...................................Passed

Test pipeline can run.

Clang-tidy diff report


1083 warnings generated.
Suppressed 1084 warnings (1070 in non-user code, 13 due to line filter, 1 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

Doxygen diff with main

Removed warnings : 0
New warnings : 0
Warnings count : 7951 → 7951 (0.0%)

Detailed changes :

@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/shammodels/sph/src/Solver.cpp 0.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant