Skip to content

Commit 05f795b

Browse files
authored
fix(viv): MoorDyn's lift direction on either deck order; VIVphaseSeed (#111)
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
1 parent b8bb4b4 commit 05f795b

12 files changed

Lines changed: 263 additions & 75 deletions

‎VALIDATION.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ article's methods, are compared in
6262
| **L2-V** | VolturnUS-S anchor tension | closed-form catenary | 0.77% | <3% | Pass |
6363
| **L2-80** | Lozon 80 m all-chain mooring | catenary (H) / MoorDyn-F (fairlead) | 0.03% / 1.8% | <2% / <5% | Pass |
6464
| **L2-arb** | Closed-form catenary reference check | OrcaFlex VolturnUS-S ref | 0.69% | <2% | Pass |
65-
| **L2-VIV** | Cross-flow VIV lock-in of a taut 100 m line, U = 0.06–0.42 m/s | MoorDyn-F (OpenFAST v5 `moordyn_driver`, `dtM` 5e-4 s) | mode-1 and mode-3 lock-in (U ≤ 0.18 and ≥ 0.36 m/s): mid-span A/D within 1.2%, frequency within one spectral bin; same response at `dtM` 5e-4 to 1e-2 s; at 0.21–0.33 m/s the codes settle on different modes (MoorDyn-F mode 1, CableDyn mode 2) | A/D <3%, frequency within one spectral bin (`viv_lockin`) | Pass scoped |
65+
| **L2-VIV** | Cross-flow VIV lock-in of a taut 100 m line, U = 0.06–0.42 m/s | MoorDyn-C v2.7.2 (RK2, `dtM` 5e-4 s) and MoorDyn-F (OpenFAST v5 `moordyn_driver`, `dtM` 5e-4 s) | mode-1 and mode-3 lock-in (U ≤ 0.18 and ≥ 0.36 m/s): mid-span A/D within 1.2% of MoorDyn-F, frequency within one spectral bin; same response at `dtM` 5e-4 to 1e-2 s. At 0.21–0.33 m/s two branches coexist (a run ramped up from 0.18 m/s stays in mode 1, one ramped down from 0.30 m/s stays in mode 2): from rest CableDyn and MoorDyn-C settle in mode 2 (U 0.24 m/s: A/D 0.575 against 0.574 at x/L 0.24, same frequency); MoorDyn-F, whose phases start at zero (it does not carry its seed into its state), in mode 1, which `zero VIVphaseSeed` reproduces (0.701 against 0.699, transient to four digits) | A/D <3%, frequency within one spectral bin; band: 3% (MoorDyn-C), 1% (MoorDyn-F) (`viv_lockin`) | Pass |
6666
| **L2-VIV-riser** | Catenary riser of Thorsen et al. in a uniform 0.2 m/s current (MoorDyn-C's VIV test: D 0.024 m, EI 10.5 N m², 100 segments, `Cl` 0.7), deck written anchor first | measured cross-flow frequency 1.04 Hz; MoorDyn-C v2.7.2 (RK4, `dtM` 1e-4 s) | over 20–40 s at `dtM` 1e-3 s: mean fairlead tension 69.92 N against 69.93 N, range 3.73 N against 3.72 N, tension period 0.4853 s against the measured 0.4808 s and MoorDyn-C's 0.4811 s (0.4843 / 0.4829 s at `dtM` 5e-4 / 2.5e-4 s) | mean 0.2%, range 10%, period 1.5% (`viv_riser`) | Pass |
6767
| **L2-VIV-EI** | Cross-flow VIV of a finite-EI cable: the L2-VIV line with EI = 1 N m², and a bending-stiff line (EA 5e9 N, EI 5e7 N m², β = π²EI/(TL²) ≈ 1, neutrally buoyant) against the EI = 0 string of equal first-mode frequency, U = 0.10–0.36 m/s | CableDyn `EI = 0` line (verification) | EI = 1: mid/quarter A/D 0.662/0.421 against 0.663/0.421, same frequency, at `dtM` 5e-4 to 1e-2 s; stiff line: mode-1 lock-in A/D within 2.5% of the string's at the same frequency for U ≤ 0.24 m/s; for U ≥ 0.27 m/s the string jumps to mode 2 while the stiff line stays in mode 1 (bending raises f₂/f₁ to 3.15) | EI = 1: A/D within 1% at `dtM` 0.01 and 0.002 s (5e-4 s run once over 200 s); stiff line at U 0.21 m/s: A/D within 3%; frequency within one spectral bin; at U 0.30 m/s stiff line A/D > 0.6, string < 0.15 (`viv_lockin`, `hermite_viv`) | Pass |
6868
| **L3-1** | WD0050 static | OrcaFlex | 0.15 / 0.85% | <2% | Pass |

‎doc/options.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,15 @@ Ambient fluid and prescribed motion
695695
different ``dtM`` with the same averaging time
696696
- lines with a LINE TYPES ``Cl > 0``, on every route
697697
- ``0.25 VIVrmsWindow``
698+
* - ``VIVphaseSeed`` / ``viv_phase_seed``
699+
- mode
700+
- ``spread``
701+
- the initial phases of the VIV synchronisation model (:ref:`theory-viv`): ``spread`` starts
702+
node ``i`` from the deck's End A at ``2 pi i/N``, as MoorDyn-C; ``zero`` starts every node
703+
at zero, where MoorDyn-F in OpenFAST v5.0.0 starts (it does not carry its seed into its
704+
state). Where two lock-in branches coexist, the seed selects the one a run settles on
705+
- lines with a LINE TYPES ``Cl > 0``, on every route
706+
- ``zero VIVphaseSeed``
698707
* - ``motionFile``
699708
- path, or ``0``/``none``
700709
- absent

‎doc/theory.rst‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,10 +1037,24 @@ so the shedding frequency locks onto the cross-flow motion inside the band
10371037
:math:`c_F \pm d_F` (MoorDyn's defaults 0.18 and 0.08). The running RMS values average over
10381038
``VIVrmsWindow`` seconds, by default 500 steps of ``dtM`` as in MoorDyn, and the phases start at
10391039
:math:`2\pi i/N` at node :math:`i` counted from the deck's End A (MoorDyn's ``AttachA``), also on
1040-
a line written anchor first, which the reader turns around. On a finite-EI mesh the static solve
1040+
a line written anchor first, which the reader turns around. The node tangent
1041+
:math:`\mathbf{q}` runs from End A to End B, as MoorDyn's; turning it around turns the lift and
1042+
:math:`\mathbf{e}` around and starts the same motion from the phases plus :math:`\pi`, with
1043+
:math:`\phi_{\dot y} = \pi` instead of MoorDyn's 0 at a node with no cross-flow motion (a node at
1044+
rest, a held end of a finite-EI cable), so the lift field is MoorDyn's whichever end a deck writes
1045+
first. On a finite-EI mesh the static solve
10411046
refined, the deck nodes keep that seed and the nodes it added take the seed interpolated in
10421047
arc length. The static equilibrium carries no lift.
10431048

1049+
The seed decides which response the line settles on where two lock-in branches coexist. On the
1050+
taut line of the ``viv_lockin`` test, between about 0.21 and 0.33 m/s, a line locked in its first
1051+
mode at 0.18 m/s stays there as the current rises, while one coming down from 0.30 m/s stays in
1052+
its second mode, and a start from rest with the spread seed settles in the second mode, as
1053+
MoorDyn-C does. MoorDyn-F (v2.3.8, OpenFAST v5.0.0) sets the same seed but does not copy it into
1054+
the state vector it integrates, so its phases start at zero at every node: a uniform lift that
1055+
excites the symmetric modes only, after which the line stays in its first mode. ``zero
1056+
VIVphaseSeed`` starts every phase at zero, and reproduces that start (:doc:`options`).
1057+
10441058
In the implicit step the phase is explicit: the step's lift takes the phase predicted at
10451059
:math:`t_{n+1}` from the step-start rate (the generalised-α level under the configuration blend),
10461060
and the committed phase is the trapezoidal (Heun) update with the rate at the converged end

‎python/cabledyn/deck_file.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@
231231
"max_strain": "max_strain",
232232
"vivrmswindow": "viv_rms_window",
233233
"viv_rms_window": "viv_rms_window",
234+
"vivphaseseed": "viv_phase_seed",
235+
"viv_phase_seed": "viv_phase_seed",
234236
"rangestart": "range_start",
235237
"range_start": "range_start",
236238
"waveseed": "wave_seed",
@@ -1332,6 +1334,8 @@ def _scalar_option_value_error(keyword: str, value: str) -> str | None:
13321334
if _strip_quotes(value).lower() in _STATICS_FRICTION_POLICIES
13331335
else "must be asLaid or none"
13341336
)
1337+
if key == "viv_phase_seed":
1338+
return None if value.lower() in {"spread", "zero"} else "must be spread or zero"
13351339
if key == "cable_statics":
13361340
return (
13371341
None

‎python/tests/test_deck_file.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,8 @@ def test_unknown_scalar_option_keyword_fails_closed(tmp_path):
672672
("1.5", "wave_seed", "must be an integer"),
673673
("maybe", "alpha_force_blend", "native boolean"),
674674
("relaxed", "cable_statics", "continuation or sequenced"),
675+
("random", "VIVphaseSeed", "spread or zero"),
676+
("0", "viv_phase_seed", "spread or zero"),
675677
("nodal", "OutputRecovery", "equilibrium or element"),
676678
("on", "ei0_substeps", "auto or off"),
677679
("0", "ei0_substep_angle", r"\(0, 90\] deg"),
@@ -756,6 +758,8 @@ def test_zero_e_exponent_waterkin_mode_is_accepted(tmp_path):
756758
"True alphaForceBlend",
757759
"continuation cable_statics",
758760
"sequenced cableStatics",
761+
"spread VIVphaseSeed",
762+
"ZERO viv_phase_seed",
759763
"equilibrium OutputRecovery",
760764
"element output_recovery",
761765
"auto ei0_substeps",

‎src/CableDyn_DeckDriver.f90‎

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,9 @@ MODULE CableDyn_DeckDriver
670670
! of the synchronisation model (OPTION VIVrmsWindow, s); 0 = MoorDyn's 500 time steps of
671671
! the deck dtM (or of the run's step when the deck has none).
672672
REAL(wp) :: viv_rms_window = CD_ZERO
673+
! Initial VIV phases (OPTION VIVphaseSeed): spread over a turn along the line, 2 pi i/N
674+
! (MoorDyn-C), or zero at every node (.TRUE.: the start of MoorDyn-F in OpenFAST v5.0.0).
675+
LOGICAL :: viv_phase_zero = .FALSE.
673676
! WaveKinMod-1 elevation history reduced once to its real Fourier components.
674677
! These feed the same arbitrary-component Airy kernel used by reference-matched
675678
! irregular seas; wave_eta_mean carries the zero-frequency waterline offset.
@@ -3468,27 +3471,23 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts,
34683471
! coupled host may step the cable at a dt adjusted from the deck dtM.
34693472
IF (PRESENT(install_viv)) THEN
34703473
IF (install_viv .AND. ANY(viv_cl > CD_ZERO)) THEN
3471-
! MoorDyn's phase seed counts the deck nodes from the deck's End A: a line the reader turned
3472-
! around, or a mesh the static solve refined, takes it node by node (CD_Deck_VIV_Phase_Seed)
3473-
IF (ln%ends_swapped .OR. ALLOCATED(cable%deck_node)) THEN
3474-
BLOCK
3475-
REAL(wp) :: seed(cable%line%nn)
3476-
IF (ALLOCATED(cable%deck_node)) THEN
3477-
CALL CD_Deck_VIV_Phase_Seed(cable%line%l0, ln%ends_swapped, seed, deck_map=cable%deck_node)
3478-
ELSE
3479-
CALL CD_Deck_VIV_Phase_Seed(cable%line%l0, ln%ends_swapped, seed)
3480-
END IF
3481-
CALL CD_HermiteCable_Dyn_Set_VIV(cable%line, viv_cl, viv_cf, viv_df, &
3482-
MERGE(opts%viv_rms_window, &
3483-
REAL(CD_VIV_NM, wp)*MERGE(opts%dtM, dt, opts%has_dtm), &
3484-
opts%viv_rms_window > CD_ZERO), es, em, phase_seed=seed)
3485-
END BLOCK
3486-
ELSE
3474+
! MoorDyn's phase seed counts the deck nodes from the deck's End A, with its node tangent
3475+
! towards the deck's End B; CD_Deck_VIV_Phase_Seed takes it node by node to the model's
3476+
! nodes and tangent (a line the reader turned around, a mesh the static solve refined)
3477+
BLOCK
3478+
REAL(wp) :: seed(cable%line%nn)
3479+
IF (ALLOCATED(cable%deck_node)) THEN
3480+
CALL CD_Deck_VIV_Phase_Seed(cable%line%l0, ln%ends_swapped, seed, deck_map=cable%deck_node, &
3481+
zero=opts%viv_phase_zero)
3482+
ELSE
3483+
CALL CD_Deck_VIV_Phase_Seed(cable%line%l0, ln%ends_swapped, seed, zero=opts%viv_phase_zero)
3484+
END IF
34873485
CALL CD_HermiteCable_Dyn_Set_VIV(cable%line, viv_cl, viv_cf, viv_df, &
34883486
MERGE(opts%viv_rms_window, &
34893487
REAL(CD_VIV_NM, wp)*MERGE(opts%dtM, dt, opts%has_dtm), &
3490-
opts%viv_rms_window > CD_ZERO), es, em)
3491-
END IF
3488+
opts%viv_rms_window > CD_ZERO), es, em, phase_seed=seed, &
3489+
tangent_reversed=.NOT. ln%ends_swapped)
3490+
END BLOCK
34923491
IF (es /= CD_HCDYN_OK) THEN
34933492
CALL fail(ErrStat, ErrMsg, 'finite-EI cable VIV wiring failed: '//TRIM(em)); RETURN
34943493
END IF
@@ -10379,17 +10378,14 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er
1037910378
END IF
1038010379
tw = opts%viv_rms_window
1038110380
IF (.NOT. (tw > CD_ZERO) .AND. opts%has_dtm) tw = REAL(CD_VIV_NM, wp)*opts%dtM
10382-
IF (ln%ends_swapped) THEN
10383-
! MoorDyn counts the phase seed from the deck's End A, which the reader turned around
10384-
BLOCK
10385-
REAL(wp) :: seed(model%n_dof/3)
10386-
CALL CD_Deck_VIV_Phase_Seed(model%l0, .TRUE., seed)
10387-
CALL CD_Set_Model_VIV(model, opts%rhoW, viv_cl, hydro_diam, viv_cf, viv_df, tw, es, em, &
10388-
phase_seed=seed)
10389-
END BLOCK
10390-
ELSE
10391-
CALL CD_Set_Model_VIV(model, opts%rhoW, viv_cl, hydro_diam, viv_cf, viv_df, tw, es, em)
10392-
END IF
10381+
! MoorDyn counts the phase seed from the deck's End A, with its node tangent towards the
10382+
! deck's End B: CD_Deck_VIV_Phase_Seed takes it to the model's nodes and tangent
10383+
BLOCK
10384+
REAL(wp) :: seed(model%n_dof/3)
10385+
CALL CD_Deck_VIV_Phase_Seed(model%l0, ln%ends_swapped, seed, zero=opts%viv_phase_zero)
10386+
CALL CD_Set_Model_VIV(model, opts%rhoW, viv_cl, hydro_diam, viv_cf, viv_df, tw, es, em, &
10387+
phase_seed=seed, tangent_reversed=.NOT. ln%ends_swapped)
10388+
END BLOCK
1039310389
IF (es == CD_MODEL_OK) CALL CD_Recompute_Model_Acceleration(model, es, em)
1039410390
IF (es /= CD_MODEL_OK) THEN
1039510391
ErrStat = CD_DECKDRV_BADINPUT
@@ -17154,6 +17150,15 @@ SUBROUTINE apply_option(line, opts, ErrStat, ErrMsg)
1715417150
opts%has_max_strain = ErrStat == 0
1715517151
CASE ('vivrmswindow', 'viv_rms_window')
1715617152
CALL rd(val, opts%viv_rms_window, ErrStat, ErrMsg)
17153+
CASE ('vivphaseseed', 'viv_phase_seed')
17154+
SELECT CASE (TRIM(to_lower(val)))
17155+
CASE ('spread')
17156+
opts%viv_phase_zero = .FALSE.
17157+
CASE ('zero')
17158+
opts%viv_phase_zero = .TRUE.
17159+
CASE DEFAULT
17160+
CALL fail(ErrStat, ErrMsg, 'OPTION VIVphaseSeed "'//TRIM(val)//'" must be spread or zero')
17161+
END SELECT
1715717162
CASE ('streamorder', 'stream_order')
1715817163
CALL rd(val, x1, ErrStat, ErrMsg)
1715917164
IF (ErrStat == 0) THEN
@@ -38492,18 +38497,25 @@ PURE FUNCTION cable_frame_is_identity(cable) RESULT(is_id)
3849238497
is_id = .NOT. (ABS(cable%frame_s) > CD_ZERO .OR. ABS(cable%frame_c - CD_ONE) > CD_ZERO)
3849338498
END FUNCTION cable_frame_is_identity
3849438499

38495-
PURE SUBROUTINE CD_Deck_VIV_Phase_Seed(l0, swapped, seed, deck_map)
38496-
!! MoorDyn's VIV phase seed i/N (phase 2 pi i/N at node i = 0 .. N counted from the deck's
38497-
!! End A, N the deck's segment count) at every node of a line, in the model's internal node
38498-
!! order (node 1 = End B; element e of length l0(e) joins nodes e and e + 1). swapped: the
38499-
!! reader turned the line's ends around, so the deck's End A is the model's End B. deck_map:
38500-
!! the mesh node (public order, End A = 1) of each deck node, on a mesh the static solve
38501-
!! refined; a node it added takes the seed interpolated linearly in unstretched arc length
38502-
!! between its two deck nodes. Without deck_map the mesh is the deck's.
38500+
PURE SUBROUTINE CD_Deck_VIV_Phase_Seed(l0, swapped, seed, deck_map, zero)
38501+
!! The initial VIV phase of every node of a line, as a fraction of a turn, in the model's
38502+
!! internal node order (node 1 = End B; element e of length l0(e) joins nodes e and e + 1).
38503+
!!
38504+
!! MoorDyn starts node i = 0 .. N (counted from the deck's End A, N the deck's segment count)
38505+
!! at the phase 2 pi i/N (MoorDyn-C; zero: at 0, where MoorDyn-F in OpenFAST v5.0.0 starts),
38506+
!! with the node tangent from the deck's End A to its End B. The model's node tangent runs from
38507+
!! its End B to its End A: against MoorDyn's on a line the reader keeps in the deck order,
38508+
!! which turns the lift and the cross-flow axis of the synchronisation model around. That
38509+
!! motion is MoorDyn's from the phases half a turn on, which the seed adds there; a line the
38510+
!! reader turned around (swapped: the deck's End A is the model's End B) has MoorDyn's tangent.
38511+
!! deck_map: the mesh node (public order, End A = 1) of each deck node, on a mesh the static
38512+
!! solve refined; a node it added takes the seed interpolated linearly in unstretched arc
38513+
!! length between its two deck nodes. Without deck_map the mesh is the deck's.
3850338514
REAL(wp), INTENT(IN) :: l0(:)
3850438515
LOGICAL, INTENT(IN) :: swapped
3850538516
REAL(wp), INTENT(OUT) :: seed(:)
3850638517
INTEGER, INTENT(IN), OPTIONAL :: deck_map(:)
38518+
LOGICAL, INTENT(IN), OPTIONAL :: zero
3850738519
REAL(wp) :: s(SIZE(l0) + 1), f
3850838520
INTEGER :: ne, nn, p, j, nd
3850938521
ne = SIZE(l0)
@@ -38527,6 +38539,10 @@ PURE SUBROUTINE CD_Deck_VIV_Phase_Seed(l0, swapped, seed, deck_map)
3852738539
f = REAL(p - 1, wp)/REAL(ne, wp)
3852838540
END IF
3852938541
IF (swapped) f = CD_ONE - f
38542+
IF (PRESENT(zero)) THEN
38543+
IF (zero) f = CD_ZERO
38544+
END IF
38545+
IF (.NOT. swapped) f = MODULO(f + 0.5_wp, CD_ONE)
3853038546
seed(nn + 1 - p) = f
3853138547
END DO
3853238548
END SUBROUTINE CD_Deck_VIV_Phase_Seed

0 commit comments

Comments
 (0)