Rename the *_array locals to _dist, matching the per-panel fields they hold - #341
Conversation
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
left a comment
There was a problem hiding this comment.
Independent review (advisory)
Verdict: APPROVE WITH COMMENTS · 1 inline, 0 off the diff
Good
- Rename matches the card:
e971c74..HEADtouches only the 7 listed files (+229/−239), and a search ofsrc test mwes examples docsfinds no\w_array\bleft. _distfollows the rule already written atsrc/solver.jl:8and thesolver.sol._*_distfields 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:
coordcomes fromgenerate_coordinates_el_wingand is a matrix, andcalculate_AIC_matrices!only loops overbody_aero.panels, so the results can't change. - The three new docstring signatures match the code, including
target=body_aero.AIC,reference_pointand 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 toforce/moment, then aliased straight back toF/M0(andr0), so the new names are never used past the first line. Either use them in the body or name the parametersF/M0; keeping both leaves two names for the same value.- The card says only private docstrings changed, but
calculate_resultsis exported and listed indocs/src/functions.md, and the docs build was not run. - In the
calculate_resultsdocstring this PR rewrites, line 756 still saysflow_curvaturereadsbody_aero.omega; the code readsbody_aero.pitch_rate_dist, whichset_va_distribution!can set without anyomega. test/bench.jl:97and:189were rewritten but still run past 92 columns.mwes/mwe_01.jl:1now namessolver.sol._va_dist, but the mock two lines down uses a field calledva_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.
| ) | ||
| F = force_array | ||
| M0 = moment_array | ||
| F = force |
There was a problem hiding this comment.
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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
No changelog entry? Is all of this internal? |
|
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 |
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 nowcalc_norm_dist!, andfind_center_of_pressuretakesforceandmoment. "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_distfor everything per-panel, whether it is 1D or 2D, for three reasons:src/solver.jlalready sets the rule: "Variables ending in_dist: per-panel distributions"._dist:VSMSolution._x_airf_dist,_va_dist,_chord_dist, andLoopResult.va_norm_dist/va_unit_dist.solver.jlwas already passingcl_distandchord_arrayin 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_array→panel_width_dist, not the field'swidth_dist). That keeps every rename one mechanical rule. The two exceptions areforce_arrayandmoment_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
test_body_aerodynamics.jl, both AIC testsets sizedva_norm_dist/va_unit_distwithlength(coord).coordis a matrix, so that counts elements, not panels. They now uselength(body_aero.panels). The test result can't change, becausecalculate_AIC_matrices!only reads rows1:P.update_effective_angle_of_attack!was documented under the name of a function that no longer exists (..._if_VSM) and left outalpha_corrected.calculate_resultsleft outreference_pointand its keywords.calculate_AIC_matrices!left outtarget.mwes/mwe_01.jl,mwe_warntype.jl) importcalc_norm_array!, so they follow the rename.Left for later
vanaming (va_distributionnext tova_dist, etc.) is One name per apparent-wind quantity:va,v_a,_vaandva_*... #337, part 3 of Refactoring part III #147._arrayand still have no suffix, e.g.induced_velocity_allandrelative_velocity_crosszingamma_loop!, oralpha_correctedandf_body_3Dincalculate_results. They'd fit alongside One name per apparent-wind quantity:va,v_a,_vaandva_*... #337.src/solver.jlandtest/solver/test_solver.jlbut no renamed line, so whichever merges second should rebase cleanly.Verification
Reproduced first: n/a, pure rename.
grep -rnE '\w_array\b'oversrc test mwes examples docsnow finds nothing (only oldCHANGELOG.mdentries mention_array).Tests, run in the worktree's session on the test env:
body_aerodynamics/test_body_aerodynamics.jlbody_aerodynamics/test_results.jlsolver/test_solver.jlsolver/test_flow_curvature.jlsolver/test_unrefined_dist.jlsolver/test_forwarddiff.jlbench.jl(allocation checks)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 anUndefVarError.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 (
vanaming).Closes #336 · task
VortexStepMethod.jl-336