From 0ef659b0ddbb5d625bfc461f58f7aec717712dc9 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 26 Oct 2026 04:44:00 +0900 Subject: [PATCH] =?UTF-8?q?fix(E03):=20=EB=B3=B4=EA=B0=95=20=EC=9E=88?= =?UTF-8?q?=EC=96=B4=EB=8F=84=20=ED=83=90=EC=83=89=20=ED=95=9C=EA=B3=84=20?= =?UTF-8?q?=EA=B7=B8=EB=8C=80=EB=A1=9C=20=E2=80=94=20=EC=A7=84=EC=9E=85=20?= =?UTF-8?q?=EB=84=93=ED=9E=98=20=EA=B1=B7=EC=9D=8C(=EA=B8=B4=20=EB=84=A4?= =?UTF-8?q?=EC=9D=BC=EC=9D=B4=20Fs=20=EB=A5=BC=20=EB=82=AE=EC=B6=98=20?= =?UTF-8?q?=ED=9D=A0=20=C2=B7=20536-3=20=C2=B7=20=EC=9A=94=EA=B5=AC=20351)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 원인: 보강 때 진입 한계를 보강재 끝 뒤까지 넓혀 보강 없는 해석이 안 본 위쪽 자연 비탈 면이 들어옴 (사본 E 0+720 우 깎기 우기 L 25 m — 그 면 보강 없음 0.722 · 보강 0.845 → 보강 없음 임계 1.027 보다 낮아 보임) - 같은 면에서는 보강이 늘 F 를 올림(힘 방향 · 부호 · 능동/수동 · 교점은 흠 없음) - 고침: 넓힘 · _exit_lo 걷음(보강 없는 해석과 같은 면 무리) · 0+720 L 3/6/9/12/25 = 1.049/1.148/1.289/1.421/1.487 - 시험: 같은 면 보강 F ≥ 보강 없음(네일 · 앵커 · 길이 셋 · 다섯 방법 · 면 9) · 측점 꼴 길이 늘려도 안 낮아짐 · 탐색 한계 그대로(옛 넓힘 시험 갈음) · Slide2 #47 · #85 · #86 그대로 Co-Authored-By: Claude Opus 5.5 --- .../E03_StabSection_Engine_Search.py | 25 ++------ resources/tester/test_536_3_stab_supports.py | 63 ++++++++++++++++--- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/E03_StabSection/E03_StabSection_Engine_Search.py b/E03_StabSection/E03_StabSection_Engine_Search.py index d67fb9de7..a5ba221c4 100644 --- a/E03_StabSection/E03_StabSection_Engine_Search.py +++ b/E03_StabSection/E03_StabSection_Engine_Search.py @@ -13,7 +13,6 @@ import time import numpy as np from E03_StabSection import E03_StabSection_Engine_LEM as lem -from E03_StabSection import E03_StabSection_Engine_Support as support from E03_StabSection.E03_StabSection_Engine_Describe import describe, safety_map from E03_StabSection.E03_StabSection_Engine_Surface import ( # noqa: F401 — 밖에서 Search 로 부르던 이름 METHODS, @@ -46,11 +45,6 @@ FAR_TOL = 0.02 # ---- 원호 --------------------------------------------------------------------- -def _exit_lo(limits) -> float: - """진출 아래 한계 — limits 셋째 칸(보강으로 진입만 넓힌 때 원래 한계) · 없으면 limits[0].""" - return limits[2] if len(limits) > 2 else limits[0] - - def entry_exit_circles(prep, limits, n_points=25, thetas_deg=(10, 20, 35, 50, 65, 80, 100, 120)): xl, xr = limits[:2] pts = np.linspace(xl, xr, n_points) @@ -60,7 +54,6 @@ def entry_exit_circles(prep, limits, n_points=25, thetas_deg=(10, 20, 35, 50, 65 xX = np.repeat(xX, len(thetas_deg)) th = np.tile(np.radians(thetas_deg), len(i)) xc, zc, R, ok = circle_from_chord(prep, xE, xX, th) - ok &= xX >= _exit_lo(limits) - 1e-6 return xc[ok], zc[ok], R[ok], xE[ok], xX[ok] @@ -87,7 +80,7 @@ def grid_radius_circles(prep, limits, gx, gz, n_radii=10): owner = np.repeat(np.arange(len(cx)), n_radii) xc, zc = cx[owner], cz[owner] xE, xX, ok = circle_cross_surface(prep, xc, zc, R) - ok &= (xE >= limits[0] - 1e-6) & (xX <= limits[1] + 1e-6) & (xX >= _exit_lo(limits) - 1e-6) + ok &= (xE >= limits[0] - 1e-6) & (xX <= limits[1] + 1e-6) return xc[ok], zc[ok], R[ok], xE[ok], xX[ok], owner[ok] @@ -106,7 +99,7 @@ def _circle_eval(prep, xc, zc, R, xE, xX, n, min_depth, methods, chunk=4000): def refine_circle(prep, limits, method, seeds, n, min_depth, seed=0, maxiter=None): """원호 다듬기 — (진입 x, 진출 x, 중심각) 차분진화 · 첫 무리 = 거친 탐색의 좋은 면.""" fun = objective(method) - lo = np.array([limits[0], _exit_lo(limits), np.radians(3)]) + lo = np.array([limits[0], limits[0], np.radians(3)]) hi = np.array([limits[1], limits[1], np.radians(170)]) def obj(p): @@ -136,7 +129,7 @@ def _cloud(prep, limits, method, p0, n, min_depth, seed, k=CLOUD_SIZE, keep=10): """원 (진입 x, 진출 x, 중심각) 둘레 구름 k 개를 method 로 한 번에 셈 → 풀리는 좋은 것 keep 개.""" rng = np.random.default_rng(seed) span = limits[1] - limits[0] - lo = np.array([limits[0], _exit_lo(limits), np.radians(3)]) + lo = np.array([limits[0], limits[0], np.radians(3)]) hi = np.array([limits[1], limits[1], np.radians(170)]) p = np.clip(p0 + rng.normal(size=(k, 3)) * [0.03 * span, 0.03 * span, np.radians(4)], lo, hi) xc, zc, R, ok = circle_from_chord(prep, p[:, 0], p[:, 1], p[:, 2]) @@ -310,7 +303,7 @@ def optimize_polyline( fun = objective(method) xl, xr = limits[:2] depth_max = max(prep.surface(np.linspace(xl, xr, 50)).max() - prep.bottom_z, 1.0) - lo = np.array([xl, _exit_lo(limits)] + [0.02] * m + [0.0] * m) + lo = np.array([xl, xl] + [0.02] * m + [0.0] * m) hi = np.array([xr, xr] + [0.98] * m + [depth_max] * m) def obj(p): @@ -393,7 +386,6 @@ def block_seeds(prep, limits, m, n_points=12, angles=((55, 35), (65, 25))): xE = _ray_to_surface(prep, a, za, act, -1.0) xX = _ray_to_surface(prep, b, zb, pas, 1.0) good = np.isfinite(xE) & np.isfinite(xX) & (xE >= xl) & (xX <= xr) - good &= xX >= _exit_lo(limits) for e, x0, x1, xx in zip(xE[good], a[good], b[good], xX[good]): ix = np.linspace(x0, x1, m) d = layer_bottom_depth(prep, ix, mat) @@ -429,13 +421,8 @@ def analyze( lim = (float(prep.surface_x[0]), float(prep.surface_x[-1])) else: lim = tuple(sorted((s * float(limits[0]), s * float(limits[1])))) - if prep.supports is not None: - # 보강 — 임계면이 보강재 끝 뒤(더 깊이 · 더 멀리)로 옮겨 가는 것도 찾게 진입 한계만 끝 뒤까지 넓힘 - # (진출 = 원래 한계 셋째 칸 — 설계 비탈 밖 자연 비탈만 무너지는 면은 보강 전처럼 안 봄) - reach = float(np.min(support.tips(prep.supports))) - max( - 2.0, 0.25 * prep.supports["L"].max() - ) - lim = (max(min(lim[0], reach), float(prep.surface_x[0])), lim[1], lim[0]) + # 보강이 있어도 탐색 한계 그대로 — 보강 없는 해석과 같은 면 무리에서 찾아야 보강 전후가 맞섬 + # (한계를 넓히면 보강 없이 안 본 자연 비탈 면이 들어와 보강 뒤 F 가 오히려 낮아 보임) results: dict = {m: {} for m in methods} counts = {} contour = smap = None diff --git a/resources/tester/test_536_3_stab_supports.py b/resources/tester/test_536_3_stab_supports.py index a234dc796..6b32ecc95 100644 --- a/resources/tester/test_536_3_stab_supports.py +++ b/resources/tester/test_536_3_stab_supports.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"""536-3 뒷부분 보강재(네일 · 앵커) 2D 한계평형 — 힘 크기 · 능동/수동 · 탐색 넓힘 · 보강 없을 때 불변. +"""536-3 뒷부분 보강재(네일 · 앵커) 2D 한계평형 — 힘 크기 · 능동/수동 · 탐색 한계 그대로 · 보강이 F 를 낮추지 않음 · 보강 없을 때 불변. - 손계산: 평면 쐐기 닫힌 꼴(능동 F = (cL + (W cosα + T sin(α+δ)) tanφ) / (W sinα − T cos(α+δ)) · 수동 T → T/F) · 교점 · 인발 · 벗겨짐 · 정착장 · 프리스트레스. @@ -205,17 +205,64 @@ def test_slide2_86_five_rows(): near(a["methods"]["spencer"]["min"]["F"], 1.620, 0.03) -def test_search_moves_behind_strong_supports(): - """아주 센 보강 — 진입 쪽 한계가 보강재 끝 뒤까지 넓어지고 임계면이 보강재를 안 지나는 깊은 면으로 감.""" +def test_search_keeps_limits_with_strong_supports(): + """아주 센 보강 — 탐색 한계 그대로(보강 없는 해석과 같은 면 무리) · 임계 F 가 보강 없음 이상.""" bare = {k: v for k, v in _p86().items() if k != "supports"} lim = [0, 45] a0 = analyze(bare, direction=-1, methods=("bishop",), min_depth=3.0, limits=lim) a = analyze(_p86(1e5), direction=-1, methods=("bishop",), min_depth=3.0, limits=lim) - assert a0["limits"] == [0, 45] and a["limits"][1] > 45 # 끝 x 45 + 여유 5 - gov = a["methods"]["bishop"]["min"] - assert gov["entry"][0] > 45 and a["support_forces_method"] == "bishop" - assert all(f["mode"] == "not_crossing" for f in a["support_forces"]) - assert gov["F"] > a0["methods"]["bishop"]["min"]["F"] + assert a0["limits"] == a["limits"] == [0, 45] + assert a["support_forces_method"] == "bishop" + assert a["methods"]["bishop"]["min"]["F"] >= a0["methods"]["bishop"]["min"]["F"] + + +# ---- 보강은 F 를 낮추지 않음(요구 351 · sub2 실측 0+720 흠) --------------------------------- +ALL = ("ordinary", "bishop", "janbu", "spencer", MP) +#: 쐐기 비탈 (10, 10) → (20, 0) 위 면 — 얕은 · 깊은 평면 · 두 마디 · 원호(중심 · 반지름) +PLANES = [[[x0, 10.0], [20.0, 0.0]] for x0 in (3.0, 5.0, 7.0, 9.0)] + [ + [[2.0, 10.0], [12.0, 3.0], [20.0, 0.0]], + [[4.0, 10.0], [14.0, -1.0], [22.0, 0.0]], +] +CIRCLES = [[21.0, 19.45, 19.45], [19.0, 13.338, 13.422], [24.0, 27.0, 27.019]] + + +def _sups(kind, L): + heads = [(12.0, 8.0), (15.0, 5.0), (18.0, 2.0)] + if kind == "nail": + return [nail(x, z, 15, L, 1.5, 120, 40) for x, z in heads] + return [anchor(x, z, 15, L, 1.5, 300, 60, min(4.0, L), 80) for x, z in heads] + + +@pytest.mark.parametrize("kind", ["nail", "anchor"]) +@pytest.mark.parametrize("L", [3.0, 8.0, 25.0]) +def test_supports_never_lower_same_surface(kind, L): + """같은 면 — 네일(수동) · 앵커(능동) · 길이 셋 · 다섯 방법 · 면 깊이 여럿: 보강 F ≥ 보강 없음 F.""" + with_s = {**WEDGE, "supports": _sups(kind, L)} + checked = 0 + for spec in [{"polyline": p} for p in PLANES] + [{"circle": c} for c in CIRCLES]: + r0 = evaluate_specified(WEDGE, methods=ALL, **spec) + r1 = evaluate_specified(with_s, methods=ALL, **spec) + for m in ALL: + f0, f1 = r0[m]["F"], r1[m]["F"] + if f0 is None or f1 is None: + continue + assert f1 >= f0 - 1e-9, (kind, L, spec, m, f0, f1) + checked += 1 + assert checked >= 40 + + +def test_station_longer_nails_never_lower(): + """측점 꼴(우 깎기) — 네일을 길게 해도 임계 F 가 보강 없음 아래로 안 감(탐색 한계 그대로).""" + base = {c["side"]: c for c in _station(None)["cases"]}["right"] + f0 = base["min_F"]["bishop"] + prev = f0 + for L in (3.0, 8.0, 15.0, 25.0): + case = {c["side"]: c for c in _station([nail(-4.0, 11.48, 15, L, 1.5, 200, 30)])["cases"]} + right = case["right"] + assert right["result"]["limits"] == base["result"]["limits"] + f = right["min_F"]["bishop"] + assert f >= f0 - 1e-9 and f >= prev - 0.02 * prev, (L, f0, prev, f) + prev = f # ---- 보강 없을 때 불변 · 측점 꼴 ------------------------------------------------------