From 78d9cb9a6638f0eaa199e44e35dfad130a0b9395 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 01:14:15 +0900 Subject: [PATCH 1/2] fix(stiffener): no negative EI where two STIFFENERS rows meet inside an element CD_Stiffener_Overlay takes an element's bending stiffness as the compliance average l / (sum of covered parts / EI_sleeved + bare part / EI_cable). Two rows meeting inside an element (a cylinder, then a cone) cover it in two parts whose sum can exceed the element length by round-off, and the bare part l - covered then came out a tiny negative length. Divided by the cable's EI it is negligible for an ordinary cable, but a soft one (EI = 1e-12 or 1e-300 N m^2) or a very stiff sleeve turned it into a negative compliance and a negative element EI: the static solve then failed with an internal message ("finite-EI hierarchy preflight failed: CD_HermiteCable_Sequence_Coarse_Max_Length: l0>0, EA>=0, EI>=0 required"). The bare part is now never below zero, and the bend-stiffener example with a cable EI of 1e-12 or 1e-300 runs. A STIFFENERS RootOD or TipOD is now at most 1e3 m, the bound of a line type's Diam, so a sleeve of 1e6 m is refused by name instead of failing the statics; the Python deck validator applies the same bound. On the shipped bend-stiffener example (2 s) the outputs change at the static solver's tolerance: 7.5e-8 of the column maximum on the main output, 1.0e-8 in the static profile and range graph; the per-element extrema file moves the position of the minimum along elements whose axial force is flat to 1e-7. Tests: test_bend_stiffener sweeps the cable EI (1e-300 to 2e4), the element length (three meshes) and the root OD (0.45 m to 1e6 m) over two rows meeting inside an element, requiring every element EI at least the cable's and finite (27 of 45 failed before); the parity tests check the OD bound against the validator and the driver. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 5 ++++ python/cabledyn/deck_file.py | 6 ++++ python/tests/test_deck_native_parity.py | 37 +++++++++++++++++++++++++ src/CableDyn_DeckDriver.f90 | 8 +++++- tests/test_bend_stiffener.f90 | 26 +++++++++++++++++ 5 files changed, 81 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3549554..428026af 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 bend stiffener over an element that two STIFFENERS rows share no longer gives it a negative + EI: their covered lengths can sum past the element length by round-off, which a soft cable's EI + (1e-12 N m^2 and below) turned into a negative compliance, and the static solve then failed + with an internal message. STIFFENERS `RootOD` and `TipOD` are now at most 1e3 m, the bound of a + line type's `Diam`, in the solver and the Python deck validator. ## [0.4.1] - 2026-11-08 diff --git a/python/cabledyn/deck_file.py b/python/cabledyn/deck_file.py index 322be45f..3acd9424 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -3146,6 +3146,12 @@ def _check_stiffeners( raise DeckFormatError( f"{where}: STIFFENERS InnerD must be smaller than RootOD and TipOD" ) + # as wide as the widest line type at most (native, LINE TYPES Diam <= 1e3 m) + if max(root_od, tip_od) > _NATIVE_MAX_DIAMETER: + raise DeckFormatError( + f"{where}: STIFFENERS RootOD and TipOD must be at most 1e3 m, as a line " + "type's Diam" + ) extent[(line_id, end)] = extent.get((line_id, end), 0.0) + length for line_id in sorted({key[0] for key in extent}, key=int): if not any( diff --git a/python/tests/test_deck_native_parity.py b/python/tests/test_deck_native_parity.py index d3dde783..521b9d80 100644 --- a/python/tests/test_deck_native_parity.py +++ b/python/tests/test_deck_native_parity.py @@ -942,6 +942,8 @@ def test_attachment_arc_length_lies_on_the_line(arc, accepted): ("1 A 0.0 0.45 0.45 0.17 5.0e7 1150", "Length, RootOD, TipOD and E must be > 0"), ("1 A 0.4 0.45 0.45 -0.1 5.0e7 1150", "InnerD and Density must be >= 0"), ("1 A 0.4 0.45 0.15 0.17 5.0e7 1150", "InnerD must be smaller than RootOD and TipOD"), + ("1 A 0.4 1.0e6 0.45 0.17 5.0e7 1150", "RootOD and TipOD must be at most 1e3 m"), + ("1 A 0.4 0.45 1001.0 0.17 5.0e7 1150", "RootOD and TipOD must be at most 1e3 m"), ("1 B 167.0 0.45 0.45 0.17 5.0e7 1150", "are longer than the line"), ], ) @@ -2790,3 +2792,38 @@ def test_a_compression_refinement_leaves_where_it_was_stops_the_refinement(tmp_p -900: ] assert _accepted(deck) + + +@pytest.mark.parametrize( + ("od", "accepted"), [("1000.0", True), ("1000.001", False), ("1e6", False)] +) +def test_stiffener_diameter_bound_matches_the_driver(od, accepted, tmp_path): + # a sleeve as wide as the widest line type (Diam <= 1e3 m) at most + text = _example( + "lazy_wave_bend_stiffener.dat", + (_STIFFENER_ROOT, f"1 A 0.4 {od} 0.45 0.17 5.0e7 1150"), + ) + if accepted: + DeckFile.from_text(text) + else: + _rejects(text, "RootOD and TipOD must be at most 1e3 m") + if not _PARITY_DRIVER or not Path(_PARITY_DRIVER).is_file(): + return + deck = tmp_path / "stiffener.dat" + deck.write_text(_static_check(text), encoding="utf-8") + shutil.copytree(EXAMPLES / "data", tmp_path / "data") + completed = subprocess.run( + [_PARITY_DRIVER, str(deck), str(tmp_path / "stiffener")], + capture_output=True, + text=True, + errors="replace", + cwd=tmp_path, + timeout=600, + env={**os.environ, "OMP_NUM_THREADS": "1", "OPENBLAS_NUM_THREADS": "1"}, + check=False, + ) + if accepted: + assert completed.returncode != 1 or "at most 1e3 m" not in completed.stderr + else: + assert completed.returncode == 1, completed.stderr[-600:] + assert "RootOD and TipOD must be at most 1e3 m" in completed.stderr diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 10f30fed..f90ec706 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -11468,7 +11468,9 @@ SUBROUTINE CD_Stiffener_Overlay(stf, l0, diam, ei, mpl) IF (.NOT. (covered > CD_ZERO)) CYCLE IF (PRESENT(ei)) THEN IF (ei_line > CD_ZERO) THEN - compliance = compliance + (l0(e) - covered)/ei_line + ! the bare part: rows meeting inside the element can sum past its length by round-off, + ! which a soft cable's EI would turn into a negative compliance + compliance = compliance + MAX(CD_ZERO, l0(e) - covered)/ei_line ei(e) = l0(e)/compliance ELSE IF (covered >= l0(e)*(CD_ONE - 1.0e-12_wp)) THEN ! an EI = 0 element bends only where the sleeve covers all of it; a bare part has an @@ -16931,6 +16933,10 @@ SUBROUTINE append_line_stiffener(row, lines, ErrStat, ErrMsg) IF (.NOT. (vals(4) < MIN(vals(2), vals(3)))) THEN CALL fail(ErrStat, ErrMsg, 'STIFFENERS InnerD must be smaller than RootOD and TipOD'); RETURN END IF + ! as wide as the widest line type at most (LINE TYPES Diam <= 1e3 m) + IF (MAX(vals(2), vals(3)) > 1.0e3_wp) THEN + CALL fail(ErrStat, ErrMsg, 'STIFFENERS RootOD and TipOD must be at most 1e3 m, as a line type''s Diam'); RETURN + END IF ! a segment starts where the previous segment of the same line end stops s0 = CD_ZERO nold = 0 diff --git a/tests/test_bend_stiffener.f90 b/tests/test_bend_stiffener.f90 index c7a9b6b6..9a0fae19 100644 --- a/tests/test_bend_stiffener.f90 +++ b/tests/test_bend_stiffener.f90 @@ -36,6 +36,7 @@ PROGRAM test_bend_stiffener CALL case_cylinder() CALL case_cone() + CALL case_row_boundary_roundoff() CALL case_node_stiffness() CALL case_grammar() CALL case_coupled() @@ -143,6 +144,31 @@ SUBROUTINE case_cone() 'cone: bare elements unchanged') END SUBROUTINE case_cone + SUBROUTINE case_row_boundary_roundoff() + !! Two stiffener rows meeting inside an element (a 0.4 m cylinder, then a cone) cover it in two + !! parts whose sum can exceed the element length by round-off. Divided by a soft cable's + !! EI, that excess once made the compliance negative and the element EI negative. Swept + !! over the cable EI and the element length (the second length is that of the shipped + !! lazy-wave example, 68.114 m in 448 elements). + REAL(wp), PARAMETER :: EI_C(5) = [1.0e-300_wp, 1.0e-12_wp, 1.0e-3_wp, 1.0_wp, 2.0e4_wp] + REAL(wp), PARAMETER :: L_ELEM(3) = [0.15_wp, 68.114_wp/448.0_wp, 0.3_wp/7.0_wp] + REAL(wp), PARAMETER :: OD_ROOT(3) = [0.45_wp, 10.0_wp, 1.0e6_wp] + REAL(wp) :: stf(8, 2), l0(40), ei(40), mpl(40), dv(40) + INTEGER :: i, j, k + DO k = 1, SIZE(OD_ROOT) + stf(:, 1) = [1.0_wp, 0.0_wp, 0.4_wp, OD_ROOT(k), OD_ROOT(k), 0.17_wp, 5.0e7_wp, 1150.0_wp] + stf(:, 2) = [1.0_wp, 0.4_wp, 4.0_wp, OD_ROOT(k), 0.18_wp, 0.17_wp, 5.0e7_wp, 1150.0_wp] + DO j = 1, SIZE(L_ELEM) + DO i = 1, SIZE(EI_C) + l0 = L_ELEM(j); ei = EI_C(i); mpl = 36.7_wp; dv = 0.16_wp + CALL CD_Stiffener_Overlay(stf, l0, dv, ei=ei, mpl=mpl) + CALL require(ALL(ei >= EI_C(i)*(1.0_wp - 1.0e-12_wp)) .AND. ALL(ei < HUGE(ei)), & + 'row boundary: every element EI is at least the cable EI and finite') + END DO + END DO + END DO + END SUBROUTINE case_row_boundary_roundoff + SUBROUTINE case_node_stiffness() !! Ten 1 m elements, line type EI_C on the first six and 2 EI_C beyond, under a cylinder over !! 0-2 m (OD 0.6), a cone over 2-5 m (0.6 -> 0.3) and a cone over 5-7.5 m (0.25 -> 0.22), From 5c9946153ae71058b7bac318bef8ddf9f13b6693 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 01:51:32 +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 428026af..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 bend stiffener over an element that two STIFFENERS rows share no longer gives it a negative - EI: their covered lengths can sum past the element length by round-off, which a soft cable's EI - (1e-12 N m^2 and below) turned into a negative compliance, and the static solve then failed - with an internal message. STIFFENERS `RootOD` and `TipOD` are now at most 1e3 m, the bound of a - line type's `Diam`, in the solver and the Python deck validator. ## [0.4.1] - 2026-11-08