From 8f91fcdc69cb060e6d30b674fb52aa2e47bf9609 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 01:32:59 +0900 Subject: [PATCH 1/2] perf(statics): stop the axial refinement when it leaves the compression where it was With tensile_safety True the AutoMesh static solve splits the elements around an element-mean axial compression until the compression falls below its tolerance, the minimum axial strain stops improving for four passes, or the mesh reaches its element budget. A compression of the equilibrium itself (a line too long for its span, held by its bending stiffness) does not move under refinement, but tiny round-off changes of its value counted as improvement, so the loop doubled the mesh to the budget (32768 elements) on each of the static routes it tried: a power cable deck with its sections given twice failed after 76 s. The loop now also stops when two successive passes leave the violation within 0.1 % of the previous pass's, naming the compression as the equilibrium's. A compression that is a mesh effect falls as its elements are split, by far more than 0.1 % a pass, so a resolvable state still refines as before. Measured: the doubled power cable fails in 6.0 s (75.7 s before) with the same compressive resultant (-514.88 N); cable_statics_matrix writes all 521 output files byte for byte as before (99.6 s, 101.6 s before); every shipped example (TMax cut to four steps) writes identical output files. Tests: the parity tests run the doubled power cable through the driver and require the new stop (fails before: the budget stop after 79 s). Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 5 ++++ python/tests/test_deck_native_parity.py | 33 +++++++++++++++++++++++++ src/CableDyn_HermiteCableStatic.f90 | 17 ++++++++++++- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3549554..2f561ea8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,11 @@ All notable changes to CableDyn are recorded in this file. The format follows The touchdown element now takes the reaction of its grounded stretch, from the grounded node to the touchdown point located from the two nodes' clearances: the error falls at the second order (2.1, 0.7, 0.2 N) and the outputs vary continuously. +- A finite-EI static solve whose equilibrium is in axial compression (with `tensile_safety True`) + stops refining once two passes leave the compression where it was (to 0.1 %), instead of + splitting elements up to the element budget: a power cable given twice its length fails in 6 s + instead of 76 s, with the same compression named. Decks that refinement does resolve are + unchanged (the static matrix and every example give identical outputs). ## [0.4.1] - 2026-11-08 diff --git a/python/tests/test_deck_native_parity.py b/python/tests/test_deck_native_parity.py index df4b1368..14652c41 100644 --- a/python/tests/test_deck_native_parity.py +++ b/python/tests/test_deck_native_parity.py @@ -2713,3 +2713,36 @@ def test_route_rules_match_the_driver(text, tmp_path): ) assert completed.returncode in (0, 1), completed.stderr[-600:] assert _accepted(deck) == (completed.returncode == 0), completed.stderr[-600:] + + +@pytest.mark.skipif( + not _PARITY_DRIVER or not Path(_PARITY_DRIVER).is_file(), + reason="set CABLEDYN_TEST_DRIVER to a built native driver to run the refinement-stop check", +) +def test_a_compression_refinement_leaves_where_it_was_stops_the_refinement(tmp_path): + # the power cable with its sections given twice: too long to hang clear of the seabed, it is + # held in axial compression by its bending stiffness, a compression of the equilibrium that + # no mesh removes; the axial refinement stops once two passes leave it where it was instead + # of splitting elements to the element budget (6 passes, 32768 elements) + tail = "1 bare 52.101 256\n" + text = _example( + "lozon_gomex80_power_cable.dat", + (tail, tail + "1 bare 68.114 448\n1 buoy 50.000 320\n" + tail), + ) + deck = tmp_path / "long.dat" + deck.write_text(text, encoding="utf-8") + completed = subprocess.run( + [_PARITY_DRIVER, str(deck), str(tmp_path / "long")], + capture_output=True, + text=True, + errors="replace", + cwd=tmp_path, + timeout=900, + env={**os.environ, "OMP_NUM_THREADS": "1", "OPENBLAS_NUM_THREADS": "1"}, + check=False, + ) + assert completed.returncode == 2, completed.stderr[-600:] + assert "two passes left the compression where it was" in completed.stderr, completed.stderr[ + -900: + ] + assert _accepted(deck) diff --git a/src/CableDyn_HermiteCableStatic.f90 b/src/CableDyn_HermiteCableStatic.f90 index 1ab2f5e2..99b81a9e 100644 --- a/src/CableDyn_HermiteCableStatic.f90 +++ b/src/CableDyn_HermiteCableStatic.f90 @@ -6565,7 +6565,9 @@ SUBROUTINE CD_HermiteCable_Static_Solve_AutoMesh(l0, EA, EI, w, seed, fixed_dofs ! move toward the compression, so it is given two more. INTEGER :: max_axial_stall_passes INTEGER, PARAMETER :: AXIAL_BUDGET_FLOOR = 2048 - INTEGER :: axial_budget, axial_stall, wios + INTEGER :: axial_budget, axial_stall, axial_flat, wios + ! A violation within this share of the previous pass's is flat: refinement does not move it. + REAL(wp), PARAMETER :: AXIAL_FLAT_REL = 1.0e-3_wp REAL(wp) :: axial_prev, end_res_prev LOGICAL :: end_min, end_prev, end_settled CHARACTER(400) :: axial_stop @@ -6576,6 +6578,7 @@ SUBROUTINE CD_HermiteCable_Static_Solve_AutoMesh(l0, EA, EI, w, seed, fixed_dofs applied_scale = 1 local_passes = 0 axial_stall = 0 + axial_flat = 0 axial_prev = CD_ZERO end_prev = .FALSE. end_res_prev = CD_ZERO @@ -6870,6 +6873,14 @@ SUBROUTINE CD_HermiteCable_Static_Solve_AutoMesh(l0, EA, EI, w, seed, fixed_dofs ELSE axial_stall = axial_stall + 1 END IF + ! A compression that two successive passes leave where it was (to 0.1 %) is the + ! equilibrium's, not the mesh's: splitting the elements around it further only grows + ! the mesh to its budget. (A mesh compression falls as its elements are split.) + IF (ABS(diag_out%axial_violation - axial_prev) <= AXIAL_FLAT_REL*axial_prev) THEN + axial_flat = axial_flat + 1 + ELSE + axial_flat = 0 + END IF END IF needs_refinement = (must_be_tensile .AND. diag_out%axial_compression) .OR. & (refine_other .AND. refinable(diag_out)) @@ -6879,6 +6890,10 @@ SUBROUTINE CD_HermiteCable_Static_Solve_AutoMesh(l0, EA, EI, w, seed, fixed_dofs axial_stop = 'the minimum axial strain stopped improving' EXIT END IF + IF (needs_refinement .AND. local_axial .AND. axial_flat >= 2) THEN + axial_stop = 'two passes left the compression where it was: it is the equilibrium''s, not the mesh''s' + EXIT + END IF IF (needs_refinement .AND. local_axial .AND. end_settled) THEN axial_stop = 'the compression is the reaction of a held end, which refinement does not change' EXIT From c06ea98a05f7668d6e668784a817bf228bdde9a4 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 01:53:02 +0900 Subject: [PATCH 2/2] chore(changelog): the entry moves to the batch changelog change The [Unreleased] entries of the open changes are added together in one change, so that they do not conflict with each other. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f561ea8..e3549554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,11 +18,6 @@ All notable changes to CableDyn are recorded in this file. The format follows The touchdown element now takes the reaction of its grounded stretch, from the grounded node to the touchdown point located from the two nodes' clearances: the error falls at the second order (2.1, 0.7, 0.2 N) and the outputs vary continuously. -- A finite-EI static solve whose equilibrium is in axial compression (with `tensile_safety True`) - stops refining once two passes leave the compression where it was (to 0.1 %), instead of - splitting elements up to the element budget: a power cable given twice its length fails in 6 s - instead of 76 s, with the same compression named. Decks that refinement does resolve are - unchanged (the static matrix and every example give identical outputs). ## [0.4.1] - 2026-11-08