diff --git a/CMakeLists.txt b/CMakeLists.txt index 894026bf..90ca3d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1877,6 +1877,17 @@ if(Python3_Interpreter_FOUND) TIMEOUT 300 ENVIRONMENT "${_cabledyn_python_test_environment}") + # Taut single-section Syrope ropes whose tension varies along them start at rest: every element + # takes its own secant on its working curve. + add_test(NAME syrope_taut_rest + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_syrope_taut_rest.py + --exe $ + --output ${CMAKE_BINARY_DIR}/syrope_taut_rest) + set_tests_properties(syrope_taut_rest PROPERTIES + LABELS "python;syrope;static;dynamic" + 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/doc/driver_format.md b/doc/driver_format.md index e9a7e678..7b0f8ec9 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -306,10 +306,10 @@ and `BA = BA_s|BA_d`: waves, host fluid fields and VIV of any `EI = 0` line, and active line control of a Syrope segment on the OpenFAST route ([CONTROL](#control-optional-openfast-line-control)). - The static start solves each Syrope element on the rest curve of its load history (the OWC, or - the `Tmax0` working curve under `SYROPE IC`). A single-section line takes one secant EA from the - curve at its mean strain; on a composite line, where the tension varies along a sagging Syrope - section, every Syrope element takes its own secant at its own tension, so every element starts - on its curve and the dynamics start in the static equilibrium. + the `Tmax0` working curve under `SYROPE IC`). The tension varies along a Syrope section (a + sagging section of a composite line, or the weight of a long or inclined taut rope), so every + Syrope element takes its own secant EA at its own tension: every element starts on its curve + and the dynamics start in the static equilibrium. The settings-file grammar is in [Auxiliary file formats](file_formats.rst). diff --git a/doc/theory.rst b/doc/theory.rst index 7f75983b..3a8fe700 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -958,15 +958,16 @@ ratchets and regenerates the working curve when the mean tension exceeds it. **Initial condition.** The static solve uses the rest curve of the initial load history: the OWC for a virgin rope, or, with ``SYROPE IC``, the working curve regenerated at :math:`T_\text{max,0}` (zero tension below its zero-tension strain, the OWC above its top -strain :math:`\varepsilon_\text{OWC}(T_\text{max,0})`). A single secant axial stiffness of that -curve is iterated to the solved mean strain, the line otherwise built as any ``EI = 0`` line +strain :math:`\varepsilon_\text{OWC}(T_\text{max,0})`). Each element's secant axial stiffness of +that curve is iterated to the curve's strain at its solved tension, the line otherwise built as +any ``EI = 0`` line (its drag in a deck current included). Each element then starts with the running maximum :math:`\max(T_\text{max,0}, T_e)` (:math:`T_e` for a virgin rope), where :math:`T_e` is its static tension, and with the slow strain whose kernel tension at the static strain and zero strain rate equals :math:`T_e`. The dynamic state therefore starts in the static equilibrium, -with no initial transient. Where the static strain lies on the rest curve, that slow strain is -the curve's rest point. Elsewhere, for example along a sagging line, it creeps at -:math:`(T_e - T_\text{mean})/BA_s`. With fixed line ends the mean tension follows from the +with no initial transient: every element's static strain lies on the rest curve, where that slow +strain is the curve's rest point. (With one secant for a whole section, an element away from the +mean tension sat off the curve and its slow strain crept at :math:`(T_e - T_\text{mean})/BA_s`.) With fixed line ends the mean tension follows from the geometry and :math:`T_\text{max,0}`, so :math:`T_\text{mean,0}` does not enter the state. A value that differs from the static mean tension by more than 1 % is reported on the console. A strain below the working curve's zero-tension strain (a slack rope on that history) stops at diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 6d9bd286..6832095b 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -10682,15 +10682,17 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts !! strain whose t = 0 kernel force equals its static tension, so the dynamic state starts in !! the static equilibrium. Tmean0 is not a state input (the fixed-end geometry and Tmax0 set !! the mean tension); a disagreement beyond 1 % is reported on the console. - !! The static solve uses secant EAs, iterated to the rest curve. A single-section line, taut - !! and of nearly uniform tension, takes one secant from the curve at its mean strain (the - !! strain the taut geometry fixes). On a composite line the tension varies along a sagging - !! Syrope section, so each Syrope element takes its own secant, from the curve's strain at the - !! element's tension: every element then starts on its rest curve, its slow strain at rest - !! (one secant per section would leave the elements away from the mean off the curve, and - !! their slow strains would settle the line after the start). The tension, which the chains' - !! weight and the geometry largely fix, keeps this update a contraction where a strain update - !! can overshoot. + !! The static solve uses secant EAs, iterated to the rest curve. The tension varies along a + !! Syrope section (a sagging section of a composite line, or the weight of a single long or + !! inclined taut rope), so each Syrope element takes its own secant, from the curve's strain + !! at the element's tension: every element then starts on its rest curve, its slow strain at + !! rest (one secant per section, from the curve at the mean strain, left the elements away + !! from the mean off the curve, and their slow strains settled the line after the start: a + !! 991 m single-section rope at rest moved its fairlead tension by 3.4e-4 in 1 s). A + !! single-section line starts the iteration from the secant at the strain its taut geometry + !! fixes, a composite line from the curve's alpha. The tension, which the chains' weight and + !! the geometry largely fix, keeps this update a contraction where a strain update can + !! overshoot. TYPE(DeckLineType), INTENT(IN) :: types(:) TYPE(DeckLine), INTENT(IN) :: ln TYPE(DeckSection), INTENT(IN) :: sections(:) @@ -10709,9 +10711,11 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts TYPE(CD_SyropeType), ALLOCATABLE :: tds(:), stype(:) INTEGER, ALLOCATABLE :: sec_type(:), sec_nseg(:), el_sec(:) LOGICAL, ALLOCATABLE :: sec_syr(:), sis(:) - REAL(wp), ALLOCATABLE :: sec_el(:), cand_el(:), sslow(:), stmax(:), t_static(:), eps_prev(:), t_prev(:) - REAL(wp) :: anchor(3), fairlead(3), eps0, t_ref, total_l0, t_hist, eps_bar, t_mean_static - REAL(wp) :: eps_e, change, secant, cand, eps_now, d_eps, d_t, eps_r, t_r, acc + REAL(wp), ALLOCATABLE :: sec_el(:), cand_el(:), sslow(:), stmax(:), t_static(:), eps_prev(:), t_prev(:), & + step_prev(:) + REAL(wp) :: anchor(3), fairlead(3), eps0, t_ref, total_l0, t_hist, t_mean_static + REAL(wp) :: eps_e, change, secant, eps_now, d_eps, d_t, eps_r, t_r, acc + LOGICAL :: have_acc INTEGER :: ne, e, es, n_owc, iter, nsec, j, k, isec, st LOGICAL :: composite, converged CHARACTER(1024) :: em @@ -10784,10 +10788,11 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts t_hist = CD_ZERO IF (ln%has_syrope_ic) t_hist = ln%syrope_tmax0 ALLOCATE (sec_el(ne), cand_el(ne), stype(ne), sis(ne), sslow(ne), stmax(ne), t_static(ne), eps_prev(ne), & - t_prev(ne)) + t_prev(ne), step_prev(ne)) sis = .FALSE. sslow = CD_ZERO stmax = CD_ZERO + step_prev = CD_ZERO sec_el = CD_ZERO DO e = 1, ne IF (.NOT. sec_syr(el_sec(e))) CYCLE @@ -10837,7 +10842,7 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts ! current's deflection). The solve just made belongs to the current secants, which are kept ! once the candidates agree with them. converged = .FALSE. - DO iter = 1, MERGE(MAX_ITER_COMPOSITE, 6, composite) + DO iter = 1, MAX_ITER_COMPOSITE CALL init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry=bathymetry, & syrope_secant=sec_el) IF (ErrStat /= CD_DECKDRV_OK) EXIT @@ -10848,7 +10853,7 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts ErrMsg = em END IF IF (ErrStat /= CD_MODEL_OK) EXIT - IF (composite) THEN + BLOCK ! each Syrope element: the curve's strain at its tension change = CD_ZERO cand_el = sec_el @@ -10889,19 +10894,40 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts ! equilibrium. It is taken only beyond the tension update in the same direction and ! at most 100 times as far, else the tension update stands. eps_now = t_static(e)/sec_el(e) + have_acc = .FALSE. IF (iter > 1) THEN d_eps = eps_now - eps_prev(e) d_t = t_static(e) - t_prev(e) - IF (d_eps*d_t < CD_ZERO) THEN + ! (a response of fixed strain, d_eps = 0, as of a taut rope whose geometry sets its + ! strain, crosses the curve at that strain) + IF (d_eps*d_t < CD_ZERO .OR. (.NOT. (ABS(d_eps) > CD_ZERO) .AND. ABS(d_t) > CD_ZERO)) THEN CALL response_root(isec, eps_now, t_static(e), d_eps, d_t, eps_r, t_r) IF (eps_r > CD_ZERO .AND. t_r > CD_ZERO) THEN acc = t_r/eps_r - IF ((acc - sec_el(e))*(cand_el(e) - sec_el(e)) > CD_ZERO .AND. & - ABS(acc - sec_el(e)) >= ABS(cand_el(e) - sec_el(e)) .AND. & - ABS(acc - sec_el(e)) <= 100.0_wp*ABS(cand_el(e) - sec_el(e))) cand_el(e) = acc + have_acc = .TRUE. END IF END IF + ! A tension update that reverses the previous one and is not below half of it + ! overshot the crossing without contracting: on a curve concave enough (the secant + ! far above the tangent) it would cycle. The secant step then stands where it lies + ! between the secant and the update, else half the update. Any other update (in the + ! same direction as the last, as on a convex curve, or an alternating one that + ! contracts) keeps the rule below. + IF ((cand_el(e) - sec_el(e))*step_prev(e) < CD_ZERO .AND. & + ABS(cand_el(e) - sec_el(e)) >= 0.5_wp*ABS(step_prev(e))) THEN + IF (have_acc .AND. (acc - sec_el(e))*(cand_el(e) - sec_el(e)) > CD_ZERO .AND. & + ABS(acc - sec_el(e)) < ABS(cand_el(e) - sec_el(e))) THEN + cand_el(e) = acc + ELSE + cand_el(e) = sec_el(e) + 0.5_wp*(cand_el(e) - sec_el(e)) + END IF + ELSE IF (have_acc .AND. d_eps*d_t < CD_ZERO) THEN + IF ((acc - sec_el(e))*(cand_el(e) - sec_el(e)) > CD_ZERO .AND. & + ABS(acc - sec_el(e)) >= ABS(cand_el(e) - sec_el(e)) .AND. & + ABS(acc - sec_el(e)) <= 100.0_wp*ABS(cand_el(e) - sec_el(e))) cand_el(e) = acc + END IF END IF + step_prev(e) = cand_el(e) - sec_el(e) eps_prev(e) = eps_now t_prev(e) = t_static(e) END DO @@ -10910,15 +10936,7 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts EXIT END IF sec_el = cand_el - ELSE - eps_bar = SUM(l0*t_static)/(secant*SUM(l0)) - CALL rest_tension(1, eps_bar, t_ref, es, em) - IF (es /= CD_SYROPE_OK .OR. .NOT. (t_ref > CD_ZERO .AND. eps_bar > CD_ZERO)) EXIT - cand = t_ref/eps_bar - IF (ABS(cand - secant) <= 1.0e-10_wp*secant) EXIT - secant = cand - sec_el = secant - END IF + END BLOCK END DO IF (ErrStat /= CD_MODEL_OK) THEN CALL release_syrope(.TRUE.) @@ -10926,8 +10944,8 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts IF (ErrStat /= CD_DECKDRV_BADINPUT) ErrStat = CD_DECKDRV_SOLVEFAIL RETURN END IF - IF (composite) THEN - ! a composite line starts only from converged secants, every Syrope element on its + BLOCK + ! a Syrope line starts only from converged secants, every Syrope element on its ! curve's table IF (.NOT. converged) THEN CALL release_syrope(.TRUE.) @@ -10951,7 +10969,7 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts RETURN END IF END DO - END IF + END BLOCK ! Per Syrope element: the running maximum is the history's (raised to the element's static ! tension where that exceeds it, i.e. the element sits on the OWC; without SYROPE IC ! every element is a virgin rope at its own static tension), and the slow strain diff --git a/tests/test_syrope_taut_rest.py b/tests/test_syrope_taut_rest.py new file mode 100644 index 00000000..d26e8001 --- /dev/null +++ b/tests/test_syrope_taut_rest.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""A taut single-section Syrope rope whose tension varies along it starts at rest. + +Three deep, inclined polyester ropes (481, 850 and 991 m, 330 to 750 m of water) carry their +weight, so the tension falls by up to 15 % from fairlead to anchor. The static start took one +secant EA from the working curve at the rope's mean strain: the elements away from the mean +started off their curve and their slow strains settled the rope at rest (the fairlead tension +moved by 1.2e-4 to 6.1e-4 in 1 s). Each rope, held at rest for 1 s, must keep its end tensions +at their static values to 1e-6. + +usage: test_syrope_taut_rest.py --exe --output +""" + +from __future__ import annotations + +import argparse +import os +import subprocess +import sys +from pathlib import Path + +SETTINGS = """syrope_owc.dat OWC +EXP WCType +0.20 k1 +1.50 k2 +""" + +DECK = """--------------------- CableDyn Input File ------------------------------------ +Taut polyester rope in deep water, held at rest +--------------------- LINE TYPES --------------------------------------- +TypeName Diam Mass EA BA EI Cd_n Cd_t Ca_n Ca_t +(-) (m) (kg/m) (N) (N-s) (N-m2) (-) (-) (-) (-) +rope 0.1438 26.8406 SYROPE:syrope_settings.dat|{alpha}|{beta} {bas}|{bad} 0.0 1.2 0.2 1.0 0.0 +--------------------- POINTS ------------------------------------------- +ID Type X Y Z +(-) (-) (m) (m) (m) +1 Coupled {a} +2 Fixed {b} +--------------------- LINES -------------------------------------------- +ID NodeA NodeB Outputs +(-) (-) (-) (-) +1 1 2 - +--------------------- SECTIONS ----------------------------------------- +LineID LineType Length NumSegs +(-) (-) (m) (-) +1 rope {length} {n} +--------------------- OPTIONS ------------------------------------------ +{depth} WtrDpth +{kbot} kBot +0.01 dtM +1.0 TMax +--------------------- OUTPUTS ------------------------------------------ +FairTen1 +AnchTen1 +--------------------- need this line ----------------------------------- +""" + +ROPES = [ + dict(alpha="1.83494e8", beta="15.9308", bas="2.28256e10", bad="4.81630e5", a="6.0913 -27.1467 -4.6733", + b="185.5774 -660.5800 -751.7888", length="990.9851", n=20, depth="751.7888", kbot="1.829e5"), + dict(alpha="1.89709e8", beta="16.1960", bas="1.31046e9", bad="7.86974e5", a="-6.0871 -36.8963 -4.5814", + b="-360.0368 -124.1505 -328.1981", length="481.3015", n=10, depth="328.1981", kbot="4.494e5"), + dict(alpha="2.67068e8", beta="15.9927", bas="1.06925e10", bad="2.82844e5", a="14.7149 -33.3903 -4.1781", + b="-60.8938 -595.2920 -643.3068", length="849.5532", n=13, depth="643.3068", kbot="1.616e5"), +] + + +# A short vertical rope on a strongly concave curve, T = 1e6 eps^0.4: its secant lies far above +# its tangent, so the per-element tension update overshoots the curve's crossing and reverses +# (it cycled between about 108 and 560 kN and the statics failed); the reversed updates take +# the secant step, and the rope must start at rest in its weight's equilibrium. +CONCAVE = dict(alpha="1.0e8", beta="15.9308", bas="2.28256e10", bad="4.81630e5", a="0.0 0.0 -29.6", + b="0.0 0.0 -50.0", length="20.0", n=2, depth="50.0", kbot="1.0e5") + + +def concave_table() -> str: + rows = ["Strain Tension", "(-) (N)"] + for k in range(61): + rows.append("%r %r" % (0.001 * k, 1.0e6 * (0.001 * k) ** 0.4)) + return "\n".join(rows) + "\n" + + +def owc_table() -> str: + rows = ["Strain Tension", "(-) (N)"] + for k in range(30): + rows.append("%r %r" % (0.00206897 * k, 1.71768e5 * k * (1.0 - 0.012 * k))) + return "\n".join(rows) + "\n" + + +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) + (out / "syrope_settings.dat").write_text(SETTINGS, encoding="utf-8", newline="\n") + (out / "syrope_owc.dat").write_text(owc_table(), encoding="utf-8", newline="\n") + (out / "syrope_settings_concave.dat").write_text(SETTINGS.replace("syrope_owc.dat", "syrope_owc_concave.dat"), + encoding="utf-8", newline="\n") + (out / "syrope_owc_concave.dat").write_text(concave_table(), encoding="utf-8", newline="\n") + env = dict(os.environ) + env.setdefault("OPENBLAS_NUM_THREADS", "1") + failures = [] + cases = [("rope_%d" % k, DECK.format(**rope)) for k, rope in enumerate(ROPES)] + cases.append(("rope_concave", DECK.format(**CONCAVE).replace("syrope_settings.dat", "syrope_settings_concave.dat"))) + for name, text in cases: + deck = out / (name + ".dat") + deck.write_text(text, encoding="utf-8", newline="\n") + root = out / name + p = subprocess.run([a.exe, str(deck), str(root)], capture_output=True, text=True, env=env, cwd=str(out)) + if p.returncode != 0: + failures.append("%s: exit %d: %s" % (name, p.returncode, (p.stdout + p.stderr)[-300:])) + continue + rows = Path(str(root) + ".out").read_text(encoding="utf-8").splitlines() + vals = [[float(v) for v in r.split()] for r in rows[2:] if r.strip()] + for j, ch in ((1, "FairTen1"), (2, "AnchTen1")): + t0 = vals[0][j] + drift = max(abs(v[j] - t0) for v in vals) / abs(t0) + if drift > 1.0e-6: + failures.append("%s: %s drifts by %.3e of its static value" % (name, ch, drift)) + print("taut Syrope ropes at rest: %d ropes, %d failures" % (len(cases), len(failures))) + for f in failures: + print("FAIL:", f) + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main())