Skip to content

Rename the *_array locals to _dist, matching the per-panel fields they hold - #341

Merged
1-Bart-1 merged 2 commits into
mainfrom
agent/336-rename-the-array-locals-to-say-whether-t
Sep 16, 2026
Merged

1-Bart-1 merged 2 commits into
mainfrom
agent/336-rename-the-array-locals-to-say-whether-t

Conversation

@1-Bort-1

Copy link
Copy Markdown
Contributor

TL;DR

The 22 locals and arguments ending in _array (per-panel data, some 1D and some P×3) now end in _dist, calc_norm_array! is now calc_norm_dist!, and find_center_of_pressure takes force and moment. "Array" says nothing about the shape, and the struct fields holding the same data already end in _dist.

The naming decision

#147 asked for vector/matrix (or _vec). I went with _dist for everything per-panel, whether it is 1D or 2D, for three reasons:

  • The top of src/solver.jl already sets the rule: "Variables ending in _dist: per-panel distributions".
  • The fields these locals read from are already _dist: VSMSolution._x_airf_dist, _va_dist, _chord_dist, and LoopResult.va_norm_dist/va_unit_dist.
  • solver.jl was already passing cl_dist and chord_array in the same call.

With _vec/_mat, a local and the field it reads would have different names (x_airf_mat = solver.sol._x_airf_dist). The shape is already in the type, and the docstrings give it where it matters.

Only the suffix changes; the rest of each name stays (panel_width_arraypanel_width_dist, not the field's width_dist). That keeps every rename one mechanical rule. The two exceptions are force_array and moment_array: each holds one 3-vector, not a per-panel quantity, so they lose the suffix. No clashes: before renaming I checked that no new name already exists in the same function.

No public API moves. Everything renamed is a local, a positional argument, or the private calc_norm_array!. Nothing renamed is exported, a struct field, or a keyword.

Also fixed in lines this PR already touches

  • In test_body_aerodynamics.jl, both AIC testsets sized va_norm_dist/va_unit_dist with length(coord). coord is a matrix, so that counts elements, not panels. They now use length(body_aero.panels). The test result can't change, because calculate_AIC_matrices! only reads rows 1:P.
  • Three docstring signatures:
    • update_effective_angle_of_attack! was documented under the name of a function that no longer exists (..._if_VSM) and left out alpha_corrected.
    • calculate_results left out reference_point and its keywords.
    • calculate_AIC_matrices! left out target.
  • The MWEs (mwes/mwe_01.jl, mwe_warntype.jl) import calc_norm_array!, so they follow the rename.

Left for later

Verification

  • Reproduced first: n/a, pure rename. grep -rnE '\w_array\b' over src test mwes examples docs now finds nothing (only old CHANGELOG.md entries mention _array).

  • Tests, run in the worktree's session on the test env:

    File Passed
    body_aerodynamics/test_body_aerodynamics.jl 4858/4858
    body_aerodynamics/test_results.jl 30/30
    solver/test_solver.jl 34/34
    solver/test_flow_curvature.jl 39/39
    solver/test_unrefined_dist.jl 40/40
    solver/test_forwarddiff.jl 7/7
    bench.jl (allocation checks) 21/21
  • Both MWEs parse, and calc_norm_dist! is defined.

  • Local CI mirror (Pkg.test(), Julia 1.12.7, fail-fast): PASS in 8 min, exit 0 · GitHub CI: not run yet (it triggers on the pull request)

  • Docs build: not run. No public symbol was added or renamed; only private docstrings changed.

  • Changelog: none, nothing user-visible changes.

  • Risk: someone running an old copy of the MWE scripts, or out-of-tree code calling the private calc_norm_array!, will get an UndefVarError.

Scope

+229 / −239 across 7 files, against #338's head. It is the rename plus the docstring and test-sizing fixes listed above, nothing else. The net −10 lines come from the three docstring signatures being reflowed. Stack: 2/3 of #147: #338 (typed empty containers) → this → #337 (va naming).

Closes #336 · task VortexStepMethod.jl-336

1-Bort-1 and others added 2 commits September 16, 2026 21:56
Per-panel quantities, 1D or P×3, now end in _dist like the VSMSolution and
BodyAerodynamics fields they are read from; calc_norm_array! becomes
calc_norm_dist!, and find_center_of_pressure takes force and moment. The
AIC test sizes its inputs by panel count, and the
update_effective_angle_of_attack! docstring names the function it documents.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@1-Bort-1 1-Bort-1 added agent:running Agent task state agent:ci Agent task state and removed agent:running Agent task state labels Sep 16, 2026

@1-Bort-1 1-Bort-1 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review (advisory)

Verdict: APPROVE WITH COMMENTS · 1 inline, 0 off the diff

Good

  • Rename matches the card: e971c74..HEAD touches only the 7 listed files (+229/−239), and a search of src test mwes examples docs finds no \w_array\b left.
  • _dist follows the rule already written at src/solver.jl:8 and the solver.sol._*_dist fields these locals read, so a local and its field now share a name.
  • Nothing renamed is part of the API: they are positional parameters, locals and the unexported calc_norm_dist!; keywords (correct_aoa, flow_curvature, force_tol) and struct fields are unchanged.
  • The test-sizing fix is right: coord comes from generate_coordinates_el_wing and is a matrix, and calculate_AIC_matrices! only loops over body_aero.panels, so the results can't change.
  • The three new docstring signatures match the code, including target=body_aero.AIC, reference_point and both keywords, and all fit within 92 columns (387 is exactly 92).
  • The net −10 lines check out: the three reflowed signatures lose 2, 4 and 4 lines.
  • Tree is clean and the .agent/ plan and card files are not in the PR's commits.

Not good

  • src/body_aerodynamics.jl:616 — The parameters are renamed to force/moment, then aliased straight back to F/M0 (and r0), so the new names are never used past the first line. Either use them in the body or name the parameters F/M0; keeping both leaves two names for the same value.
  • The card says only private docstrings changed, but calculate_results is exported and listed in docs/src/functions.md, and the docs build was not run.
  • In the calculate_results docstring this PR rewrites, line 756 still says flow_curvature reads body_aero.omega; the code reads body_aero.pitch_rate_dist, which set_va_distribution! can set without any omega.
  • test/bench.jl:97 and :189 were rewritten but still run past 92 columns.
  • mwes/mwe_01.jl:1 now names solver.sol._va_dist, but the mock two lines down uses a field called va_dist; the header and the code now disagree.

claude, rubric CLEAN_CODE.md. A different lab from the implementer
on purpose: a reviewer sharing its blind spots would not flag its mistakes.

Comment thread src/body_aerodynamics.jl
)
F = force_array
M0 = moment_array
F = force

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

MINOR: The parameters are renamed to force/moment, then aliased straight back to F/M0 (and r0), so the new names are never used past the first line. Either use them in the body or name the parameters F/M0; keeping both leaves two names for the same value.

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.36066% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/body_aerodynamics.jl 95.83% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@1-Bort-1 1-Bort-1 added agent:review Agent task state and removed agent:ci Agent task state labels Sep 16, 2026
Base automatically changed from agent/147-refactoring-part-iii to main September 16, 2026 22:01
@1-Bart-1

Copy link
Copy Markdown
Member

No changelog entry? Is all of this internal?

@1-Bort-1 1-Bort-1 added agent:queued Agent task state agent:running Agent task state and removed agent:review Agent task state agent:queued Agent task state labels Sep 16, 2026
@1-Bort-1

Copy link
Copy Markdown
Contributor Author

Yes, it is all internal, so no changelog entry. Every renamed name is a local, a positional argument (Julia callers can't pass those by name), or the unexported calc_norm_array!. No exported symbol, struct field or keyword changes, and no result changes. The only thing a user could notice is the docstring of the exported calculate_results, which now lists reference_point, correct_aoa and flow_curvature. The function already took all three on main (src/body_aerodynamics.jl:771); the docstring just left them out. Nothing to change in #341.

@1-Bort-1 1-Bort-1 added agent:ci Agent task state agent:review Agent task state and removed agent:running Agent task state agent:ci Agent task state labels Sep 16, 2026
@1-Bart-1
1-Bart-1 merged commit 246237a into main Sep 16, 2026
6 checks passed
@1-Bart-1
1-Bart-1 deleted the agent/336-rename-the-array-locals-to-say-whether-t branch September 16, 2026 22:08
@1-Bort-1 1-Bort-1 added agent:done Agent task state agent:queued Agent task state agent:running Agent task state and removed agent:review Agent task state agent:done Agent task state agent:queued Agent task state labels Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:done Agent task state

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename the *_array locals to say whether they are a vector or a...

2 participants