Skip to content

Restore optnames_aero used by the stability evaluations - #2903

Closed
ManasBagul23 wants to merge 1 commit into
su2code:developfrom
ManasBagul23:fix-stability-optnames-aero
Closed

ManasBagul23 wants to merge 1 commit into
su2code:developfrom
ManasBagul23:fix-stability-optnames-aero

Conversation

@ManasBagul23

@ManasBagul23 ManasBagul23 commented Sep 16, 2026

Copy link
Copy Markdown

Proposed Changes

optnames_aero was removed from SU2.io when the history field mapping was introduced (39dbebc), but stability() in SU2_PY/SU2/eval/functions.py and SU2_PY/SU2/eval/gradients.py still use it to find the base coefficient of the D_*_D_ALPHA objectives. Choosing any of those objectives fails with:

AttributeError: module 'SU2.io' has no attribute 'optnames_aero'. Did you mean: 'optnames_geo'?

This PR defines optnames_aero again in SU2_PY/SU2/io/tools.py, built from the COEFFICIENT entries of the history map. Every entry of optnames_stab matches exactly one of them (D_LIFT_D_ALPHA -> LIFT, ..., D_MOMENT_Z_D_ALPHA -> MOMENT_Z).

Tested by calling both stability() functions with the solver runs mocked: gradients.stability picks the right base name for all six objectives, and functions.stability returns the expected finite differences.

Related Work

Closes #2913.

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

optnames_aero was removed from SU2.io when the history field mapping
was introduced, but stability() in eval/functions.py and
eval/gradients.py still use it to find the base coefficient of the
D_*_D_ALPHA objectives. Selecting any of those objectives failed with
AttributeError. Rebuild the list from the coefficient entries of the
history map, which gives one match for every stability objective.
Copilot AI lite review requested due to automatic review settings September 16, 2026 17:00

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.

🟢 Approval recommended

No unresolved review issues were identified.

Pull request overview

Restores SU2.io.optnames_aero so stability evaluations can resolve base aerodynamic coefficients.

Changes:

  • Rebuilds aerodynamic objective names from coefficient entries.
  • Restores stability evaluation compatibility.
File summaries
File Description
SU2_PY/SU2/io/tools.py Defines optnames_aero from historyOutFields.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants