From 13134056f39d43538c2ecd5c1d696594c645a082 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 00:41:20 +0900 Subject: [PATCH 1/2] fix(statics): the residual-floor note only for a residual above the tolerance The finite-EI static solve repeats a polish that does not converge at the tight static tolerance at the coupled tolerance 1e-6 and notes "static residual floor above the dynamic tolerance ...; equilibrium accepted at the relative residual ...". The repeated polish can end below the tight tolerance (its last Newton step lands there), and the note then reported a residual below the tolerance it said was missed: "1.00E-08; ... accepted at ... 6.91E-09" for a two-section line restrained in torsion. The note is now printed only when the residual reached lies above the tight tolerance. The solves and their results are unchanged. The new static_floor_note test runs that line and requires every such note to report a residual above its tolerance. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 4 ++ CMakeLists.txt | 10 ++++ src/CableDyn_DeckDriver.f90 | 4 +- tests/test_static_floor_note.py | 93 +++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 tests/test_static_floor_note.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e3549554..ffdbdec2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ 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: the note "static residual floor above the dynamic tolerance" could report a + residual below that tolerance (accepted at 6.91e-9 against 1e-8): a polish repeated at the + coupled static tolerance after the tight one failed can still end below the tight tolerance. + The note is now printed only when the residual reached lies above it. ## [0.4.1] - 2026-11-08 diff --git a/CMakeLists.txt b/CMakeLists.txt index f99e3c67..43c0fc5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1888,6 +1888,16 @@ if(Python3_Interpreter_FOUND) TIMEOUT 300 ENVIRONMENT "${_cabledyn_python_test_environment}") + # The static residual-floor note reports a residual above the tolerance it says was missed. + add_test(NAME static_floor_note + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_static_floor_note.py + --exe $ + --output ${CMAKE_BINARY_DIR}/static_floor_note) + set_tests_properties(static_floor_note PROPERTIES + LABELS "python;hermite;static" + TIMEOUT 300 + 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/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 8c31da49..3060eaf2 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -3173,7 +3173,9 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, END IF IF (LEN_TRIM(resolution_note) > 0 .AND. primary_done) & CALL report_note('line '//TRIM(int_to_str(ln%id))//': '//TRIM(resolution_note)) - IF (tolerance_note) THEN + ! tolerance_note is set by a solve repeated at a looser tolerance, whose last Newton step can + ! still land below the tight one: only a residual above the tight tolerance is a floor to note + IF (tolerance_note .AND. res > static_tol_target) THEN WRITE (note_text, '(A,I0,A,ES9.2,A,ES9.2)') 'line ', ln%id, ': static residual floor above the '// & 'dynamic tolerance ', static_tol_target, '; equilibrium accepted at the relative residual ', res CALL report_note(note_text) diff --git a/tests/test_static_floor_note.py b/tests/test_static_floor_note.py new file mode 100644 index 00000000..69b1251a --- /dev/null +++ b/tests/test_static_floor_note.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""The static residual-floor note names a residual above the tolerance it says was missed. + +A two-section finite-EI line restrained in torsion (pinned in bending at its fairlead, clamped +at its anchor, 9.7 deg of imposed twist) is polished at the tight static tolerance, which does +not converge, and again at the coupled static tolerance 1e-6, whose last Newton step lands at a +relative residual of 6.9e-9, below the tight 1e-8. The run printed "static residual +floor above the dynamic tolerance 1.00E-08; equilibrium accepted at the relative residual +6.91E-09". Every such note must report a residual above its tolerance, and this run none. + +usage: test_static_floor_note.py --exe --output +""" + +from __future__ import annotations + +import argparse +import os +import re +import subprocess +import sys +from pathlib import Path + +DECK = """--------------------- CableDyn Input File ------------------------------------ +Two-section finite-EI line restrained in torsion +--------------------- LINE TYPES --------------------------------------- +TypeName Diam Mass EA BA EI GAs GJ Irt Irn Cd_n Cd_t Ca_n Ca_t +(-) (m) (kg/m) (N) (N-s) (N-m2) (-) (-) (-) (-) +t1 0.11958934169215762 24.223380558396716 819311396.4530731 -1.0 13696.958265809739 315119767.8665666 \ +15490.529253648816 0.021652084830305268 0.043304169660610535 1.2 0.01 1.0 0.0 +t2 0.2138970906163321 85.11251138269321 1087874573.7545362 -1.0 2845.9411357014956 418413297.5978985 \ +3005.149240256559 0.2433790421053965 0.486758084210793 1.2 0.01 1.0 0.0 +--------------------- POINTS ------------------------------------------- +ID Type X Y Z +(-) (-) (m) (m) (m) +1 Coupled -22.067725644878863 -43.46036418329759 -11.351640609291547 +2 Fixed 155.09096486699008 -43.46036418329759 -231.01460743349267 +--------------------- LINES -------------------------------------------- +ID NodeA NodeB Outputs +(-) (-) (-) (-) +1 1 2 - +--------------------- SECTIONS ----------------------------------------- +LineID LineType Length NumSegs +(-) (-) (m) (-) +1 t1 246.90435544324012 56 +1 t2 99.25397277211934 56 +--------------------- END CONNECTIONS ------------------------------- +LineID End Stiffness EzX EzY EzZ TorsStiffness NxX NxY NxZ Pretwist +(-) (-) (N-m/rad) (-) (-) (-) (N-m/rad) (-) (-) (-) (deg) +1 A Pinned 0.5000000000000001 0.0 -0.8660254037844386 Rigid 0.0 1.0 0.0 0.0 +1 B Rigid 1.0 0.0 0.0 Rigid 0.0 1.0 0.0 9.686369916584601 +--------------------- OPTIONS ------------------------------------------ +0.01 dtM +0.0 TMax +--------------------- OUTPUTS ------------------------------------------ +FairTen1 +Twist1 +--------------------- need this line ----------------------------------- +""".replace("\\\n", "") + +NOTE = re.compile(r"static residual floor above the dynamic tolerance\s+(\S+); equilibrium accepted at the " + r"relative residual\s+(\S+)\.") + + +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) + deck = out / "twisted.dat" + deck.write_text(DECK, encoding="utf-8", newline="\n") + env = dict(os.environ) + env.setdefault("OPENBLAS_NUM_THREADS", "1") + p = subprocess.run([a.exe, str(deck), str(out / "twisted")], capture_output=True, text=True, env=env, + cwd=str(out)) + log = p.stdout + p.stderr + failures = [] + if p.returncode != 0: + failures.append("exit %d: %s" % (p.returncode, log[-400:])) + for tol, res in NOTE.findall(log): + if float(res) <= float(tol): + failures.append("floor note with a residual %s at or below its tolerance %s" % (res, tol)) + print("static floor note: %d failures" % len(failures)) + for f in failures: + print("FAIL:", f) + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main()) From b47ae7c85bc3b83215bd93b3921691c532faf1b7 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Mon, 9 Nov 2026 01:54: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 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffdbdec2..e3549554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +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: the note "static residual floor above the dynamic tolerance" could report a - residual below that tolerance (accepted at 6.91e-9 against 1e-8): a polish repeated at the - coupled static tolerance after the tight one failed can still end below the tight tolerance. - The note is now printed only when the residual reached lies above it. ## [0.4.1] - 2026-11-08