rtx-cfd: the deformed cylinder–flag outline's edge fractions come from the UNDEFORMED straight edge (x_tip_ref), so the patch topology is the mesh family's and not the deformation's — the P5-1 gate run died at the first bend with set_mesh refusing 143 → 144 wall cells; the P5-0 test now gates ns across amplitudes (143 at −80 / +40 / +80 mm)
CI / Build (macos-latest) (push) Canceled after 0s
CI / Build (ubuntu-latest) (push) Canceled after 0s
CI / Test (macos-latest) (push) Canceled after 0s
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Build CPU-Only (Explicit) (push) Canceled after 0s
CI / Python Bindings (maturin) (macos-latest) (push) Canceled after 0s
Performance Benchmarks / Run Benchmarks (push) Canceled after 0s
CI / Format Check (push) Canceled after 0s
CI / Clippy Check (push) Canceled after 0s
CI / Python Bindings (maturin) (ubuntu-latest) (push) Canceled after 0s
CI / WASM Build + Size Check (push) Canceled after 0s
CI / Distributed Training Tests (push) Canceled after 0s
CI / CI Success (push) Canceled after 0s
Documentation / Build API Documentation (push) Canceled after 0s
Documentation / Build User Guide (push) Canceled after 0s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0116sg1Qz1gMv9hdcKP1XUam
This commit is contained in:
Omar Sobh
2026-09-07 07:34:26 -07:00
co-authored by Claude Fable 5.1
parent f0b2563bf8
commit d74571e21a
4 changed files with 46 additions and 12 deletions
@@ -615,6 +615,7 @@ pub fn cylinder_flag_patch_deformed(
r: f64,
t: f64,
edges: &FlagEdges,
x_tip_ref: f64,
h: f64,
fillet: f64,
offset: f64,
@@ -622,7 +623,8 @@ pub fn cylinder_flag_patch_deformed(
stretch: f64,
winslow_sweeps: usize,
) -> CfdResult<(PatchMesh, (usize, f64))> {
let (inner, tip) = cylinder_flag_outline_deformed(centre, r, t, edges, fillet, 3, 16, h, 1.15);
let (inner, tip) =
cylinder_flag_outline_deformed(centre, r, t, edges, x_tip_ref, fillet, 3, 16, h, 1.15);
let hull_src = hull_source(centre, r, tip.centre, tip.radius, tip.axis);
o_grid_from_outline(inner, hull_src, h, offset, nn, stretch, winslow_sweeps)
}
@@ -705,12 +707,13 @@ fn arclength_at_x(pts: &[[f64; 2]], cum: &[f64], x0: f64, from_end: bool) -> f64
}
}
/// Points at graded arclength fractions along an open polyline from its
/// start, EXCLUDING the end point (the rigid outline's convention).
fn graded_along(pts: &[[f64; 2]], d0: f64, d_straight: f64, grade: f64) -> Vec<[f64; 2]> {
/// Points at the arclength fractions `fr` (`0 ..= 1`) along an open
/// polyline from its start, EXCLUDING the end point (the rigid outline's
/// convention). The fractions are the UNDEFORMED edge's graded ones, so
/// the point count — the patch topology — is fixed across a march.
fn along_fractions(pts: &[[f64; 2]], fr: &[f64]) -> Vec<[f64; 2]> {
let cum = open_cum(pts);
let len = cum[cum.len() - 1];
let fr = graded_fractions(len, d0, d_straight, grade);
fr[..fr.len() - 1]
.iter()
.map(|&f| open_point_at(pts, &cum, f * len))
@@ -723,14 +726,18 @@ fn graded_along(pts: &[[f64; 2]], d0: f64, d_straight: f64, grade: f64) -> Vec<[
/// fillet's tangent point (resampled at the graded arclength spacing), the
/// root fillets and the cylinder arc from the RIGID construction (the
/// clamp keeps the root straight to a micron), the bottom edge, and the
/// tip semicircle whose centre and axis come from the deformed tip. Returns
/// the outline and the tip arc.
/// tip semicircle whose centre and axis come from the deformed tip. The
/// edges' graded spacing is that of the UNDEFORMED straight edge (tip at
/// `x_tip_ref`), so the outline's point count — the patch topology the
/// composite's `set_mesh` requires fixed — does not change with the
/// deformation. Returns the outline and the tip arc.
#[allow(clippy::too_many_arguments)]
pub fn cylinder_flag_outline_deformed(
centre: [f64; 2],
r: f64,
t: f64,
edges: &FlagEdges,
x_tip_ref: f64,
fillet: f64,
k_fillet: usize,
k_tip: usize,
@@ -753,6 +760,9 @@ pub fn cylinder_flag_outline_deformed(
];
let t2_bot = [cx + r * dir_bot[0], cy + r * dir_bot[1]];
let d0 = (PI * t / k_tip as f64).min(fillet * PI / 2.0 / k_fillet as f64);
// The edge fractions of the undeformed straight edge (as the rigid
// outline's `len_top`), applied to each deformed edge's arclength.
let fr = graded_fractions((x_tip_ref - t) - x_f, d0, d_straight, grade);
// The tip: corners, the tangent axis from the last segments, the
// semicircle of radius half the tip edge, centred `radius` back.
let (bottom, top) = (&edges.bottom, &edges.top);
@@ -779,7 +789,7 @@ pub fn cylinder_flag_outline_deformed(
let s_root_t = arclength_at_x(top, &cum_t, x_f, true);
let mut top_run = open_slice(top, &cum_t, radius, s_root_t);
top_run[0] = start_top;
pts.extend(graded_along(&top_run, d0, d_straight, grade));
pts.extend(along_fractions(&top_run, &fr));
// 2. Top fillet, 3. cylinder arc, 4. bottom fillet — the rigid construction.
let a_t1 = -PI / 2.0;
let mut a_t2 = (t2_top[1] - f_top[1]).atan2(t2_top[0] - f_top[0]);
@@ -811,7 +821,7 @@ pub fn cylinder_flag_outline_deformed(
let mut bot_run = open_slice(bottom, &cum_b, s_root_b, cum_b[nb - 1] - radius);
let last = bot_run.len() - 1;
bot_run[last] = start_bot;
pts.extend(graded_along(&bot_run, d0, d_straight, grade));
pts.extend(along_fractions(&bot_run, &fr));
// 6. Tip semicircle from the bottom end through the apex to the top end.
let a0 = (start_bot[1] - tip_c[1]).atan2(start_bot[0] - tip_c[0]);
pts.extend(arc_points(tip_c, radius, a0, a0 + PI, k_tip));