From a03044c1fa207ae51f172d6a37fa028af1896bb7 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Tue, 27 Oct 2026 14:53:22 +0900 Subject: [PATCH] fix(outputs): note that line nodes are numbered from 1, MoorDyn's from 0 CableDyn numbers a line's nodes from 1 at End A, while MoorDyn-C and MoorDyn-F number them from 0 at End A, and CableDyn runs a line written anchor-first from its fairlead. A MoorDyn deck's LN therefore named another node without notice: on the VIV benchmark L1N12 read the node at 22 m where MoorDyn reads 24 m. The numbering stays; a run whose OUTPUTS name line nodes, or whose LINES Outputs flag writes the per-line files, now prints a note giving the correspondence (N, or N on an anchor-first line), on the standalone driver and in OpenFAST. The outputs and migration pages state it. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 5 +++++ doc/migrating.rst | 9 +++++++-- doc/options.rst | 3 ++- doc/outputs.rst | 9 +++++++++ src/CableDyn_DeckDriver.f90 | 22 ++++++++++++++++++++++ src/openfast/CableDyn_OF.f90 | 11 ++++++++++- tests/test_ei0_slack_dynamics.f90 | 8 ++++++++ 7 files changed, 63 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02657bfa..4ed0bbc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,11 @@ All notable changes to CableDyn are recorded in this file. The format follows - 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. +- A run whose outputs name line nodes (`LN…`, `TenN` and the other node channels, or a + LINES `Outputs` flag) notes that CableDyn numbers line nodes from 1 at End A while MoorDyn + numbers them from 0, so a MoorDyn deck's `N` is CableDyn's `N`, or `N` on + a line written anchor-first. The numbering itself is unchanged; the outputs and migration pages + state it. ### Fixed diff --git a/doc/migrating.rst b/doc/migrating.rst index 66cf82f4..ba7cf3f1 100644 --- a/doc/migrating.rst +++ b/doc/migrating.rst @@ -154,8 +154,13 @@ What differs on purpose * - Unsupported input - rejected at parse time with a message naming the feature, never silently ignored * - Node identity - - CableDyn meshes are its own; MoorDyn node numbers and rod-node histories are not - reproduced + - line nodes are numbered from 1 at End A, MoorDyn's from 0 at its End A, so a MoorDyn + deck's ``LN`` names another node here: MoorDyn's ``N`` is CableDyn's ``N`` + on a line kept in the order written, and ``N`` on a line written + anchor-first, which CableDyn runs from its fairlead (see above and + :ref:`node numbering `). A run reporting line nodes notes + the difference. Rod nodes keep MoorDyn's numbering (node 0 = End A); rod-node histories + are not reproduced Inside OpenFAST ~~~~~~~~~~~~~~~ diff --git a/doc/options.rst b/doc/options.rst index 936b05ac..7acce5e1 100644 --- a/doc/options.rst +++ b/doc/options.rst @@ -791,7 +791,8 @@ These names exist so a migrated MoorDyn deck fails less often at the syntax boun Other MoorDyn constructs that fail by name rather than as unknown input: ``CoupledPinned`` bodies, and ``CoupledPinned``/``VesselPinned`` rods outside a coupled host (they run in OpenFAST, see -:doc:`openfast`). Line-node output channels start at node 1 (``N0`` is rejected), and a number +:doc:`openfast`). Line-node output channels start at node 1 (``N0`` is rejected; MoorDyn numbers from 0, see +:ref:`node numbering `), and a number with a sign inside its mantissa (such as ``1+2``) is rejected instead of being read up to the sign. Water-kinematics sources diff --git a/doc/outputs.rst b/doc/outputs.rst index 3eac9688..c8cd7872 100644 --- a/doc/outputs.rst +++ b/doc/outputs.rst @@ -477,6 +477,15 @@ numeric id written with leading zeros (``Ten1N02`` = ``Ten1N2``), or an alias sp ``LINES`` and ``POINTS`` ids (not array positions); ```` is a node number on line ````, 1 = End A to ``N`` = End B, where ``N`` = 1 + the total ``NumSegs`` of the line's sections. +.. _outputs-moordyn-node-numbers: + +This is **not MoorDyn's numbering**. MoorDyn numbers a line's nodes from 0 at its End A +(``AttachA``) to ``NumSegs``, so on a line kept in the order written ``LN`` here is MoorDyn's +``LN``. A line written anchor-first (``AttachA`` a ``Fixed`` anchor, ``AttachB`` the +fairlead) runs from its fairlead here (:doc:`migrating`), so its ``N`` is MoorDyn's +``N``. The per-line files (``Node…`` columns) number the same way. A run whose +outputs name line nodes says so in a note, and ``N0`` is rejected rather than read as another node. + .. _outputs-refined-nodes: Node channels on a refined line diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 49aaf8e7..b539047b 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -245,6 +245,15 @@ MODULE CableDyn_DeckDriver REAL(wp), SAVE :: probe_v0(3) = 0.0_wp, probe_w0(3) = 0.0_wp REAL(wp), ALLOCATABLE, SAVE :: probe_rec(:, :) INTEGER, PARAMETER, PUBLIC :: CD_DECKDRV_OK = 0, CD_DECKDRV_BADINPUT = 1, CD_DECKDRV_SOLVEFAIL = 2 + ! Printed by a run that reports line nodes (an OUTPUTS channel CD_Is_Line_Node_Channel names, or + ! a LINES Outputs flag): CableDyn numbers a line's nodes from 1 = End A, MoorDyn from 0 = its End + ! A, and CableDyn runs a line written anchor-first from its fairlead (normalize_stock_endpoint_order), + ! so a MoorDyn deck's line-node channels would otherwise name other nodes without notice. + CHARACTER(*), PARAMETER, PUBLIC :: CD_LINE_NODE_NUMBERING_NOTE = 'line nodes are numbered from 1 = End '// & + 'A in the channels and line files, MoorDyn''s from 0: N here is '// & + 'MoorDyn''s N, or N on a line written anchor-first, '// & + 'which CableDyn runs from its fairlead (End A)' + PUBLIC :: CD_Is_Line_Node_Channel ! Deck token / OUTPUTS channel-name length. Public so the aggregate facade can declare its ! retained channel-name store with a matching length. @@ -7924,6 +7933,9 @@ SUBROUTINE run_deck_driver(deck_path, out_root, converged, ErrStat, ErrMsg) CALL parse_deck(deck_path, types, bodies, rod_types, rods, points, lines, sections, opts, channels, & ErrStat, ErrMsg, failures=fails) IF (ErrStat /= 0) RETURN + IF (ANY([(CD_Is_Line_Node_Channel(channels(j)), j=1, SIZE(channels))]) .OR. & + ANY([(line_outputs_requested(lines(j)%outputs), j=1, SIZE(lines))])) & + WRITE (output_unit, '(A)') ' Note: '//CD_LINE_NODE_NUMBERING_NOTE//'.' ! Torsion (both ends of a line torsionally restrained) runs on the standalone cubic-Hermite ! route and the multibody march, in statics and dynamics (quasi-static torsion: no torsional ! inertia). One restrained end carries no torque (the other end is free to twist), so it is @@ -32378,6 +32390,16 @@ SUBROUTINE check_channel(ch, lines, points, sections, ErrStat, ErrMsg, bodies, r END IF END SUBROUTINE check_channel + LOGICAL FUNCTION CD_Is_Line_Node_Channel(ch) RESULT(yes) + !! True for an OUTPUTS channel that names a node of a line (TenN, Curv, BendMom, StfMom, + !! Torq, TwistN, LN...), whose node numbering differs from MoorDyn's + !! (CD_LINE_NODE_NUMBERING_NOTE); the line total Twist names no node. + CHARACTER(*), INTENT(IN) :: ch + INTEGER :: line_id, node_id, kind, comp + CALL parse_line_node_channel(ch, line_id, node_id, kind, comp) + yes = kind /= 0 .AND. kind /= 11 + END FUNCTION CD_Is_Line_Node_Channel + PURE LOGICAL FUNCTION names_node_zero(lo) RESULT(yes) !! True when a lower-cased line-node channel names node 0 ("...n0" at the end or before !! a letter), the MoorDyn End A numbering. diff --git a/src/openfast/CableDyn_OF.f90 b/src/openfast/CableDyn_OF.f90 index 2e13f9c0..9fc90ee1 100644 --- a/src/openfast/CableDyn_OF.f90 +++ b/src/openfast/CableDyn_OF.f90 @@ -72,7 +72,8 @@ MODULE CableDyn USE CableDyn_Precision, ONLY: wp USE CableDyn_Conventions, ONLY: CD_NATIVE_CHANNEL_FMT USE CableDyn_Hydro, ONLY: CD_Current_Profile_Velocity, CD_SeaState_Steady_Current, CD_HYDRO_OK - USE CableDyn_DeckDriver, ONLY: CD_Deck_Query_dtM, CD_DECKDRV_OK + USE CableDyn_DeckDriver, ONLY: CD_Deck_Query_dtM, CD_DECKDRV_OK, CD_Is_Line_Node_Channel, & + CD_LINE_NODE_NUMBERING_NOTE USE CableDyn_OpenFAST_Aggregate, ONLY: CD_AGG_ModuleType, CD_AGG_Init_From_Deck, CD_AGG_UpdateStates_Moving, & CD_AGG_Step_Moving, CD_AGG_CalcOutput, CD_AGG_GetMovingPointMesh, & CD_AGG_Snapshot, CD_AGG_Restore, & @@ -306,6 +307,14 @@ SUBROUTINE open_native_outputs( id, root, t_start, ErrStat, ErrMsg, write_profil nch = CD_AGG_NumChannels(Inst(id)%agg) IF (nch <= 0) RETURN + ! MoorDyn numbers line nodes from N0, CableDyn from N1: say so as the standalone driver does + DO ic = 1, nch + CALL CD_AGG_ChannelHeader(Inst(id)%agg, ic, hdr, unt, es, em) + IF (es /= CD_AGG_OK) EXIT + IF (.NOT. CD_Is_Line_Node_Channel(hdr)) CYCLE + CALL WrScr( ' Note: '//CD_LINE_NODE_NUMBERING_NOTE//'.' ) + EXIT + END DO ! One run-level path has one owner. A rebuilt state must adopt the existing ! unit through restore_native_outputs rather than attempting a second OPEN. DO owner = 1, SIZE(Inst) diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index 5cefc951..e7157fe3 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -816,6 +816,14 @@ SUBROUTINE case_run_audit() CALL require(ok, 'audit:rhoinf-run') CALL require(file_contains('ei0slack_audit_rho.log', 'Note: rhoInf = 0.990 leaves almost no numerical'), & 'audit:rhoinf-note') + ! line nodes are numbered from 1 = End A, MoorDyn's from 0: noted when a run reports line nodes + CALL require(.NOT. file_contains('ei0slack_audit_rho.log', 'line nodes are numbered from 1'), & + 'audit:no-node-numbering-note') + CALL light_cable_deck('ei0slack_audit_node.dat', 0.1_wp, 1.0_wp, '', 'p') + CALL run_driver_logged('ei0slack_audit_node.dat', 'ei0slack_audit_node', 'ei0slack_audit_node.log', ok) + CALL require(ok, 'audit:node-run') + CALL require(file_contains('ei0slack_audit_node.log', 'Note: line nodes are numbered from 1 = End A'), & + 'audit:node-numbering-note') ! a 10 m sway at dtM 0.2 s turns the segments by several degrees per step: taken as given ! (off ei0_substeps) the run notes the turn CALL write_motion('ei0slack_sway.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 2, 10.0_wp, 10.0_wp, 10.0_wp, &