From cf2d1be3a8d7329926d953feb4b6d50a3926bbdc Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 01:13:58 +0900 Subject: [PATCH 1/2] fix(statics): the drag arclength continuation takes a Rigid end connection When the drag load steps of a finite-EI static solve in a current stall at a limit point in the drag fraction, a pseudo-arclength continuation follows the path around it. It was skipped for a line with a Rigid end connection, whose end tangent the static solve takes in the basis of its direction, so such a line failed ("current load stepping stopped at drag fraction 0.519") where the same line with a 1e9 N m/rad rotational spring, or pinned, solved: a 2982 m cable clamped at its fairlead in a 1.1 m/s current that folds its grounded run back past the anchor. The continuation now carries a Rigid end as the static solve does: the residual and tangent come in the end-direction basis (CD_EndConn_Basis), the drag load is turned into it, the two transverse components of the end tangent are held, and each solved increment and path tangent is turned back to global components. Decks whose load steps converge are unchanged; every example gives the same output. The new arclength_rigid_end test solves the clamped cable and requires its end tensions within 1e-3 of the 1e9 N m/rad spring line's. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 6 ++ CMakeLists.txt | 11 ++++ doc/theory.rst | 4 +- src/CableDyn_HermiteCableStatic.f90 | 55 +++++++++++++--- tests/test_arclength_rigid_end.py | 97 +++++++++++++++++++++++++++++ 5 files changed, 164 insertions(+), 9 deletions(-) create mode 100644 tests/test_arclength_rigid_end.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e3549554..0b1cd6b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ 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. +- Finite-EI statics in a current with a `Rigid` end connection: when the drag load steps stall at + a limit point, the pseudo-arclength continuation that follows the path around it was skipped + for a line with a `Rigid` end, so the statics failed where the same line with a stiff + rotational spring solved (a 3 km cable clamped at its fairlead in 1.1 m/s, folded back past + its anchor). The continuation now takes a `Rigid` end in the basis of its direction, with the + transverse components of the end tangent held, as the static solve does. ## [0.4.1] - 2026-11-08 diff --git a/CMakeLists.txt b/CMakeLists.txt index d2dda5b0..54d8a9d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1924,6 +1924,17 @@ if(Python3_Interpreter_FOUND) TIMEOUT 300 ENVIRONMENT "${_cabledyn_python_test_environment}") + # A Rigid-ended cable in a strong current follows its drag path past a limit point by the + # pseudo-arclength continuation, as a stiff rotational spring does. + add_test(NAME arclength_rigid_end + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_arclength_rigid_end.py + --exe $ + --output ${CMAKE_BINARY_DIR}/arclength_rigid_end) + set_tests_properties(arclength_rigid_end PROPERTIES + LABELS "python;hermite;static;robustness;current" + TIMEOUT 900 + ENVIRONMENT "${_cabledyn_python_test_environment}") + # The note on grounded lines that a current moves over a seabed without friction: once per run # on every standalone route, and never without a grounded node, a current, or a march, or # with friction. diff --git a/doc/theory.rst b/doc/theory.rst index 6d43e1bc..6d84938f 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1937,7 +1937,9 @@ still-water equilibrium is found first and the drag is brought in by load steps. that stalls hands over to a pseudo-arclength continuation in the drag fraction :math:`\lambda`: each corrector solves the bordered system :math:`[K,\,-D;\ t_q^T,\ t_\lambda]` (:math:`D` the drag at full current) by block elimination -with two banded solves, so the path can turn at a limit point in :math:`\lambda`. A current +with two banded solves, so the path can turn at a limit point in :math:`\lambda`. At a ``Rigid`` +end the system is taken in the basis of the end direction, as in the static solve, with the +two transverse components of the end tangent held. A current across the vertical plane of the line makes the static solve three-dimensional, as the dynamics are. diff --git a/src/CableDyn_HermiteCableStatic.f90 b/src/CableDyn_HermiteCableStatic.f90 index 3270bbc6..f7b4c8b5 100644 --- a/src/CableDyn_HermiteCableStatic.f90 +++ b/src/CableDyn_HermiteCableStatic.f90 @@ -3585,6 +3585,10 @@ SUBROUTINE CD_HermiteCable_Static_Solve_Continuation(l0, EA, EI, w, seed, fixed_ REAL(wp), ALLOCATABLE :: fres(:), kband(:, :), kwork(:, :), dvec(:) LOGICAL, ALLOCATABLE :: free(:) REAL(wp) :: wq + ! A Rigid end in the arclength solve: the end tangent in the basis of its direction (the + ! static solve's residual and tangent come in it), the two transverse components held. + REAL(wp) :: arc_basis(3, 3, 2) + LOGICAL :: arc_rigid(2) CHARACTER(1024) :: first_msg CHARACTER(16) :: frac_txt ! Seabed friction of the current (active in every stage after the still-water one). @@ -3628,6 +3632,7 @@ SUBROUTINE CD_HermiteCable_Static_Solve_Continuation(l0, EA, EI, w, seed, fixed_ END IF IF (use_fric) ALLOCATE (fric_stage, SOURCE=current%friction) drag_homotopy = PRESENT(current) + arc_rigid = .FALSE. CALL ei_homotopy() IF (.NOT. PRESENT(current)) THEN IF (ErrStat /= CD_HCSTAT_OK) RETURN @@ -3672,7 +3677,7 @@ SUBROUTINE CD_HermiteCable_Static_Solve_Continuation(l0, EA, EI, w, seed, fixed_ planar_run_limit = .FALSE. IF (.NOT. picard_ok .AND. COUNT(MOD(fixed_dofs - 1, 6) == 1) >= nn) & planar_run_limit = frictionless_run_limit(q) - IF (.NOT. picard_ok .AND. .NOT. has_rigid_end() .AND. .NOT. planar_run_limit) THEN + IF (.NOT. picard_ok .AND. .NOT. planar_run_limit) THEN arc_msg = em iters_out = 0 IF (use_fric) THEN @@ -3877,13 +3882,6 @@ SUBROUTINE full_fixed_point(ok) iters_out = iters_out + iters_before END SUBROUTINE full_fixed_point - LOGICAL FUNCTION has_rigid_end() RESULT(rig) - !! A rigid end connection solves its end tangent in a rotated basis (not supported by - !! the bordered arclength solve). - rig = .FALSE. - IF (PRESENT(endconn_mode)) rig = ANY(endconn_mode == CD_ENDCONN_RIGID) - END FUNCTION has_rigid_end - LOGICAL FUNCTION frictionless_run_limit(qx) RESULT(run_limit) !! TRUE when the diagnosis of state qx is a grounded run driven along a frictionless !! seabed (see current_compression_note). @@ -3955,6 +3953,21 @@ SUBROUTINE drag_arclength(ok) DO k = 1, SIZE(fixed_dofs) free(fixed_dofs(k)) = .FALSE. END DO + ! A Rigid end: the static solve returns its end-tangent rows and columns in the basis of + ! the end direction (CD_EndConn_Basis), whose first component is the free tangent + ! magnitude and whose two transverse components are held. + arc_rigid = .FALSE. + IF (PRESENT(endconn_mode) .AND. PRESENT(endconn_direction)) THEN + DO k = 1, 2 + IF (endconn_mode(k) /= CD_ENDCONN_RIGID) CYCLE + CALL CD_EndConn_Basis(endconn_direction(:, k), arc_basis(:, :, k), es_a, em) + IF (es_a /= CD_ENDCONN_OK) THEN + em = 'arclength continuation: '//TRIM(em); RETURN + END IF + arc_rigid(k) = .TRUE. + free(arc_tangent_base(k) + 2:arc_tangent_base(k) + 3) = .FALSE. + END DO + END IF ei_stage = EI IF (PRESENT(endconn_stiffness)) k_stage = endconn_stiffness wq = CD_ONE/SUM(l0) @@ -3994,6 +4007,8 @@ SUBROUTINE drag_arclength(ok) z2 = dvec CALL CD_Solve_Banded(kwork, KL_H, KU_H, z2, es_a, em) IF (es_a /= CD_LINALG_OK) EXIT + CALL arc_to_global(z1) + CALL arc_to_global(z2) CALL CD_Arclength_Bordered_Update(wq, tq, tl, g, z1, z2, qc, lamc, es_a) IF (es_a /= 0) EXIT IF (.NOT. CD_All_Finite(qc) .OR. .NOT. CD_Is_Finite(lamc)) EXIT @@ -4087,6 +4102,12 @@ SUBROUTINE arc_assemble(qx, lamx, resx, esx) IF (esx /= CD_HCSTAT_OK) RETURN CALL CD_HermiteCable_Current_Load(l0, qx, current, dvec, esx, em) IF (esx /= CD_HCSTAT_OK) RETURN + ! the drag load in the basis of a Rigid end, as the residual and tangent are + DO kk = 1, 2 + IF (.NOT. arc_rigid(kk)) CYCLE + jj = arc_tangent_base(kk) + dvec(jj + 1:jj + 3) = MATMUL(TRANSPOSE(arc_basis(:, :, kk)), dvec(jj + 1:jj + 3)) + END DO ! Held DOFs: zero residual and load, identity rows and columns of the band. DO kk = 1, SIZE(dvec) IF (free(kk)) CYCLE @@ -4114,9 +4135,27 @@ SUBROUTINE arc_tangent(tqx, tlx, esx) esx = CD_HCSTAT_NOCONVERGE; RETURN END IF esx = CD_HCSTAT_OK + CALL arc_to_global(tqx) CALL CD_Arclength_Unit_Tangent(wq, tqx, tlx) END SUBROUTINE arc_tangent + INTEGER FUNCTION arc_tangent_base(iend) RESULT(base) + !! The DOF before the end tangent of End A (iend 1) or End B (iend 2). + INTEGER, INTENT(IN) :: iend + base = MERGE(3, 6*(nn - 1) + 3, iend == 1) + END FUNCTION arc_tangent_base + + SUBROUTINE arc_to_global(vx) + !! A solved increment from the basis of each Rigid end back to the global components. + REAL(wp), INTENT(INOUT) :: vx(:) + INTEGER :: ie, b0 + DO ie = 1, 2 + IF (.NOT. arc_rigid(ie)) CYCLE + b0 = arc_tangent_base(ie) + vx(b0 + 1:b0 + 3) = MATMUL(arc_basis(:, :, ie), vx(b0 + 1:b0 + 3)) + END DO + END SUBROUTINE arc_to_global + SUBROUTINE drag_load_steps(ok) !! Bring the current in at full stiffness from the still-water equilibrium in load !! steps (fraction of the drag advancing by up to half the load, halved on failure), diff --git a/tests/test_arclength_rigid_end.py b/tests/test_arclength_rigid_end.py new file mode 100644 index 00000000..da9a76aa --- /dev/null +++ b/tests/test_arclength_rigid_end.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""A clamped (Rigid) finite-EI line in a strong current follows its drag path past a limit point. + +A 2982 m cable hangs from a fairlead 1300 m above a soft seabed, clamped there (Rigid End A), in +a 1.1 m/s current that carries its grounded run 34 m past the anchor, where it folds back (a +hairpin). The drag load steps stall at a limit point in the drag fraction; the pseudo-arclength +continuation that follows the path around such a point was skipped for a line with a Rigid end, +and the statics failed, while the same line with a rotational spring of 1e9 N m/rad, or pinned, +solved. The Rigid line must solve, with end tensions within 1e-3 of the stiff-spring line's. + +usage: test_arclength_rigid_end.py --exe --output +""" + +from __future__ import annotations + +import argparse +import os +import subprocess +import sys +from pathlib import Path + +DECK = """--------------------- CableDyn Input File ------------------------------------ +Clamped cable in a strong current, folded back past its anchor +--------------------- LINE TYPES --------------------------------------- +TypeName Diam Mass EA BA EI Cd_n Cd_t Ca_n Ca_t +(-) (m) (kg/m) (N) (N-s) (N-m2) (-) (-) (-) (-) +t1 0.220140427337277 98.69067167615302 1404666756.1903045 -1.0 28098.621431099004 1.2 0.01 1.0 0.0 +--------------------- POINTS ------------------------------------------- +ID Type X Y Z +(-) (-) (m) (m) (m) +1 Coupled -86.22983517581444 29.680326533513522 -18.41049814550798 +2 Fixed 1829.3161686664414 -108.94426352048342 -1300.878186612071 +--------------------- LINES -------------------------------------------- +ID NodeA NodeB Outputs +(-) (-) (-) (-) +1 1 2 - +--------------------- SECTIONS ----------------------------------------- +LineID LineType Length NumSegs +(-) (-) (m) (-) +1 t1 2982.4084481132636 100 +--------------------- END CONNECTIONS ------------------------------- +LineID End Stiffness EzX EzY EzZ +(-) (-) (N-m/rad) (-) (-) (-) +1 A {k} 0.9264201469208807 0.154631906329435 -0.343270571013623 +--------------------- OPTIONS ------------------------------------------ +1300.878186612071 WtrDpth +6413.910151738813 kBot +0.02 dtM +0.0 TMax +uniform 1.12 -0.2 0.0 current +--------------------- OUTPUTS ------------------------------------------ +FairTen1 +AnchTen1 +--------------------- need this line ----------------------------------- +""" + + +def run(exe: str, out: Path, k: str) -> list: + name = "clamped_%s" % k.replace(".", "p") + deck = out / (name + ".dat") + deck.write_text(DECK.format(k=k), encoding="utf-8", newline="\n") + root = out / name + env = dict(os.environ) + env.setdefault("OPENBLAS_NUM_THREADS", "1") + p = subprocess.run([exe, str(deck), str(root)], capture_output=True, text=True, env=env, cwd=str(out)) + if p.returncode != 0: + raise RuntimeError("End A %s: exit %d: %s" % (k, p.returncode, (p.stdout + p.stderr)[-400:])) + rows = Path(str(root) + ".out").read_text(encoding="utf-8").splitlines() + return [float(v) for v in rows[2].split()[1:3]] + + +def main() -> int: + ap = argparse.ArgumentParser() + ap.add_argument("--exe", required=True) + ap.add_argument("--output", required=True) + a = ap.parse_args() + out = Path(a.output) + out.mkdir(parents=True, exist_ok=True) + failures = [] + try: + rigid = run(a.exe, out, "Rigid") + spring = run(a.exe, out, "1.0e9") + for r, s, ch in zip(rigid, spring, ("FairTen1", "AnchTen1")): + if abs(r - s) > 1.0e-3 * spring[0]: + failures.append("%s %.6e (Rigid) against %.6e (1e9 N m/rad spring)" % (ch, r, s)) + except RuntimeError as ex: + failures.append(str(ex)) + print("clamped cable in a strong current: %d failures" % len(failures)) + for f in failures: + print("FAIL:", f) + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main()) From 11863e7d01f1e6264c1a26020a82709cd1f428e0 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 01:56:47 +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 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1cd6b0..e3549554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,12 +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. -- Finite-EI statics in a current with a `Rigid` end connection: when the drag load steps stall at - a limit point, the pseudo-arclength continuation that follows the path around it was skipped - for a line with a `Rigid` end, so the statics failed where the same line with a stiff - rotational spring solved (a 3 km cable clamped at its fairlead in 1.1 m/s, folded back past - its anchor). The continuation now takes a `Rigid` end in the basis of its direction, with the - transverse components of the end tangent held, as the static solve does. ## [0.4.1] - 2026-11-08