diff --git a/research/duetsch_re100_kc5/protocol.py b/research/duetsch_re100_kc5/protocol.py index c070535..ecd3ced 100644 --- a/research/duetsch_re100_kc5/protocol.py +++ b/research/duetsch_re100_kc5/protocol.py @@ -53,7 +53,7 @@ def interval_bases(n, T, points=16): """Single-step interval averages over [n, n + 1] of cos phi |cos phi| and sin phi (phi in radians = 2 pi s / T - pi / 2), Gauss-Legendre quadrature.""" x, w = np.polynomial.legendre.leggauss(points) - s = n + 0.5 * (x + 1.0) + s = int(n) % T + 0.5 * (x + 1.0) # periodic: identical bases in every cycle phi = 2.0 * np.pi * s / T - 0.5 * np.pi c = np.cos(phi) return 0.5 * float(np.sum(w * c * np.abs(c))), 0.5 * float(np.sum(w * np.sin(phi))) diff --git a/tests/unit/test_duetsch_protocol.py b/tests/unit/test_duetsch_protocol.py index 0751be7..9fea3b1 100644 --- a/tests/unit/test_duetsch_protocol.py +++ b/tests/unit/test_duetsch_protocol.py @@ -73,6 +73,7 @@ def test_geometry_repeats_exactly_across_cycles(): v0 = p.position(m + 1, T, A) - p.position(m, T, A) assert p.position(m + 1 + c * T, T, A) - p.position(m + c * T, T, A) == v0 assert p.cycle(T // 4 + 5 * T, T) == 6 # unwrapped index stays separate + assert p.interval_bases(123 + 7 * T, T) == p.interval_bases(123, T) def test_exact_point_inside_body_is_missing_even_with_fluid_corners():