Skip to content

fix(aerostructural): NumPy 2.4 compatibility in the coupled solvers - #24

Merged
ocayon merged 1 commit into
developfrom
fix/numpy-scalar-conversion
Oct 8, 2026
Merged

ocayon merged 1 commit into
developfrom
fix/numpy-scalar-conversion

Conversation

@ocayon

@ocayon ocayon commented Oct 8, 2026

Copy link
Copy Markdown
Member

Fixes a crash of run_simulation_BILLOW.py on NumPy ≥ 2.4 (TypeError: only 0-dimensional arrays can be converted to Python scalars).

  • coupled/coupled_solver.py: results_aero["alpha_at_ac"] is one row per panel, so [mid_idx] is a one-element array; float() of it raises from NumPy 2.4 on. Flatten before indexing (the wireframe solver already did).
  • Both coupled solvers: np.cross on 2-element vectors (deprecated since NumPy 2.0) replaced by the written-out 2-D cross product.

Checked with both deprecations promoted to errors: the test suite and both baseline scripts run through, and the baselines' results are unchanged (Billow 5049 N, wireframe 4518 N).

run_simulation_BILLOW.py crashed on NumPy 2.4 at the per-iteration alpha
print: results_aero["alpha_at_ac"] is one row per panel, so [mid_idx] is a
one-element array, and float() of it raises from NumPy 2.4 on (deprecated
since 1.25, a warning only up to 2.3). Flatten before indexing, as the
wireframe solver already does.

Both solvers also called np.cross on 2-element vectors for the same print,
deprecated since NumPy 2.0; write out the 2-D cross product instead.

Checked by running the test suite and both baseline scripts with both
deprecations promoted to errors: the baselines run through with unchanged
results (Billow 5049 N, wireframe 4518 N).
Copilot AI balanced review requested due to automatic review settings October 8, 2026 14:04
@ocayon
ocayon merged commit 473b272 into develop Oct 8, 2026
4 checks passed

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
16177 8502 53% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/awetrim/aerostructural/coupled/coupled_solver.py 20% 🟢
src/awetrim/aerostructural/wireframe/coupled_solver_qsm.py 4% 🟢
TOTAL 12% 🟢

updated for commit: 47c2d65 by action🐍

@ocayon
ocayon deleted the fix/numpy-scalar-conversion branch October 12, 2026 08:30
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