Skip to content

[Examples] fix dustysod IC & improve dustywave plots - #1949

Merged
tdavidcl merged 2 commits into
Shamrock-code:mainfrom
tdavidcl:dustysodbug
Jul 27, 2026
Merged

[Examples] fix dustysod IC & improve dustywave plots#1949
tdavidcl merged 2 commits into
Shamrock-code:mainfrom
tdavidcl:dustysodbug

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

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates two SPH dusty TVA examples: configurable dusty-wave sizing and plotting, plus revised Sod-tube dust initialization, timescale, labels, and figure outputs.

Changes

Dusty-wave example

Layer / File(s) Summary
Configurable wave and lattice setup
examples/sph/run_dustywave_tva.py
Perturbation amplitude, plotting controls, and box dimensions are made configurable; periodic HCP lattice bounds and spacing are recalculated from the configured dimensions.
Wave execution and result aggregation
examples/sph/run_dustywave_tva.py
Wave iteration uses a floating period count, snapshot limits scale with perturbation amplitude, and per-case curves are aggregated into expanded GIF and summary plots.

Dusty TVA Sod-tube example

Layer / File(s) Summary
Dust timescale and entropy initialization
examples/sph/run_sod_dust_tva.py
The dust drag timescale changes to 1e-4, and dust entropy fields are initialized through overwrite callbacks using local density and dust-specific epsilon values.
Checkpoint analysis output
examples/sph/run_sod_dust_tva.py
Checkpoint plot labels and styling are updated, with figures saved in both PNG and PDF formats.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, so there is nothing to assess for topical relevance. Add a brief description of the example fixes and plotting updates.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main changes: dusty-sod IC fixes and dustywave plotting improvements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/sph/run_dustywave_tva.py`:
- Around line 50-51: Update the lmin and lmax bounds calculation in the box
setup to preserve odd configured dimensions such as LZ=19; use floating-point
half-length bounds so the domain spans the requested size, or explicitly
validate and reject odd values instead of silently rounding them to the
even-sized domain.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c3ac773d-ee40-4f1d-8a58-fc6699ceb64c

📥 Commits

Reviewing files that changed from the base of the PR and between 7462189 and 5580c4e.

📒 Files selected for processing (2)
  • examples/sph/run_dustywave_tva.py
  • examples/sph/run_sod_dust_tva.py

Comment on lines +50 to +51
lmin = (-(lx // 2), -(ly // 2), -(lz // 2))
lmax = (lx // 2, ly // 2, lz // 2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve odd configured box lengths.

With LZ=19, these bounds are identical to LZ=18 (-9 to 9), so the requested domain size is silently ignored. Use half-length floating bounds, or explicitly reject odd values.

Proposed fix
-lmin = (-(lx // 2), -(ly // 2), -(lz // 2))
-lmax = (lx // 2, ly // 2, lz // 2)
+lmin = (-lx / 2, -ly / 2, -lz / 2)
+lmax = (lx / 2, ly / 2, lz / 2)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
lmin = (-(lx // 2), -(ly // 2), -(lz // 2))
lmax = (lx // 2, ly // 2, lz // 2)
lmin = (-lx / 2, -ly / 2, -lz / 2)
lmax = (lx / 2, ly / 2, lz / 2)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/sph/run_dustywave_tva.py` around lines 50 - 51, Update the lmin and
lmax bounds calculation in the box setup to preserve odd configured dimensions
such as LZ=19; use floating-point half-length bounds so the domain spans the
requested size, or explicitly validate and reject odd values instead of silently
rounding them to the even-sized domain.

Comment thread examples/sph/run_dustywave_tva.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
examples/sph/run_dustywave_tva.py (1)

480-507: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard GIF encoding to rank 0.

show_image_sequence returns None on nonzero MPI ranks, but the added ani1.save(...) and ani2.save(...) calls are unconditional. Multi-rank runs will therefore fail with an attribute error; guard all animation creation/saving with a rank-0 check. (github.com)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/sph/run_dustywave_tva.py` around lines 480 - 507, Guard the ani1 and
ani2 animation creation and save blocks, including their associated
show_image_sequence calls, behind the existing rank-0 condition so nonzero MPI
ranks do not call save on None. Keep the plotting flow unchanged for rank 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@examples/sph/run_dustywave_tva.py`:
- Around line 480-507: Guard the ani1 and ani2 animation creation and save
blocks, including their associated show_image_sequence calls, behind the
existing rank-0 condition so nonzero MPI ranks do not call save on None. Keep
the plotting flow unchanged for rank 0.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6bd5d693-981a-496d-a971-f8b038ad4cfa

📥 Commits

Reviewing files that changed from the base of the PR and between 5580c4e and 16874be.

📒 Files selected for processing (1)
  • examples/sph/run_dustywave_tva.py

@tdavidcl
tdavidcl merged commit 430c187 into Shamrock-code:main Jul 27, 2026
87 checks passed
@tdavidcl
tdavidcl deleted the dustysodbug branch July 27, 2026 21:45
@github-actions

Copy link
Copy Markdown
Contributor

Workflow report

workflow report corresponding to commit 16874be
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

No relevant changes found.
Well done!

You should now go back to your normal life and enjoy a hopefully sunny day while waiting for the review.

Doxygen diff with main

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

Detailed changes :

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 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