From e25828968b902a3c8e89c3de71ded6b7146e990d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Oct 2026 07:35:45 +0000 Subject: [PATCH] lbm: choose the moving-link fallback from FP64 q, as the host builder does Co-Authored-By: Claude Opus 5.5 --- src/CelerisLab/lbm/kernels/step/moving_circle.cu | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CelerisLab/lbm/kernels/step/moving_circle.cu b/src/CelerisLab/lbm/kernels/step/moving_circle.cu index c58fe2d..360f4ee 100644 --- a/src/CelerisLab/lbm/kernels/step/moving_circle.cu +++ b/src/CelerisLab/lbm/kernels/step/moving_circle.cu @@ -71,9 +71,11 @@ __global__ void MovingCircleLinks( const float q = (float)qd; const float rx = (float)__dsub_rn(hx, cx), ry = (float)__dsub_rn(hy, cy); - // Same fallback rule as build_cut_links (q < 1/2 needs a fluid donor at x - c). + // Same two-stage order as build_cut_links + pack_cut_links_to_soa: the fallback + // class is chosen from the clamped FP64 q (q < 1/2 needs a fluid donor at x - c); + // only then are q, rx, ry rounded to FP32 for the BFL branch and spin velocity. unsigned char fallback = CURVED_FALLBACK_BOUZIDI; - if (q < 0.5f) { + if (qd < 0.5) { const int xd = x - ex, yd = y - ey; if (xd < 0 || xd >= (int)NX || yd < 0 || yd >= (int)NY || mc_inside(xd, yd, cx, cy, r) || (flag[linear_index((unsigned int)xd, (unsigned int)yd)] & FLAG_FLUID) == 0)