Skip to content

feat(rustfoil-cli): add --flap option to polar and faithful-polar#18

Open
aeronauty-flexcompute wants to merge 2 commits into
mainfrom
harry/rustfoil-cli-flap
Open

feat(rustfoil-cli): add --flap option to polar and faithful-polar#18
aeronauty-flexcompute wants to merge 2 commits into
mainfrom
harry/rustfoil-cli-flap

Conversation

@aeronauty-flexcompute

@aeronauty-flexcompute aeronauty-flexcompute commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds an XFOIL-style --flap "hinge_x:hinge_y:deflection_deg" option to both the inviscid polar and viscous faithful-polar commands.
  • The deflection is applied via the existing rustfoil_core::flap::xfoil_flap before the body is built. faithful-polar writes the flapped section to a temp .dat and feeds it to XFOIL.
  • Lets you generate flapped-airfoil priors straight from the CLI — no separate pre-deflected coordinate file needed.

Motivation

Came out of the blown-lift / Tailor multifidelity work (FXC-9009): we needed a cheap flapped-airfoil lift prior for an LS(1)-0417 with a deployed flap. A plain-XFOIL flap on the main element turns out to be a strong prior — the viscous+flap panel curve carries ~98.5% of the RANS C_L variance, leaving Tailor to model only the small residual.

Test Plan

# inviscid, 12 deg flap at hinge (0.72c, 0.5 t)
rustfoil polar ls417.dat --alpha-start=0 --alpha-end=12 --alpha-step=4 --flap 0.72:0.5:12
# viscous (XFOIL) with the same flap
rustfoil faithful-polar ls417.dat --re 1e7 --mach 0.2 --alpha 0:12:4 --flap 0.72:0.5:12

Verified locally: flap increases C_L monotonically with deflection; a bad --flap string warns and is ignored (clean polar still runs).

🤖 Generated with Claude Code


Note

Low Risk
CLI-only wiring around existing flap geometry; invalid specs are ignored with a warning and default behavior is unchanged.

Overview
Adds --flap "hinge_x:hinge_y:deflection_deg" to the inviscid polar and viscous faithful-polar subcommands so flapped polars can be run without a pre-deflected coordinate file.

When --flap is set, coordinates are transformed with rustfoil_core::flap::xfoil_flap before Body construction (inviscid) or before XFOIL-style repaneling via a new build_body_for_faithful_points helper (faithful path). A shared parse_flap_spec parses the colon-separated triple; malformed values log a warning and the command falls back to the unflapped geometry.

Status messages about the applied hinge/deflection go to stderr so tabular polar output stays clean.

Reviewed by Cursor Bugbot for commit 62b263e. Bugbot is set up for automated code reviews on this repo. Configure here.

Add an XFOIL-style --flap "hinge_x:hinge_y:deflection_deg" option to both
the inviscid `polar` and viscous `faithful-polar` commands. The deflection
is applied via the existing rustfoil_core::flap::xfoil_flap before the body
is built (faithful-polar writes the flapped section to a temp .dat and feeds
it to XFOIL). Enables flapped-airfoil priors directly from the CLI without a
separate pre-deflected coordinate file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: Invalid flap silently ignored
    • faithful-polar now uses shared flap validation and emits the same bad --flap warning before ignoring malformed input.
  • ✅ Fixed: Flap fields shift after empty segments
    • Both polar paths now require exactly three colon-separated flap fields and reject any unparseable or empty segment.
  • ✅ Fixed: Shared temp file race
    • faithful-polar now builds the flapped body directly from in-memory points instead of writing a shared temporary geometry file.

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 9694a76. Configure here.

Comment thread crates/rustfoil-cli/src/main.rs Outdated
Comment thread crates/rustfoil-cli/src/main.rs Outdated
Comment thread crates/rustfoil-cli/src/main.rs Outdated
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