Skip to content

perf: vectorized panel method (same results, about 50x faster) - #11

Merged
Filettus-newkeyboard merged 1 commit into
feat/validation-error-breakdownfrom
perf/vectorized-panel-method
Sep 23, 2026
Merged

Filettus-newkeyboard merged 1 commit into
feat/validation-error-breakdownfrom
perf/vectorized-panel-method

Conversation

@PSamuele

@PSamuele PSamuele commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What

_calculate_influence_coefficients in naca_core/panel_method.py computed the influence coefficients with a Python double loop (160 x 160 = 25,600 iterations per analysis).
The same formulas are now evaluated for all panel pairs at once with NumPy arrays. The diagonal (i == j) is zero, as before. No other function is changed.

Verified

  • Baseline 24/24 on Windows and Linux, max difference 2e-15 (round-off only).
  • Linux: baseline also run with warnings as errors (-W error): no division-by-zero warnings.
  • Windows: in-house optimizer with seed 136031 gives exactly the same run as before (112 iterations, NACA 3207, m = 0.0308, p = 0.2392, t = 0.0687).
  • Linux: in-house optimizer with seed 42, all 105 table rows identical to the old version.

Speed (Linux sandbox)

Before After
One analysis, 160 panels 0.247 s 0.0046 s
Full in-house optimization 30.3 s 2.9 s

Measured on a single-core Intel Xeon 2.10 GHz VM, Ubuntu 24.04, Python 3.12.3, numpy 2.4.4 (OpenBLAS). Absolute times depend on the machine; the ratio does not.

The XFOIL optimizer is almost unaffected: its time is spent in XFOIL.

Depends on

#10 (base branch: feat/validation-error-breakdown).

@Filettus-newkeyboard

Copy link
Copy Markdown
Contributor

Mi sono preso del tempo per chiedere a Gemini cosa cambia, e adesso ho imparato come il comando python np.asarray vettorializza e migliora tutto... Niente da dire... Chapeau Samu!!!

@Filettus-newkeyboard
Filettus-newkeyboard merged commit 24aac8c into feat/validation-error-breakdown Sep 23, 2026
@PSamuele

Copy link
Copy Markdown
Contributor Author

Mi sono preso del tempo per chiedere a Gemini cosa cambia, e adesso ho imparato come il comando python np.asarray vettorializza e migliora tutto... Niente da dire... Chapeau Samu!!!

Calma prima di fare complimenti, claude mi ha spiegato di np.asarray, io ho chiesto quali fossero i limiti strutturali del codice riguardo alla velocità e come migliorarla...

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