Skip to content

fixed bug in moddump_flyby where secondary's orbit was not being set properly#852

Merged
danieljprice merged 2 commits into
danieljprice:mainfrom
ahermosillo:master
Jul 17, 2026
Merged

fixed bug in moddump_flyby where secondary's orbit was not being set properly#852
danieljprice merged 2 commits into
danieljprice:mainfrom
ahermosillo:master

Conversation

@ahermosillo

@ahermosillo ahermosillo commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description:

Components modified:

  • Setup (src/setup)
  • Main code (src/main)
  • Moddump utilities (src/utils/moddump)
  • Analysis utilities (src/utils/analysis)
  • Test suite (src/tests)
  • Documentation (docs/)
  • Build/CI (build/ or github actions)

Type of change:

  • Bug fix
  • Physics improvements
  • Better initial conditions
  • Performance improvements
  • Documentation update
  • Better testing
  • Code cleanup / refactor
  • Other (please describe)

Testing:
I calculated the secondary's orbital elements using the xyzvxyz data from a dump file, and I confirmed this was the same as the orbital parameters I input in flyby.moddump. I tested this for bound and unbound case.

Did you run the bots? no

Did you update relevant documentation in the docs directory? no

Did you add comments such that the purpose of the code is understandable? yes

Is there a unit test that could be added for this feature/bug? yes

If so, please describe what a unit test might check:
We can test that running this moddump will add a star at the correct orbit for all of the 4 options (bound, unbound, orbit reconstructor, observed dx dy).

Related issues: #851

Summary by CodeRabbit

  • Bug Fixes
    • Corrected flyby sink placement when modifying dumps.
    • Flyby positions and velocities are now translated relative to the current primary sink, preserving the intended relative motion.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 15f2437e-eaf5-48cd-940c-5959e1e5722c

📥 Commits

Reviewing files that changed from the base of the PR and between f3ebe66 and 43d8832.

📒 Files selected for processing (1)
  • src/utils/moddump_addflyby.f90
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/utils/moddump_addflyby.f90

📝 Walkthrough

Walkthrough

modify_dump initializes flyby orbit inputs and inserts the secondary with position and velocity translated relative to the target primary sink, while retaining the sink-count and capacity checks.

Changes

Flyby sink translation

Layer / File(s) Summary
Translate inserted flyby state
src/utils/moddump_addflyby.f90
modify_dump initializes orbit inputs, increments nptmass, checks array capacity, and shifts the inserted secondary’s position and velocity relative to the current primary sink.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main bug fix in moddump_flyby and matches the changeset.
Description check ✅ Passed The description follows the template and includes the change summary, component, type, testing, bot, docs, comments, test idea, and related issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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 introduces translation logic for the secondary sink particle relative to the primary sink particle in src/utils/moddump_addflyby.f90. Feedback suggests initializing xyzmh_ptmass_in and vxyz_ptmass_in to zero to avoid copying uninitialized garbage values, and simplifying the velocity translation into a single assignment.

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 thread src/utils/moddump_addflyby.f90
Comment thread src/utils/moddump_addflyby.f90 Outdated
@danieljprice
danieljprice merged commit 5afc87f into danieljprice:main Jul 17, 2026
537 of 539 checks passed
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.

2 participants