Skip to content

test_forwarddiff.jl's POLAR_MATRICES check flakes at ~4%, and the oper #287

Description

@1-Bort-1

test_forwarddiff.jl's POLAR_MATRICES check flakes at ~4%, and the operating point 320e756 chose to prevent it does not move

test/solver/test_forwarddiff.jl:88 asserts rel_err < 1e-3 on max|jac_fwd - jac_fd| / max|jac_fwd|. It failed on #285's CI in Julia 1.12 - ubuntu - x64 - with code coverage at 0.0400, with the other five matrix cells green on the same commit. #285's diff is entirely inside the NONLIN branch of gamma_loop! (src/solver.jl:913-1010, which returns before the LOOP branch at :1012) and this test builds a solver_type=LOOP solver, so no changed line is reachable from it.

This is the third time the check has been in the frame. 320e756 recorded "one Windows run crossed 1e-3 at 0.044 while a re-run passed", moved y_op[1:4] off zero (defl_rad = deg2rad(1.0)) and loosened the bound to 0.1 in the same commit. ae11d48 then pinned NeuralFoil table generation to one BLAS thread, tightened the bound back to 1e-3, and put y_op[1:4] back to zeros(4). 0.0400 is the same jump as 0.044.

Measured here (VSM at the test's operating point, 8 panels, tables regenerated on this box):

  • rel_err = 3.31e-6, repeatable to four significant figures — 300x inside the 1e-3 bound. CI's 0.0400 is 12000x that, so it is a discrete derivative jump, not tolerance drift.
  • Flat in freestream alpha: 3.23e-6 at 5.0 deg, 3.23e-6 at 6.0 deg, 3.31e-6 at 7.5 deg, 3.23e-6 at 10.0 deg.
  • Flat in theta: 3.314e-6 at theta = 0, and the same 3.314e-6 at 1e-12, -1e-12, 1e-9, -1e-9, 1e-6 and -1e-6; 3.316e-6 at 0.25 deg, 3.273e-6 at 1.0 deg, 3.307e-6 at -1.0 deg. There is no knife edge in theta anywhere between 0 and 1 deg.

That last line is the point: theta_idxs=1:4 feeds twist, and linearize passes delta_angles=nothing, so 320e756's defl_rad never moved the operating point off a delta knot. Its green run came from the 0.1 bound it set in the same commit, which ae11d48 was right to tighten. Restoring that operating point would buy nothing — worth writing down before someone reaches for it again.

Where the knife edge actually is, still open. Two candidates measured at the operating point:

  1. Every panel's delta is exactly 0.0, which is exactly a knot of the table's delta_range = -3:3:3 deg. Whichever delta strip's slopes the interpolant selects at an exact knot decides the alpha-direction slopes, and the worst entry is always a theta column (2 or 3).
  2. The tip panels solve to alpha 19.04 and 18.93 deg, outside the table's alpha_range = -5:5:15 deg, so they are extrapolated.

Deciding between them needs the environment that produces the 4% jump; it does not reproduce here. A fix that would follow from (1) is shifting delta_range so 0 is interior to a cell (e.g. deg2rad.(-4.5:3:4.5), putting the operating point 1.5 deg from the nearest knot, 2600x the 1e-5 finite-difference step) rather than moving an input that does not reach delta. Not done here: it changes what the test covers and I cannot show it red before and green after.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions