From 24eebe5f3935c3827a3c2b9e4698f31b851c05eb Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 29 Oct 2026 11:01:03 +0900 Subject: [PATCH 1/4] feat(outputs): CurvX/CurvY, the curvature on a cable's section axes CurvN gives the curvature as a magnitude only. The fatigue of an armour wire or conductor at a fixed point of a power cable's cross section needs its direction in the section, so cross-section analysis (CableXSec) had to rebuild it from node positions. CurvXN and CurvYN resolve the nodal curvature vector, toward the centre of curvature and of length CurvN, on the section axes of a finite-EI line. The vector is the normal part of the recovered section moment over EI on the side that gives the curvature, or the exact trace's (r' x r'') x r'/|r'|^4 where the recovery falls back to it (both now returned by node_values and CD_HermiteCable_Curvature). The section axis x starts at End A normal to the End A -> End B tangent: on a line restrained in torsion along End A's torsion normal; otherwise along the static start's upper normal, kept in the hang-off's axes when End A is clamped (it turns with the vessel) and in global axes at a pinned End A. It is carried to every node by parallel transport (eight smallest rotations between the Hermite tangents per element) and, in torsion, turned about the tangent by the twist from End A. The result is cached per state, so the channels of one output row share one recovery. EI = 0 lines and the two-moving-end route refuse the channels by name, natively and in the Python deck validator. section_curvature: on a planar line CurvY is zero and the norm is Curv; in a cross current both components appear with the same norm; the deck turned 30 degrees about the vertical gives the same components to 8e-9; a clamped hang-off turned 30 degrees about its tangent turns them by -30 degrees to 1e-15; on a line twisted 90 degrees the carried axes reach End B within 3e-6 rad of its own pretwisted normal. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 8 + CMakeLists.txt | 5 + doc/outputs.rst | 10 + doc/theory.rst | 32 +++ python/cabledyn/deck_file.py | 16 ++ python/tests/test_deck_file.py | 22 ++ src/CableDyn_DeckDriver.f90 | 51 ++++- src/CableDyn_HermiteCable.f90 | 9 +- src/CableDyn_HermiteCableDynamic.f90 | 182 +++++++++++++++-- src/CableDyn_OpenFAST_HermiteFMF.f90 | 107 ++++++++++ tests/test_section_curvature.f90 | 290 +++++++++++++++++++++++++++ 11 files changed, 713 insertions(+), 19 deletions(-) create mode 100644 tests/test_section_curvature.f90 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8711f8d5..422d3d38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,14 @@ All notable changes to CableDyn are recorded in this file. The format follows ### Added +- Section-frame curvature channels `CurvXN` and `CurvYN` on finite-EI lines: the + curvature vector on the cable's cross-section axes, for the fatigue of an armour wire or + conductor at a fixed point of the section. The axes start at End A from the end connection + (the torsion normal, or the static start's upper normal), turn with a clamped hang-off, are + carried along the line by parallel transport and turn with the twist of a line restrained in + torsion; `CurvX^2 + CurvY^2 = Curv^2`. On a line twisted 90 degrees the carried axes reach + End B within 3e-6 rad of its pretwisted normal. `EI = 0` lines and finite-EI lines with two + moving ends refuse the channels. - Cross-flow vortex-induced vibration of `EI = 0` lines in the standalone driver: MoorDyn v2's LINE TYPES columns `Cl` or `Cl dF cF` switch on the synchronisation model of Thorsen et al., with the same phase start and running-RMS window (`VIVrmsWindow`, default 500 steps of diff --git a/CMakeLists.txt b/CMakeLists.txt index 0409e213..28259b42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2062,6 +2062,11 @@ target_link_libraries(test_torsion_deck PRIVATE cabledyn_core) add_test(NAME torsion_deck COMMAND test_torsion_deck) set_tests_properties(torsion_deck PROPERTIES LABELS "fortran;driver;integration;static;dynamic") +add_executable(test_section_curvature tests/test_section_curvature.f90) +target_link_libraries(test_section_curvature PRIVATE cabledyn_core) +add_test(NAME section_curvature COMMAND test_section_curvature) +set_tests_properties(section_curvature PROPERTIES LABELS "fortran;driver;integration;static") + add_executable(test_coupled_torsion tests/test_coupled_torsion.f90) target_link_libraries(test_coupled_torsion PRIVATE cabledyn_core) add_test(NAME coupled_torsion COMMAND test_coupled_torsion WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/doc/outputs.rst b/doc/outputs.rst index 7da7d638..03e4af94 100644 --- a/doc/outputs.rst +++ b/doc/outputs.rst @@ -690,6 +690,16 @@ Line-node channels same value; ``CD_HermiteCable_Dyn_Curvature_Exact`` and ``CD_HFMF_Curvature_Exact`` the exact geometric traces - 1/m + * - ``CurvXN``, ``CurvYN`` + - the curvature vector at node ``J`` on the cross-section axes x and y of a finite-EI line + (:ref:`theory-section-curvature`): the vector points to the centre of curvature, its + length is ``CurvN`` (``CurvX² + CurvY² = Curv²``), and a section point at (x, y) + has the bending strain ``−(CurvX x + CurvY y)``. The axes start at End A from the end + connection, follow the hang-off when End A is clamped, and are carried along the line, + turned by the twist when the line is restrained in torsion. ``EI = 0`` lines and + finite-EI lines with two moving ends refuse the channels. ``CD_HFMF_Section_Curvature`` + returns them for every node + - 1/m * - ``BendMomN`` - bend moment ``EI × κ`` measured relative to the stress-free reference shape (the cubic-Hermite reference is straight). Finite-EI lines: the component normal to the tangent diff --git a/doc/theory.rst b/doc/theory.rst index 98295023..e0db1ed5 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -328,6 +328,38 @@ node, the larger one-sided exact curvature, and the midpoint axial resultant as tension. The material-strain checks (``tensile_safety``, the static compression notes) judge :math:`EA\varepsilon` under either setting. +.. _theory-section-curvature: + +Curvature on the section axes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``CurvXN`` and ``CurvYN`` resolve the nodal curvature vector +:math:`\kappa\mathbf{n}`, which points to the centre of curvature, on two axes of the cable's +cross section. The vector is the one whose length is ``CurvN``: the normal part of the +recovered section moment over :math:`EI` on the side that gives the curvature, or the exact +trace :math:`(\mathbf{r}' \times \mathbf{r}'') \times \mathbf{r}'/|\mathbf{r}'|^4` where +the recovery falls back to it (:ref:`theory-output-recovery`). + +The section axis :math:`\mathbf{d}_1` (x) starts at End A normal to the End A → End B tangent +:math:`\mathbf{t}`: + +- on a line restrained in torsion, along End A's torsion normal ``Nx``, which turns with the + hang-off; +- otherwise along the static start's upper normal, the projection of global +z normal to the + End A tangent (global +x where the tangent is vertical). It is fixed in the hang-off's axes + when End A is clamped or held by a finite rotational stiffness, so it turns with the vessel, + and fixed in global axes at a pinned End A, where the roll of the section is undefined. + +It is carried to every node by parallel transport along the centreline, eight smallest +rotations between the Hermite tangents per element, which does not twist it about the tangent. +On a line in torsion it is then turned about :math:`\mathbf{t}` by the twist from End A, the +torque times the End A compliance plus :math:`\sum l_0/GJ` from End A, right-handed about +:math:`\mathbf{t}`. With :math:`\mathbf{d}_2 = \mathbf{t} \times \mathbf{d}_1` (y), +``CurvX`` :math:`= \kappa\mathbf{n} \cdot \mathbf{d}_1` and ``CurvY`` +:math:`= \kappa\mathbf{n} \cdot \mathbf{d}_2`. A fibre at :math:`(x, y)` in the section is +strained in bending by :math:`-(\kappa_x x + \kappa_y y)`. On a line twisted 90 degrees from +End A to End B the carried axes reach End B within 3e-6 rad of its own pretwisted normal. + .. _theory-torsion: Condensed torsion diff --git a/python/cabledyn/deck_file.py b/python/cabledyn/deck_file.py index 5eadc030..033e5d0d 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -708,6 +708,8 @@ def _parse_line_node_channel(lowered: str) -> tuple[int, int, int, int]: ("torq", 9), ("twist", 10), ("ten", 3), + ("curvx", 13), + ("curvy", 14), ("curv", 5), ("bendmom", 6), ("stfmom", 12), @@ -3649,6 +3651,14 @@ def is_body_kind(kind: str, pinned: bool) -> bool: f"{self._label}: the LINES Outputs flag V (VIV lift) needs a line that carries " "VIV, which a finite-EI line with two moving ends does not" ) + if moving_end_b: + for channel in channels: + if _parse_line_node_channel(channel.lower())[2] in (13, 14): + raise DeckFormatError( + f"{self._label}: OUTPUT {channel!r}: the section curvature components " + "need a finite-EI line with a Fixed End B (the cubic-Hermite march); a " + "line with two moving ends reports CurvN" + ) if failures and deck_driver_route: # native CD_Run_Deck_Driver: FAILURE runs on the point-system object graph only if not has_dtm: @@ -4120,6 +4130,12 @@ def is_body_kind(kind: str, pinned: bool) -> bool: f"{self._label}: OUTPUT {channel!r}: line {line_id} has no STIFFENERS, " "so no stiffener moment" ) + if kind in (13, 14) and line_id not in finite_line_ids: + raise DeckFormatError( + f"{self._label}: OUTPUT {channel!r}: the section curvature components " + f"need a finite-EI line (a section frame); line {line_id} has EI = 0 " + "(CurvN gives its curvature)" + ) continue raise DeckFormatError(f"{self._label}: unsupported OUTPUT channel {channel!r}") diff --git a/python/tests/test_deck_file.py b/python/tests/test_deck_file.py index 1da6a512..4bfc7fa4 100644 --- a/python/tests/test_deck_file.py +++ b/python/tests/test_deck_file.py @@ -4098,6 +4098,28 @@ def test_reserved_windows_device_names_are_refused(monkeypatch, tmp_path): ) +def test_section_curvature_channels_need_a_finite_ei_line(): + # CurvX/CurvYN: the curvature on the section axes of a finite-EI line; distinct from + # CurvN and from each other + with_channels = _edit(_DYNAMIC, ("\nFairTen1\n", "\nFairTen1\nCurvX1N2\nCurvY1N2\nCurv1N2\n")) + deck = DeckFile.from_text(with_channels) + assert {"CurvX1N2", "CurvY1N2", "Curv1N2"} <= set(deck.outputs) + ei0 = _edit(_TIMED, ("\nFairTen1\n", "\nFairTen1\nCurvX1N2\n")) + with pytest.raises(DeckFormatError, match="section curvature components need a finite-EI line"): + DeckFile.from_text(ei0) + # a farm-shared cable (two moving ends) runs on the compatibility route, which has no frame + shared = _edit( + _TURBINE_DECK, + ("chain 0.1 20.0 1.0e9 -1.0 0.0 1.2", "chain 0.1 20.0 1.0e9 -1.0 1.0e4 1.2"), + ("1 1 3 -\n2 2 3 -\n", "1 1 2 -\n"), + ("1 chain 380 20\n2 chain 380 20\n", "1 chain 620 30\n"), + ("100 WtrDpth\n", "100 WtrDpth\n0.1 dtM\n10.0 TMax\n"), + ('"Point3FH"', '"CurvY1N5"'), + ) + with pytest.raises(DeckFormatError, match="Fixed End B"): + DeckFile.from_text(shared) + + def test_viv_and_lift_flag_refused_on_a_finite_ei_line_with_two_moving_ends(): # native run_deck_driver: a farm-shared finite-EI line (Turbine1 to Turbine2) runs on the # compatibility route, which carries no VIV: Cl > 0 and the lift file V are refused diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index d6d19fe5..dfe17576 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -116,6 +116,7 @@ MODULE CableDyn_DeckDriver CD_Vessel_Point_Kinematics, CD_Vessel_RAO_Set, CD_Vessel_RAO_Eval, & CD_Vessel_RAO_Motion, CD_Vessel_Ramp, CD_VESSEL_OK USE CableDyn_OpenFAST_HermiteFMF, ONLY: CD_HFMF_ModuleType, CD_HFMF_Init, CD_HFMF_Set_Drag, & + CD_HFMF_Set_Section_Reference, CD_HFMF_Section_Curvature, & CD_HFMF_Set_Axial_Damping, & CD_HFMF_Set_AddedMass, CD_HFMF_Set_ModifiedNewton, & CD_HFMF_Set_Tensile_Monitor, CD_HFMF_Get_Tensile_Diagnostics, & @@ -3268,6 +3269,11 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, END IF ! OPTIONS OutputRecovery selects the definition of the node tension, curvature and bend moment. CALL CD_HermiteCable_Dyn_Set_Output_Recovery(cable%line, opts%output_element_recovery) + ! the cross-section reference of the CurvX/CurvY channels, at the static start + CALL CD_HFMF_Set_Section_Reference(cable, es, em) + IF (es /= CD_HFMF_OK) THEN + CALL fail(ErrStat, ErrMsg, 'finite-EI cable section reference failed: '//TRIM(em)); RETURN + END IF CONTAINS SUBROUTINE torsion_stage(est, emt) @@ -8187,7 +8193,7 @@ SUBROUTINE run_deck_driver(deck_path, out_root, converged, ErrStat, ErrMsg) TYPE(CD_BathymetryType) :: bathymetry TYPE(DeckFailure), ALLOCATABLE :: fails(:) TYPE(CD_LineInitSummary), ALLOCATABLE :: init_summaries(:) - INTEGER :: nl, li, es, j, n_finite + INTEGER :: nl, li, es, j, n_finite, node_sc, kind_sc, comp_sc LOGICAL :: line_conv, has_line_outputs, has_finite, has_dyn_points, has_rigid6, hermite_standalone_eligible CHARACTER(1024) :: em @@ -8366,6 +8372,16 @@ SUBROUTINE run_deck_driver(deck_path, out_root, converged, ErrStat, ErrMsg) '(the cubic-Hermite march); set Cl = 0 for a line with two moving ends') RETURN END DO + ! the compatibility route carries no section frame for the curvature components + DO li = 1, SIZE(channels) + CALL parse_line_node_channel(channels(li), j, node_sc, kind_sc, comp_sc) + IF (kind_sc /= 13 .AND. kind_sc /= 14) CYCLE + IF (opts%has_bathymetry_file) CALL CD_End_Bathymetry(bathymetry) + CALL fail(ErrStat, ErrMsg, 'OUTPUT "'//TRIM(channels(li))//'": the section curvature components '// & + 'need a finite-EI line with a Fixed End B (the cubic-Hermite march); a line with two '// & + 'moving ends reports CurvN') + RETURN + END DO END IF IF (hermite_standalone_eligible) THEN ALLOCATE (hermite_models(SIZE(lines))) @@ -16808,7 +16824,7 @@ SUBROUTINE finalize_checks(types, bodies, rod_types, rods, points, lines, sectio DO i = 1, SIZE(channels) at_line = 0 IF (i <= SIZE(channel_lines)) at_line = channel_lines(i) - CALL check_channel(channels(i), lines, points, sections, ErrStat, ErrMsg, bodies, rods, opts%zl_rod) + CALL check_channel(channels(i), lines, points, sections, ErrStat, ErrMsg, bodies, rods, opts%zl_rod, types) IF (ErrStat /= 0) RETURN END DO at_line = 0 @@ -32805,7 +32821,7 @@ INTEGER FUNCTION deck_to_internal_node(deck_node, nelem) RESULT(internal_node) internal_node = nelem + 2 - deck_node END FUNCTION deck_to_internal_node - SUBROUTINE check_channel(ch, lines, points, sections, ErrStat, ErrMsg, bodies, rods, zl_rod) + SUBROUTINE check_channel(ch, lines, points, sections, ErrStat, ErrMsg, bodies, rods, zl_rod, types) CHARACTER(*), INTENT(IN) :: ch TYPE(DeckLine), INTENT(IN) :: lines(:) TYPE(DeckPoint), INTENT(IN) :: points(:) @@ -32816,6 +32832,8 @@ SUBROUTINE check_channel(ch, lines, points, sections, ErrStat, ErrMsg, bodies, r TYPE(DeckRod), INTENT(IN), OPTIONAL :: rods(:) ! zero-length rods collapsed to connector points (collapse_zero_length_rods) INTEGER, INTENT(IN), OPTIONAL :: zl_rod(:) + ! the line types, for the channels of finite-EI lines only (CurvX, CurvY) + TYPE(DeckLineType), INTENT(IN), OPTIONAL :: types(:) CHARACTER(NAMELEN) :: lo INTEGER :: pidx, comp, kind, line_id, node, li, nelem LOGICAL :: is_body @@ -32916,12 +32934,20 @@ SUBROUTINE check_channel(ch, lines, points, sections, ErrStat, ErrMsg, bodies, r CALL fail(ErrStat, ErrMsg, 'OUTPUT "'//TRIM(ch)//'": line '//TRIM(int_to_str(line_id))//' has no '// & 'STIFFENERS, so no stiffener moment'); RETURN END IF + IF ((kind == 13 .OR. kind == 14) .AND. PRESENT(types)) THEN + IF (.NOT. line_is_finite_ei(lines(li), types, sections)) THEN + CALL fail(ErrStat, ErrMsg, 'OUTPUT "'//TRIM(ch)//'": the section curvature components need a '// & + 'finite-EI line (a section frame); line '//TRIM(int_to_str(line_id))//' has EI = 0 '// & + '(CurvN gives its curvature)'); RETURN + END IF + END IF ELSE CALL fail(ErrStat, ErrMsg, 'OUTPUT channel "'//TRIM(ch)// & '" not supported (use FairTen, AnchTen, AnchFz, AnchFH, FairIncl, AnchIncl, '// & 'FairDecl, AnchDecl (FairAngle/AnchAngle aliases), FairDefl, AnchDefl, '// & 'Point

p{x,y,z} (alias Con

p{x,y,z}), Point

F{x,y,z,H}, '// & - 'TenN, CurvN, BendMomN, StfMomN, TorqN, TwistN, Twist, '// & + 'TenN, CurvN, CurvXN, CurvYN, BendMomN, StfMomN, '// & + 'TorqN, TwistN, Twist, '// & 'LNp{x,y,z}, LNv{x,y,z}, LNa{x,y,z}, LNDec, LNAzi, '// & 'TDP{s,x,y,z,Lay,Exc,Grd}, or the Body/Rod channels)'); RETURN END IF @@ -33165,6 +33191,8 @@ SUBROUTINE parse_line_node_channel(ch, line_id, node_id, kind, comp) !! Parse supported line-node output channels (kind codes shared with the writers): !! TenN -> kind=3, comp=0 nodal tension [N] !! CurvN -> kind=5, comp=0 curvature [1/m] + !! CurvXN -> kind=13, comp=0 curvature on section axis x [1/m] + !! CurvYN -> kind=14, comp=0 curvature on section axis y [1/m] !! BendMomN -> kind=6, comp=0 cable bend moment [N.m] !! StfMomN -> kind=12, comp=0 stiffener moment [N.m] !! LNp{x,y,z} -> kind=1, comp=1..3 position [m] @@ -33211,6 +33239,10 @@ SUBROUTINE parse_line_node_channel(ch, line_id, node_id, kind, comp) CALL parse_keyword_line_node(lo, 3, last, line_id, node_id) IF (line_id > 0 .AND. node_id > 0) kind = 3 RETURN + ELSE IF (starts_with(lo, 'curvx') .OR. starts_with(lo, 'curvy')) THEN + CALL parse_keyword_line_node(lo, 5, last, line_id, node_id) + IF (line_id > 0 .AND. node_id > 0) kind = MERGE(13, 14, lo(5:5) == 'x') + RETURN ELSE IF (starts_with(lo, 'curv')) THEN CALL parse_keyword_line_node(lo, 4, last, line_id, node_id) IF (line_id > 0 .AND. node_id > 0) kind = 5 @@ -35034,6 +35066,15 @@ SUBROUTINE eval_cable_channel(cable, ch, val, ErrStat, ErrMsg, mesh_node) IF (es /= CD_HCABLE_OK) THEN CALL fail_solve(ErrStat, ErrMsg, 'OUTPUT "'//TRIM(ch)//'": '//TRIM(em)); RETURN END IF + CASE (13, 14) ! the curvature vector on the section axes x, y (CD_HFMF_Section_Curvature) + BLOCK + REAL(wp) :: kxa(cable%line%nn), kya(cable%line%nn) + CALL CD_HFMF_Section_Curvature(cable, kxa, kya, es, em) + IF (es /= CD_HFMF_OK) THEN + CALL fail_solve(ErrStat, ErrMsg, 'OUTPUT "'//TRIM(ch)//'": '//TRIM(em)); RETURN + END IF + val = MERGE(kxa(inode), kya(inode), kind == 13) + END BLOCK CASE (9, 10, 11) ! condensed torsion: torque [N m], twist from End A to node J, total twist [deg] BLOCK REAL(wp) :: th, mt @@ -35408,7 +35449,7 @@ FUNCTION CD_Channel_Unit(ch) RESULT(unit) CALL parse_line_node_channel(ch, line_id, node, kind, comp) SELECT CASE (kind) CASE (3); unit = '(N)' - CASE (5); unit = '(1/m)' + CASE (5, 13, 14); unit = '(1/m)' CASE (6, 12); unit = '(N.m)' CASE (7, 8); unit = '(deg)' CASE (9); unit = '(N.m)' diff --git a/src/CableDyn_HermiteCable.f90 b/src/CableDyn_HermiteCable.f90 index 2dea8258..ea7cef97 100644 --- a/src/CableDyn_HermiteCable.f90 +++ b/src/CableDyn_HermiteCable.f90 @@ -444,18 +444,22 @@ SUBROUTINE CD_HermiteCable_Mass(rho_a, L, M, ErrStat, ErrMsg) END DO END SUBROUTINE CD_HermiteCable_Mass - SUBROUTINE CD_HermiteCable_Curvature(qr, L, u, curvature, ErrStat, ErrMsg) - !! Parametrisation-invariant centreline curvature at station u in [0,1] for output. + SUBROUTINE CD_HermiteCable_Curvature(qr, L, u, curvature, ErrStat, ErrMsg, kvec) + !! Parametrisation-invariant centreline curvature at station u in [0,1] for output. kvec, when + !! asked for, is the curvature vector kappa n, toward the centre of curvature: + !! (r' x r'') x r'/|r'|^4, whose length is the curvature. REAL(wp), INTENT(IN) :: qr(12), L, u REAL(wp), INTENT(OUT) :: curvature INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg + REAL(wp), INTENT(OUT), OPTIONAL :: kvec(3) REAL(wp) :: H(4), dH(4), ddH(4), rp(3), rpp(3), cr(3), sp INTEGER :: k ErrStat = CD_HCABLE_OK ErrMsg = '' curvature = CD_ZERO + IF (PRESENT(kvec)) kvec = CD_ZERO IF (.NOT. CD_All_Finite(qr) .OR. .NOT. CD_Is_Finite(L) .OR. .NOT. CD_Is_Finite(u)) THEN ErrStat = CD_HCABLE_BADINPUT; ErrMsg = 'CD_HermiteCable_Curvature: inputs must be finite'; RETURN END IF @@ -473,6 +477,7 @@ SUBROUTINE CD_HermiteCable_Curvature(qr, L, u, curvature, ErrStat, ErrMsg) END IF cr = [rp(2)*rpp(3) - rp(3)*rpp(2), rp(3)*rpp(1) - rp(1)*rpp(3), rp(1)*rpp(2) - rp(2)*rpp(1)] curvature = SQRT(cr(1)**2 + cr(2)**2 + cr(3)**2)/sp**3 + IF (PRESENT(kvec)) kvec = [cr(2)*rp(3) - cr(3)*rp(2), cr(3)*rp(1) - cr(1)*rp(3), cr(1)*rp(2) - cr(2)*rp(1)]/sp**4 END SUBROUTINE CD_HermiteCable_Curvature SUBROUTINE CD_HermiteCable_Peak_Curvature(qr, L, curvature_peak, u_peak, ErrStat, ErrMsg) diff --git a/src/CableDyn_HermiteCableDynamic.f90 b/src/CableDyn_HermiteCableDynamic.f90 index b303cb3d..b0a5d1da 100644 --- a/src/CableDyn_HermiteCableDynamic.f90 +++ b/src/CableDyn_HermiteCableDynamic.f90 @@ -128,6 +128,7 @@ MODULE CableDyn_HermiteCableDynamic PUBLIC :: CD_HermiteCable_Dyn_Restore PUBLIC :: CD_HermiteCable_Dyn_Energy PUBLIC :: CD_HermiteCable_Dyn_Curvature + PUBLIC :: CD_HermiteCable_Dyn_Section_Curvature PUBLIC :: CD_HermiteCable_Dyn_Reaction PUBLIC :: CD_HermiteCable_Dyn_Curvature_Exact PUBLIC :: CD_HermiteCable_Dyn_Set_Output_Recovery @@ -5542,6 +5543,145 @@ SUBROUTINE CD_HermiteCable_Dyn_Curvature_Exact(model, curv_out, ErrStat, ErrMsg) END DO END SUBROUTINE CD_HermiteCable_Dyn_Curvature_Exact + SUBROUTINE CD_HermiteCable_Dyn_Section_Curvature(model, ref_a, kx, ky, ErrStat, ErrMsg, frame) + !! The two components of the nodal curvature vector on the cross-section axes (the channels + !! CurvXN, CurvYN), in internal node order (node nn is End A). The curvature + !! vector kappa n points to the centre of curvature and its length is the curvature of + !! CD_HermiteCable_Dyn_Curvature: the recovered section moment over EI on the side that + !! gives it (CD_HermiteCable_Dyn_Node_Recovery), or the larger exact one-sided trace under + !! element output recovery. + !! + !! The section axes: d1 at End A is the reference normal -- the End A torsion normal on a + !! line restrained in torsion, else ref_a (solve frame) -- made normal to the End A tangent. + !! It is carried to every node by parallel transport along the centreline, NSUB smallest + !! rotations per element between the Hermite tangents, and on a line in torsion turned + !! about the tangent by the twist from End A: the torque times the End A compliance plus + !! l0/GJ summed from End A, right-handed about the End A -> End B tangent t. d2 = t x d1, + !! kx = kappa n . d1 and ky = kappa n . d2; frame(:, j), when asked for, is d1 at node j. + !! Read-only. + TYPE(CD_HermiteCableDynType), INTENT(IN) :: model + REAL(wp), INTENT(IN) :: ref_a(3) + REAL(wp), INTENT(OUT) :: kx(:), ky(:) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + REAL(wp), INTENT(OUT), OPTIONAL :: frame(:, :) + INTEGER, PARAMETER :: NSUB = 8 + REAL(wp) :: kvec(3, model%nn), qe(12), kv(3), kl, kr, d1(3), d(3), t(3), tp(3), tq(3), H(4), dH(4) + REAL(wp) :: r(3), rn, th, mt, comp, phi + INTEGER :: a, e, k, es + CHARACTER(1024) :: em2 + + ErrStat = CD_HCDYN_OK; ErrMsg = '' + kx = CD_ZERO + ky = CD_ZERO + IF (.NOT. model%initialized) THEN + ErrStat = CD_HCDYN_BADINPUT; ErrMsg = 'CD_HermiteCable_Dyn_Section_Curvature: model not initialised'; RETURN + END IF + IF (SIZE(kx) /= model%nn .OR. SIZE(ky) /= model%nn) THEN + ErrStat = CD_HCDYN_BADINPUT; ErrMsg = 'CD_HermiteCable_Dyn_Section_Curvature: kx, ky must be nn'; RETURN + END IF + IF (PRESENT(frame)) THEN + IF (SIZE(frame, 1) /= 3 .OR. SIZE(frame, 2) /= model%nn) THEN + ErrStat = CD_HCDYN_BADINPUT; ErrMsg = 'CD_HermiteCable_Dyn_Section_Curvature: frame must be (3, nn)'; RETURN + END IF + frame = CD_ZERO + END IF + IF (model%output_element_recovery) THEN + ! the larger exact one-sided trace and its vector (CD_HermiteCable_Dyn_Curvature_Exact) + DO a = 1, model%nn + kvec(:, a) = CD_ZERO + kl = -CD_ONE + IF (a <= model%ne) THEN + CALL gather_elem(model, a, qe) + CALL CD_HermiteCable_Curvature(qe, model%l0(a), CD_ZERO, kr, es, em2, kvec=kv) + IF (es /= CD_HCABLE_OK) THEN + ErrStat = CD_HCDYN_NOCONVERGE; ErrMsg = 'CD_HermiteCable_Dyn_Section_Curvature: '//TRIM(em2); RETURN + END IF + kvec(:, a) = kv + kl = kr + END IF + IF (a >= 2) THEN + CALL gather_elem(model, a - 1, qe) + CALL CD_HermiteCable_Curvature(qe, model%l0(a - 1), CD_ONE, kr, es, em2, kvec=kv) + IF (es /= CD_HCABLE_OK) THEN + ErrStat = CD_HCDYN_NOCONVERGE; ErrMsg = 'CD_HermiteCable_Dyn_Section_Curvature: '//TRIM(em2); RETURN + END IF + IF (kr > kl) kvec(:, a) = kv + END IF + END DO + ELSE + CALL CD_HermiteCable_Dyn_Node_Recovery(model, ErrStat, ErrMsg, curvature_vector=kvec) + IF (ErrStat /= CD_HCDYN_OK) RETURN + END IF + ! d1 at End A, normal to the End A -> End B tangent there + IF (model%torsion%active) THEN + r = model%torsion%ends(:, 4) + ELSE + r = ref_a + END IF + t = -unit_tangent(model, model%nn) + d1 = r - DOT_PRODUCT(r, t)*t + rn = NORM2(d1) + IF (.NOT. rn > 1.0e-6_wp*MAX(NORM2(r), TINY(CD_ONE))) THEN + ErrStat = CD_HCDYN_BADINPUT + ErrMsg = 'CD_HermiteCable_Dyn_Section_Curvature: the section reference lies along the End A tangent'; RETURN + END IF + d1 = d1/rn + mt = CD_ZERO + comp = CD_ZERO + IF (model%torsion%active) THEN + CALL CD_HermiteCable_Dyn_Torsion_State(model, th, mt, ErrStat, ErrMsg) + IF (ErrStat /= CD_HCDYN_OK) RETURN + comp = model%torsion%end_compliance(2) + END IF + DO a = model%nn, 1, -1 + IF (a < model%nn) THEN + ! carry d1 from node a + 1 to node a along element a (xi from 1 to 0) + e = a + CALL gather_elem(model, e, qe) + tp = t + DO k = NSUB - 1, 0, -1 + CALL CD_HermiteCable_Shapes(REAL(k, wp)/REAL(NSUB, wp), model%l0(e), H, dH) + tq = -(dH(1)*qe(1:3) + dH(2)*qe(4:6) + dH(3)*qe(7:9) + dH(4)*qe(10:12)) + rn = NORM2(tq) + IF (.NOT. rn > CD_ZERO) THEN + ErrStat = CD_HCDYN_NOCONVERGE + ErrMsg = 'CD_HermiteCable_Dyn_Section_Curvature: degenerate centreline tangent'; RETURN + END IF + tq = tq/rn + d1 = rotate_onto(tp, tq, d1) + tp = tq + END DO + t = -unit_tangent(model, a) + d1 = d1 - DOT_PRODUCT(d1, t)*t + d1 = d1/NORM2(d1) + IF (model%torsion%active) comp = comp + model%l0(e)/model%torsion%gj(e) + END IF + phi = mt*comp + d = COS(phi)*d1 + SIN(phi)*cross3_local(t, d1) + IF (PRESENT(frame)) frame(:, a) = d + kx(a) = DOT_PRODUCT(kvec(:, a), d) + ky(a) = DOT_PRODUCT(kvec(:, a), cross3_local(t, d)) + END DO + + CONTAINS + + PURE FUNCTION rotate_onto(u, w, v) RESULT(rv) + !! The smallest rotation taking unit u to unit w, applied to v. + REAL(wp), INTENT(IN) :: u(3), w(3), v(3) + REAL(wp) :: rv(3), c, x(3) + c = DOT_PRODUCT(u, w) + x = cross3_local(u, w) + rv = c*v + cross3_local(x, v) + x*DOT_PRODUCT(x, v)/(CD_ONE + c) + END FUNCTION rotate_onto + + PURE FUNCTION cross3_local(u, w) RESULT(x) + REAL(wp), INTENT(IN) :: u(3), w(3) + REAL(wp) :: x(3) + x = [u(2)*w(3) - u(3)*w(2), u(3)*w(1) - u(1)*w(3), u(1)*w(2) - u(2)*w(1)] + END FUNCTION cross3_local + END SUBROUTINE CD_HermiteCable_Dyn_Section_Curvature + SUBROUTINE CD_HermiteCable_Dyn_Reaction(model, node, freac, ErrStat, ErrMsg, full_assembly) !! Constraint reaction at a fixed/prescribed node: the force the LINE exerts ON its !! support (fairlead/anchor) at the current committed state, in global coordinates. @@ -5962,7 +6102,7 @@ END SUBROUTINE cached_end_residual END SUBROUTINE CD_HermiteCable_Dyn_Node_Values SUBROUTINE CD_HermiteCable_Dyn_Node_Recovery(model, ErrStat, ErrMsg, tension, curvature, bend_moment, & - segment_tension) + segment_tension, curvature_vector) !! Effective tension, curvature and bend moment at every node (internal order) recovered !! from nodal equilibrium, in one pass over the elements. !! @@ -5986,8 +6126,11 @@ SUBROUTINE CD_HermiteCable_Dyn_Node_Recovery(model, ErrStat, ErrMsg, tension, cu !! exact geometric trace on an element without bending stiffness, or with EI below ei_resolve, !! where the recovered moment error w L0^2/12 exceeds the elastic moment of a 1 m bend radius). !! segment_tension(e) is the - !! mean of the axial components of element e's own two end forces. Every output is - !! optional (node arrays nn, segment_tension ne); the routine allocates nothing. + !! mean of the axial components of element e's own two end forces. curvature_vector(:, j) + !! is the curvature vector kappa n of node j in the solve frame, toward the centre of + !! curvature, of length curvature(j): the section moment vector over EI on the side that + !! gives curvature(j), or the exact trace's vector. Every output is optional (node arrays nn, + !! curvature_vector (3, nn), segment_tension ne); the routine allocates nothing. !! !! The condensed torque of a line restrained in torsion is not part of g_e: it adds a shear !! normal to the tangent and does no work on bending rotations, so tension and bend moment @@ -5996,6 +6139,7 @@ SUBROUTINE CD_HermiteCable_Dyn_Node_Recovery(model, ErrStat, ErrMsg, tension, cu INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg REAL(wp), INTENT(OUT), OPTIONAL :: tension(:), curvature(:), bend_moment(:), segment_tension(:) + REAL(wp), INTENT(OUT), OPTIONAL :: curvature_vector(:, :) REAL(wp) :: g(12), fm(3), mm(3), fp(3), mp(3), ta(3), tb(3) INTEGER :: e, nn LOGICAL :: want_nodes @@ -6010,7 +6154,13 @@ SUBROUTINE CD_HermiteCable_Dyn_Node_Recovery(model, ErrStat, ErrMsg, tension, cu ErrStat = CD_HCDYN_BADINPUT ErrMsg = 'CD_HermiteCable_Dyn_Node_Recovery: node arrays must be nn, segment_tension ne'; RETURN END IF - want_nodes = PRESENT(tension) .OR. PRESENT(curvature) .OR. PRESENT(bend_moment) + IF (PRESENT(curvature_vector)) THEN + IF (SIZE(curvature_vector, 1) /= 3 .OR. SIZE(curvature_vector, 2) /= nn) THEN + ErrStat = CD_HCDYN_BADINPUT + ErrMsg = 'CD_HermiteCable_Dyn_Node_Recovery: curvature_vector must be (3, nn)'; RETURN + END IF + END IF + want_nodes = PRESENT(tension) .OR. PRESENT(curvature) .OR. PRESENT(bend_moment) .OR. PRESENT(curvature_vector) fm = CD_ZERO; mm = CD_ZERO DO e = 1, model%ne CALL element_end_residual(model, e, g, ErrStat, ErrMsg) @@ -6034,8 +6184,9 @@ SUBROUTINE CD_HermiteCable_Dyn_Node_Recovery(model, ErrStat, ErrMsg, tension, cu SUBROUTINE store_node(node) INTEGER, INTENT(IN) :: node - REAL(wp) :: t_n, k_n, b_n - CALL node_values(model, node, fm, mm, fp, mp, t_n, k_n, b_n, ErrStat, ErrMsg) + REAL(wp) :: t_n, k_n, b_n, kv(3) + CALL node_values(model, node, fm, mm, fp, mp, t_n, k_n, b_n, ErrStat, ErrMsg, curvature_vector=kv) + IF (PRESENT(curvature_vector)) curvature_vector(:, node) = kv IF (PRESENT(tension)) tension(node) = t_n IF (PRESENT(curvature)) curvature(node) = k_n IF (PRESENT(bend_moment)) bend_moment(node) = b_n @@ -6050,20 +6201,22 @@ END FUNCTION size_ok END SUBROUTINE CD_HermiteCable_Dyn_Node_Recovery SUBROUTINE node_values(model, node, fm, mm, fp, mp, tension, curvature, bend_moment, ErrStat, ErrMsg, & - sleeve_moment) + sleeve_moment, curvature_vector) !! Node values from the one-sided section force and moment before (fm, mm) and after !! (fp, mp) the node; a line end uses its only side (see CD_HermiteCable_Dyn_Node_Recovery). !! bend_moment is the cable's own share of the section moment, EI_line kappa on the side of !! the larger value (the whole section moment on a side without a bend stiffener), and - !! sleeve_moment the rest, the share a stiffener sleeve carries. + !! sleeve_moment the rest, the share a stiffener sleeve carries. curvature_vector is the + !! curvature vector kappa n (solve frame, toward the centre of curvature) of the side that + !! gives curvature: the normal part of the section moment over EI, or the exact trace's. TYPE(CD_HermiteCableDynType), INTENT(IN) :: model INTEGER, INTENT(IN) :: node REAL(wp), INTENT(IN) :: fm(3), mm(3), fp(3), mp(3) REAL(wp), INTENT(OUT) :: tension, curvature, bend_moment INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg - REAL(wp), INTENT(OUT), OPTIONAL :: sleeve_moment - REAL(wp) :: t(3), f(3), m(3), fend(3), qe(12), trace, section_moment, cable_moment + REAL(wp), INTENT(OUT), OPTIONAL :: sleeve_moment, curvature_vector(3) + REAL(wp) :: t(3), f(3), m(3), fend(3), qe(12), trace, section_moment, cable_moment, m_perp(3), kv(3) INTEGER :: e, side CHARACTER(200) :: em2 @@ -6083,13 +6236,17 @@ SUBROUTINE node_values(model, node, fm, mm, fp, mp, tension, curvature, bend_mom ELSE tension = DOT_PRODUCT(t, f) END IF - section_moment = NORM2(m - DOT_PRODUCT(m, t)*t) + m_perp = m - DOT_PRODUCT(m, t)*t + section_moment = NORM2(m_perp) curvature = CD_ZERO cable_moment = CD_ZERO + IF (PRESENT(curvature_vector)) curvature_vector = CD_ZERO DO side = 0, 1 e = node - 1 + side IF (e < 1 .OR. e > model%ne) CYCLE IF (model%EI(e) > CD_ZERO .AND. model%EI(e) >= model%ei_resolve) THEN + IF (PRESENT(curvature_vector) .AND. section_moment/model%EI(e) > curvature) & + curvature_vector = m_perp/model%EI(e) curvature = MAX(curvature, section_moment/model%EI(e)) IF (model%EI_line(e) == model%EI(e)) THEN cable_moment = MAX(cable_moment, section_moment) @@ -6098,10 +6255,11 @@ SUBROUTINE node_values(model, node, fm, mm, fp, mp, tension, curvature, bend_mom END IF ELSE CALL gather_elem(model, e, qe) - CALL CD_HermiteCable_Curvature(qe, model%l0(e), REAL(1 - side, wp), trace, ErrStat, em2) + CALL CD_HermiteCable_Curvature(qe, model%l0(e), REAL(1 - side, wp), trace, ErrStat, em2, kvec=kv) IF (ErrStat /= CD_HCABLE_OK) THEN ErrStat = CD_HCDYN_NOCONVERGE; ErrMsg = 'CD_HermiteCable_Dyn_Node_Recovery: '//TRIM(em2); RETURN END IF + IF (PRESENT(curvature_vector) .AND. trace > curvature) curvature_vector = kv curvature = MAX(curvature, trace) IF (model%EI_line(e) == model%EI(e)) THEN cable_moment = MAX(cable_moment, section_moment) diff --git a/src/CableDyn_OpenFAST_HermiteFMF.f90 b/src/CableDyn_OpenFAST_HermiteFMF.f90 index 5871b946..588d8f96 100644 --- a/src/CableDyn_OpenFAST_HermiteFMF.f90 +++ b/src/CableDyn_OpenFAST_HermiteFMF.f90 @@ -38,6 +38,7 @@ MODULE CableDyn_OpenFAST_HermiteFMF CD_HermiteCable_Dyn_Reaction, & CD_HermiteCable_Dyn_EndConnection_Moment, & CD_HermiteCable_Dyn_Curvature, CD_HermiteCable_Dyn_Curvature_Exact, & + CD_HermiteCable_Dyn_Section_Curvature, & CD_HermiteCable_Dyn_Snapshot, CD_HermiteCable_Dyn_Restore, & CD_HermiteCable_Dyn_End, CD_HCDYN_OK, & CD_HermiteCable_Dyn_Set_Torsion, CD_HermiteCable_Dyn_Set_Torsion_Drive, & @@ -81,6 +82,7 @@ MODULE CableDyn_OpenFAST_HermiteFMF PUBLIC :: CD_HFMF_GetCoupledKinematics PUBLIC :: CD_HFMF_CalcOutput PUBLIC :: CD_HFMF_Curvature, CD_HFMF_Curvature_Exact + PUBLIC :: CD_HFMF_Set_Section_Reference, CD_HFMF_Section_Curvature PUBLIC :: CD_HFMF_MinSpanZ PUBLIC :: CD_HFMF_MirrorSize PUBLIC :: CD_HFMF_FrictionMirrorSize @@ -145,6 +147,18 @@ MODULE CableDyn_OpenFAST_HermiteFMF ! total NumSegs of the deck sections, End A first), 0 if no mesh node lies there. Unallocated ! when the mesh is the deck mesh. The node output channels (TenN, ...) read deck nodes. INTEGER, ALLOCATABLE :: deck_node(:) + ! The cross-section reference of the CurvX/CurvY channels (CD_HFMF_Set_Section_Reference): + ! the static start's normal at End A in global axes and, for an End A connected to a parent, + ! in the parent's axes, so it turns with the parent. + LOGICAL :: has_sect_ref = .FALSE. + REAL(wp) :: sect_ref_global(3) = CD_ZERO + REAL(wp) :: sect_ref_parent(3) = CD_ZERO + ! the last CD_HFMF_Section_Curvature result and the state it was evaluated at (time, load + ! epoch, reference, q, v, a): the channels of one output row share one evaluation + LOGICAL :: sc_valid = .FALSE. + INTEGER :: sc_epoch = -1 + REAL(wp) :: sc_t = CD_ZERO, sc_ref(3) = CD_ZERO + REAL(wp), ALLOCATABLE :: sc_q(:), sc_v(:), sc_a(:), sc_kx(:), sc_ky(:) LOGICAL :: initialized = .FALSE. END TYPE CD_HFMF_ModuleType @@ -1432,6 +1446,94 @@ SUBROUTINE CD_HFMF_Curvature(self, curv_out, ErrStat, ErrMsg) END IF END SUBROUTINE CD_HFMF_Curvature + SUBROUTINE CD_HFMF_Set_Section_Reference(self, ErrStat, ErrMsg) + !! Freeze the cross-section reference of the CurvX/CurvY channels at the current (static) + !! state: the normal at End A of the End A -> End B tangent t nearest global +z, the section's + !! upper side (global +x where t is vertical). It is kept in global axes and, when End A is + !! connected to a parent (a clamped or finite-stiffness end connection), in the parent's axes, + !! in which it then turns with the parent. A line restrained in torsion takes its End A torsion + !! normal instead (CD_HermiteCable_Dyn_Section_Curvature). + TYPE(CD_HFMF_ModuleType), INTENT(INOUT) :: self + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + REAL(wp) :: t(3), r(3), up(3), tn + INTEGER :: nn + ErrStat = CD_HFMF_OK; ErrMsg = '' + IF (.NOT. self%initialized) THEN + ErrStat = CD_HFMF_BADINPUT; ErrMsg = 'CD_HFMF_Set_Section_Reference: module not initialised'; RETURN + END IF + nn = self%line%nn + ! End A is the last internal node; its internal tangent points away from End B + t = -frame_to_global(self, self%line%q(6*(nn - 1) + 4:6*(nn - 1) + 6)) + tn = NORM2(t) + IF (.NOT. tn > CD_ZERO) THEN + ErrStat = CD_HFMF_BADINPUT; ErrMsg = 'CD_HFMF_Set_Section_Reference: degenerate End A tangent'; RETURN + END IF + t = t/tn + up = [CD_ZERO, CD_ZERO, CD_ONE] + IF (ABS(t(3)) > CD_ONE - 1.0e-6_wp) up = [CD_ONE, CD_ZERO, CD_ZERO] + r = up - DOT_PRODUCT(up, t)*t + r = r/NORM2(r) + self%sect_ref_global = r + self%sect_ref_parent = MATMUL(self%parent_dcm, r) + self%has_sect_ref = .TRUE. + self%sc_valid = .FALSE. + END SUBROUTINE CD_HFMF_Set_Section_Reference + + SUBROUTINE CD_HFMF_Section_Curvature(self, kx, ky, ErrStat, ErrMsg) + !! The CurvX/CurvY channels of every node (internal order): the curvature vector on the + !! cross-section axes (CD_HermiteCable_Dyn_Section_Curvature), with the reference of + !! CD_HFMF_Set_Section_Reference, turned with the parent when End A is connected to one. + TYPE(CD_HFMF_ModuleType), INTENT(INOUT) :: self + REAL(wp), INTENT(OUT) :: kx(:), ky(:) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + REAL(wp) :: r(3) + INTEGER :: es, nn + CHARACTER(1024) :: em + ErrStat = CD_HFMF_OK; ErrMsg = '' + kx = CD_ZERO + ky = CD_ZERO + IF (.NOT. (self%initialized .AND. self%has_sect_ref)) THEN + ErrStat = CD_HFMF_BADINPUT + ErrMsg = 'CD_HFMF_Section_Curvature: module not initialised or without a section reference'; RETURN + END IF + nn = self%line%nn + IF (SIZE(kx) /= nn .OR. SIZE(ky) /= nn) THEN + ErrStat = CD_HFMF_BADINPUT; ErrMsg = 'CD_HFMF_Section_Curvature: kx, ky must be nn'; RETURN + END IF + IF (self%has_parent_endconn) THEN + r = MATMUL(TRANSPOSE(self%parent_dcm), self%sect_ref_parent) + ELSE + r = self%sect_ref_global + END IF + r = frame_to_local(self, r) + IF (self%sc_valid .AND. self%sc_epoch == self%line%rc_epoch) THEN + ! exact equality (a NaN never matches) + IF (ALL(ABS(self%sc_ref - r) <= CD_ZERO) .AND. ABS(self%sc_t - self%line%t) <= CD_ZERO .AND. & + ALL(ABS(self%sc_q - self%line%q) <= CD_ZERO) .AND. ALL(ABS(self%sc_v - self%line%v) <= CD_ZERO) .AND. & + ALL(ABS(self%sc_a - self%line%a) <= CD_ZERO)) THEN + kx = self%sc_kx + ky = self%sc_ky + RETURN + END IF + END IF + self%sc_valid = .FALSE. + CALL CD_HermiteCable_Dyn_Section_Curvature(self%line, r, kx, ky, es, em) + IF (es /= CD_HCDYN_OK) THEN + ErrStat = CD_HFMF_BADINPUT; ErrMsg = 'CD_HFMF_Section_Curvature: '//TRIM(em); RETURN + END IF + self%sc_ref = r + self%sc_t = self%line%t + self%sc_epoch = self%line%rc_epoch + self%sc_q = self%line%q + self%sc_v = self%line%v + self%sc_a = self%line%a + self%sc_kx = kx + self%sc_ky = ky + self%sc_valid = .TRUE. + END SUBROUTINE CD_HFMF_Section_Curvature + SUBROUTINE CD_HFMF_Curvature_Exact(self, curv_out, ErrStat, ErrMsg) !! Nodal geometric curvature of the cubic-Hermite centreline at the current state, the larger !! one-sided trace at an interior node (CD_HermiteCable_Dyn_Curvature_Exact). @@ -1827,6 +1929,11 @@ SUBROUTINE CD_HFMF_End(self) self%snap_parent_dcm = identity_dcm() self%snap_parent_omega = CD_ZERO self%snap_parent_alpha = CD_ZERO + self%has_sect_ref = .FALSE. + self%sect_ref_global = CD_ZERO + self%sect_ref_parent = CD_ZERO + self%sc_valid = .FALSE. + IF (ALLOCATED(self%sc_q)) DEALLOCATE (self%sc_q, self%sc_v, self%sc_a, self%sc_kx, self%sc_ky) self%tors_parent = .FALSE. self%tors_index = 0 self%tors_frame_parent = CD_ZERO diff --git a/tests/test_section_curvature.f90 b/tests/test_section_curvature.f90 new file mode 100644 index 00000000..3db48387 --- /dev/null +++ b/tests/test_section_curvature.f90 @@ -0,0 +1,290 @@ +! File: tests/test_section_curvature.f90 +! SPDX-License-Identifier: Apache-2.0 +! Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +PROGRAM test_section_curvature + !! The section-frame curvature components (CurvXN, CurvYN) of a lazy-wave cable at + !! its static start (CD_HFMF_Section_Curvature): + !! 1. on a planar line (End A clamped, no current) the curvature lies on the section axis x + !! (CurvY is zero) and sqrt(CurvX^2 + CurvY^2) is CurvN; + !! 2. in a cross current the line leaves its plane, both components appear and their norm is + !! still the curvature; + !! 3. the same deck turned 30 degrees about the vertical gives the same components (the + !! section frame turns with the line); + !! 4. turning the hang-off 30 degrees about the End A tangent turns the section axes with it + !! (End A clamped): the components rotate by -30 degrees at every node; + !! 5. on a line restrained in torsion with a 90 degree pretwist at End B, the section axis x + !! leaves End A on its torsion normal Nx and reaches End B turned 90 degrees about the + !! tangent, onto End B's own pretwisted normal. + USE CableDyn_Precision, ONLY: wp + USE CableDyn_DeckDriver, ONLY: CD_Init_Deck_HermiteCable, CD_Run_Deck_Driver, CD_DECKDRV_OK + USE CableDyn_OpenFAST_HermiteFMF, ONLY: CD_HFMF_ModuleType, CD_HFMF_Curvature, CD_HFMF_Section_Curvature, & + CD_HFMF_End, CD_HFMF_OK + USE CableDyn_HermiteCableDynamic, ONLY: CD_HermiteCable_Dyn_Section_Curvature, CD_HCDYN_OK + IMPLICIT NONE + + REAL(wp), PARAMETER :: PI = 3.14159265358979323846_wp + ! the nodes 1, 9, ..., 129 the driver cases write (End A to End B) + INTEGER, PARAMETER :: NSAMPLE = 17 + INTEGER :: nfail = 0 + REAL(wp), ALLOCATABLE :: k1(:), x1(:), y1(:), k2(:), x2(:), y2(:), k3(:), x3(:), y3(:) + + ! 1. planar + CALL static_components('sc_planar.dat', 0.0_wp, [0.0_wp, 0.0_wp, 0.0_wp], .FALSE., 0.0_wp, k1, x1, y1) + IF (ALLOCATED(k1)) THEN + CALL require(MAXVAL(ABS(y1)) <= 1.0e-9_wp*MAXVAL(k1), 'planar line: CurvY is zero') + CALL require(MAXVAL(ABS(SQRT(x1**2 + y1**2) - k1)) <= 1.0e-10_wp*MAXVAL(k1), & + 'planar line: sqrt(CurvX^2 + CurvY^2) = Curv') + END IF + ! 2. cross current (the standalone driver: the single-cable entry takes no deck current) + CALL driver_components('sc_cross', 0.0_wp, [0.0_wp, 0.4_wp, 0.0_wp], k2, x2, y2) + IF (ALLOCATED(k2)) THEN + CALL require(MAXVAL(ABS(y2)) > 1.0e-3_wp*MAXVAL(k2), 'cross current: the line bends out of its plane') + ! the driver prints eight significant digits + CALL require(MAXVAL(ABS(SQRT(x2**2 + y2**2) - k2)) <= 1.0e-7_wp*MAXVAL(k2), & + 'cross current: sqrt(CurvX^2 + CurvY^2) = Curv') + END IF + ! 3. the cross-current deck turned 30 degrees about the vertical + CALL driver_components('sc_turned', 30.0_wp, [0.0_wp, 0.4_wp, 0.0_wp], k3, x3, y3) + IF (ALLOCATED(k2) .AND. ALLOCATED(k3)) THEN + WRITE (*, '(A,2ES10.3)') 'turned deck: largest CurvX, CurvY change / largest curvature ', & + MAXVAL(ABS(x3 - x2))/MAXVAL(k2), MAXVAL(ABS(y3 - y2))/MAXVAL(k2) + CALL require(MAXVAL(ABS(x3 - x2)) <= 1.0e-6_wp*MAXVAL(k2) .AND. MAXVAL(ABS(y3 - y2)) <= 1.0e-6_wp*MAXVAL(k2), & + 'the components do not depend on the heading of the line') + END IF + ! 4. the hang-off turned about its tangent + CALL parent_roll() + ! 5. torsion + CALL torsion_frame() + + IF (nfail > 0) THEN + WRITE (*, '(A,I0,A)') 'FAIL: ', nfail, ' assertion(s) failed' + ERROR STOP 1 + END IF + WRITE (*, '(A)') 'PASS: section-frame curvature components' + +CONTAINS + + SUBROUTINE static_components(path, heading_deg, current, torsion, pretwist_b, k, kx, ky) + !! Build the deck (write_deck) and return Curv, CurvX and CurvY of every node (internal order). + CHARACTER(*), INTENT(IN) :: path + REAL(wp), INTENT(IN) :: heading_deg, current(3), pretwist_b + LOGICAL, INTENT(IN) :: torsion + REAL(wp), ALLOCATABLE, INTENT(OUT) :: k(:), kx(:), ky(:) + TYPE(CD_HFMF_ModuleType) :: cable + INTEGER :: es, cn, nn + CHARACTER(1024) :: em + CALL write_deck(path, heading_deg, current, torsion, pretwist_b) + CALL CD_Init_Deck_HermiteCable(path, 0.1_wp, cable, cn, es, em, host_orientation=.TRUE.) + CALL require(es == CD_DECKDRV_OK, TRIM(path)//': build: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + nn = cable%line%nn + ALLOCATE (k(nn), kx(nn), ky(nn)) + CALL CD_HFMF_Curvature(cable, k, es, em) + CALL require(es == CD_HFMF_OK, TRIM(path)//': curvature: '//TRIM(em)) + CALL CD_HFMF_Section_Curvature(cable, kx, ky, es, em) + CALL require(es == CD_HFMF_OK, TRIM(path)//': section curvature: '//TRIM(em)) + CALL CD_HFMF_End(cable) + END SUBROUTINE static_components + + SUBROUTINE driver_components(root, heading_deg, current, k, kx, ky) + !! Curv, CurvX and CurvY of every eighth node at t = 0 (TMax = 0) from the standalone driver. + CHARACTER(*), INTENT(IN) :: root + REAL(wp), INTENT(IN) :: heading_deg, current(3) + REAL(wp), ALLOCATABLE, INTENT(OUT) :: k(:), kx(:), ky(:) + REAL(wp) :: row(1 + 3*NSAMPLE) + INTEGER :: es, u, ios, j + LOGICAL :: conv + CHARACTER(1024) :: em, line + CALL write_deck(root//'.dat', heading_deg, current, .FALSE., 0.0_wp, node_channels=.TRUE.) + CALL CD_Run_Deck_Driver(root//'.dat', root, conv, es, em) + CALL require(es == CD_DECKDRV_OK .AND. conv, root//': run: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + OPEN (NEWUNIT=u, FILE=root//'.out', STATUS='OLD', ACTION='READ') + DO + READ (u, '(A)', IOSTAT=ios) line + IF (ios /= 0) EXIT + IF (INDEX(line, 'Time') == 1) EXIT + END DO + READ (u, *, IOSTAT=ios) row + CLOSE (u) + CALL require(ios == 0, root//': read the t = 0 row') + IF (ios /= 0) RETURN + ALLOCATE (k(NSAMPLE), kx(NSAMPLE), ky(NSAMPLE)) + DO j = 1, NSAMPLE + k(j) = row(1 + 3*j - 2) + kx(j) = row(1 + 3*j - 1) + ky(j) = row(1 + 3*j) + END DO + END SUBROUTINE driver_components + + SUBROUTINE parent_roll() + TYPE(CD_HFMF_ModuleType) :: cable + REAL(wp), ALLOCATABLE :: kx0(:), ky0(:), kx1(:), ky1(:) + REAL(wp) :: t(3), r(3, 3), ca, sa, kmax + INTEGER :: es, cn, nn, i, j + CHARACTER(1024) :: em + CALL write_deck('sc_roll.dat', 0.0_wp, [0.0_wp, 0.0_wp, 0.0_wp], .FALSE., 0.0_wp) + CALL CD_Init_Deck_HermiteCable('sc_roll.dat', 0.1_wp, cable, cn, es, em, host_orientation=.TRUE.) + CALL require(es == CD_DECKDRV_OK, 'roll: build: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + CALL require(cable%has_parent_endconn, 'roll: the clamped End A has a parent frame') + nn = cable%line%nn + ALLOCATE (kx0(nn), ky0(nn), kx1(nn), ky1(nn)) + CALL CD_HFMF_Section_Curvature(cable, kx0, ky0, es, em) + ! turn the parent 30 degrees about the End A -> End B tangent (global = solve frame here): + ! global-to-parent DCM P' = P R^T, R the rotation by +30 degrees about t + t = -cable%line%q(6*(nn - 1) + 4:6*(nn - 1) + 6) + t = t/NORM2(t) + ca = COS(PI/6.0_wp) + sa = SIN(PI/6.0_wp) + DO i = 1, 3 + DO j = 1, 3 + r(i, j) = ca*MERGE(1.0_wp, 0.0_wp, i == j) + (1.0_wp - ca)*t(i)*t(j) + END DO + END DO + r(1, 2) = r(1, 2) - sa*t(3); r(2, 1) = r(2, 1) + sa*t(3) + r(1, 3) = r(1, 3) + sa*t(2); r(3, 1) = r(3, 1) - sa*t(2) + r(2, 3) = r(2, 3) - sa*t(1); r(3, 2) = r(3, 2) + sa*t(1) + cable%parent_dcm = MATMUL(cable%parent_dcm, TRANSPOSE(r)) + CALL CD_HFMF_Section_Curvature(cable, kx1, ky1, es, em) + CALL require(es == CD_HFMF_OK, 'roll: section curvature: '//TRIM(em)) + kmax = MAXVAL(SQRT(kx0**2 + ky0**2)) + WRITE (*, '(A,ES10.3)') 'roll: largest departure from the axes turned by 30 degrees / largest curvature ', & + MAX(MAXVAL(ABS(kx1 - (ca*kx0 + sa*ky0))), MAXVAL(ABS(ky1 - (-sa*kx0 + ca*ky0))))/kmax + CALL require(MAXVAL(ABS(kx1 - (ca*kx0 + sa*ky0))) <= 1.0e-9_wp*kmax .AND. & + MAXVAL(ABS(ky1 - (-sa*kx0 + ca*ky0))) <= 1.0e-9_wp*kmax, & + 'roll: the section axes turn with the clamped hang-off') + CALL CD_HFMF_End(cable) + END SUBROUTINE parent_roll + + SUBROUTINE torsion_frame() + TYPE(CD_HFMF_ModuleType) :: cable + REAL(wp), ALLOCATABLE :: kx(:), ky(:), fr(:, :), k(:) + REAL(wp) :: tb(3), ny(3), expect(3), ang_a, ang_b + INTEGER :: es, cn, nn + CHARACTER(1024) :: em + CALL write_deck('sc_torsion.dat', 0.0_wp, [0.0_wp, 0.0_wp, 0.0_wp], .TRUE., 90.0_wp) + CALL CD_Init_Deck_HermiteCable('sc_torsion.dat', 0.1_wp, cable, cn, es, em, host_orientation=.TRUE.) + CALL require(es == CD_DECKDRV_OK, 'torsion: build: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + nn = cable%line%nn + ALLOCATE (kx(nn), ky(nn), fr(3, nn), k(nn)) + CALL CD_HermiteCable_Dyn_Section_Curvature(cable%line, [0.0_wp, 0.0_wp, 1.0_wp], kx, ky, es, em, frame=fr) + CALL require(es == CD_HCDYN_OK, 'torsion: section curvature: '//TRIM(em)) + CALL CD_HFMF_Curvature(cable, k, es, em) + CALL require(MAXVAL(ABS(SQRT(kx**2 + ky**2) - k)) <= 1.0e-10_wp*MAXVAL(k), & + 'torsion: sqrt(CurvX^2 + CurvY^2) = Curv') + ny = [0.0_wp, 1.0_wp, 0.0_wp] + ! End A (the last internal node) starts on its torsion normal Nx = +y + ang_a = ACOS(MAX(-1.0_wp, MIN(1.0_wp, DOT_PRODUCT(fr(:, nn), ny)))) + ! End B (internal node 1): Nx = +y turned 90 degrees about the End A -> End B tangent + tb = -cable%line%q(4:6)/NORM2(cable%line%q(4:6)) + expect = cross(tb, ny) + ang_b = ACOS(MAX(-1.0_wp, MIN(1.0_wp, DOT_PRODUCT(fr(:, 1), expect)))) + WRITE (*, '(A,2ES10.3,A)') 'torsion: section axis x off Nx at End A, off the pretwisted normal at End B ', & + ang_a, ang_b, ' rad' + CALL require(ang_a <= 1.0e-9_wp, 'torsion: the section axis x starts on End A''s Nx') + CALL require(ang_b <= 2.0e-3_wp, 'torsion: the section axis x arrives on End B''s pretwisted normal') + CALL CD_HFMF_End(cable) + END SUBROUTINE torsion_frame + + SUBROUTINE write_deck(path, heading_deg, current, torsion, pretwist_b, node_channels) + !! A 170 m lazy-wave cable from a hang-off at 14 m depth to an anchor at 80 m, clamped at End A, + !! turned by heading_deg about the vertical through the origin, in the uniform current + !! (given before the turn). torsion: both ends restrained in torsion, Nx along +y, Pretwist + !! pretwist_b at End B. + CHARACTER(*), INTENT(IN) :: path + REAL(wp), INTENT(IN) :: heading_deg, current(3), pretwist_b + LOGICAL, INTENT(IN) :: torsion + ! node_channels: write Curv, CurvX, CurvY of every eighth node, and run to TMax = 0 + LOGICAL, INTENT(IN), OPTIONAL :: node_channels + REAL(wp) :: c, s, pa(3), pb(3), eza(3), ezb(3), nx(3), cu(3) + INTEGER :: u, j + LOGICAL :: nodes + nodes = .FALSE. + IF (PRESENT(node_channels)) nodes = node_channels + c = COS(heading_deg*PI/180.0_wp) + s = SIN(heading_deg*PI/180.0_wp) + pa = turn(c, s, [5.0_wp, 0.0_wp, -14.0_wp]) + pb = turn(c, s, [125.0_wp, 0.0_wp, -80.0_wp]) + eza = turn(c, s, [0.14641_wp, 0.0_wp, -0.98922_wp]) + ezb = turn(c, s, [0.99999_wp, 0.0_wp, 0.00503_wp]) + nx = turn(c, s, [0.0_wp, 1.0_wp, 0.0_wp]) + cu = turn(c, s, current) + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') '--------------------- CableDyn Input File ------------------------------------' + WRITE (u, '(A)') 'section-frame curvature test cable' + WRITE (u, '(A)') '--------------------- LINE TYPES ---------------------------------------------' + WRITE (u, '(A)') 'TypeName Diam MassDenInAir EA BA EI GAs GJ Irt Irn '// & + 'Cd_n Cd_t Ca_n Ca_t' + WRITE (u, '(A)') '(-) (m) (kg/m) (N) (-) (N-m2) (N) (N-m2) (kg-m) (kg-m) '// & + '(-) (-) (-) (-)' + WRITE (u, '(A)') 'bare 0.160 36.70 4.69e8 0.0 1.99e4 9.02e7 5.0e4 0.0587 0.1174 '// & + '1.2 0.1 1.0 0.0' + WRITE (u, '(A)') 'buoy 0.290 59.53 4.69e8 0.0 1.99e4 9.02e7 5.0e4 0.3129 0.6258 '// & + '1.2 0.1 1.0 0.0' + WRITE (u, '(A)') '--------------------- POINTS ------------------------------------------------' + WRITE (u, '(A)') 'ID Type X Y Z' + WRITE (u, '(A)') '(-) (-) (m) (m) (m)' + WRITE (u, '(A,3F14.8)') '1 Coupled ', pa + WRITE (u, '(A,3F14.8)') '2 Fixed ', pb + WRITE (u, '(A)') '--------------------- LINES -------------------------------------------------' + WRITE (u, '(A)') 'ID NodeA NodeB Outputs' + WRITE (u, '(A)') '(-) (-) (-) (-)' + WRITE (u, '(A)') '1 1 2 -' + WRITE (u, '(A)') '--------------------- SECTIONS ----------------------------------------------' + WRITE (u, '(A)') 'LineID LineType Length NumSegs' + WRITE (u, '(A)') '(-) (-) (m) (-)' + WRITE (u, '(A)') '1 bare 68.114 56' + WRITE (u, '(A)') '1 buoy 50.000 40' + WRITE (u, '(A)') '1 bare 52.101 32' + WRITE (u, '(A)') '--------------------- END CONNECTIONS ---------------------------------------' + IF (torsion) THEN + WRITE (u, '(A)') 'LineID End Stiffness EzX EzY EzZ TorsStiffness NxX NxY NxZ Pretwist' + WRITE (u, '(A)') '(-) (-) (N-m/rad) (-) (-) (-) (N-m/rad) (-) (-) (-) (deg)' + WRITE (u, '(A,3F12.8,A,3F12.8,A)') '1 A Rigid ', eza, ' Rigid ', nx, ' 0.0' + WRITE (u, '(A,3F12.8,A,3F12.8,F8.2)') '1 B Rigid ', ezb, ' Rigid ', nx, pretwist_b + ELSE + WRITE (u, '(A)') 'LineID End Stiffness EzX EzY EzZ' + WRITE (u, '(A)') '(-) (-) (N-m/rad) (-) (-) (-)' + WRITE (u, '(A,3F12.8)') '1 A Rigid ', eza + END IF + WRITE (u, '(A)') '--------------------- OPTIONS -----------------------------------------------' + WRITE (u, '(A)') '80.0 WtrDpth' + WRITE (u, '(A)') '0.1 dtM' + WRITE (u, '(A)') MERGE('0.0 TMax', '1.0 TMax', nodes) + IF (NORM2(cu) > 0.0_wp) WRITE (u, '(A,3F12.8,A)') 'uniform ', cu, ' current' + WRITE (u, '(A)') '--------------------- OUTPUTS -----------------------------------------------' + IF (nodes) THEN + DO j = 1, NSAMPLE + WRITE (u, '(A,I0,A,I0,A,I0)') 'Curv1N', 8*j - 7, ' CurvX1N', 8*j - 7, ' CurvY1N', 8*j - 7 + END DO + ELSE + WRITE (u, '(A)') '"FairTen1"' + END IF + WRITE (u, '(A)') '--------------------- need this line ----------------------------------------' + CLOSE (u) + END SUBROUTINE write_deck + + PURE FUNCTION turn(c, s, v) RESULT(w) + !! v turned about the vertical by the angle of cosine c and sine s. + REAL(wp), INTENT(IN) :: c, s, v(3) + REAL(wp) :: w(3) + w = [c*v(1) - s*v(2), s*v(1) + c*v(2), v(3)] + END FUNCTION turn + + PURE FUNCTION cross(a, b) RESULT(c) + REAL(wp), INTENT(IN) :: a(3), b(3) + REAL(wp) :: c(3) + c = [a(2)*b(3) - a(3)*b(2), a(3)*b(1) - a(1)*b(3), a(1)*b(2) - a(2)*b(1)] + END FUNCTION cross + + SUBROUTINE require(cond, label) + LOGICAL, INTENT(IN) :: cond + CHARACTER(*), INTENT(IN) :: label + IF (.NOT. cond) THEN + WRITE (*, '(A,A)') 'MISMATCH: ', label + nfail = nfail + 1 + END IF + END SUBROUTINE require +END PROGRAM test_section_curvature From aa6a94a92cc382ffb4f6e232bbea47ad09c9b6cd Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 29 Oct 2026 10:45:00 +0900 Subject: [PATCH 2/4] fix(openfast): start a coupled run from the equilibrium in SeaState's current A coupled OpenFAST run solved its static start in still water and let the SeaState current act from t = 0, while a standalone deck starts in the equilibrium of its current OPTION. The twin user's lazy-wave cable then spent the first minutes of every coupled run drifting into the current, and those minutes were discarded. CD_Init_Deck_Aggregate (and CD_AGG_Init_From_Deck) take an optional static_current profile (z, ux, uy, uz by ascending z). With the host fluid field and the host current on, it goes into a copy of the options that only the static builders see: body and rod equilibrium, the EI = 0 system and its points, and the finite-EI cables. The dynamics take the host field alone (the EI = 0 models' fluid field is replaced, the cables' drag carries no deck current), so the current is not counted twice. A deck whose WaterKin CurrentMod 1 file gives its own profile keeps it. The OpenFAST shell builds the profile from SeaState's CurrMod 1 current at the levels of its vertical wave grid (CD_SeaState_Steady_Current) and passes it at the initialisation, the checkpoint rebuild and the linearization probes. CurrMod 2 and InflowWind currents keep the still-water start, with a note. On the mixed deck (EI = 0 chain and finite-EI cable) held in a 0.5 m/s current, the start in that current moves its loads by 2.3e-8 over 1 s, the still-water start by 4.8e-3. On the IEA-15 MW mixed example in a 0.5 m/s cross current the cable starts 29 m across at its deepest monitored node and moves less than 0.6 m in 30 s; from still water it has covered a third of that offset by then. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 7 ++ doc/openfast.rst | 14 +++- src/CableDyn_DeckDriver.f90 | 61 ++++++++++++---- src/CableDyn_OpenFAST_Aggregate.f90 | 8 ++- src/openfast/CableDyn_OF.f90 | 81 ++++++++++++++++++++- tests/test_openfast_aggregate.f90 | 105 ++++++++++++++++++++++++++++ 6 files changed, 257 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 422d3d38..ed9f1f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,13 @@ All notable changes to CableDyn are recorded in this file. The format follows 0.1 s drops from 18,000 components to 1,800. On the 300 s lazy-wave case both records then run in 72 s, and every output channel's standard deviation moves by at most 0.002 %. A record with no component at or below the cut-off is refused by name. +- Coupled OpenFAST runs start from the equilibrium in SeaState's steady current (`CurrMod 1`), + as standalone decks start in their `current` option, instead of from the still-water shape. + The current is evaluated at SeaState's vertical grid levels for the static solves only; the + dynamics take the SeaState field alone. On the IEA-15 MW mixed example in a 0.5 m/s cross + current, the lazy-wave cable starts 29 m across at its deepest monitored node and moves less + than 0.6 m over the first 30 s, where the still-water start has reached a third of that offset. + `CurrMod 2` and InflowWind currents keep the still-water start, with a note. - Under a bend stiffener, `BendMomN` (and the `BendMoment` columns of the static profile, range graphs and element file) report the cable's own moment, the line type's EI times the curvature; lines without stiffeners are unchanged. diff --git a/doc/openfast.rst b/doc/openfast.rst index e21b582e..6ddf88dd 100644 --- a/doc/openfast.rst +++ b/doc/openfast.rst @@ -129,6 +129,16 @@ WaterKin file can select file waves, a file depth-dependent current, host waves, current independently where the field is separable. Unsupported or double-counted combinations fail during initialisation. The selector matrix is in :doc:`options` and :doc:`driver_format`. +The static start includes the steady SeaState current. With ``CurrMod = 1`` and the host +current in use, CableDyn evaluates that current at the levels of SeaState's vertical wave grid +and solves the equilibrium of every line, cable, point and body in it. A run therefore starts +where a standalone deck with the same ``current`` starts, not from the still-water shape. The +profile is linear in depth between the grid levels, so the start agrees with the first step's +current at the levels and very nearly between them. The dynamics then take the SeaState field +alone, and the current is not counted twice. Waves act from t = 0. A ``CurrMod = 2`` current or +an InflowWind current field is known only through the run's samples: the start is then the +still-water equilibrium, and the console says so. + SeaState grid ~~~~~~~~~~~~~ @@ -213,8 +223,8 @@ Before trusting a run, confirm in the console: (``Note: line ...``, for example a folded ``EI = 0`` layout; see :doc:`troubleshooting`); #. ``Requested CableDyn OUTPUTS at t = 0 s``, the deck's channels in the first output row. With SeaState waves or current the header adds ``SeaState kinematics at t = 0``: the equilibrium is - solved before the kinematics act, so a line-end tension at t = 0 can differ slightly from the - equilibrium value above by the kinematic load on the end node. ``.CD.static.out`` holds + solved in the steady current before the waves act, so a line-end tension at t = 0 can differ + slightly from the equilibrium value above by the kinematic load on the end node. ``.CD.static.out`` holds the equilibrium; and #. ``OpenFAST terminated normally.`` diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index dfe17576..84d98509 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -6814,7 +6814,7 @@ END SUBROUTINE CD_Init_Deck_HermiteCable SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravity, env_rho_water, env_wtrdpth, & ptfm_init, external_fluid, coupled_positions, & n_turbines, turbine_ref_pos, farm_ptfm_init, forbid_deck_ambient, run_tmax, & - range_files, host_orientation) + range_files, host_orientation, static_current) !! Parse a MIXED deck ONCE and partition its lines into {EI=0 mooring} and !! {finite-EI cable}, returning the raw parts the OpenFAST aggregate facade wraps: !! the EI=0 mooring SYSTEM built from the mooring subset (over ALL deck points, the @@ -6886,6 +6886,14 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi ! restrained in torsion. Without it (the C API, the standalone mixed route) a deck with ! torsion columns fails closed rather than holding that frame fixed. LOGICAL, INTENT(IN), OPTIONAL :: host_orientation + ! static_current (4, n): the host's steady current as a depth profile, rows z (ascending), + ! ux, uy, uz -- the OpenFAST shell's SeaState CurrMod 1 current at SeaState's grid levels. + ! With external_fluid and the host current on, the static solves (bodies and rods, points, + ! EI = 0 lines, finite-EI cables) take it as a deck current profile, so the coupled start + ! is the equilibrium in that current, as a standalone deck's is in its current OPTION. The + ! dynamics take the host field alone: the profile goes into a copy of the options that + ! only the static builders see. + REAL(wp), INTENT(IN), OPTIONAL :: static_current(:, :) INTEGER :: nturb LOGICAL :: host_turns @@ -6897,6 +6905,8 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi TYPE(DeckLine), ALLOCATABLE :: lines(:), ei0_lines(:) TYPE(DeckSection), ALLOCATABLE :: sections(:) TYPE(DeckOptions) :: opts + ! opts plus the host's steady current (static_current): the options of the static builders + TYPE(DeckOptions) :: opts_static CHARACTER(NAMELEN), ALLOCATABLE :: channels(:) TYPE(CD_BathymetryType) :: bathymetry TYPE(DeckFailure), ALLOCATABLE :: fails(:) @@ -7361,6 +7371,32 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi IF (ErrStat /= CD_DECKDRV_OK) RETURN END IF + ! The static builders' options: the deck's, plus the host's steady current when the host + ! current drives this deck (a WaterKin CurrentMod 1 file keeps its own profile instead). + opts_static = opts + IF (PRESENT(static_current)) THEN + IF (.NOT. opts%external_fluid) THEN + CALL fail(ErrStat, ErrMsg, 'CD_Init_Deck_Aggregate: static_current needs the host fluid field '// & + '(external_fluid)'); RETURN + END IF + IF (SIZE(static_current, 1) /= 4 .OR. SIZE(static_current, 2) < 2) THEN + CALL fail(ErrStat, ErrMsg, 'CD_Init_Deck_Aggregate: static_current must be shaped (4, n >= 2): '// & + 'z, ux, uy, uz'); RETURN + END IF + IF (.NOT. ALL(IEEE_IS_FINITE(static_current))) THEN + CALL fail(ErrStat, ErrMsg, 'CD_Init_Deck_Aggregate: static_current must be finite'); RETURN + END IF + IF (ANY(static_current(1, 2:) <= static_current(1, :SIZE(static_current, 2) - 1))) THEN + CALL fail(ErrStat, ErrMsg, 'CD_Init_Deck_Aggregate: static_current levels must ascend in z'); RETURN + END IF + IF (agg%host_current_enabled .AND. .NOT. (opts%has_current .OR. opts%has_current_profile)) THEN + opts_static%has_current = .TRUE. + opts_static%has_current_profile = .TRUE. + opts_static%current_profile_z = static_current(1, :) + opts_static%current_profile_velocity = static_current(2:4, :) + END IF + END IF + ! Free Rigid6 bodies and free rods start at their static equilibrium with the host's coupled ! points held at their initial (PtfmInit) pose, as on the standalone route (bodyIC static; ! bodyIC deck keeps the deck pose). The solve moves the bodies' start pose and the rod and @@ -7370,11 +7406,12 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi CALL load_bathymetry_file(path_join(deck_dir(deck_path), opts%bathymetry_file), bathymetry, ErrStat, ErrMsg, & points=points) IF (ErrStat /= CD_DECKDRV_OK) RETURN - CALL solve_body_equilibrium(types, bodies, rod_types, rods, points, lines, sections, opts, ErrStat, ErrMsg, & - bathymetry=bathymetry) + CALL solve_body_equilibrium(types, bodies, rod_types, rods, points, lines, sections, opts_static, ErrStat, & + ErrMsg, bathymetry=bathymetry) CALL CD_End_Bathymetry(bathymetry) ELSE - CALL solve_body_equilibrium(types, bodies, rod_types, rods, points, lines, sections, opts, ErrStat, ErrMsg) + CALL solve_body_equilibrium(types, bodies, rod_types, rods, points, lines, sections, opts_static, ErrStat, & + ErrMsg) END IF IF (ErrStat /= CD_DECKDRV_OK) THEN ErrMsg = 'CD_Init_Deck_Aggregate: '//TRIM(ErrMsg) @@ -7401,12 +7438,12 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi CALL load_bathymetry_file(path_join(deck_dir(deck_path), opts%bathymetry_file), bathymetry, ErrStat, ErrMsg, & points=points) IF (ErrStat /= CD_DECKDRV_OK) RETURN - CALL init_deck_system_from_parsed(types, points, ei0_lines, sections, opts, agg%sys, ErrStat, ErrMsg, & - bathymetry=bathymetry, failures=fails) + CALL init_deck_system_from_parsed(types, points, ei0_lines, sections, opts_static, agg%sys, ErrStat, & + ErrMsg, bathymetry=bathymetry, failures=fails) CALL CD_End_Bathymetry(bathymetry) ELSE - CALL init_deck_system_from_parsed(types, points, ei0_lines, sections, opts, agg%sys, ErrStat, ErrMsg, & - failures=fails) + CALL init_deck_system_from_parsed(types, points, ei0_lines, sections, opts_static, agg%sys, ErrStat, & + ErrMsg, failures=fails) END IF IF (ErrStat /= CD_DECKDRV_OK) THEN CALL CD_End_Deck_Aggregate(agg); RETURN @@ -7475,14 +7512,14 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi fairlead_dcm = ptfm_zyx_dcm(ptfm_init(4:6)) END IF IF (opts%has_bathymetry_file) THEN - CALL build_one_hermite_cable(lines(i), sections, types, points, opts, dt, agg%cables(c), cn, es, em, & - bathymetry=bathymetry, fairlead_orientation=fairlead_dcm, & + CALL build_one_hermite_cable(lines(i), sections, types, points, opts_static, dt, agg%cables(c), cn, es, & + em, bathymetry=bathymetry, fairlead_orientation=fairlead_dcm, & init_note=agg%cable_note(c), install_viv=.TRUE., & fold_support=MERGE(FOLD_FRICTION_NONE, FOLD_FRICTION_FULL, & deck_has_dynamic_points(points))) ELSE - CALL build_one_hermite_cable(lines(i), sections, types, points, opts, dt, agg%cables(c), cn, es, em, & - fairlead_orientation=fairlead_dcm, init_note=agg%cable_note(c), & + CALL build_one_hermite_cable(lines(i), sections, types, points, opts_static, dt, agg%cables(c), cn, es, & + em, fairlead_orientation=fairlead_dcm, init_note=agg%cable_note(c), & install_viv=.TRUE., & fold_support=MERGE(FOLD_FRICTION_NONE, FOLD_FRICTION_FULL, & deck_has_dynamic_points(points))) diff --git a/src/CableDyn_OpenFAST_Aggregate.f90 b/src/CableDyn_OpenFAST_Aggregate.f90 index c0d6f785..81fb7426 100644 --- a/src/CableDyn_OpenFAST_Aggregate.f90 +++ b/src/CableDyn_OpenFAST_Aggregate.f90 @@ -249,7 +249,7 @@ MODULE CableDyn_OpenFAST_Aggregate SUBROUTINE CD_AGG_Init_From_Deck(self, deck_path, dt, ErrStat, ErrMsg, env_gravity, env_rho_water, env_wtrdpth, & ptfm_init, external_fluid, coupled_positions, & n_turbines, turbine_ref_pos, farm_ptfm_init, forbid_deck_ambient, run_tmax, & - range_files, host_orientation) + range_files, host_orientation, static_current) !! Build the aggregate from ONE mixed deck: partition its lines into {EI=0 mooring} !! and {finite-EI cable}, wrap the mooring subset into a CD_FMF, and own one CD_HFMF !! per cable. Same signature philosophy as CD_FMF_Init_From_Deck (host environment @@ -288,6 +288,9 @@ SUBROUTINE CD_AGG_Init_From_Deck(self, deck_path, dt, ErrStat, ErrMsg, env_gravi ! host_orientation: the caller passes the moving-point orientations with every update, ! which a finite-EI line restrained in torsion requires (see CD_Init_Deck_Aggregate) LOGICAL, INTENT(IN), OPTIONAL :: host_orientation + ! static_current (4, n): the host's steady current (z, ux, uy, uz by ascending z) for the + ! static solves only (see CD_Init_Deck_Aggregate) + REAL(wp), INTENT(IN), OPTIONAL :: static_current(:, :) ! Both bundles (about 70 KB together) are built on the heap: initialisation runs on the ! thread of the calling host, whose stack size CableDyn does not choose. @@ -326,7 +329,8 @@ SUBROUTINE CD_AGG_Init_From_Deck(self, deck_path, dt, ErrStat, ErrMsg, env_gravi coupled_positions=coupled_positions, n_turbines=n_turbines, & turbine_ref_pos=turbine_ref_pos, farm_ptfm_init=farm_ptfm_init, & forbid_deck_ambient=forbid_deck_ambient, run_tmax=run_tmax, & - range_files=range_files, host_orientation=host_orientation) + range_files=range_files, host_orientation=host_orientation, & + static_current=static_current) IF (PRESENT(external_fluid)) THEN candidate%built_extfluid = external_fluid END IF diff --git a/src/openfast/CableDyn_OF.f90 b/src/openfast/CableDyn_OF.f90 index a8a72f8f..9c29dee5 100644 --- a/src/openfast/CableDyn_OF.f90 +++ b/src/openfast/CableDyn_OF.f90 @@ -521,6 +521,7 @@ SUBROUTINE CD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er REAL(wp) :: cval, dtC, deck_dtm, dt_moor REAL(wp) :: fair_ten, fair_force(3), fair_incl, fair_decl, fair_azi, force_incl LOGICAL :: has_dtm, has_ptfm, use_extf + REAL(wp), ALLOCATABLE :: static_cur(:,:) ! the host's steady current for the static start CHARACTER(ChanLen) :: chan_hdr, chan_unt CHARACTER(1024) :: native_root, init_note INTEGER(IntKi) :: note_at, note_end @@ -755,11 +756,21 @@ SUBROUTINE CD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er host_orientation=.TRUE. ) END IF ELSE + ! the static start in the host's steady current (seastate_static_current) + IF (use_extf) THEN + CALL seastate_static_current( InitInp%WaveField, static_cur, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) RETURN + IF (InitInp%WaveField%Current_InitInput%CurrMod /= 0_IntKi .AND. & + InitInp%WaveField%Current_InitInput%CurrMod /= 1_IntKi .OR. InitInp%WaveField%hasCurrField) & + CALL WrScr( ' Note: CableDyn starts from its still-water statics: of the SeaState currents only '// & + 'CurrMod 1 enters the static start; this current acts from t = 0.' ) + END IF CALL CD_AGG_Init_From_Deck( Inst(id)%agg, TRIM(InitInp%FileName), dt_moor, es, em, & env_gravity=REAL(InitInp%g, wp), env_rho_water=REAL(InitInp%rhoW, wp), & env_wtrdpth=REAL(InitInp%WtrDepth, wp), ptfm_init=REAL(ptfm6, wp), & external_fluid=use_extf, run_tmax=REAL(InitInp%Tmax, wp), & - host_orientation=.TRUE. ) + host_orientation=.TRUE., static_current=static_cur ) END IF IF (es /= CD_AGG_OK) THEN ! The slot stays inactive (it is activated only after full success, below), so this and @@ -1343,6 +1354,7 @@ SUBROUTINE rebuild_from_checkpoint( t, u1, p, x, other, m, ErrStat, ErrMsg ) CHARACTER(2100) :: rst_deck INTEGER(IntKi) :: id, old_id, stale_id, i, es, ncp, nlines, il, ndofl, nin, k, ic, csz, koff LOGICAL :: use_extf, profile_requested, preserve_profile + REAL(wp), ALLOCATABLE :: static_cur(:,:) ! the host's steady current for the static start LOGICAL :: restored ! held fluid fields restored from the checkpoint CHARACTER(ErrMsgLen) :: em INTEGER(IntKi) :: ErrStat2 @@ -1405,11 +1417,18 @@ SUBROUTINE rebuild_from_checkpoint( t, u1, p, x, other, m, ErrStat, ErrMsg ) END IF use_extf = .FALSE. IF (ASSOCIATED(p%WaveField)) use_extf = wavefield_is_ambient( p%WaveField ) + ! the rebuild solves the same static start as the run it continues (the restored state + ! then replaces it; a static-shape-driven mesh refinement must match) + IF (use_extf) THEN + CALL seastate_static_current( p%WaveField, static_cur, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) RETURN + END IF CALL CD_AGG_Init_From_Deck( Inst(id)%agg, TRIM(rst_deck), REAL(p%dtM0, wp), es, em, & env_gravity=REAL(p%g, wp), env_rho_water=REAL(p%rhoW, wp), & env_wtrdpth=REAL(p%WtrDpth, wp), external_fluid=use_extf, & ptfm_init=REAL(p%PtfmInit, wp), run_tmax=REAL(p%Tmax, wp), & - host_orientation=.TRUE. ) + host_orientation=.TRUE., static_current=static_cur ) CALL delete_file( rst_deck ) IF (es /= CD_AGG_OK) THEN CALL SetErrStat( ErrID_Fatal, 'CableDyn mooring module: checkpoint rebuild: '//TRIM(em), & @@ -2925,6 +2944,7 @@ SUBROUTINE quasistatic_dydu( Vars, u, p, m, dYdu, ErrStat, ErrMsg ) CHARACTER(2100) :: lin_deck REAL(wp), ALLOCATABLE :: op_pos(:,:), prb_pos(:,:) LOGICAL :: use_extf + REAL(wp), ALLOCATABLE :: static_cur(:,:) ! the host's steady current for the static probes ErrStat = ErrID_None ErrMsg = '' @@ -2954,6 +2974,12 @@ SUBROUTINE quasistatic_dydu( Vars, u, p, m, dYdu, ErrStat, ErrMsg ) use_extf = .FALSE. IF (ASSOCIATED(p%WaveField)) use_extf = wavefield_is_ambient( p%WaveField ) + ! each probe is a static solve in the host's steady current, as the operating point is + IF (use_extf) THEN + CALL seastate_static_current( p%WaveField, static_cur, ErrStat2, ErrMsg2 ) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF (ErrStat >= AbortErrLev) RETURN + END IF DO i = 1, SIZE(Vars%u) IF (Vars%u(i)%Field /= FieldTransDisp) CYCLE ! vel/acc/orientation: zero columns @@ -3011,7 +3037,8 @@ SUBROUTINE probe_loads( pos, PErrStat, PErrMsg ) CALL CD_AGG_Init_From_Deck( agg_p, TRIM(lin_deck), REAL(p%dtM0, wp), es_p, em_p, & env_gravity=REAL(p%g, wp), env_rho_water=REAL(p%rhoW, wp), & env_wtrdpth=REAL(p%WtrDpth, wp), external_fluid=use_extf, & - coupled_positions=pos, run_tmax=REAL(p%Tmax, wp) ) + coupled_positions=pos, run_tmax=REAL(p%Tmax, wp), & + static_current=static_cur ) IF (es_p /= CD_AGG_OK) THEN PErrStat = ErrID_Fatal PErrMsg = 'linearization static probe init failed: '//TRIM(em_p) @@ -4454,6 +4481,54 @@ LOGICAL FUNCTION wavefield_is_ambient( wf ) RESULT(ambient) ambient = wf%WaveMod /= WaveMod_None .OR. wf%Current_InitInput%CurrMod /= 0_IntKi .OR. wf%hasCurrField END FUNCTION wavefield_is_ambient + !> The host's steady current for the static start (CD_AGG_Init_From_Deck static_current): + !> SeaState's CurrMod 1 current (CD_SeaState_Steady_Current) at the levels of its vertical + !> wave grid, z ascending. SeaState interpolates between those levels in its own stretched + !> coordinate, the profile linearly in z: the start takes the run's current at the levels + !> and very nearly between them. Left unallocated -- a still-water start -- without a + !> nonzero CurrMod 1 current; a CurrMod 2 current or an InflowWind current field is known + !> only through the run's samples (CD_Init notes it). + SUBROUTINE seastate_static_current( wf, prof, ErrStat, ErrMsg ) + TYPE(SeaSt_WaveFieldType), INTENT(IN ) :: wf + REAL(wp), ALLOCATABLE, INTENT( OUT) :: prof(:,:) + INTEGER(IntKi), INTENT( OUT) :: ErrStat + CHARACTER(*), INTENT( OUT) :: ErrMsg + INTEGER(IntKi) :: k, nz, m, es + REAL(wp) :: zk, v(3) + CHARACTER(1024) :: em + ErrStat = ErrID_None + ErrMsg = '' + IF (wf%Current_InitInput%CurrMod /= 1_IntKi) RETURN + nz = wf%VolGridParams%n(4) + IF (nz < 2) RETURN + ALLOCATE (prof(4, nz)) + m = 0 + DO k = 0, nz - 1 + zk = REAL(wf%GridDepth, wp)*(SIN(REAL(wf%VolGridParams%pZero(4) + k*wf%VolGridParams%delta(4), wp)) - 1.0_wp) + IF (m > 0) THEN + IF (.NOT. zk > prof(1, m)) CYCLE + END IF + CALL CD_SeaState_Steady_Current(zk, REAL(wf%EffWtrDpth, wp), 1, & + REAL(wf%Current_InitInput%CurrSSV0, wp), REAL(wf%Current_InitInput%CurrSSDir, wp), & + REAL(wf%Current_InitInput%CurrNSRef, wp), REAL(wf%Current_InitInput%CurrNSV0, wp), & + REAL(wf%Current_InitInput%CurrNSDir, wp), REAL(wf%Current_InitInput%CurrDIV, wp), & + REAL(wf%Current_InitInput%CurrDIDir, wp), v, es, em) + IF (es /= CD_HYDRO_OK) THEN + ErrStat = ErrID_Fatal + ErrMsg = 'CableDyn mooring module: SeaState current for the static start: '//TRIM(em) + DEALLOCATE (prof) + RETURN + END IF + m = m + 1 + prof(:, m) = [zk, v] + END DO + IF (m < 2 .OR. .NOT. ANY(ABS(prof(2:4, 1:m)) > 0.0_wp)) THEN + DEALLOCATE (prof) + RETURN + END IF + prof = prof(:, 1:m) + END SUBROUTINE seastate_static_current + !> Write the packed deck copy to /, the !> file the checkpoint rebuild and the linearization probes re-parse. In the MooringFile !> folder, deck-relative side files (bathymetry, WaterKin, Syrope tables) resolve as in diff --git a/tests/test_openfast_aggregate.f90 b/tests/test_openfast_aggregate.f90 index 7736be0a..4187e938 100644 --- a/tests/test_openfast_aggregate.f90 +++ b/tests/test_openfast_aggregate.f90 @@ -159,6 +159,7 @@ PROGRAM test_openfast_aggregate CALL case_external_fluid() CALL case_still_water_deck_ambient() CALL case_external_fluid_report() + CALL case_static_current() CALL case_coupled_positions_override() CALL case_farm_partition() CALL case_farm_free_clump() @@ -4519,6 +4520,110 @@ SUBROUTINE case_external_fluid_cable() CALL CD_AGG_End(agg_p, es, em) END SUBROUTINE case_external_fluid_cable + SUBROUTINE case_static_current() + !! The coupled start in the host's steady current (static_current, what the OpenFAST shell + !! passes from a SeaState CurrMod 1 current: 0.4 m/s along x and 0.3 m/s across): + !! - a pure EI = 0 deck starts as the same deck with that current as its deck OPTION; + !! - on the mixed deck (EI = 0 line and finite-EI cable), held under the host field of the + !! same current, the start stays at its loads -- the equilibrium in that current, with no + !! second copy of it in the dynamics -- where the still-water start moves away; + !! - static_current needs the host field, and z levels that ascend. + TYPE(CD_AGG_ModuleType) :: agg_w, agg_c, agg_u + REAL(wp), PARAMETER :: DT = 0.05_wp + REAL(wp), PARAMETER :: UC(3) = [0.4_wp, 0.3_wp, 0.0_wp] + REAL(wp) :: prof(4, 2), r0(3, 3), vel(3, 3), acc(3, 3), lu(3, 3), lc3(3, 3), v3(3, 3), a3(3, 3) + REAL(wp) :: drift(2) + INTEGER :: es + CHARACTER(1024) :: em + + prof(:, 1) = [-300.0_wp, UC] + prof(:, 2) = [0.0_wp, UC] + + ! (1) pure EI = 0: the static current is the deck current OPTION's + CALL write_volturnus_deck('agg_sc_still.dat', extra_option='0.05 dtM', extra_option2='60.0 TMax') + CALL write_volturnus_deck('agg_sc_deck.dat', extra_option='uniform 0.4 0.3 0.0 current', & + extra_option2='0.05 dtM', extra_option3='60.0 TMax') + CALL CD_AGG_Init_From_Deck(agg_u, 'agg_sc_deck.dat', DT, es, em) + CALL require(es == CD_AGG_OK, 'static-current:deck-current-init: '//TRIM(em)) + CALL CD_AGG_Init_From_Deck(agg_c, 'agg_sc_still.dat', DT, es, em, external_fluid=.TRUE., static_current=prof) + CALL require(es == CD_AGG_OK, 'static-current:ei0-init: '//TRIM(em)) + IF (es == CD_AGG_OK) THEN + CALL CD_AGG_CalcOutput(agg_u, es, em) + CALL CD_AGG_GetMovingPointMesh(agg_u, r0, vel, acc, lu, es, em) + CALL CD_AGG_CalcOutput(agg_c, es, em) + CALL CD_AGG_GetMovingPointMesh(agg_c, r0, v3, a3, lc3, es, em) + CALL require(nan_max_abs(lc3 - lu) <= 1.0e-9_wp*nan_max_abs(lu), & + 'static-current:ei0-start-equals-deck-current-start') + END IF + CALL CD_AGG_End(agg_u, es, em) + CALL CD_AGG_End(agg_c, es, em) + + ! (2) mixed deck: held in the host's current, the start in that current stays put + CALL write_mixed_deck('agg_sc_mixed.dat') + CALL CD_AGG_Init_From_Deck(agg_w, 'agg_sc_mixed.dat', DT, es, em, external_fluid=.TRUE.) + CALL require(es == CD_AGG_OK, 'static-current:still-water-start: '//TRIM(em)) + CALL CD_AGG_Init_From_Deck(agg_c, 'agg_sc_mixed.dat', DT, es, em, external_fluid=.TRUE., static_current=prof) + CALL require(es == CD_AGG_OK, 'static-current:current-start: '//TRIM(em)) + IF (es == CD_AGG_OK) THEN + CALL held_drift(agg_w, UC, drift(1)) + CALL held_drift(agg_c, UC, drift(2)) + WRITE (*, '(A,ES10.3,A,ES10.3)') 'static current: load drift over 1 s held in the current, still-water '// & + 'start ', drift(1), ', start in the current ', drift(2) + CALL require(drift(2) <= 1.0e-4_wp, 'static-current:start-in-current-stays-put') + CALL require(drift(1) > 1.0e2_wp*drift(2), 'static-current:still-water-start-moves') + END IF + CALL CD_AGG_End(agg_w, es, em) + CALL CD_AGG_End(agg_c, es, em) + + ! (3) contract + CALL CD_AGG_Init_From_Deck(agg_c, 'agg_sc_mixed.dat', DT, es, em, static_current=prof) + CALL require(es /= CD_AGG_OK .AND. INDEX(em, 'external_fluid') > 0, & + 'static-current:needs-host-field: '//TRIM(em)) + CALL CD_AGG_End(agg_c, es, em) + prof(1, 2) = -400.0_wp + CALL CD_AGG_Init_From_Deck(agg_c, 'agg_sc_mixed.dat', DT, es, em, external_fluid=.TRUE., static_current=prof) + CALL require(es /= CD_AGG_OK .AND. INDEX(em, 'ascend') > 0, 'static-current:levels-ascend: '//TRIM(em)) + CALL CD_AGG_End(agg_c, es, em) + END SUBROUTINE case_static_current + + SUBROUTINE held_drift(agg, uc, rel) + !! Largest relative change of the two moving-point loads of the mixed deck over 1 s with the + !! boundary held at its start and the host field the uniform current uc. + TYPE(CD_AGG_ModuleType), INTENT(INOUT) :: agg + REAL(wp), INTENT(IN) :: uc(3) + REAL(wp), INTENT(OUT) :: rel + REAL(wp), PARAMETER :: DT = 0.05_wp + REAL(wp), ALLOCATABLE :: fu(:, :), fud(:, :), wl(:), r(:, :), v(:, :), a(:, :), l0(:, :), l1(:, :) + INTEGER :: nf, nm, s, ni, k, es + LOGICAL :: cv, st + CHARACTER(1024) :: em + rel = HUGE(1.0_wp) + nf = CD_AGG_NFluidNodes(agg, es, em) + IF (es /= CD_AGG_OK) RETURN + ALLOCATE (fu(3, nf), fud(3, nf), wl(nf)) + DO k = 1, nf + fu(:, k) = uc + END DO + fud = 0.0_wp + wl = 0.0_wp + CALL CD_AGG_SetFluidFields(agg, fu, fud, wl, es, em) + CALL require(es == CD_AGG_OK, 'static-current:set-fields: '//TRIM(em)) + nm = 2 + ALLOCATE (r(3, nm), v(3, nm), a(3, nm), l0(3, nm), l1(3, nm)) + CALL CD_AGG_CalcOutput(agg, es, em) + CALL CD_AGG_GetMovingPointMesh(agg, r, v, a, l0, es, em) + v = 0.0_wp + a = 0.0_wp + DO s = 1, 20 + CALL CD_AGG_Step_Moving(agg, DT, r, v, a, cv, st, ni, es, em) + CALL require(es == CD_AGG_OK .AND. cv, 'static-current:held-step: '//TRIM(em)) + IF (es /= CD_AGG_OK) RETURN + END DO + CALL CD_AGG_CalcOutput(agg, es, em) + CALL CD_AGG_GetMovingPointMesh(agg, r, v, a, l1, es, em) + rel = nan_max_abs(l1 - l0)/nan_max_abs(l0) + END SUBROUTINE held_drift + SUBROUTINE case_restart_line_control() !! CHECKPOINT-RESTART of a controlled EI = 0 deck, bit for bit (the shell rebuild's !! recipe): instance A marches the three VolturnUS chains under a surge drive while From 2e85ff8c05a3460af275db0d0b88b93d6feb961a Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Wed, 28 Oct 2026 01:31:32 +0900 Subject: [PATCH 3/4] feat(syrope): hydrodynamics, current, waves, host fluid and VIV on Syrope lines MoorDyn applies its line hydrodynamics to Syrope polyester lines as to any other. CableDyn built a Syrope line on its own path with gravity, buoyancy and a flat seabed only: no drag, no added mass, and current, waves, a host's fluid field, a bathymetryFile and VIV refused. The Syrope builder now keeps its working-curve initial condition (the secant EA iterated to the rest curve, the per-element running maximum and slow strain) but builds each probe and the final line through init_one_model, which takes the secant and the Syrope states as optional arguments: the line gets the seabed, hydrodynamics and fluid fields of any EI = 0 line, its static start includes the current's drag, and its legacy BA is zero (the working curve's BA_s|BA_d carries the rope's damping). Composite and finite-EI Syrope lines stay refused. A taut 88.5 m polyester line in water whose fairlead sways 2 m matches MoorDyn-C v2.7.2's fairlead tension within 10.6 N over a 44.8 kN range (1.03 MN mean; 0.5 N at t = 0); without drag and added mass the range grows 4.8 % (syrope_hydro, with a cross current, VIV and waves). Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 6 ++ CMakeLists.txt | 9 ++ VALIDATION.md | 2 +- doc/capabilities.rst | 5 +- doc/modeling.rst | 2 +- doc/theory.rst | 7 +- doc/troubleshooting.rst | 8 +- python/cabledyn/deck_file.py | 5 - python/tests/test_deck_file.py | 10 ++ src/CableDyn_DeckDriver.f90 | 192 ++++++++++++--------------------- tests/test_deck_driver.f90 | 17 ++- tests/test_syrope_hydro.py | 161 +++++++++++++++++++++++++++ 12 files changed, 281 insertions(+), 143 deletions(-) create mode 100644 tests/test_syrope_hydro.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ed9f1f26..0404db5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,6 +87,12 @@ All notable changes to CableDyn are recorded in this file. The format follows current, the lazy-wave cable starts 29 m across at its deepest monitored node and moves less than 0.6 m over the first 30 s, where the still-water start has reached a third of that offset. `CurrMod 2` and InflowWind currents keep the still-water start, with a note. +- Syrope polyester lines take the seabed, Morison drag and added mass, deck current and waves, + a coupled host's fluid field, a `bathymetryFile` and VIV, as every `EI = 0` line does and as + MoorDyn's do; before, they ran without hydrodynamics and refused current, waves, host fluid + and bathymetry. The static initial condition includes the current's drag. A taut polyester + line whose fairlead sways 2 m in water matches MoorDyn-C's fairlead tension within 11 N on a + 45 kN range (1.03 MN mean); without drag and added mass the range is 5 % larger. - Under a bend stiffener, `BendMomN` (and the `BendMoment` columns of the static profile, range graphs and element file) report the cable's own moment, the line type's EI times the curvature; lines without stiffeners are unchanged. diff --git a/CMakeLists.txt b/CMakeLists.txt index 28259b42..7f9167d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1661,6 +1661,15 @@ if(Python3_Interpreter_FOUND) PROCESSORS 4 TIMEOUT ${_viv_lockin_timeout} ENVIRONMENT "${_cabledyn_python_test_environment}") + # Syrope polyester with hydrodynamics against MoorDyn-C (a fairlead swaying in water) + add_test(NAME syrope_hydro + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_syrope_hydro.py + --exe $ + --output ${CMAKE_BINARY_DIR}/syrope_hydro) + set_tests_properties(syrope_hydro PROPERTIES + LABELS "python;integration;dynamic;validation" + TIMEOUT ${_viv_lockin_timeout} + ENVIRONMENT "${_cabledyn_python_test_environment}") # MoorDyn-C's VIV test case: the catenary riser of Thorsen et al. in a uniform current add_test(NAME viv_riser COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_viv_riser.py diff --git a/VALIDATION.md b/VALIDATION.md index 8414bb19..af80d954 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -793,7 +793,7 @@ stop with a named error. | Coupled pinned rods (`Pinned`, `CoupledPinned`/`VesselPinned`) | Pass verified | `openfast_pinned_rod` on the aggregate: a dry rod (10 m, 500 kg) released at 30° swings with the elliptic-integral compound-pendulum period to 1.6e-4 at `dt = T/100`, End A on the pin to 0 m; a held `CoupledPinned` node reproduces the `Pinned` rod to round-off (1e-12), returns zero moment, and its force equals the analytic pin reaction to 2.0e-13 of `mg`; a pin accelerating at 2 m/s² gives the mean angle `atan(a/g)` to 1e-6 rad and the period of `sqrt(g² + a²)` to 1.6e-4; a harmonic pin motion follows the linear base-excitation solution to 1.5e-3 / 3.7e-4 of the amplitude at `T0/100` / `T0/200` (ratio 4.03); a 0.1 s step sub-cycled 7 times reproduces a run at the sub-step size to 1e-14 rad and 4e-10 N for a drifting pin; a 1 m `Pinned` rod that carries no line (dry and hanging, or buoyant and upright under water) at a 0.6 s step (`omega0 dt` 2.29 / 3.42, beyond the explicit limit 2) sub-cycles it 6 / 9 times from its own swing stiffness `|W d_g - B d_b|`, equals the run at the sub-step size bit for bit, stays within its release angle and keeps the elliptic-integral period to 6.0e-3 / 5.9e-3 (taken whole, the step turns the rod over); a `CoupledPinned` pin crossing the free surface within one step at constant velocity (a 1 kg/m rod lifted from submerged to dry in 0.1 s, `omega dt` 2.13 wet; a 33 kg/m rod lowered from dry to submerged in 0.6 s, 2.29 dry) takes at least 6 sub-steps from its step-start wetting (more from the waterplane near the surface) and ends within 5e-5 / 3e-4 rad of a run at a sixtieth of the step, where the end-of-step wetting alone gives one sub-step and an angle error of 0.20 / 0.69 rad; on a stiff seabed (`kBot` 1e7 N/m³) a `Pinned` rod whose far end rests on the bed (0.1 s step) and a `Free` rod lying on it (0.05 s step) sub-cycle their contact mode (34–36 and 26 sub-steps), stay at rest on the bed over 5 s (angle change 3.8e-3 / 4e-15 rad, the undamped static settlement) and end within 1.9e-6 / 8e-8 of a run at a tenth of the step, where the sub-steps of the lines and swing alone (1 and 4) throw them off the bed (4.2 rad, 0.8 m); an output probe returns `-m (I_c/I_p) a_p` within 1e-10 of `mg` (not `-m a_p`), and its pin force moves by 2e-11 N when the held end acceleration of the attached tethers changes their end load by 8 N; snapshot/restore, probe restore and restart overlay are bit-identical, the restored state's loads before the next step included; a step without the staged rods (the step-start pin carried by the rod) is bit-identical to the staged one; a `Free` or `Coupled` rod with an end without a line is refused by name; with `PtfmInit` the static start leaves 1.4e-8 N·m about the pin. OpenFAST (IEA-15 UMaine, JONSWAP Hs 6 m, 60 s, `dtM = DT = 0.025 s`) with line 1 hung from a 4 m `CoupledPinned` rod at its fairlead: `openfast -restart` at 30 s reproduces every later OpenFAST output row bit for bit (`NumCrctn` 0 and 1), `NumCrctn = 1` equals `NumCrctn = 0` bit for bit, and surge/heave/pitch statistics stay within 0.2 % / 0.4 % / 1.7 % (mean) of the deck with line 1 on a `Coupled` point | | Coupled finite-EI touchdown/contact | Pass verified | flat `WtrDpth` and equivalent constant structured bathymetry initialise and step with matching loads; friction and checkpoint restore are tested. The IEA-15 mixed example (its power cable on 248 elements, each at most half the bending length) has 149 grounded nodes and completes a 20 s aggregate trajectory at `dtM=0.025 s` with 2 m surge, 1 m heave, and 0.5 m/s host current, without fallback or stall recovery, at most 12 Newton iterations. A full-turbine run of the same model (one hour after a 200 s transient; TurbSim normal turbulence, 10.6 m/s, 17 % TI; JONSWAP Hs 8 m, Tp 12 s, aligned with the wind and the cable; AeroDyn with the rotor held at 7.55 rpm, no controller, rigid blades and tower; SeaState grid covering the lines) completes without recoveries or non-finite values. The cable's hang-off tension is 11.5 ± 1.1 kN (static 11.9 kN, maximum 17.9 kN). The 149 nodes grounded at the static state stay grounded, joined by one more once the platform has drifted (the touchdown moves 2.5 m toward the platform). The peak curvature is 0.156 1/m at the sag bend, 72 m from the hang-off, and 0.109 1/m at the touchdown. On the former 87-element mesh (10 m elements along the laid section) the peak was 0.160 1/m and the touchdown curvature 0.075 1/m, under-resolved by about 30 %. These curvatures were recorded before the `Curv` channels took the curvature recovered from nodal equilibrium: they are the geometric curvature of the centreline (the larger one-sided trace at a node), which `OutputRecovery element` reproduces. The chain-only twin of the run matches stock MoorDyn over 1200 s to 0.3 % in platform motion and fairlead tension statistics. The anchor tension of the laid cable stays at its static 1.23 kN (maximum 1.24 kN): the seabed friction of the 370 m laid section holds the tension changes at the touchdown. On the former mesh it read 1.39 kN (median) with wave-frequency stick-slip peaks up to 4.1 kN lasting under 1 s, which the resolved mesh does not show, and before the anchor-end correction of this release it locked at about 2.75 kN for the whole run. The run takes 27.1 min of wall time (18.8 min on the former mesh) | | `WaterKin` from file | Pass verified | See [WaterKin and SeaState modes](#waterkin-and-seastate-modes) | -| Syrope polyester (`SYROPE:` syntax; [Falkenberg et al., 2017](https://cabledyn.readthedocs.io/en/latest/references.html#ref-falkenberg2017)) | Pass verified | MoorDyn-F/C `BA_s|BA_d` rate and force equations; analytic position/velocity tangents with finite-difference checks; projected, bracketed backward-Euler slow-state update with a strong-unloading boundary test; OWC running maximum; `SYROPE IC` `Tmax0/Tmean0` history with range/order checks; both states carried through every lifecycle stage and the coupled checkpoint. `BA_s` is kept separate from line axial damping (`BA`) and tested against double counting. Composite, hydrodynamic, finite-EI, current, and wave combinations stop with a named error | +| Syrope polyester (`SYROPE:` syntax; [Falkenberg et al., 2017](https://cabledyn.readthedocs.io/en/latest/references.html#ref-falkenberg2017)) | Pass verified | MoorDyn-F/C `BA_s|BA_d` rate and force equations; analytic position/velocity tangents with finite-difference checks; projected, bracketed backward-Euler slow-state update with a strong-unloading boundary test; OWC running maximum; `SYROPE IC` `Tmax0/Tmean0` history with range/order checks; both states carried through every lifecycle stage and the coupled checkpoint. `BA_s` is kept separate from line axial damping (`BA`) and tested against double counting. The line takes the seabed, Morison loads, current, waves, host fluid and VIV of any `EI = 0` line: a taut 88.5 m polyester line in water whose fairlead sways 2 m matches MoorDyn-C v2.7.2 within 10.6 N over a 44.8 kN tension range (1.03 MN mean; t = 0 within 0.5 N), and its range grows 4.8 % without drag and added mass (`syrope_hydro`). Composite and finite-EI combinations stop with a named error | | Cross-flow VIV (LINE TYPES `Cl`) | Pass verified | `EI = 0` lines and finite-EI cables on the aggregate with the host's fluid field: an `EI = 0` riser and a cable (EI 1 N m²) in a 0.15 m/s host current lock in at A/D 0.6645 / 0.6646 and 0.292 Hz (MoorDyn-F 0.662 at 0.293 Hz; standalone 0.665); the phases, running mean squares and averaging time ride in the checkpoint state and the correction rewind: a rebuild from the checkpoint continues bit for bit, one without the VIV reload does not (`viv_coupled`). OpenFAST (IEA-15 UMaine mixed deck, `Cl` 0.8 on the lazy-wave cable, SeaState 0.5 m/s current, 60 s): `openfast -restart` at 30 s reproduces every later CableDyn and OpenFAST output row bit for bit | **Standalone mixed aggregate.** `CableDyn_driver.exe` partitions and steps the diff --git a/doc/capabilities.rst b/doc/capabilities.rst index 666b9511..902b8201 100644 --- a/doc/capabilities.rst +++ b/doc/capabilities.rst @@ -77,8 +77,9 @@ Line and constitutive capability including load-dependent dynamic stiffness; ``EI = 0`` lines * - Syrope polyester - Supported with limits - - single-section taut dynamic line with OWC and two history states; composite, hydro, - finite-EI, current, and wave combinations fail closed by name + - single-section taut dynamic line with OWC and two history states, with the seabed, + Morison loads, current, waves, host fluid fields and VIV of any ``EI = 0`` line; + composite and finite-EI combinations fail closed by name * - Torsion of finite-EI lines - Supported with limits - condensed isotropic torsion (uniform torque, quasi-static: no torsional inertia) of a diff --git a/doc/modeling.rst b/doc/modeling.rst index a7c00699..b13561a9 100644 --- a/doc/modeling.rst +++ b/doc/modeling.rst @@ -71,7 +71,7 @@ models: - MoorDyn ``ElasticMod = 3`` behaviour * - Syrope - ``SYROPE:settings|alpha|beta`` and ``BA_s|BA_d`` - - supported single-section taut dynamic polyester use case + - single-section taut dynamic polyester line, with the hydrodynamics of any ``EI = 0`` line Use :doc:`examples` for runnable instances and :doc:`theory` for the state equations (the viscoelastic model is a four-parameter series-Kelvin solid that reduces to a standard linear diff --git a/doc/theory.rst b/doc/theory.rst index e0db1ed5..93b844e5 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -682,7 +682,8 @@ ratchets and regenerates the working curve when the mean tension exceeds it. 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. Each element then starts with the running maximum +curve is iterated to the solved mean strain, 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, @@ -707,7 +708,9 @@ the next admissible :math:`T_\text{max}`. An optional ``SYROPE IC`` row supplies the prior history :math:`(T_\text{max,0}, T_\text{mean,0})`; see the initial condition above. The model applies -to single-section ``EI = 0`` taut lines; see :doc:`capabilities` for the supported combinations. +to single-section ``EI = 0`` taut lines, which take the seabed, the Morison loads below, current, +waves, a host's fluid field and VIV as any ``EI = 0`` line does (MoorDyn's line hydrodynamics); see +:doc:`capabilities` for the supported combinations. Hydrodynamic loads ------------------ diff --git a/doc/troubleshooting.rst b/doc/troubleshooting.rst index 5ebb7d05..14cfbfc4 100644 --- a/doc/troubleshooting.rst +++ b/doc/troubleshooting.rst @@ -327,11 +327,11 @@ Model data ``EI = 0``. * - ``a LINE TYPES BA entry cannot have more bar-separated values than its EA entry`` - write ``BA`` as one value for a plain EA and at most ``Bs|Bd`` for a viscoelastic EA. - * - ``a Syrope line does not support ...`` / ``a Syrope line must be a single section`` / - ``must be taut at init`` / ``has no static output`` + * - ``a Syrope line does not support finite-EI bending`` / ``a Syrope line must be a single + section`` / ``must be taut at init`` / ``has no static output`` - a Syrope line is one ``EI = 0`` section, taut at initialisation, marched with - ``dtM``/``TMax``, without ``bathymetryFile``, deck current/waves, or host fluid loads (a - flat ``WtrDpth`` is accepted). Adjust the model accordingly. + ``dtM``/``TMax``; it takes the seabed, Morison loads, current, waves and host fluid of any + ``EI = 0`` line. Adjust the model accordingly. * - ``Syrope alpha and beta ... must be positive`` / ``the Syrope BA column needs two parts`` / ``the Syrope settings file needs OWC, WCType, k1, and k2 rows`` - see the Syrope column rules in :doc:`driver_format`: ``EA = SYROPE:|alpha|beta`` diff --git a/python/cabledyn/deck_file.py b/python/cabledyn/deck_file.py index 033e5d0d..ef9bbb5f 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -2734,11 +2734,6 @@ def numeric(token: str, row: DeckRecord, field: str) -> float: f"{self._at(row)}: LINE TYPES VIV synchronisation band needs cF > 0 " "and 0 <= dF < cF" ) - if cl > 0.0 and is_syrope: - raise DeckFormatError( - f"{self._at(row)}: VIV (Cl > 0) does not combine with the Syrope " - "working-curve model" - ) has_viv_ei0 = has_viv_ei0 or (cl > 0.0 and not ei > 0.0) if cl > 0.0: viv_type_names.add(row.tokens[0].lower()) diff --git a/python/tests/test_deck_file.py b/python/tests/test_deck_file.py index 4bfc7fa4..0e93c791 100644 --- a/python/tests/test_deck_file.py +++ b/python/tests/test_deck_file.py @@ -4022,6 +4022,16 @@ def test_syrope_line_needs_the_dynamic_clock(): DeckFile.from_text(static, caller_driven=True) +def test_syrope_line_takes_viv_and_a_current(): + # a Syrope line takes the hydrodynamics of any EI = 0 line, VIV included (MoorDyn's) + source = (ROOT / "examples/syrope_polyester_mooring.dat").read_text(encoding="utf-8") + row = '"SYROPE:data/syrope/syrope_settings.dat|1.53e8|23.12" 5.0e10|1.0e5' + row += " 0.0 1.0 0.0 1.0 0.0" + assert source.count(row) == 1 + text = source.replace(row, row + " 0.8") + DeckFile.from_text(re.sub(r"none(\s+)current", r"uniform 0 0.5 0\1current", text)) + + @pytest.mark.parametrize("column", [6, 7, 8, 9]) def test_negative_drag_or_added_mass_coefficient_is_rejected(column): row = "chainR3 0.2466 373.5 1.607e9 -1.0 0.0 1.37 0.64 1.0 0.0" diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 84d98509..56d9903a 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -8754,8 +8754,12 @@ SUBROUTINE line_static_friction(opts, line_id, lay_az, laid_t) END IF END SUBROUTINE line_static_friction - SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry) - !! Initialize one persistent model from a validated deck LINE. + RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry, & + syrope_secant, syrope_is, syrope_type, syrope_slow0, syrope_tmax0) + !! Initialize one persistent model from a validated deck LINE. A Syrope line is built by + !! init_one_syrope_model, which calls back here with syrope_secant (the secant EA of its + !! static solve) and, for the final build, the per-element Syrope states: the line then + !! takes the same seabed, hydrodynamics and fluid fields as any EI = 0 line. TYPE(DeckLine), INTENT(IN) :: ln TYPE(DeckSection), INTENT(IN) :: sections(:) TYPE(DeckLineType), INTENT(IN) :: types(:) @@ -8765,6 +8769,10 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg TYPE(CD_BathymetryType), INTENT(IN), OPTIONAL :: bathymetry + REAL(wp), INTENT(IN), OPTIONAL :: syrope_secant + LOGICAL, INTENT(IN), OPTIONAL :: syrope_is(:) + TYPE(CD_SyropeType), INTENT(IN), OPTIONAL :: syrope_type(:) + REAL(wp), INTENT(IN), OPTIONAL :: syrope_slow0(:), syrope_tmax0(:) TYPE(CD_LineType), ALLOCATABLE :: lts(:) TYPE(CD_LineSection), ALLOCATABLE :: secs(:) @@ -8872,9 +8880,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err hydro_cdt = hydro_cdt(SIZE(hydro_cdt):1:-1) hydro_can = hydro_can(SIZE(hydro_can):1:-1) hydro_cat = hydro_cat(SIZE(hydro_cat):1:-1) - ! Syrope line: a dedicated basic build path (single section, taut, no seabed - ! or hydro). Detected here and handled separately from the hydro variants - ! below, which do not carry the working-curve state. + ! Syrope line: init_one_syrope_model solves its working-curve initial state and builds it + ! back through this routine (syrope_secant present), with the hydro variants below BLOCK INTEGER :: syt, i2 syt = 0 @@ -8882,14 +8889,17 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err IF (types(line_section_type(sections, ln%id, i2))%is_syrope) & syt = line_section_type(sections, ln%id, i2) END DO - IF (syt > 0) THEN - IF (ANY(viv_cl > CD_ZERO)) THEN - CALL fail(ErrStat, ErrMsg, 'VIV (LINE TYPES Cl > 0) does not combine with a Syrope line'); RETURN - END IF - CALL init_one_syrope_model(types, syt, ln, lts, secs, anchor, fairlead, l0, opts, & - static_cfg, dynamic_cfg, factors, bathymetry, model, ErrStat, ErrMsg) + IF (syt > 0 .AND. .NOT. PRESENT(syrope_secant)) THEN + CALL init_one_syrope_model(types, syt, ln, sections, points, l0, opts, model, ErrStat, ErrMsg, & + bathymetry=bathymetry) RETURN END IF + IF (PRESENT(syrope_secant)) THEN + ! the static solve's single secant EA; the working curve carries the rope's damping + ! (BA_s|BA_d), so the line takes no legacy BA on top of it + lts(secs(1)%line_type)%ea = syrope_secant + ba = CD_ZERO + END IF END BLOCK ! external_fluid: the host prescribes per-node fluid kinematics each step, so the ! model must be built with the full wave-capable hydro configuration (drag + FK + @@ -8936,7 +8946,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err ! MoorDyn's, whose deck dialect this parser reads. CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., & anchor_is_end_b=.TRUE., seabed_kn=kn, bathymetry=bathymetry, seabed_cn=cn, & seabed_kbot=opts%kbot, seabed_contact_diameter=diam, & seabed_cn_over_kn=opts%cbot/opts%kbot, & @@ -8965,7 +8976,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err cn = kn*(opts%cbot/opts%kbot) CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., & anchor_is_end_b=.TRUE., seabed_kn=kn, bathymetry=bathymetry, seabed_cn=cn, & seabed_kbot=opts%kbot, seabed_contact_diameter=diam, & seabed_cn_over_kn=opts%cbot/opts%kbot, & @@ -8992,7 +9004,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err cn = kn*(opts%cbot/opts%kbot) CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., & anchor_is_end_b=.TRUE., seabed_kn=kn, bathymetry=bathymetry, seabed_cn=cn, & seabed_kbot=opts%kbot, seabed_contact_diameter=diam, & seabed_cn_over_kn=opts%cbot/opts%kbot, & @@ -9019,7 +9032,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err cn = kn*(opts%cbot/opts%kbot) CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., & anchor_is_end_b=.TRUE., & seabed_z_floor=-opts%wtrdpth, seabed_kn=kn, seabed_cn=cn, & seabed_kbot=opts%kbot, seabed_contact_diameter=diam, & @@ -9049,7 +9063,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err cn = kn*(opts%cbot/opts%kbot) CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., & anchor_is_end_b=.TRUE., & seabed_z_floor=-opts%wtrdpth, seabed_kn=kn, seabed_cn=cn, & seabed_kbot=opts%kbot, seabed_contact_diameter=diam, & @@ -9077,7 +9092,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err cn = kn*(opts%cbot/opts%kbot) CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., & anchor_is_end_b=.TRUE., & seabed_z_floor=-opts%wtrdpth, seabed_kn=kn, seabed_cn=cn, & seabed_kbot=opts%kbot, seabed_contact_diameter=diam, & @@ -9097,7 +9113,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err ELSE IF (opts%has_current) THEN CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE., ba=ba, & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE., ba=ba, & ve_ea_d=ve_ead, ve_ba=ve_bas, ve_ba_d=ve_bad, ve_alpha_mbl=ve_ambl, ve_vbeta=ve_vbet, & current_profile_z=opts%current_profile_z, & current_profile_velocity=opts%current_profile_velocity, & @@ -9106,7 +9123,8 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err ELSE CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE., ba=ba, & + syrope_is=syrope_is, syrope_type=syrope_type, syrope_slow0=syrope_slow0, & + syrope_tmax0=syrope_tmax0, dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE., ba=ba, & ve_ea_d=ve_ead, ve_ba=ve_bas, ve_ba_d=ve_bad, ve_alpha_mbl=ve_ambl, ve_vbeta=ve_vbet) END IF IF (ErrStat /= CD_MODEL_OK) THEN @@ -9148,13 +9166,14 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err END IF END SUBROUTINE init_one_model - SUBROUTINE init_one_syrope_model(types, syt, ln, lts, secs, anchor, fairlead, l0, opts, & - static_cfg, dynamic_cfg, factors, bathymetry, model, ErrStat, ErrMsg) - !! Build one Syrope line model. The supported scope is a single-section taut line with - !! no hydro. Builds the working-curve constitutive from the parse-resolved OWC data and - !! solves the static equilibrium on the rest curve of the initial load history (the OWC - !! for a virgin rope; with SYROPE IC, the Tmax0 working curve below its top strain and - !! the OWC above): the secant EA of that curve at the solved mean strain. Each element + RECURSIVE SUBROUTINE init_one_syrope_model(types, syt, ln, sections, points, l0, opts, model, ErrStat, ErrMsg, & + bathymetry) + !! Build one Syrope line model: a single-section line, taut at init, with the seabed, + !! hydrodynamics and fluid fields of any EI = 0 line (init_one_model builds it). Builds the + !! working-curve constitutive from the parse-resolved OWC data and solves the static + !! equilibrium on the rest curve of the initial load history (the OWC for a virgin rope; + !! with SYROPE IC, the Tmax0 working curve below its top strain and the OWC above): the + !! secant EA of that curve at the solved mean strain, current drag included. Each element !! then gets the running maximum of that history and the slow 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 @@ -9162,55 +9181,37 @@ SUBROUTINE init_one_syrope_model(types, syt, ln, lts, secs, anchor, fairlead, l0 TYPE(DeckLineType), INTENT(IN) :: types(:) INTEGER, INTENT(IN) :: syt TYPE(DeckLine), INTENT(IN) :: ln - TYPE(CD_LineType), INTENT(INOUT) :: lts(:) - TYPE(CD_LineSection), INTENT(IN) :: secs(:) - REAL(wp), INTENT(IN) :: anchor(3), fairlead(3), l0(:), factors(:) + TYPE(DeckSection), INTENT(IN) :: sections(:) + TYPE(DeckPoint), INTENT(IN) :: points(:) + REAL(wp), INTENT(IN) :: l0(:) TYPE(DeckOptions), INTENT(IN) :: opts - TYPE(CableSolverConfig), INTENT(IN) :: static_cfg - TYPE(GenAlphaConfig), INTENT(IN) :: dynamic_cfg - TYPE(CD_BathymetryType), INTENT(IN), OPTIONAL :: bathymetry TYPE(CD_ModelType), INTENT(INOUT) :: model INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg + TYPE(CD_BathymetryType), INTENT(IN), OPTIONAL :: bathymetry TYPE(CD_SyropeType) :: td TYPE(CD_SyropeType), ALLOCATABLE :: stype(:) LOGICAL, ALLOCATABLE :: sis(:) - REAL(wp), ALLOCATABLE :: sslow(:), stmax(:), kn(:), diam(:), cn(:), t_static(:) - REAL(wp) :: eps0, t_ref, secant, total_l0, t_hist, eps_bar, t_mean_static - INTEGER :: ne, e, es, n_owc, iter + REAL(wp), ALLOCATABLE :: sslow(:), stmax(:), t_static(:) + REAL(wp) :: anchor(3), fairlead(3), eps0, t_ref, secant, total_l0, t_hist, eps_bar, t_mean_static + INTEGER :: ne, e, es, n_owc, iter, nsec CHARACTER(1024) :: em CHARACTER(24) :: s_eps, s_lo, s_hi - ! static seabed friction of this line: lay azimuth override [rad] and as-laid tension - REAL(wp), ALLOCATABLE :: lay_az_opt - REAL(wp) :: laid_t ErrStat = CD_DECKDRV_OK ErrMsg = '' - CALL line_static_friction(opts, ln%id, lay_az_opt, laid_t) - IF (SIZE(secs) /= 1) THEN + nsec = COUNT(sections%line_id == ln%id) + IF (nsec /= 1) THEN CALL fail(ErrStat, ErrMsg, 'a Syrope line must be a single section (composite Syrope lines are '// & 'not supported yet)'); RETURN END IF IF (types(syt)%ei > CD_ZERO) THEN CALL fail(ErrStat, ErrMsg, 'a Syrope line does not support finite-EI bending'); RETURN END IF - ! A flat WtrDpth seabed floor IS supported (a taut Syrope mooring clears it, so the - ! penalty contact stays inactive and the OWC-secant taut IC below is unchanged). - ! Structured bathymetry and hydro loads (current/waves/host fluid) are not supported. - IF (PRESENT(bathymetry)) THEN - CALL fail(ErrStat, ErrMsg, 'a Syrope line does not support a structured seabed (bathymetryFile); '// & - 'use WtrDpth'); RETURN - END IF - IF (opts%has_current) THEN - CALL fail(ErrStat, ErrMsg, 'a Syrope line does not support current hydro loads'); RETURN - END IF - IF (opts%has_wave) THEN - CALL fail(ErrStat, ErrMsg, 'a Syrope line does not support wave hydro loads'); RETURN - END IF - IF (opts%external_fluid) THEN - CALL fail(ErrStat, ErrMsg, 'a Syrope line does not support host-driven hydro loads'); RETURN - END IF + ! internal order anchor (End B) -> fairlead (End A), as gather_line_inputs + anchor = points(find_point(points, ln%nodeB))%pos + fairlead = points(find_point(points, ln%nodeA))%pos ! the working-curve constitutive from the parse-resolved OWC data CALL CD_Syrope_Init(td, types(syt)%syrope_owc_strain, types(syt)%syrope_owc_tension, & types(syt)%syrope_wc_mod, types(syt)%syrope_p1, types(syt)%syrope_p2, & @@ -9264,30 +9265,14 @@ SUBROUTINE init_one_syrope_model(types, syt, ln, lts, secs, anchor, fairlead, l0 DO e = 1, ne stype(e) = td END DO - IF (opts%has_wtrdpth) THEN - ! flat seabed floor at -WtrDpth: build the nodal penalty stiffness (inactive for a - ! taut line clearing the floor) so a coupled Syrope mooring inits like the EI=0 path - ALLOCATE (diam(ne)) - diam = types(syt)%diam - CALL CD_Nodal_Seabed_Stiffness(opts%kbot, diam, l0, kn, es, em) - IF (es /= CD_LINE_OK) THEN - CALL release_syrope() - CALL fail(ErrStat, ErrMsg, 'Syrope seabed stiffness: '//TRIM(em)); RETURN - END IF - ! carry the SAME contact physics the EI=0 WtrDpth branch does: normal damping cn - ! from cBot and Coulomb friction from frictionMu, so a Syrope node that reaches the - ! floor behaves identically to a plain EI=0 line (not just the spring alone) - ALLOCATE (cn(SIZE(kn))) - cn = kn*(opts%cbot/opts%kbot) - END IF - ! Static solve with a single secant EA (the line-local type's EA: lts is rebuilt - ! line-local by gather_line_inputs; secs(1)%line_type indexes it, NOT the global syt). - ! The secant is iterated to the rest curve at the solved mean strain, so the static - ! line carries the curve tension on average (a chord-strain secant misses it by the sag). + ! Static solve with a single secant EA, the line otherwise built as any EI = 0 line (seabed, + ! drag in the deck current, buoyancy). The secant is iterated to the rest curve at the solved + ! mean strain, so the static line carries the curve tension on average (a chord-strain + ! secant misses it by the sag and the current's deflection). DO iter = 1, 6 - lts(secs(1)%line_type)%ea = secant - CALL build_model(.FALSE.) - IF (ErrStat /= CD_MODEL_OK) EXIT + CALL init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry=bathymetry, & + syrope_secant=secant) + IF (ErrStat /= CD_DECKDRV_OK) EXIT CALL CD_Get_Model_Tension(model, t_static, es, em) CALL CD_End_Model(model, ErrStat, ErrMsg) IF (es /= CD_MODEL_OK) THEN @@ -9330,15 +9315,16 @@ SUBROUTINE init_one_syrope_model(types, syt, ln, lts, secs, anchor, fairlead, l0 ln%syrope_tmean0, ' N is superseded (the line starts at the equilibrium)' END IF END IF - CALL build_model(.TRUE.) + CALL init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry=bathymetry, & + syrope_secant=secant, syrope_is=sis, syrope_type=stype, syrope_slow0=sslow, & + syrope_tmax0=stmax) CALL release_syrope() - IF (ErrStat /= CD_MODEL_OK) THEN + IF (ErrStat /= CD_DECKDRV_OK) THEN ErrMsg = 'CableDyn_DeckDriver: Syrope model init failed: '//TRIM(ErrMsg) IF (ErrStat /= CD_DECKDRV_BADINPUT) ErrStat = CD_DECKDRV_SOLVEFAIL END IF CONTAINS - SUBROUTINE rest_tension(eps, tension, es_out, em_out) !! The static curve of the initial load history at strain eps: the OWC for a virgin !! rope (no SYROPE IC), the Tmax0 working curve / OWC (CD_Syrope_Static_Tension) with it. @@ -9355,44 +9341,6 @@ SUBROUTINE rest_tension(eps, tension, es_out, em_out) END IF END SUBROUTINE rest_tension - SUBROUTINE build_model(with_syrope) - !! The line build (static solve + model init) at the current secant EA; with_syrope - !! passes the per-element Syrope states, without it the build is the plain-EA probe - !! whose element tensions are the static solution. - LOGICAL, INTENT(IN) :: with_syrope - IF (opts%has_wtrdpth .AND. with_syrope) THEN - CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & - static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE., & - seabed_z_floor=-opts%wtrdpth, seabed_kn=kn, seabed_cn=cn, & - seabed_cn_over_kn=opts%cbot/opts%kbot, seabed_mu=opts%friction_mu, & - seabed_mu_axial=opts%friction_mu_axial, & - static_friction=opts%static_friction, lay_azimuth=lay_az_opt, & - as_laid_tension=laid_t, & - seabed_kbot=opts%kbot, seabed_contact_diameter=diam, & - syrope_is=sis, syrope_type=stype, syrope_slow0=sslow, syrope_tmax0=stmax) - ELSE IF (opts%has_wtrdpth) THEN - CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & - static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE., & - seabed_z_floor=-opts%wtrdpth, seabed_kn=kn, seabed_cn=cn, & - seabed_cn_over_kn=opts%cbot/opts%kbot, seabed_mu=opts%friction_mu, & - seabed_mu_axial=opts%friction_mu_axial, & - static_friction=opts%static_friction, lay_azimuth=lay_az_opt, & - as_laid_tension=laid_t, & - seabed_kbot=opts%kbot, seabed_contact_diameter=diam) - ELSE IF (with_syrope) THEN - CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & - static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE., & - syrope_is=sis, syrope_type=stype, syrope_slow0=sslow, syrope_tmax0=stmax) - ELSE - CALL CD_Init_Line_Model(model, anchor, fairlead, lts, secs, opts%g, opts%rhoW, .FALSE., & - static_cfg, dynamic_cfg, factors, ErrStat, ErrMsg, & - dynamic_tension_only=.TRUE., anchor_is_end_b=.TRUE.) - END IF - END SUBROUTINE build_model - SUBROUTINE release_syrope() !! Free the constitutive copies (the model deep-copies what it keeps). INTEGER :: k @@ -13118,10 +13066,6 @@ SUBROUTINE check_viv_columns(t, ErrStat, ErrMsg) IF (.NOT. (t%viv_cf > CD_ZERO .AND. t%viv_df >= CD_ZERO .AND. t%viv_df < t%viv_cf)) THEN CALL fail(ErrStat, ErrMsg, 'LINE TYPES VIV synchronisation band needs cF > 0 and 0 <= dF < cF'); RETURN END IF - IF (t%is_syrope) THEN - CALL fail(ErrStat, ErrMsg, 'LINE TYPES "'//TRIM(t%name)//'": VIV (Cl > 0) does not combine with the '// & - 'Syrope working-curve model'); RETURN - END IF END SUBROUTINE check_viv_columns SUBROUTINE parse_stiffness_columns(ea_str, ba_str, t, ErrStat, ErrMsg) diff --git a/tests/test_deck_driver.f90 b/tests/test_deck_driver.f90 index f7a302f1..c2081107 100644 --- a/tests/test_deck_driver.f90 +++ b/tests/test_deck_driver.f90 @@ -1196,15 +1196,24 @@ PROGRAM test_deck_driver CALL write_syrope_deck('deck_syrope_current.dat', 'SYROPE:syrope.dat|1.53e8|23.12', & '5.0e10|1.0e5', option_row='uniform 1.0 0.0 0.0 current') + ! a Syrope line takes the hydrodynamics of any EI = 0 line (MoorDyn's): current and waves CALL CD_Init_Deck_Models('deck_syrope_current.dat', smodels, es, em) - CALL require(es /= CD_DECKDRV_OK .AND. INDEX(em, 'current hydro') > 0, & - 'current-loaded Syrope fails closed by name: '//TRIM(em)) + CALL require(es == CD_DECKDRV_OK, 'current-loaded Syrope builds: '//TRIM(em)) + IF (es == CD_DECKDRV_OK) THEN + CALL require(smodels(1)%has_syrope .AND. smodels(1)%has_morison_drag, & + 'current-loaded Syrope keeps its working curve and takes the Morison drag') + CALL CD_End_Model(smodels(1), es, em) + END IF CALL write_syrope_deck('deck_syrope_wave.dat', 'SYROPE:syrope.dat|1.53e8|23.12', & '5.0e10|1.0e5', wtrdpth=10.0_wp, option_row='airy 1.0 8.0 0.0 waves') CALL CD_Init_Deck_Models('deck_syrope_wave.dat', smodels, es, em) - CALL require(es /= CD_DECKDRV_OK .AND. INDEX(em, 'wave hydro') > 0, & - 'wave-loaded Syrope fails closed by name: '//TRIM(em)) + CALL require(es == CD_DECKDRV_OK, 'wave-loaded Syrope builds: '//TRIM(em)) + IF (es == CD_DECKDRV_OK) THEN + CALL require(smodels(1)%has_syrope .AND. smodels(1)%has_morison_drag, & + 'wave-loaded Syrope keeps its working curve and takes the Morison drag') + CALL CD_End_Model(smodels(1), es, em) + END IF END BLOCK ! end-to-end Syrope deck build: a single-section taut line (no seabed/hydro) ! builds the DYNAMIC model through the OWC-secant static solve, initializes diff --git a/tests/test_syrope_hydro.py b/tests/test_syrope_hydro.py new file mode 100644 index 00000000..a91597a2 --- /dev/null +++ b/tests/test_syrope_hydro.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +"""Hydrodynamics of a Syrope polyester line against MoorDyn-C. + +A taut 88.5 m polyester line (D 0.203 m, 40 kg/m, 20 segments, Cd 1.2, Ca 1.0) from an anchor at +60 m depth to a fairlead at 20 m depth, 80 m away, with MoorDyn-C's linear working curve +(k1 1.25e8 N) over an OWC table T = 8.5e7 eps + 1.1e9 eps^2 N, alpha 1.53e8 N, beta 23.12, +BA_s|BA_d 5e10|1e5 N s and a SYROPE IC history (Tmax0 1.2 MN). The fairlead sways +2 sin(2 pi t/8) m across the line. MoorDyn-C v2.7.2 (RK2, dtM 5e-4 s; a driver that prescribes +the coupled point) gives a fairlead tension of 1 009 228.1 N at t = 0 and, over 24-40 s, a mean +of 1 029 671.6 N and a range of 44 782.4 N. Gates, CableDyn at dtM 0.01 s: + +* the fairlead tension at t = 0 and its mean over 24-40 s within 1e-5 of MoorDyn-C's, and its + range within 0.2 %; +* the line's drag and added mass act: without them (Cd = Ca = 0) the range grows by more + than 2 %; +* a cross current deflects the static start (mid-span 0.12 m) and holds the line still; +* VIV (Cl 0.8) in the current lifts the line (LINES Outputs flag V) and moves its tension; +* deck waves move the tension of the line held still. + +usage: test_syrope_hydro.py --exe --output

+""" + +from __future__ import annotations + +import argparse +import math +import os +import shutil +import subprocess +import sys +from pathlib import Path + +import numpy as np + +MDC_T0, MDC_MEAN, MDC_RANGE = 1009228.1, 1029671.6, 44782.4 +FAILURES: list[str] = [] + + +def check(ok: bool, message: str) -> None: + print(("PASS: " if ok else "FAIL: ") + message) + if not ok: + FAILURES.append(message) + + +def deck(hydro: str = "1.2 1.0 0.0 0.0", flags: str = "-", options: str = "", tmax: float = 40.0, + motion: bool = True) -> str: + return f"""--------------------- CableDyn Input File --- +Syrope polyester line with hydrodynamics +---------------------- LINE TYPES ---------------------------------- +LineType Diam MassDenInAir EA BA/-zeta EI Cd Ca CdAx CaAx +(-) (m) (kg/m) (N) (N-s/-) (N-m^2) (-) (-) (-) (-) +poly 0.203 40 SYROPE:syrope.dat|1.53e8|23.12 5.0e10|1.0e5 0.0 {hydro} +---------------------- POINTS -------------------------------------- +Node Type X Y Z M V CdA CA +(-) (-) (m) (m) (m) (kg) (m^3) (m^2) (-) +1 Fixed 0 0 -60 0 0 0 0 +2 Coupled 80 0 -20 0 0 0 0 +---------------------- LINES --------------------------------------- +Line LineType NodeA NodeB UnstrLen NumSegs Outputs +(-) (-) (-) (-) (m) (-) (-) +1 poly 2 1 88.5 20 {flags} +---------------------- SYROPE IC ---------------------------------- +Line(s) Tmax0 Tmean0 +(-) (N) (N) +1 1.2e6 1.0313e6 +---------------------- OPTIONS ----------------------------------- +9.80665 g +1025 rhoW +100 WtrDpth +{options}0.01 dtM +{tmax} TMax +{"motion.txt motionFile" if motion else ""} +---------------------- OUTPUTS ----------------------------------- +FairTen1 +L1N11PY +END +---------------------- need this line ---------------------------- +""" + + +def run(exe: str, out: Path, name: str, text: str) -> tuple[list[str], np.ndarray] | None: + (out / f"{name}.dat").write_text(text, encoding="utf-8", newline="\n") + proc = subprocess.run([exe, f"{name}.dat", name], cwd=out, capture_output=True, text=True, + env=dict(os.environ, OMP_NUM_THREADS="1")) + check(proc.returncode == 0, f"{name}: the run completes (exit {proc.returncode})") + if proc.returncode != 0: + print(proc.stdout[-1500:], proc.stderr[-1500:]) + return None + return table(out / f"{name}.out") + + +def table(path: Path) -> tuple[list[str], np.ndarray]: + lines = path.read_text().splitlines() + head = next(i for i, line in enumerate(lines) if line.startswith("Time")) + data = np.array([[float(v) for v in line.split()] for line in lines[head + 1:] + if line.strip() and not line.lstrip().startswith("(")]) + return lines[head].split("\t"), data + + +def main() -> int: + ap = argparse.ArgumentParser() + ap.add_argument("--exe", required=True) + ap.add_argument("--output", required=True) + args = ap.parse_args() + out = Path(args.output) + if out.exists(): + shutil.rmtree(out) + out.mkdir(parents=True) + eps = np.linspace(0.0, 0.06, 31) + (out / "owc.dat").write_text("Strain Tension\n(-) (N)\n" + "\n".join( + f"{e:.6e} {8.5e7 * e + 1.1e9 * e * e:.6e}" for e in eps)) + (out / "syrope.dat").write_text("owc.dat OWC\nLINEAR WCType\n1.25e8 k1\n0.0 k2\n") + w = 2.0 * math.pi / 8.0 + (out / "motion.txt").write_text("# time point x y z vx vy vz ax ay az\n" + "\n".join( + f"{k * 0.01:.6f} 2 80 {2 * math.sin(w * k * 0.01):.12e} -20 0 {2 * w * math.cos(w * k * 0.01):.12e} 0 " + f"0 {-2 * w * w * math.sin(w * k * 0.01):.12e} 0" for k in range(4001)) + "\n") + + sway = run(args.exe, out, "sway", deck()) + if sway: + t, ten = sway[1][:, 0], sway[1][:, sway[0].index("FairTen1")] + win = ten[(t >= 24.0) & (t <= 40.0)] + t0, mean, span = float(ten[0]), float(win.mean()), float(np.ptp(win)) + check(abs(t0 - MDC_T0) <= 1.0e-5 * MDC_T0, f"fairlead tension at t = 0: {t0:.1f} N, MoorDyn-C {MDC_T0} N") + check(abs(mean - MDC_MEAN) <= 1.0e-5 * MDC_MEAN, + f"mean fairlead tension over 24-40 s: {mean:.1f} N, MoorDyn-C {MDC_MEAN} N") + check(abs(span - MDC_RANGE) <= 2.0e-3 * MDC_RANGE, + f"fairlead tension range over 24-40 s: {span:.1f} N, MoorDyn-C {MDC_RANGE} N") + dry = run(args.exe, out, "sway_dry", deck(hydro="0.0 0.0 0.0 0.0")) + if dry: + td, tend = dry[1][:, 0], dry[1][:, dry[0].index("FairTen1")] + dspan = float(np.ptp(tend[(td >= 24.0) & (td <= 40.0)])) + check(dspan > 1.02 * span, f"without drag and added mass the range grows: {dspan:.1f} N against " + f"{span:.1f} N") + + current = "uniform 0.0 1.0 0.0 current\n" + cur = run(args.exe, out, "current", deck(options=current, tmax=10.0, motion=False)) + if cur: + y = cur[1][:, cur[0].index("L1N11PY")] + ten = cur[1][:, cur[0].index("FairTen1")] + check(y[0] > 0.1 and np.ptp(y) < 1.0e-6 and np.ptp(ten) < 1.0, + f"a 1 m/s cross current deflects the static start (mid-span {y[0]:.3f} m) and holds it") + viv = run(args.exe, out, "viv", deck(hydro="1.2 1.0 0.0 0.0 0.8", flags="V", options=current, tmax=20.0, + motion=False)) + if viv: + ten = viv[1][:, viv[0].index("FairTen1")] + names, lift = table(out / "viv.Line1.V.out") + lz = lift[:, names.index("Node11LiftZ(N)")] + check(lz.std() > 50.0 and ten.std() > 100.0, + f"VIV in the current: mid-span lift std {lz.std():.1f} N, fairlead tension std {ten.std():.1f} N") + waves = run(args.exe, out, "waves", deck(options="airy 4.0 8.0 0.0 waves\n", tmax=16.0, motion=False)) + if waves: + ten = waves[1][:, waves[0].index("FairTen1")] + check(ten.std() > 10.0, f"deck waves move the tension of the held line (std {ten.std():.1f} N)") + print(f"{len(FAILURES)} failure(s)") + return 1 if FAILURES else 0 + + +if __name__ == "__main__": + sys.exit(main()) From 7a91aecbac4fec0b66b9d05359a89d8d8f065541 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 29 Oct 2026 14:46:42 +0900 Subject: [PATCH 4/4] fix(outputs): key the CurvX/CurvY cache on the torsion state too At a bending-pinned End A restrained in torsion, a host rotation turns the committed torsion end frames and torque without moving q, v, a, the time or the load epoch, and the reference normal stays fixed (no parent end connection). The section-curvature cache then served the components of the frames before the rotation. The key now holds the torsion end frames, Theta, Phi and the torque. section_curvature turns the host 30 degrees about the End A tangent of such a line and requires the next evaluation to equal a fresh one. Signed-off-by: Jae Hoon Seo --- src/CableDyn_OpenFAST_HermiteFMF.f90 | 12 ++++-- tests/test_section_curvature.f90 | 62 ++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/src/CableDyn_OpenFAST_HermiteFMF.f90 b/src/CableDyn_OpenFAST_HermiteFMF.f90 index 588d8f96..c4588703 100644 --- a/src/CableDyn_OpenFAST_HermiteFMF.f90 +++ b/src/CableDyn_OpenFAST_HermiteFMF.f90 @@ -154,10 +154,11 @@ MODULE CableDyn_OpenFAST_HermiteFMF REAL(wp) :: sect_ref_global(3) = CD_ZERO REAL(wp) :: sect_ref_parent(3) = CD_ZERO ! the last CD_HFMF_Section_Curvature result and the state it was evaluated at (time, load - ! epoch, reference, q, v, a): the channels of one output row share one evaluation + ! epoch, reference, q, v, a and, in torsion, the end frames, Theta, Phi and the torque, which + ! a host rotation turns without moving q): the channels of one output row share one evaluation LOGICAL :: sc_valid = .FALSE. INTEGER :: sc_epoch = -1 - REAL(wp) :: sc_t = CD_ZERO, sc_ref(3) = CD_ZERO + REAL(wp) :: sc_t = CD_ZERO, sc_ref(3) = CD_ZERO, sc_tors(15) = CD_ZERO REAL(wp), ALLOCATABLE :: sc_q(:), sc_v(:), sc_a(:), sc_kx(:), sc_ky(:) LOGICAL :: initialized = .FALSE. END TYPE CD_HFMF_ModuleType @@ -1488,7 +1489,7 @@ SUBROUTINE CD_HFMF_Section_Curvature(self, kx, ky, ErrStat, ErrMsg) REAL(wp), INTENT(OUT) :: kx(:), ky(:) INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg - REAL(wp) :: r(3) + REAL(wp) :: r(3), tors(15) INTEGER :: es, nn CHARACTER(1024) :: em ErrStat = CD_HFMF_OK; ErrMsg = '' @@ -1508,9 +1509,13 @@ SUBROUTINE CD_HFMF_Section_Curvature(self, kx, ky, ErrStat, ErrMsg) r = self%sect_ref_global END IF r = frame_to_local(self, r) + tors = CD_ZERO + IF (self%line%torsion%active) tors = [RESHAPE(self%line%torsion%ends, [12]), self%line%torsion%theta, & + self%line%torsion%phi, self%line%torsion%torque] IF (self%sc_valid .AND. self%sc_epoch == self%line%rc_epoch) THEN ! exact equality (a NaN never matches) IF (ALL(ABS(self%sc_ref - r) <= CD_ZERO) .AND. ABS(self%sc_t - self%line%t) <= CD_ZERO .AND. & + ALL(ABS(self%sc_tors - tors) <= CD_ZERO) .AND. & ALL(ABS(self%sc_q - self%line%q) <= CD_ZERO) .AND. ALL(ABS(self%sc_v - self%line%v) <= CD_ZERO) .AND. & ALL(ABS(self%sc_a - self%line%a) <= CD_ZERO)) THEN kx = self%sc_kx @@ -1524,6 +1529,7 @@ SUBROUTINE CD_HFMF_Section_Curvature(self, kx, ky, ErrStat, ErrMsg) ErrStat = CD_HFMF_BADINPUT; ErrMsg = 'CD_HFMF_Section_Curvature: '//TRIM(em); RETURN END IF self%sc_ref = r + self%sc_tors = tors self%sc_t = self%line%t self%sc_epoch = self%line%rc_epoch self%sc_q = self%line%q diff --git a/tests/test_section_curvature.f90 b/tests/test_section_curvature.f90 index 3db48387..670102b7 100644 --- a/tests/test_section_curvature.f90 +++ b/tests/test_section_curvature.f90 @@ -14,11 +14,14 @@ PROGRAM test_section_curvature !! (End A clamped): the components rotate by -30 degrees at every node; !! 5. on a line restrained in torsion with a 90 degree pretwist at End B, the section axis x !! leaves End A on its torsion normal Nx and reaches End B turned 90 degrees about the - !! tangent, onto End B's own pretwisted normal. + !! tangent, onto End B's own pretwisted normal; + !! 6. with End A bending-pinned and restrained in torsion, turning the host about the End A + !! tangent turns the torsion frames only; the next evaluation is not the cached one but the + !! same as a fresh evaluation. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Init_Deck_HermiteCable, CD_Run_Deck_Driver, CD_DECKDRV_OK USE CableDyn_OpenFAST_HermiteFMF, ONLY: CD_HFMF_ModuleType, CD_HFMF_Curvature, CD_HFMF_Section_Curvature, & - CD_HFMF_End, CD_HFMF_OK + CD_HFMF_SetCoupledKinematics, CD_HFMF_End, CD_HFMF_OK USE CableDyn_HermiteCableDynamic, ONLY: CD_HermiteCable_Dyn_Section_Curvature, CD_HCDYN_OK IMPLICIT NONE @@ -55,6 +58,8 @@ PROGRAM test_section_curvature CALL parent_roll() ! 5. torsion CALL torsion_frame() + ! 6. the torsion frames turned by the host, End A pinned in bending + CALL torsion_pinned_rotation() IF (nfail > 0) THEN WRITE (*, '(A,I0,A)') 'FAIL: ', nfail, ' assertion(s) failed' @@ -157,6 +162,48 @@ SUBROUTINE parent_roll() CALL CD_HFMF_End(cable) END SUBROUTINE parent_roll + SUBROUTINE torsion_pinned_rotation() + TYPE(CD_HFMF_ModuleType) :: cable + REAL(wp), ALLOCATABLE :: kx0(:), ky0(:), kx1(:), ky1(:), kx2(:), ky2(:) + REAL(wp) :: t(3), r(3, 3), ca, sa, pos(3), zero3(3) + INTEGER :: es, cn, nn, i, j + CHARACTER(1024) :: em + CALL write_deck('sc_tpin.dat', 0.0_wp, [0.0_wp, 0.0_wp, 0.0_wp], .TRUE., 90.0_wp, pinned_a=.TRUE.) + CALL CD_Init_Deck_HermiteCable('sc_tpin.dat', 0.1_wp, cable, cn, es, em, host_orientation=.TRUE.) + CALL require(es == CD_DECKDRV_OK, 'pinned torsion: build: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + CALL require(.NOT. cable%has_parent_endconn, 'pinned torsion: End A carries no bending connection') + nn = cable%line%nn + ALLOCATE (kx0(nn), ky0(nn), kx1(nn), ky1(nn), kx2(nn), ky2(nn)) + CALL CD_HFMF_Section_Curvature(cable, kx0, ky0, es, em) + CALL require(es == CD_HFMF_OK, 'pinned torsion: section curvature: '//TRIM(em)) + ! the host turned 30 degrees about the End A -> End B tangent: global-to-parent DCM R^T + t = -cable%line%q(6*(nn - 1) + 4:6*(nn - 1) + 6) + t = t/NORM2(t) + ca = COS(PI/6.0_wp) + sa = SIN(PI/6.0_wp) + DO i = 1, 3 + DO j = 1, 3 + r(i, j) = ca*MERGE(1.0_wp, 0.0_wp, i == j) + (1.0_wp - ca)*t(i)*t(j) + END DO + END DO + r(1, 2) = r(1, 2) - sa*t(3); r(2, 1) = r(2, 1) + sa*t(3) + r(1, 3) = r(1, 3) + sa*t(2); r(3, 1) = r(3, 1) - sa*t(2) + r(2, 3) = r(2, 3) - sa*t(1); r(3, 2) = r(3, 2) + sa*t(1) + pos = cable%line%q(6*(nn - 1) + 1:6*(nn - 1) + 3) + zero3 = 0.0_wp + CALL CD_HFMF_SetCoupledKinematics(cable, pos, zero3, zero3, es, em, TRANSPOSE(r), zero3, zero3) + CALL require(es == CD_HFMF_OK, 'pinned torsion: host rotation: '//TRIM(em)) + CALL CD_HFMF_Section_Curvature(cable, kx1, ky1, es, em) + cable%sc_valid = .FALSE. + CALL CD_HFMF_Section_Curvature(cable, kx2, ky2, es, em) + CALL require(MAXVAL(ABS(kx1 - kx0)) + MAXVAL(ABS(ky1 - ky0)) > 0.0_wp, & + 'pinned torsion: the turned torsion frames turn the components') + CALL require(MAXVAL(ABS(kx1 - kx2)) <= 0.0_wp .AND. MAXVAL(ABS(ky1 - ky2)) <= 0.0_wp, & + 'pinned torsion: the evaluation after the host rotation is the fresh one, not the cached one') + CALL CD_HFMF_End(cable) + END SUBROUTINE torsion_pinned_rotation + SUBROUTINE torsion_frame() TYPE(CD_HFMF_ModuleType) :: cable REAL(wp), ALLOCATABLE :: kx(:), ky(:), fr(:, :), k(:) @@ -188,7 +235,7 @@ SUBROUTINE torsion_frame() CALL CD_HFMF_End(cable) END SUBROUTINE torsion_frame - SUBROUTINE write_deck(path, heading_deg, current, torsion, pretwist_b, node_channels) + SUBROUTINE write_deck(path, heading_deg, current, torsion, pretwist_b, node_channels, pinned_a) !! A 170 m lazy-wave cable from a hang-off at 14 m depth to an anchor at 80 m, clamped at End A, !! turned by heading_deg about the vertical through the origin, in the uniform current !! (given before the turn). torsion: both ends restrained in torsion, Nx along +y, Pretwist @@ -198,6 +245,9 @@ SUBROUTINE write_deck(path, heading_deg, current, torsion, pretwist_b, node_chan LOGICAL, INTENT(IN) :: torsion ! node_channels: write Curv, CurvX, CurvY of every eighth node, and run to TMax = 0 LOGICAL, INTENT(IN), OPTIONAL :: node_channels + ! pinned_a: End A pinned in bending (still restrained in torsion) + LOGICAL, INTENT(IN), OPTIONAL :: pinned_a + CHARACTER(8) :: stiff_a REAL(wp) :: c, s, pa(3), pb(3), eza(3), ezb(3), nx(3), cu(3) INTEGER :: u, j LOGICAL :: nodes @@ -242,7 +292,11 @@ SUBROUTINE write_deck(path, heading_deg, current, torsion, pretwist_b, node_chan IF (torsion) THEN WRITE (u, '(A)') 'LineID End Stiffness EzX EzY EzZ TorsStiffness NxX NxY NxZ Pretwist' WRITE (u, '(A)') '(-) (-) (N-m/rad) (-) (-) (-) (N-m/rad) (-) (-) (-) (deg)' - WRITE (u, '(A,3F12.8,A,3F12.8,A)') '1 A Rigid ', eza, ' Rigid ', nx, ' 0.0' + stiff_a = 'Rigid' + IF (PRESENT(pinned_a)) THEN + IF (pinned_a) stiff_a = 'Pinned' + END IF + WRITE (u, '(A,3F12.8,A,3F12.8,A)') '1 A '//TRIM(stiff_a)//' ', eza, ' Rigid ', nx, ' 0.0' WRITE (u, '(A,3F12.8,A,3F12.8,F8.2)') '1 B Rigid ', ezb, ' Rigid ', nx, pretwist_b ELSE WRITE (u, '(A)') 'LineID End Stiffness EzX EzY EzZ'