Skip to content

feat(planning): non-geodesic VK winding math core (#327) - #350

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/vk-nongeodesic-math-core
Aug 8, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/vk-nongeodesic-math-core

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Part of #327 (Stage 3b Phase 2 — non-geodesic VK nosecone winding). PR 1 of 3: math core.

Adds the friction-assisted (non-geodesic) winding math so a pass can climb past the geodesic turnaround toward the tip. The solver + kinematics are unit-tested directly; the .wind frictionLambda field, validator, dispatch, and slip-limit (μ) threading are deliberately deferred to PR2/PR3 — this slice is pure math.

What's here

  • VonKarman.radius_curvature_at(z) — analytic r″ (cancelled closed form; **0.5/**1.5/math.hypot, no math.sqrt token per the Motion IR guard). Raises at both singular ends (base r″ ∝ −z^{-1/2} and tip).
  • _integrate_nongeodesic — adaptive RK4-march of the coupled (α, θ) ODE from the base to an α_max = 88° ceiling (the turnaround is a coordinate singularity, dα/dz ∝ 1/cos α), the exact crossing pinned by bisection. The step adapts — bounded per-step fibre-angle advance — so the floored z_cap is converged and platform-stable. λ = 0 recovers the geodesic exactly.
  • compute_profile_helical_kinematics(..., friction_lambda=0.0) — λ=0 keeps the Phase-1 geodesic path byte-for-byte frozen (the 22552/32572 move-count pins still hold); λ>0 routes to the marched path and reports the α-table + the cap slip demand |r'(z_cap)|.

Why adaptive (the interesting part)

A fixed-step march to a fixed α_max is not enough: near the cap the geodesic term sin α·r'/r diverges as r→0 (and 1/cos α as α→90°), so a 0.05 mm step advances α by degrees, an RK4 stage overshoots 90° and sign-flips dα/dz, and z_cross came out mm-wrong and step-dependent for moderate λ (e.g. λ=0.17 → 288.96 mm at dz=0.05 vs 281.3 converged; broad floor-flips across λ∈[0.15,0.5]). This was caught by an adversarial review of the first draft. Bounding the per-step α-advance shrinks the step exactly where the ODE stiffens (the near-cap tail and the base r″ spike), giving a converged, deterministic cap — 0 floor-flips across the adversarial λ×angle grid.

Tests (independent oracles)

  • λ=0 ≡ geodesic element-wise (the correctness anchor)
  • cylinder closed form 1/sin α = 1/sin α₀ + λz/r — pins the k_n coefficient and sign independent of the RK4 structure
  • an independently adaptive RK2 integrator agrees into the steep tail (freshly transcribed ODE + different method)
  • cap shrinks monotonically as λ rises (sign-error catch) with the slip demand rising
  • z_cap converged/step-stable across the adversarial λ×angle grid (incl. the values a fixed step got wrong: 0.17/0.28/0.33)
  • r″ vs central difference + the z^{-1/2} base scaling

Gate

Full backend suite 309 passed; ruff + format clean; mypy clean on the touched files. λ=0 geodesic move-count pins unchanged.

Add the friction-assisted (non-geodesic) winding math for the Von Karman
nose so a pass can climb past the geodesic turnaround toward the tip. This
is the math-core slice (PR1 of 3): the solver + kinematics are unit-tested
directly; schema field, validator, dispatch and mu threading follow in PR2/PR3.

- VonKarman.radius_curvature_at(z): analytic r'' (cancelled closed form,
  **0.5/**1.5 not math.sqrt per the Motion IR guard), raising at BOTH the
  base (r'' ~ -z^-1/2) and the tip.
- _integrate_nongeodesic: adaptive RK4-march of the coupled (alpha, theta) ODE
  from the base to an alpha_max=88 ceiling, the exact crossing pinned by
  bisection. The step shrinks to bound the per-step fibre-angle advance where
  dalpha/dz stiffens (the base r'' spike and the near-cap tail where sin(a)r'/r
  diverges as r->0) so the floored z_cap is CONVERGED and platform-stable; a
  fixed step was mm-wrong and step-dependent for moderate lambda. lambda=0
  recovers the geodesic exactly.
- compute_profile_helical_kinematics(..., friction_lambda=0.0): lambda=0 keeps
  the frozen geodesic path byte-for-byte; lambda>0 routes to the marched path,
  reporting the alpha table and the cap slip demand |r'(z_cap)|.
- profile_local_alpha_deg reads the marched alpha table when present.

Tests (independent oracles): lambda=0 == geodesic element-wise; cylinder
closed form 1/sin(a)=1/sin(a0)+lambda*z/r pins the k_n coefficient+sign; an
independently adaptive RK2 integrator agrees into the steep tail; cap shrinks
monotonically as lambda rises (sign-error catch); z_cap converged/step-stable
across an adversarial lambda x angle grid; r'' vs central difference + z^-1/2
base scaling.
@CameronBrooks11
CameronBrooks11 merged commit adf9f55 into main Aug 8, 2026
21 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/vk-nongeodesic-math-core branch August 8, 2026 17:10
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