Skip to content

feat: XFOIL objectives - minimum Cd at target Cl, maximum Cl with Cd limit - #9

Open
PSamuele wants to merge 1 commit into
feat/optimizer-parityfrom
feat/xfoil-objective
Open

PSamuele wants to merge 1 commit into
feat/optimizer-parityfrom
feat/xfoil-objective

Conversation

@PSamuele

Copy link
Copy Markdown
Contributor

What

New prompt in the XFOIL solver:

  1. Minimum Cd at a target Cl (asks the target Cl)
  2. Maximum Cl with a Cd limit (asks the maximum Cd)

Score:

  • Mode 1: Cd in drag counts (1 count = 0.0001). If Cl is outside target +/- 0.005, a quadratic penalty is added (0.001 of Cl outside the tolerance = 100 counts).
  • Mode 2: -Cl. If Cd is above the limit, a quadratic penalty is added.

Other changes:

  • The chosen objective is printed before the table. A warning is printed if the final Cl is outside the tolerance (mode 1) or the final Cd is above the limit (mode 2).
  • Results folder: ..._Cl<target> (mode 1) or ..._CdMax<limit> (mode 2).
  • Score column one character wider in both programs (negative scores in mode 2). The history plot uses a symmetric log scale when scores are negative.
  • Failed analyses and airfoils outside the box now score 1e9 instead of 1e6. With the new penalties a valid airfoil far from the target Cl could score up to about 4e8, i.e. worse than a failed analysis. The Genetic Algorithm would then prefer failed analyses to valid airfoils.
  • README updated.

The in-house solver is unchanged: it cannot minimise Cd until a boundary-layer model is added.

Results (Re 3.42e6, alpha 4 deg, seed 42)

Cl Cd
Previous PR (Cl target only), sandbox 0.8009 0.00656
Mode 1, target Cl 0.8, Windows 0.7967 0.00571
Mode 2, Cd <= 0.007, Windows (run with failure score 1e6) 1.5922 0.00688
Mode 2, Cd <= 0.007, sandbox (failure score 1e9) 1.5802 0.00699

Notes

  • Mode 1: the best airfoil is found by the Genetic Algorithm; SLSQP rarely improves it. XFOIL prints Cd with 5 decimals (0.1 count), so the finite-difference gradient of Cd is coarse.
  • Mode 2: with the default limit (Cd 0.02) the constraint is not active at 4 deg (final Cd 0.007). Maximum Cl is reached by pushing the camber to its upper bound (m = 0.09). A lower default limit may be more useful: to be decided.
  • Open question from the previous PR: now that mode 1 has a well-defined objective, should the default seed be fixed instead of random?

Verified

  • Baseline 24/24.
  • Windows: both modes run; final Cl within tolerance (mode 1) and Cd below the limit (mode 2).
  • Sandbox: with failure score 1e9, every valid airfoil scores below every failed one (max valid 3.7e7, min failed 1.0e9).

Depends on

#8 (base branch: feat/optimizer-parity).

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.

1 participant