Repository navigation
perf: reuse the clamped-cable Jacobian columns across body steps - #10
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 645f81fbd9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
645f81f to
6b8d71d
Compare
Profiling a buoy with a clamped power cable showed 77 % of the run in cable steps: 4849 of them for 600 march steps. Each monolithic step took one outer iteration, then rebuilt the junction Jacobian, whose clamped- cable part is six finite-difference columns, each re-stepping the whole cable from the step entry, and converged at the second iteration: eight cable steps per step. The cable columns are now kept per cable and reused across steps, with the refresh rules of the mooring lines' condensed tangent: rebuilt on a step's first Jacobian when they are 20 steps old, when the previous step needed more than two outer iterations, or when the step size changed (step halving), and on every Jacobian from the third outer iteration on; a failed step discards them. A fresh build adds the same values as before. examples/buoy_clamped_cable.dat runs in 3.03 s instead of 7.50 s with the same mean outer iterations (2.01). The junction still converges to its tolerance, so results change within it: tensions by about 2e-6 relative, the body position by under 1 um, the body pitch moment by 2 N m on a 10 kN m channel. Decks without a clamped cable are unchanged. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
6b8d71d to
296fb9a
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Review found that the cache of a clamped cable's Jacobian columns was allocated as 6 x 6, the coordinates of a free body. A body's junction group also holds three coordinates for every rod pinned to it, and a clamped cable on that body, or on one of its pinned rods, fills the whole group: with one pinned rod the cache was indexed up to 9, out of bounds. The cache is now allocated with the junction layout, sized for the largest group. A test deck, the clamped-cable buoy with an arm rod pinned to the body, runs in the Debug build's bounds checks; before the fix it stopped there with index 9 outside 1:6. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Speeds up the monolithic multibody step when a body holds a clamped cable (
examples/buoy_clamped_cable.dat).Profiling that deck showed 77 % of the run in cable steps: 4849 of them for 600 march steps. Each step:
That is eight cable steps per march step.
Changes (
mb_step_implicitinsrc/CableDyn_DeckDriver.f90):MultibodyMarch%cab_jac) and reused across steps. The refresh rules are those of the mooring lines' condensed tangent (tan_age). The columns are rebuilt:Speed (IFX 2025.3.2 release-mirror build, one thread, median of 3, isolated runs, before =
devb5c647f):buoy_clamped_cablechain_two_train_sea,mixed_body_rods_points,lazy_wave_vessel_rao,als_volturnus_line_break_time,lozon_gomaine200_power_cableWith gfortran 16.2 the deck goes from 7.50 s to 3.03 s, and the mean outer iterations per step are unchanged (2.01).
Results. The junction Newton still converges to the same tolerance (
JUNCTION_TOL = 1e-6of each object's force and moment scale). It now reaches that tolerance from a slightly different Jacobian, so results move within the tolerance.buoy_clamped_cable(IFX), largest differences per channel:Body1MyBody1PzBody1RyAnchTen4FairTen4BendMom4N1To check that these differences come from the convergence tolerance and not from a different solution, both versions were also run with
JUNCTION_TOLtightened to 1e-10 (gfortran, local build only, not committed):Body1My, the largest)So the existing tolerance already allows differences of this size, and with a tight tolerance both versions converge to the same solution.
Tests
driver_clamped_cable_pinned_rod:tests/data/buoy_clamped_cable_pinned_rod.datis the clamped-cable buoy with an arm rod pinned to the body, so the body's junction group has nine coordinates. The kept columns are sized for the largest group (review fix 76cf96f). Under the Debug build's bounds checks, a cache sized for six stops with index 9 outside 1:6; the fixed code runs cleanly.devwith feat: add a run-time profile to the standalone driver #8 and perf: evaluate each directional-sea phase and depth profile once #9.pre-commit run --all-filespasses.Checklist
pre-commit run --all-filespassesctest --test-dir build --output-on-failurepassespython -m pytest tests python/testspasses (if Python or validation records changed) — not applicable[Unreleased](heading added if missing) for user-visible changesdoc/updated for changed inputs, options, or outputs — not applicable, no inputs or outputs changedfeat:,fix:,docs:, ...)git commit -s) under theDeveloper Certificate of Origin