From cd98e395ee572cecacd6a2c86865633187638cf7 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Sun, 15 Nov 2026 00:36:48 +0900 Subject: [PATCH] feat: wake-oscillator VIV on EI = 0 lines The WAKE OSCILLATOR section now acts on EI = 0 lines as on finite-EI cables; a deck with the wake oscillator on an EI = 0 line was refused. At each free node next to a lifting element the van der Pol wake variable q drives the lift 1/4 rho D CL0 q U^2 over the node's tributary length, in the direction of the synchronisation lift. The forcing is the node's smoothed cross-flow acceleration, and the wake frequency that of the ambient flow normal to the line. The step follows the finite-EI cable: q predicted at the step's evaluation point under the step-start forcing, then advanced from the committed state with the acceleration linear over the step (the shared CD_VIV_Wake_Advance). The state (q, dq/dt) is held in the line's VIV phase and first motion statistic, so the rollback, step-recovery, sub-step and checkpoint copies carry it unchanged; the checkpoint layout of an EI = 0 line does not change. CD_Set_Model_VIV takes the per-element (St, eps, A) as an optional wake argument; it refuses in-line VIV and amplitude tables with it, as the finite-EI cable does. Gates (tests/test_viv_wake_deck.f90, test_viv_coupled.f90): - the taut line of the wake gate with EI = 0 locks in at 0.282 Hz and A/D 0.5856, against 0.5850 for the finite-EI cable (0.1 %), and responds uncoupled (A 0) at the wake's 0.298 Hz, A/D 0.0989 against 0.0986; - the drag and damping take out the wake-lift power within 0.3 %; - CL0 0 is the deck without the section, bit for bit; - on the coupled route a checkpoint restart continues bit for bit with the EI = 0 wake state, a rebuild without it does not, and a rewound step repeats; - a line mixing the two models and an EI = 0 type that keeps its Cl are refused by name. The Python deck reader accepts the wake oscillator on EI = 0 lines. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 9 +- doc/capabilities.rst | 2 +- doc/driver_format.md | 4 +- doc/theory.rst | 10 +- python/cabledyn/builder.py | 2 +- python/cabledyn/deck_file.py | 9 +- python/tests/test_deck_file.py | 12 ++- python/tests/test_end_to_end.py | 2 +- src/CableDyn_DeckDriver.f90 | 25 ++++- src/CableDyn_Model.f90 | 173 ++++++++++++++++++++++++++++++-- tests/test_viv_coupled.f90 | 21 ++-- tests/test_viv_wake_deck.f90 | 105 ++++++++++--------- 12 files changed, 289 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2d000..dd9ba21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,11 +44,14 @@ All notable changes to CableDyn are recorded in this file. The format follows - Wake-oscillator VIV: an optional `WAKE OSCILLATOR` section row `TypeName CL0 [St [eps [A]]]` replaces the synchronisation lift of a type (which keeps `Cl` 0) by the van der Pol wake oscillator of Facchinetti et al. (2004) with acceleration coupling (defaults St 0.2, eps 0.3, - A 12), distributed along finite-EI cables, standalone and coupled. The kernel follows the + A 12), distributed along finite-EI cables and at the nodes of `EI = 0` lines, standalone and + coupled. The kernel follows the published forced-wake lift magnification within 2 %; on the taut example cable the wake locks the cable in at its first mode (A/D 0.58 against 0.10 uncoupled) and the drag and damping take - out the wake lift's power within 0.3 %. Its state is in the step-recovery, snapshot and - checkpoint state; the Python deck reader and builder take the section. + out the wake lift's power within 0.3 %; the same line with `EI = 0` locks in within 0.1 % of + the cable's A/D at the same frequency. Its state is in the step-recovery, snapshot and + checkpoint state (on an `EI = 0` line, in the slots of the VIV phase and first motion + statistic); the Python deck reader and builder take the section. - Amplitude-dependent VIV coefficients: an optional `VIV AMPLITUDE` section, rows `TypeName AD Cv [CdAmp]`, gives a line type a table over the cross-flow amplitude ratio of the coefficient `Cv` that replaces its `Cl` and a factor `CdAmp` of its normal drag coefficient, read diff --git a/doc/capabilities.rst b/doc/capabilities.rst index f1526d5..fd73d2a 100644 --- a/doc/capabilities.rst +++ b/doc/capabilities.rst @@ -159,7 +159,7 @@ Line and constitutive capability * - Wake-oscillator VIV (``WAKE OSCILLATOR`` section ``CL0``, ``St``, ``eps``, ``A``) - Standalone and coupled - the van der Pol wake oscillator of Facchinetti et al. (2004) with acceleration coupling, - distributed along finite-EI cables in place of the synchronisation model + on ``EI = 0`` lines and along finite-EI cables in place of the synchronisation model (:ref:`theory-viv-wake`), its state in the checkpoint * - Amplitude-dependent VIV coefficients (``VIV AMPLITUDE`` section ``AD``, ``Cv``, ``CdAmp``) - Standalone and coupled diff --git a/doc/driver_format.md b/doc/driver_format.md index 51a9812..7d5502d 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -1240,7 +1240,7 @@ Wake-oscillator vortex-induced vibration of a line type, the model of Facchinett a van der Pol oscillator per node stands for the near wake and drives the cross-flow lift, coupled to the cable's cross-flow acceleration (see [Wake oscillator](theory.rst)). It replaces the synchronisation model of the LINE TYPES `Cl` column for that type, so the type keeps `Cl = 0`, and -it acts on finite-EI cables. +it acts on finite-EI cables and `EI = 0` lines alike. ```text --------------------- WAKE OSCILLATOR ---------------------------------- @@ -1270,7 +1270,7 @@ Behaviour: `VIVPow` carry the wake lift. A row with `CL0 = 0` leaves the run exactly as without it. - A row fails if it is not `TypeName CL0 [St [eps [A]]]`, names an undefined or already named type, or holds a value out of range; `CL0 > 0` fails on a type with `Cl > 0`. A line whose types - mix the two models fails, and so does an `EI = 0` line with the wake oscillator. + mix the two models fails. ### VIV AMPLITUDE (optional) diff --git a/doc/theory.rst b/doc/theory.rst index 0ad2c0a..9b37488 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1314,7 +1314,11 @@ oscillation and the van der Pol damping rate at the start of the interval, so a :math:`\varepsilon` stays resolved; should the rate exceed :math:`0.2/\delta t` on the way, or the result not be finite, the interval is redone with twice the sub-steps. The lift is integrated on a finite-EI cable at the Gauss points of the synchronisation lift, :math:`q` interpolated between the element's end nodes, with -its exact position and velocity derivatives in the tangent at fixed :math:`q`. :math:`q` starts on +its exact position and velocity derivatives in the tangent at fixed :math:`q`. On an ``EI = 0`` +line it acts at the free nodes as the synchronisation lift does, over the node's tributary length, +with the node's smoothed cross-flow acceleration (the average with its two neighbours) as the +forcing, and :math:`(q, \dot q)` takes the place of the phase and the first motion statistic in +the line's VIV state. :math:`q` starts on its limit cycle at the node's phase seed, :math:`q = 2\cos\phi_0`, :math:`\dot q = 0`, and the state is part of the step-recovery, snapshot and checkpoint state. @@ -1326,7 +1330,9 @@ one-harmonic balance leaves out. On the taut cable of ``viv_taut_cable_inline.da ``Cl`` 0 and ``CL0`` 0.3 the cable locks in at 0.282 Hz, below the wake's own 0.30 Hz, at a steady mid-span A/D of 0.58; with :math:`A` = 0 the uncoupled wake drives it at 0.298 Hz at A/D 0.10, and over the lock-in the drag and damping take out the wake lift's power within 0.3 %. The -wake oscillator acts on finite-EI cables, cross-flow only. +same line with ``EI = 0`` locks in at the same 0.282 Hz and A/D 0.586 (0.1 % from the finite-EI +cable), and 0.099 uncoupled (0.3 %). The wake oscillator acts on finite-EI cables and ``EI = 0`` +lines, cross-flow only. .. _theory-viv-amplitude: diff --git a/python/cabledyn/builder.py b/python/cabledyn/builder.py index 4e28bdb..53d184f 100644 --- a/python/cabledyn/builder.py +++ b/python/cabledyn/builder.py @@ -227,7 +227,7 @@ class LineType: reference lift coefficient, the Strouhal number, the van der Pol parameter and the acceleration coupling. It replaces the synchronisation lift, so ``cl`` stays ``None`` or 0, and acts on - finite-EI cables. ``None`` leaves a trailing value out of the row (the + ``EI = 0`` lines and finite-EI cables. ``None`` leaves a trailing value out of the row (the solver takes 0.2, 0.3 and 12); a value given writes the ones before it. viv_amplitude : list of tuples | None Optional amplitude-dependent VIV coefficients of a type (Thorsen et al. diff --git a/python/cabledyn/deck_file.py b/python/cabledyn/deck_file.py index b59704e..e337f94 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -4789,8 +4789,8 @@ def end_key(token: str) -> str: for line_id, section_types in section_types_by_line.items() if {line_type.lower() for line_type in section_types} & amp_type_names } - # native build_one_hermite_cable and the EI = 0 line wiring: the wake oscillator and the - # cross-flow damping act on finite-EI cables only, and a cable takes one VIV model + # native build_one_hermite_cable and the EI = 0 line wiring: the cross-flow damping acts on + # finite-EI cables only, and a line takes one VIV model for line_id, section_types in section_types_by_line.items(): types_used = {line_type.lower() for line_type in section_types} if types_used & damp_type_names and line_id not in finite_line_ids: @@ -4800,11 +4800,6 @@ def end_key(token: str) -> str: ) if not types_used & wake_type_names: continue - if line_id not in finite_line_ids: - raise DeckFormatError( - f"{self._label}: line {line_id}: the wake oscillator (WAKE OSCILLATOR " - "section) acts on finite-EI cables (EI > 0) only" - ) if types_used & viv_type_names: raise DeckFormatError( f"{self._label}: line {line_id}: a line takes one VIV model, but its types mix " diff --git a/python/tests/test_deck_file.py b/python/tests/test_deck_file.py index 4399e9c..f06061e 100644 --- a/python/tests/test_deck_file.py +++ b/python/tests/test_deck_file.py @@ -4888,15 +4888,15 @@ def test_wake_oscillator_rows_are_read_and_kept(tmp_path, rows, expected): (None, ("chain 0.3 0.2 0.0",), "St > 0, eps > 0 and A >= 0"), (None, ("chain 0.3 0.2 0.3 -1",), "St > 0, eps > 0 and A >= 0"), ("lift", ("chain 0.3",), "give the type LINE TYPES Cl 0"), - ("ei0", ("chain 0.3",), "acts on finite-EI cables (EI > 0) only"), + ("lift ei0", ("chain 0.3",), "give the type LINE TYPES Cl 0"), ], ) def test_wake_oscillator_rows_follow_the_native_checks(base, rows, message): text = _DYNAMIC - if base == "lift": + if base and "lift" in base: row = "chain 0.252 390.0 1.674e9 -1.0 1.0e4 1.37 0.64 1.0 0.0" text = _edit(text, (row, row + " 0.8")) - elif base == "ei0": + if base and "ei0" in base: text = _edit(text, ("1.674e9 -1.0 1.0e4 1.37", "1.674e9 -1.0 0.0 1.37")) with pytest.raises(DeckFormatError, match=re.escape(message)): DeckFile.from_text(_with_section(text, "WAKE OSCILLATOR", *rows)) @@ -5066,6 +5066,12 @@ def test_wake_oscillator_cl0_zero_is_off_and_needs_no_finite_line(): DeckFile.from_text(_with_section(text, "WAKE OSCILLATOR", "chain 0.0")) +def test_wake_oscillator_acts_on_an_ei0_line(): + # native init_one_model installs the wake oscillator on EI = 0 lines as on finite-EI cables + text = _edit(_DYNAMIC, ("1.674e9 -1.0 1.0e4 1.37", "1.674e9 -1.0 0.0 1.37")) + DeckFile.from_text(_with_section(text, "WAKE OSCILLATOR", "chain 0.3 0.2 0.3 12")) + + def test_viv_is_accepted_on_the_coupled_route(): text = _edit(_STATIC, (_VIV_ROW, _VIV_ROW + " 0.8")) DeckFile.from_text(text) diff --git a/python/tests/test_end_to_end.py b/python/tests/test_end_to_end.py index 496f4be..fd3c2bd 100644 --- a/python/tests/test_end_to_end.py +++ b/python/tests/test_end_to_end.py @@ -280,7 +280,7 @@ def test_generated_study_runs_on_the_real_driver(tmp_path): ( "wake-ei0-line", [_WAKE_LIFT, _WAKE_SECTION, ("-0.8 1.0 1.2", "-0.8 0.0 1.2")], - False, + True, ), ] diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index ae0033a..a0dbf67 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -10498,6 +10498,8 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er REAL(wp), ALLOCATABLE :: ve_ead(:), ve_bas(:), ve_bad(:), ve_ambl(:), ve_vbet(:) REAL(wp), ALLOCATABLE :: viv_cl(:), viv_cf(:), viv_df(:), viv_clx(:), viv_al(:), viv_hh(:) REAL(wp), ALLOCATABLE :: viv_tix(:), viv_amp3(:, :, :), viv_dia(:) + ! the WAKE OSCILLATOR rows per element (C_L0, St, eps, A; C_L0 0 where none) + REAL(wp), ALLOCATABLE :: viv_wo(:, :) INTEGER, ALLOCATABLE :: viv_ampn(:) LOGICAL, ALLOCATABLE :: syr_el(:) REAL(wp) :: anchor(3), fairlead(3), mode1_omega @@ -10538,8 +10540,9 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er hydro_can(SIZE(l0)), hydro_cat(SIZE(l0)), ve_ead(SIZE(l0)), ve_bas(SIZE(l0)), & ve_bad(SIZE(l0)), ve_ambl(SIZE(l0)), ve_vbet(SIZE(l0)), viv_cl(SIZE(l0)), viv_cf(SIZE(l0)), & viv_df(SIZE(l0)), syr_el(SIZE(l0)), viv_clx(SIZE(l0)), viv_al(SIZE(l0)), viv_hh(SIZE(l0)), & - viv_tix(SIZE(l0)), viv_dia(SIZE(l0))) + viv_tix(SIZE(l0)), viv_dia(SIZE(l0)), viv_wo(4, SIZE(l0))) viv_tix = CD_ZERO + viv_wo = CD_ZERO viv_dia = CD_ZERO viv_cl = CD_ZERO viv_cf = CD_ZERO @@ -10604,8 +10607,10 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er hydro_cat(e) = types(line_section_type(sections, ln%id, i))%cat viv_cl(e) = types(line_section_type(sections, ln%id, i))%cl IF (types(line_section_type(sections, ln%id, i))%wo_cl0 > CD_ZERO) THEN - CALL fail(ErrStat, ErrMsg, 'line '//TRIM(int_to_str(ln%id))//': the wake oscillator (WAKE '// & - 'OSCILLATOR section) acts on finite-EI cables (EI > 0) only'); RETURN + viv_wo(:, e) = [types(line_section_type(sections, ln%id, i))%wo_cl0, & + types(line_section_type(sections, ln%id, i))%wo_st, & + types(line_section_type(sections, ln%id, i))%wo_eps, & + types(line_section_type(sections, ln%id, i))%wo_a] END IF IF (types(line_section_type(sections, ln%id, i))%cdy_a >= CD_ZERO) THEN CALL fail(ErrStat, ErrMsg, 'line '//TRIM(int_to_str(ln%id))//': the cross-flow damping (VIV '// & @@ -10633,6 +10638,14 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er viv_hh = viv_hh(SIZE(viv_hh):1:-1) viv_tix = viv_tix(SIZE(viv_tix):1:-1) viv_dia = viv_dia(SIZE(viv_dia):1:-1) + viv_wo = viv_wo(:, SIZE(viv_wo, 2):1:-1) + IF (ANY(viv_wo(1, :) > CD_ZERO) .AND. ANY(viv_cl > CD_ZERO)) THEN + CALL fail(ErrStat, ErrMsg, 'line '//TRIM(int_to_str(ln%id))//': a line takes one VIV model, but its '// & + 'types mix the synchronisation lift (LINE TYPES Cl > 0) and the wake oscillator (WAKE '// & + 'OSCILLATOR section)'); RETURN + END IF + ! the wake oscillator: the lift coefficient passed on is C_L0 + IF (ANY(viv_wo(1, :) > CD_ZERO)) viv_cl = viv_wo(1, :) ba = ba(SIZE(ba):1:-1) ve_ead = ve_ead(SIZE(ve_ead):1:-1) ve_bas = ve_bas(SIZE(ve_bas):1:-1) @@ -10925,7 +10938,11 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er ! the VIV AMPLITUDE tables, left unallocated (absent below) on a line without one CALL viv_amp_tables(types, viv_tix, viv_amp3, viv_ampn) ! with the in-line VIV of the VIV section where a type has ClX > 0 - IF (ANY(viv_clx > CD_ZERO)) THEN + IF (ANY(viv_wo(1, :) > CD_ZERO)) THEN + ! the wake oscillator: cl is C_L0, the band unused + CALL CD_Set_Model_VIV(model, opts%rhoW, viv_cl, viv_dia, viv_cf, viv_df, tw, es, em, & + phase_seed=seed, tangent_reversed=.NOT. ln%ends_swapped, wake=viv_wo(2:4, :)) + ELSE IF (ANY(viv_clx > CD_ZERO)) THEN CALL CD_Set_Model_VIV(model, opts%rhoW, viv_cl, viv_dia, viv_cf, viv_df, tw, es, em, & phase_seed=seed, tangent_reversed=.NOT. ln%ends_swapped, clx=viv_clx, & il_alpha=viv_al, chh=viv_hh, amp=viv_amp3, amp_n=viv_ampn) diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index d12a277..195ff8d 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -59,7 +59,7 @@ MODULE CableDyn_Model USE CableDyn_VIV, ONLY: CD_VIV_Node_Lift, CD_VIV_Crossflow_Motion, CD_VIV_Phase_Rate, CD_VIV_Mean_Square, & CD_VIV_Wrap_Phase, CD_VIV_NM, CD_VIV_TWO_PI, CD_VIV_Node_Inline, CD_VIV_Inline_Phase_Rate, & CD_VIV_NMS, CD_VIV_NMS_AMP, CD_VIV_AMP_MAXP, CD_VIV_Amplitude_Update, CD_VIV_Table, & - CD_VIV_Check_Amp_Table, CD_VIV_Ambient_Crossflow_Rate + CD_VIV_Check_Amp_Table, CD_VIV_Ambient_Crossflow_Rate, CD_VIV_Wake_Advance USE CableDyn_Dynamic, ONLY: GenAlphaConfig, CD_CableGenAlphaWorkspace, CD_Clear_GenAlpha_Workspace, & CD_Cable_Initial_Acceleration, CD_Cable_Gen_Alpha_Step, CD_Cable_Step_Loads, & CD_DYN_OK, CD_DYN_ALLOCFAIL, & @@ -438,6 +438,16 @@ MODULE CableDyn_Model LOGICAL :: has_viv_amp = .FALSE. REAL(wp), ALLOCATABLE :: viv_amp(:, :, :) INTEGER, ALLOCATABLE :: viv_amp_n(:) + ! Wake-oscillator VIV (CD_Set_Model_VIV wake; Facchinetti et al. 2004): the van der Pol wake + ! variable q = 2 C_L/C_L0 replaces the synchronisation phase of the whole line, the lift scale + ! taking viv_cl = C_L0/2. Per node the Strouhal number, van der Pol eps and coupling A + ! (length-weighted over its lifting elements). The state rides in the VIV state slots, so the + ! rollback, step-recovery, sub-step and checkpoint copies carry it unchanged: viv_phi holds q + ! (viv_phi_eval q at the step's evaluation point, viv_phi_next q at the step end) and row 1 of + ! viv_ms dq/dt; in a step, viv_rate holds the step-start wake frequency and row 2 of viv_ms_next + ! the step-start cross-flow acceleration (row 2 of viv_ms stays 0). + LOGICAL :: viv_wake = .FALSE. + REAL(wp), ALLOCATABLE :: wo_st(:), wo_eps(:), wo_a(:) TYPE(GenAlphaConfig) :: cfg ! Run audit of the committed host steps (CD_Audit_Model_Step), diagnostics only: never part ! of the state, of a copy, or of a result. audit_t holds the segment tensions of the last two @@ -3947,7 +3957,7 @@ SUBROUTINE CD_Set_Model_Syrope_State(model, slow, tmax, ErrStat, ErrMsg) END SUBROUTINE CD_Set_Model_Syrope_State SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, ErrMsg, phase_seed, & - tangent_reversed, clx, il_alpha, chh, amp, amp_n) + tangent_reversed, clx, il_alpha, chh, amp, amp_n, wake) !! Install the cross-flow VIV model (CableDyn_VIV) on an initialised line. Per element: !! the lift coefficient cl (0 = no lift on that element), hydrodynamic diameter, and the !! synchronisation centre cf and half-range df of the non-dimensional shedding frequency; @@ -3974,6 +3984,11 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, !! amplitude ratio A/D >= 0 (strictly increasing), the cross-flow coefficient C_v >= 0 that !! replaces cl, and the factor > 0 of the element's normal drag coefficient, at the smoothed !! amplitude estimate of Thorsen et al. (2016); piecewise linear, held beyond the end rows. + !! Wake oscillator (Facchinetti et al. 2004; not with in-line VIV or amplitude tables): wake + !! (3, n_elem), per element the Strouhal number St > 0, van der Pol eps > 0 and acceleration + !! coupling A >= 0 (each at most 1e15) where cl > 0, with cl then the reference lift + !! coefficient C_L0 of a fixed cylinder; cf and df are unused. The wake variable q of a node + !! starts on its limit cycle at the node's start phase, q = 2 cos(phi_0), with dq/dt = 0. TYPE(CD_ModelType), INTENT(INOUT) :: model REAL(wp), INTENT(IN) :: rho, cl(:), diameter(:), cf(:), df(:), t_window INTEGER, INTENT(OUT) :: ErrStat @@ -3986,9 +4001,10 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, REAL(wp), INTENT(IN), OPTIONAL :: clx(:), il_alpha(:), chh(:) REAL(wp), INTENT(IN), OPTIONAL :: amp(:, :, :) INTEGER, INTENT(IN), OPTIONAL :: amp_n(:) + REAL(wp), INTENT(IN), OPTIONAL :: wake(:, :) INTEGER :: n_nodes, n_elem, e, nd, istat, k, nms REAL(wp) :: wsum - LOGICAL :: want_il, want_amp + LOGICAL :: want_il, want_amp, want_wake CHARACTER(160) :: amsg ErrStat = CD_MODEL_OK @@ -4076,6 +4092,35 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, END IF want_amp = ANY(amp_n > 0) END IF + want_wake = .FALSE. + IF (PRESENT(wake)) THEN + IF (SIZE(wake, 1) /= 3 .OR. SIZE(wake, 2) /= n_elem) THEN + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator wake must have shape (3, n_elem)') + RETURN + END IF + IF (.NOT. CD_All_Finite(wake)) THEN + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator St, eps and A must be finite') + RETURN + END IF + DO e = 1, n_elem + IF (.NOT. (cl(e) > CD_ZERO)) CYCLE + IF (.NOT. (wake(1, e) > CD_ZERO .AND. wake(2, e) > CD_ZERO .AND. wake(3, e) >= CD_ZERO .AND. & + ALL(wake(:, e) <= 1.0e15_wp))) THEN + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator needs St > 0, eps > 0 and A >= 0, each at most '// & + '1e15, where cl > 0') + RETURN + END IF + END DO + want_wake = ANY(cl > CD_ZERO) + IF (want_wake .AND. want_il) THEN + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator takes no in-line VIV (clx > 0)') + RETURN + END IF + IF (want_wake .AND. want_amp) THEN + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator takes no amplitude tables') + RETURN + END IF + END IF CALL clear_viv(model) IF (.NOT. ANY(cl > CD_ZERO)) RETURN IF (.NOT. (CD_Is_Finite(rho) .AND. rho > CD_ZERO)) THEN @@ -4088,6 +4133,7 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, CALL fail(ErrStat, ErrMsg, 'VIV needs a positive diameter on every Cl > 0 element') RETURN END IF + IF (want_wake) CYCLE IF (.NOT. (cf(e) > CD_ZERO .AND. df(e) >= CD_ZERO .AND. df(e) < cf(e))) THEN CALL fail(ErrStat, ErrMsg, 'VIV synchronisation needs cF > 0 and 0 <= dF < cF (a positive '// & 'shedding frequency)') @@ -4164,6 +4210,43 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, model%viv_phi_next = model%viv_phi model%viv_phi_rest = 0.5_wp*CD_VIV_TWO_PI IF (PRESENT(tangent_reversed)) model%viv_phi_rest = MERGE(0.5_wp*CD_VIV_TWO_PI, CD_ZERO, tangent_reversed) + IF (want_wake) THEN + ALLOCATE (model%wo_st(n_nodes), model%wo_eps(n_nodes), model%wo_a(n_nodes), STAT=istat) + IF (istat /= 0) THEN + CALL clear_viv(model) + CALL alloc_fail(ErrStat, ErrMsg, 'VIV wake oscillator storage allocation failed') + RETURN + END IF + ! the node's lift scale (viv_node_coef, 1/2 rho D viv_cl over its tributary length) is then + ! that of 1/4 rho D C_L0, the lift per unit length 1/4 rho D C_L0 q U^2 + model%viv_cl = 0.5_wp*model%viv_cl + model%wo_st = CD_ZERO + model%wo_eps = CD_ZERO + model%wo_a = CD_ZERO + DO nd = 2, n_nodes - 1 + IF (.NOT. model%viv_node(nd)) CYCLE + wsum = CD_ZERO + DO k = nd - 1, nd + IF (.NOT. (cl(k) > CD_ZERO)) CYCLE + wsum = wsum + model%l0(k) + model%wo_st(nd) = model%wo_st(nd) + model%l0(k)*wake(1, k) + model%wo_eps(nd) = model%wo_eps(nd) + model%l0(k)*wake(2, k) + model%wo_a(nd) = model%wo_a(nd) + model%l0(k)*wake(3, k) + END DO + model%wo_st(nd) = model%wo_st(nd)/wsum + model%wo_eps(nd) = model%wo_eps(nd)/wsum + model%wo_a(nd) = model%wo_a(nd)/wsum + ! on the limit cycle at the node's start phase + model%viv_phi(nd) = 2.0_wp*COS(model%viv_phi(nd)) + END DO + model%viv_cf = CD_ZERO + model%viv_df = CD_ZERO + model%viv_phi_rollback = model%viv_phi + model%recovery_viv_phi = model%viv_phi + model%viv_phi_eval = model%viv_phi + model%viv_phi_next = model%viv_phi + model%viv_wake = .TRUE. + END IF model%has_viv = .TRUE. IF (.NOT. want_il) RETURN ALLOCATE (model%vil_cx(n_elem), model%vil_alpha(n_nodes), model%vil_node(n_nodes), model%vil_phi(n_nodes), & @@ -4224,7 +4307,8 @@ SUBROUTINE CD_Get_Model_VIV_State(model, phi, ms, t_window, ErrStat, ErrMsg, phi !! the running mean squares of the cross-flow velocity and acceleration (2, n_nodes), and !! the averaging time (0 while unlatched). A model without VIV returns zeros. phi_x and ms_x !! (both or neither, same shapes) take the in-line phase and mean squares, zero without - !! in-line VIV. + !! in-line VIV. On a wake-oscillator line phi is the wake variable q and row 1 of ms its rate + !! dq/dt (row 2 zero). TYPE(CD_ModelType), INTENT(IN) :: model REAL(wp), INTENT(OUT) :: phi(:), ms(:, :), t_window INTEGER, INTENT(OUT) :: ErrStat @@ -4298,7 +4382,12 @@ SUBROUTINE CD_Set_Model_VIV_State(model, phi, ms, t_window, ErrStat, ErrMsg, phi END IF ! the mean squares (rows 1:2) and the amplitudes y0, y0s (rows 4:5) cannot be negative; the ! travel and the last cross-flow velocity of the amplitude estimate (rows 3, 6) are signed - neg = ANY(ms(1:2, :) < CD_ZERO) + ! (a wake-oscillator line holds dq/dt in row 1, signed, and 0 in row 2) + IF (model%viv_wake) THEN + neg = ANY(ms(2, :) < CD_ZERO) + ELSE + neg = ANY(ms(1:2, :) < CD_ZERO) + END IF IF (SIZE(ms, 1) >= 5) neg = neg .OR. ANY(ms(4:5, :) < CD_ZERO) IF (neg .OR. t_window < CD_ZERO) THEN CALL fail(ErrStat, ErrMsg, 'VIV mean squares, amplitudes and averaging time must be non-negative') @@ -4479,6 +4568,11 @@ SUBROUTINE viv_node_load(model, q, v, nd, in_step, force, ok, jac_v, jac_prev, j ia = 3*nd - 2 phi = model%viv_phi(nd) IF (in_step) phi = model%viv_phi_eval(nd) + IF (model%viv_wake) THEN + ! the wake lift: the scale times the wake variable q (held in the phase slot) + coef = coef*phi + phi = CD_ZERO + END IF IF (PRESENT(jac_v)) THEN CALL CD_VIV_Node_Lift(q(ia - 3:ia - 1), q(ia + 3:ia + 5), smoothed(v, ia), uu, coef, phi, force, ok, & jac_v, jac_prev, jac_next) @@ -4642,7 +4736,7 @@ SUBROUTINE viv_step_begin(model, dt, ErrStat, ErrMsg) INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg INTEGER :: nd, ia - REAL(wp) :: w, alpha_f, yd, ydd, un, coef, uu(3), xd, xdd + REAL(wp) :: w, alpha_f, yd, ydd, un, coef, uu(3), xd, xdd, sw(2) LOGICAL :: ok ErrStat = CD_MODEL_OK ErrMsg = '' @@ -4668,6 +4762,18 @@ SUBROUTINE viv_step_begin(model, dt, ErrStat, ErrMsg) CALL fail(ErrStat, ErrMsg, 'VIV phase: the neighbours of a node coincide (no line tangent)') RETURN END IF + IF (model%viv_wake) THEN + ! the wake frequency of the ambient flow normal to the line (the free stream of the + ! paper), not of the relative flow, which the line's own cross-flow motion modulates; the + ! wake state predicted at the step's evaluation point under the step-start forcing + model%viv_rate(nd) = CD_VIV_TWO_PI*model%wo_st(nd)*viv_node_ambient_speed(model%q, ia, uu)/model%viv_dn(nd) + model%viv_ms_next(2, nd) = ydd + sw = [model%viv_phi(nd), model%viv_ms(1, nd)] + CALL CD_VIV_Wake_Advance(sw, model%viv_rate(nd), model%wo_eps(nd), model%wo_a(nd)/model%viv_dn(nd), & + ydd, ydd, (CD_ONE - alpha_f)*dt) + model%viv_phi_eval(nd) = sw(1) + CYCLE + END IF model%viv_ms_next(1, nd) = CD_VIV_Mean_Square(model%viv_ms(1, nd), yd, w) model%viv_ms_next(2, nd) = CD_VIV_Mean_Square(model%viv_ms(2, nd), ydd, w) model%viv_rate(nd) = CD_VIV_Phase_Rate(yd, ydd, model%viv_ms_next(1, nd), model%viv_ms_next(2, nd), & @@ -4694,7 +4800,7 @@ SUBROUTINE viv_step_end(model, dt, ErrStat, ErrMsg) INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg INTEGER :: nd, ia - REAL(wp) :: w, yd, ydd, un, coef, uu(3), ms1, ms2, rate_end, xd, xdd, rate_end_x, st(4) + REAL(wp) :: w, yd, ydd, un, coef, uu(3), ms1, ms2, rate_end, xd, xdd, rate_end_x, st(4), sw(2), ydd0 LOGICAL :: ok ErrStat = CD_MODEL_OK ErrMsg = '' @@ -4708,6 +4814,24 @@ SUBROUTINE viv_step_end(model, dt, ErrStat, ErrMsg) CALL CD_VIV_Crossflow_Motion(model%q_step(ia - 3:ia - 1), model%q_step(ia + 3:ia + 5), & smoothed(model%v_step, ia), smoothed(model%a_step, ia), uu, yd, ydd, un, ok, & xd, xdd) + IF (model%viv_wake) THEN + ! the wake state over the step with the cross-flow acceleration linear from its step-start + ! value to the converged end one (held where the end tangent is degenerate), at the + ! step-start wake frequency; a non-finite result keeps the step-start forcing alone + ydd0 = model%viv_ms_next(2, nd) + IF (.NOT. (ok .AND. CD_Is_Finite(ydd))) ydd = ydd0 + sw = [model%viv_phi(nd), model%viv_ms(1, nd)] + CALL CD_VIV_Wake_Advance(sw, model%viv_rate(nd), model%wo_eps(nd), model%wo_a(nd)/model%viv_dn(nd), & + ydd0, ydd, dt) + IF (.NOT. (CD_Is_Finite(sw(1)) .AND. CD_Is_Finite(sw(2)))) THEN + sw = [model%viv_phi(nd), model%viv_ms(1, nd)] + CALL CD_VIV_Wake_Advance(sw, model%viv_rate(nd), model%wo_eps(nd), model%wo_a(nd)/model%viv_dn(nd), & + ydd0, ydd0, dt) + END IF + model%viv_phi_next(nd) = sw(1) + model%viv_ms_next(1, nd) = sw(2) + CYCLE + END IF IF (.NOT. ok) THEN CALL fail(ErrStat, ErrMsg, 'VIV phase: the neighbours of a node coincide (no line tangent)') RETURN @@ -4735,6 +4859,14 @@ SUBROUTINE viv_step_end(model, dt, ErrStat, ErrMsg) rate_end, model%vil_alpha(nd)) model%vil_phi_next(nd) = CD_VIV_Wrap_Phase(model%vil_phi(nd) + 0.5_wp*dt*(model%vil_rate(nd) + rate_end_x)) END DO + IF (model%viv_wake) THEN + ! row 2 held the step-start acceleration (scratch); the committed row stays 0 + model%viv_ms_next(2, :) = CD_ZERO + IF (.NOT. (CD_All_Finite(model%viv_phi_next) .AND. CD_All_Finite(model%viv_ms_next))) THEN + CALL fail(ErrStat, ErrMsg, 'VIV wake oscillator update produced a non-finite state') + END IF + RETURN + END IF IF (.NOT. CD_All_Finite(model%viv_phi_next)) THEN CALL fail(ErrStat, ErrMsg, 'VIV phase update produced a non-finite phase') END IF @@ -4745,6 +4877,18 @@ SUBROUTINE viv_step_end(model, dt, ErrStat, ErrMsg) END IF END SUBROUTINE viv_step_end + PURE REAL(wp) FUNCTION viv_node_ambient_speed(q, ia, uu) RESULT(ua) + !! Speed of the ambient flow uu normal to the tangent of the node whose x component is ia (the + !! chord of its two neighbours at positions q); 0 for a degenerate tangent. + REAL(wp), INTENT(IN) :: q(:), uu(3) + INTEGER, INTENT(IN) :: ia + REAL(wp) :: yd, ydd + LOGICAL :: ok + CALL CD_VIV_Crossflow_Motion(q(ia - 3:ia - 1), q(ia + 3:ia + 5), [CD_ZERO, CD_ZERO, CD_ZERO], & + [CD_ZERO, CD_ZERO, CD_ZERO], uu, yd, ydd, ua, ok) + IF (.NOT. ok) ua = CD_ZERO + END FUNCTION viv_node_ambient_speed + PURE FUNCTION smoothed(x, ia) RESULT(xs) !! Node kinematics for the VIV phase and lift: the node value averaged with its two !! neighbours, (x_{i-1} + 2 x_i + x_{i+1})/4, at the node whose x component is ia. Thorsen's @@ -4796,6 +4940,10 @@ SUBROUTINE clear_viv(model) IF (ALLOCATED(model%vil_phi_next)) DEALLOCATE (model%vil_phi_next) IF (ALLOCATED(model%viv_amp)) DEALLOCATE (model%viv_amp) IF (ALLOCATED(model%viv_amp_n)) DEALLOCATE (model%viv_amp_n) + IF (ALLOCATED(model%wo_st)) DEALLOCATE (model%wo_st) + IF (ALLOCATED(model%wo_eps)) DEALLOCATE (model%wo_eps) + IF (ALLOCATED(model%wo_a)) DEALLOCATE (model%wo_a) + model%viv_wake = .FALSE. model%has_viv_amp = .FALSE. model%has_viv_il = .FALSE. model%has_viv = .FALSE. @@ -7556,6 +7704,13 @@ SUBROUTINE CD_Copy_Model(src, dst, ErrStat, ErrMsg) IF (ErrStat /= CD_MODEL_OK) RETURN CALL copy_real1(src%viv_phi_next, work%viv_phi_next, 'viv_phi_next', ErrStat, ErrMsg) IF (ErrStat /= CD_MODEL_OK) RETURN + work%viv_wake = src%viv_wake + CALL copy_real1(src%wo_st, work%wo_st, 'wo_st', ErrStat, ErrMsg) + IF (ErrStat /= CD_MODEL_OK) RETURN + CALL copy_real1(src%wo_eps, work%wo_eps, 'wo_eps', ErrStat, ErrMsg) + IF (ErrStat /= CD_MODEL_OK) RETURN + CALL copy_real1(src%wo_a, work%wo_a, 'wo_a', ErrStat, ErrMsg) + IF (ErrStat /= CD_MODEL_OK) RETURN work%has_viv_amp = src%has_viv_amp CALL copy_real3(src%viv_amp, work%viv_amp, 'viv_amp', ErrStat, ErrMsg) IF (ErrStat /= CD_MODEL_OK) RETURN @@ -7746,6 +7901,10 @@ SUBROUTINE commit_model_copy(from, to) CALL MOVE_ALLOC(from%viv_rate, to%viv_rate) CALL MOVE_ALLOC(from%viv_ms_next, to%viv_ms_next) CALL MOVE_ALLOC(from%viv_phi_next, to%viv_phi_next) + to%viv_wake = from%viv_wake + CALL MOVE_ALLOC(from%wo_st, to%wo_st) + CALL MOVE_ALLOC(from%wo_eps, to%wo_eps) + CALL MOVE_ALLOC(from%wo_a, to%wo_a) to%has_viv_amp = from%has_viv_amp CALL MOVE_ALLOC(from%viv_amp, to%viv_amp) CALL MOVE_ALLOC(from%viv_amp_n, to%viv_amp_n) diff --git a/tests/test_viv_coupled.f90 b/tests/test_viv_coupled.f90 index 81320a6..31da211 100644 --- a/tests/test_viv_coupled.f90 +++ b/tests/test_viv_coupled.f90 @@ -30,10 +30,11 @@ PROGRAM test_viv_coupled !! * in-line VIV (a VIV section, ClX 0.85, on both lines): the checkpoint blocks grow by the !! in-line phase and mean squares (3 per node), the restarted run continues bit for bit with !! both phases, a rebuild without the VIV state does not, and a rewound step repeats; - !! * wake oscillator (a WAKE OSCILLATOR row, C_L0 0.3, on the cable, whose type has Cl 0; the - !! EI = 0 riser keeps its synchronisation lift): the cable's checkpoint block grows by the wake - !! state (2 per node), the restarted run continues bit for bit with it, a rebuild without the - !! VIV state does not, and a rewound step repeats; + !! * wake oscillator (a WAKE OSCILLATOR row, C_L0 0.3, on both types, which have Cl 0): the + !! cable's checkpoint block grows by the wake state (2 per node), the EI = 0 riser carries it in + !! its VIV block (q in the phase, dq/dt in the first motion statistic), the restarted run + !! continues bit for bit with both, a rebuild without the VIV state does not, and a rewound step + !! repeats; !! * amplitude tables (a VIV AMPLITUDE table on both types, Cv falling from 0.8 at A/D 0 to 0.4 at !! 1, CdAmp from 1 to 1.5): both checkpoint blocks grow by the amplitude estimate (4 per node), !! the restarted run continues bit for bit with it, a rebuild without the VIV state does not, @@ -404,7 +405,10 @@ LOGICAL FUNCTION identical(a, b) RESULT(same) MAXVAL(ABS(a%cables(1)%line%q - b%cables(1)%line%q)) <= 0.0_wp .AND. & MAXVAL(ABS(a%cables(1)%line%viv_phi - b%cables(1)%line%viv_phi)) <= 0.0_wp IF (same .AND. wake_case) same = a%cables(1)%line%viv_wake .AND. & - MAXVAL(ABS(a%cables(1)%line%wo_s - b%cables(1)%line%wo_s)) <= 0.0_wp + MAXVAL(ABS(a%cables(1)%line%wo_s - b%cables(1)%line%wo_s)) <= 0.0_wp .AND. & + a%sys%fast%system%lines(1)%viv_wake .AND. & + MAXVAL(ABS(a%sys%fast%system%lines(1)%viv_ms - & + b%sys%fast%system%lines(1)%viv_ms)) <= 0.0_wp IF (same .AND. amp_case) THEN ! the motion statistics with the amplitude estimate (rows 3-6) on both lines same = a%sys%fast%system%lines(1)%has_viv_amp .AND. a%cables(1)%line%has_viv_amp .AND. & @@ -443,8 +447,8 @@ END SUBROUTINE response SUBROUTINE write_deck(path, cl, window, dtm, anchor_first, inline, wake, amp) !! The EI = 0 riser (line 1) and the finite-EI cable (line 2), 20 m apart across the current; !! VIVrmsWindow 0.25 s unless window is given (0: none), and a deck dtM when dtm is given; - !! inline adds the in-line VIV of both types (a VIV section, ClX 0.85); wake gives the cable - !! the wake oscillator instead of its lift (Cl 0 and a WAKE OSCILLATOR row, C_L0 0.3); amp a VIV + !! inline adds the in-line VIV of both types (a VIV section, ClX 0.85); wake gives both types + !! the wake oscillator instead of their lift (Cl 0 and WAKE OSCILLATOR rows, C_L0 0.3); amp a VIV !! AMPLITUDE table on both types. CHARACTER(*), INTENT(IN) :: path REAL(wp), INTENT(IN) :: cl @@ -466,7 +470,7 @@ SUBROUTINE write_deck(path, cl, window, dtm, anchor_first, inline, wake, amp) WRITE (u, '(A)') '--------------------- LINE TYPES ---' WRITE (u, '(A)') 'TypeName Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx Cl dF cF' WRITE (u, '(A)') '(name) (m) (kg/m) (N) (N-s/-) (-) (-) (-) (-) (-) (-) (-) (-)' - WRITE (u, '(A)') 'riser 0.10 10.0 5.0e7 -0.8 0.0 1.2 1.0 0.0 0.0 '//TRIM(cl_txt)//' 0.08 0.18' + WRITE (u, '(A)') 'riser 0.10 10.0 5.0e7 -0.8 0.0 1.2 1.0 0.0 0.0 '//TRIM(clc_txt)//' 0.08 0.18' WRITE (u, '(A)') 'cable 0.10 10.0 5.0e7 -0.8 1.0 1.2 1.0 0.0 0.0 '//TRIM(clc_txt)//' 0.08 0.18' WRITE (u, '(A)') '--------------------- POINTS ---' WRITE (u, '(A)') 'ID Attachment X Y Z M V CdA CA' @@ -500,6 +504,7 @@ SUBROUTINE write_deck(path, cl, window, dtm, anchor_first, inline, wake, amp) IF (wo) THEN WRITE (u, '(A)') '--------------------- WAKE OSCILLATOR ---' WRITE (u, '(A)') 'TypeName CL0 St eps A' + WRITE (u, '(A)') 'riser 0.3 0.2 0.3 12' WRITE (u, '(A)') 'cable 0.3 0.2 0.3 12' END IF IF (PRESENT(amp)) THEN diff --git a/tests/test_viv_wake_deck.f90 b/tests/test_viv_wake_deck.f90 index 7546516..aefad2f 100644 --- a/tests/test_viv_wake_deck.f90 +++ b/tests/test_viv_wake_deck.f90 @@ -3,9 +3,10 @@ ! Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University PROGRAM test_viv_wake_deck !! Wake-oscillator VIV on a deck (the optional WAKE OSCILLATOR section, TypeName CL0 [St [eps - !! [A]]]; Facchinetti et al. 2004): the taut finite-EI cable of the in-line VIV gate (100 m, - !! D 0.1 m, EI 1 N m^2, 50 kN, pinned at 50 m depth) in a uniform 0.15 m/s current along y, its - !! type with no synchronisation lift (Cl 0) and the row riser 0.3 (St 0.2, eps 0.3, A 12). + !! [A]]]; Facchinetti et al. 2004): the taut cable of the in-line VIV gate (100 m, D 0.1 m, + !! 50 kN, pinned at 50 m depth) in a uniform 0.15 m/s current along y, its type with no + !! synchronisation lift (Cl 0) and the row riser 0.3 (St 0.2, eps 0.3, A 12). W1-W3 run on the + !! finite-EI cable (EI 1 N m^2) and on the EI = 0 line alike. !! W1 lock-in: with the acceleration coupling A 12 the cross-flow response is captured by the !! cable's first mode, below the wake's own frequency St U/D = 0.30 Hz by more than !! 0.01 Hz, at a steady mid-span A/D between 0.4 and 0.8; uncoupled (A 0) the wake drives @@ -16,15 +17,25 @@ PROGRAM test_viv_wake_deck !! W3 a row with CL0 0 is the deck without the section, to the printed digits; !! W4 refusals by name: a malformed or non-numeric row, an unknown or repeated type, St, eps or !! A out of range, a type that keeps its synchronisation lift (Cl > 0, which in-line VIV - !! also needs), a line that mixes the two models, and an EI = 0 line. + !! also needs), and a line that mixes the two models (finite-EI and EI = 0); + !! W5 the two cores agree: the EI = 0 line locks in within 3 % of the finite-EI cable's A/D + !! and 0.003 Hz of its frequency, and so does its uncoupled response. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_DECKDRV_OK IMPLICIT NONE REAL(wp), PARAMETER :: PI = 3.14159265358979323846_wp, D = 0.1_wp, F_WAKE = 0.2_wp*0.15_wp/0.1_wp INTEGER :: nfail = 0 + REAL(wp) :: ad_fe(4) = 0.0_wp, ad_l(4) = 0.0_wp CALL write_current('wod_current.dat') - CALL check_runs() + CALL check_runs('1.0', 'wod', ad_fe) + CALL check_runs('0.0', 'wod0', ad_l) + WRITE (*, '(A,4F8.4)') 'W5: lock-in A/D, f [Hz] finite-EI, EI = 0: ', ad_fe(1:2), ad_l(1:2) + WRITE (*, '(A,4F8.4)') 'W5: uncoupled A/D, f [Hz] finite-EI, EI = 0: ', ad_fe(3:4), ad_l(3:4) + CALL require(ABS(ad_l(1)/ad_fe(1) - 1.0_wp) <= 0.03_wp .AND. ABS(ad_l(2) - ad_fe(2)) <= 0.003_wp, & + 'W5: the EI = 0 line locks in as the finite-EI cable') + CALL require(ABS(ad_l(3)/ad_fe(3) - 1.0_wp) <= 0.03_wp .AND. ABS(ad_l(4) - ad_fe(4)) <= 0.003_wp, & + 'W5: and responds uncoupled as it') CALL check_refusals() IF (nfail > 0) THEN WRITE (*, '(A,I0,A)') 'FAIL: ', nfail, ' assertion(s) failed' @@ -213,53 +224,61 @@ SUBROUTINE window_stats(tab, n, t0, t1, ad, f) f = peak_frequency(tt, z) END SUBROUTINE window_stats - SUBROUTINE check_runs() + SUBROUTINE check_runs(ei, tag, res) + !! W1-W3 on the cable of EI ei ('1.0' finite-EI, '0.0' the EI = 0 line), the files named + !! after tag; res = (coupled A/D, f, uncoupled A/D, f) over the steady windows. + CHARACTER(*), INTENT(IN) :: ei, tag + REAL(wp), INTENT(OUT) :: res(4) REAL(wp), ALLOCATABLE :: tw(:, :), t0(:, :), tn(:, :), tz(:, :) INTEGER :: nw, n0, nn, nz REAL(wp) :: ad_w, f_w, ad_w2, f_w2, ad_0, f_0, pv, pd, pb LOGICAL :: ok, keep(20000) CHARACTER(1024) :: msg - CALL write_deck('wod_wake.dat', 'riser 0.3', 100.0_wp) - CALL run('wod_wake.dat', 'wod_wake', ok, msg) - CALL require(ok, 'W1: the wake-oscillator deck runs: '//TRIM(msg)) - CALL write_deck('wod_a0.dat', 'riser 0.3 0.2 0.3 0.0', 100.0_wp) - CALL run('wod_a0.dat', 'wod_a0', ok, msg) - CALL require(ok, 'W1: the uncoupled deck (A 0) runs: '//TRIM(msg)) - CALL read_out('wod_wake.out', tw, nw) - CALL read_out('wod_a0.out', t0, n0) - CALL require(nw > 1000 .AND. n0 == nw, 'W1: the runs wrote matching rows') + CHARACTER(:), ALLOCATABLE :: lab + res = 0.0_wp + lab = ' (EI '//ei//')' + CALL write_deck(tag//'_wake.dat', 'riser 0.3', 100.0_wp, ei=ei) + CALL run(tag//'_wake.dat', tag//'_wake', ok, msg) + CALL require(ok, 'W1: the wake-oscillator deck runs'//lab//': '//TRIM(msg)) + CALL write_deck(tag//'_a0.dat', 'riser 0.3 0.2 0.3 0.0', 100.0_wp, ei=ei) + CALL run(tag//'_a0.dat', tag//'_a0', ok, msg) + CALL require(ok, 'W1: the uncoupled deck (A 0) runs'//lab//': '//TRIM(msg)) + CALL read_out(tag//'_wake.out', tw, nw) + CALL read_out(tag//'_a0.out', t0, n0) + CALL require(nw > 1000 .AND. n0 == nw, 'W1: the runs wrote matching rows'//lab) IF (.NOT. (nw > 1000 .AND. n0 == nw)) RETURN CALL window_stats(tw, nw, 50.0_wp, 75.0_wp, ad_w, f_w) CALL window_stats(tw, nw, 75.0_wp, 100.0_wp, ad_w2, f_w2) CALL window_stats(t0, n0, 50.0_wp, 100.0_wp, ad_0, f_0) - WRITE (*, '(A,2F8.4,A,2F8.4,A,F7.4)') 'W1: coupled A/D, f [Hz] (50-75 s, 75-100 s) ', ad_w, f_w, ', ', ad_w2, & - f_w2, '; wake frequency ', F_WAKE - WRITE (*, '(A,2F8.4)') 'W1: uncoupled (A 0) A/D, f [Hz] ', ad_0, f_0 + res = [ad_w, f_w, ad_0, f_0] + WRITE (*, '(A,2F8.4,A,2F8.4,A,F7.4)') 'W1'//lab//': coupled A/D, f [Hz] (50-75 s, 75-100 s) ', ad_w, f_w, & + ', ', ad_w2, f_w2, '; wake frequency ', F_WAKE + WRITE (*, '(A,2F8.4)') 'W1'//lab//': uncoupled (A 0) A/D, f [Hz] ', ad_0, f_0 CALL require(f_w < F_WAKE - 0.01_wp .AND. ad_w > 0.4_wp .AND. ad_w < 0.8_wp, & - 'W1: the coupled response locks in below the wake frequency at A/D 0.4-0.8') - CALL require(ABS(ad_w2/ad_w - 1.0_wp) <= 0.01_wp .AND. ABS(f_w2 - f_w) <= 0.002_wp, 'W1: and is steady') - CALL require(ABS(f_0 - F_WAKE) <= 0.005_wp, 'W1: uncoupled, the wake drives the cable at its own frequency') - CALL require(ad_w >= 3.0_wp*ad_0, 'W1: lock-in at least triples the uncoupled amplitude') + 'W1: the coupled response locks in below the wake frequency at A/D 0.4-0.8'//lab) + CALL require(ABS(ad_w2/ad_w - 1.0_wp) <= 0.01_wp .AND. ABS(f_w2 - f_w) <= 0.002_wp, 'W1: and is steady'//lab) + CALL require(ABS(f_0 - F_WAKE) <= 0.005_wp, 'W1: uncoupled, the wake drives the cable at its own frequency'//lab) + CALL require(ad_w >= 3.0_wp*ad_0, 'W1: lock-in at least triples the uncoupled amplitude'//lab) ! W2: the power balance of the steady lock-in keep(1:nw) = tw(1, 1:nw) >= 60.0_wp pv = SUM(PACK(tw(3, 1:nw), keep(1:nw)))/COUNT(keep(1:nw)) pd = SUM(PACK(tw(4, 1:nw), keep(1:nw)))/COUNT(keep(1:nw)) pb = SUM(PACK(tw(5, 1:nw), keep(1:nw)))/COUNT(keep(1:nw)) - WRITE (*, '(A,3ES12.4)') 'W2: mean VIVPow, DragPow, DampPow [W] over 60-100 s: ', pv, pd, pb + WRITE (*, '(A,3ES12.4)') 'W2'//lab//': mean VIVPow, DragPow, DampPow [W] over 60-100 s: ', pv, pd, pb CALL require(pv > 0.0_wp .AND. ABS(pv + pd + pb) <= 0.005_wp*pv, & - 'W2: the drag and damping take out the wake-lift power within 0.5 %') + 'W2: the drag and damping take out the wake-lift power within 0.5 %'//lab) ! W3: CL0 0 is no wake oscillator - CALL write_deck('wod_none.dat', '', 20.0_wp) - CALL run('wod_none.dat', 'wod_none', ok, msg) - CALL require(ok, 'W3: the deck without the section runs: '//TRIM(msg)) - CALL write_deck('wod_zero.dat', 'riser 0.0', 20.0_wp) - CALL run('wod_zero.dat', 'wod_zero', ok, msg) - CALL require(ok, 'W3: the CL0 0 deck runs: '//TRIM(msg)) - CALL read_out('wod_none.out', tn, nn) - CALL read_out('wod_zero.out', tz, nz) - CALL require(nn > 100 .AND. nz == nn, 'W3: the runs wrote matching rows') + CALL write_deck(tag//'_none.dat', '', 20.0_wp, ei=ei) + CALL run(tag//'_none.dat', tag//'_none', ok, msg) + CALL require(ok, 'W3: the deck without the section runs'//lab//': '//TRIM(msg)) + CALL write_deck(tag//'_zero.dat', 'riser 0.0', 20.0_wp, ei=ei) + CALL run(tag//'_zero.dat', tag//'_zero', ok, msg) + CALL require(ok, 'W3: the CL0 0 deck runs'//lab//': '//TRIM(msg)) + CALL read_out(tag//'_none.out', tn, nn) + CALL read_out(tag//'_zero.out', tz, nz) + CALL require(nn > 100 .AND. nz == nn, 'W3: the runs wrote matching rows'//lab) IF (nn > 100 .AND. nz == nn) CALL require(ALL(tz(:, 1:nz) == tn(:, 1:nn)), & - 'W3: a row with CL0 0 is the deck without the section') + 'W3: a row with CL0 0 is the deck without the section'//lab) END SUBROUTINE check_runs SUBROUTINE check_refusals() @@ -273,7 +292,10 @@ SUBROUTINE check_refusals() CALL refused('riser 0.3 0.2 0.3 -1', 'St > 0, eps > 0 and A >= 0', 'a negative A') CALL refused('riser 0.3', 'give the type LINE TYPES Cl 0', 'a type that keeps its lift', cl='0.8') CALL refused('riser 0.3', 'a line takes one VIV model', 'a line mixing the two models', mixed=.TRUE.) - CALL refused('riser 0.3', 'finite-EI cables (EI > 0) only', 'an EI = 0 line', ei='0.0') + CALL refused('riser 0.3', 'a line takes one VIV model', 'an EI = 0 line mixing the two models', ei='0.0', & + mixed=.TRUE.) + CALL refused('riser 0.3', 'give the type LINE TYPES Cl 0', 'an EI = 0 type that keeps its lift', cl='0.8', & + ei='0.0') END SUBROUTINE check_refusals SUBROUTINE refused(rows, needle, what, cl, ei, viv_row, mixed) @@ -282,17 +304,8 @@ SUBROUTINE refused(rows, needle, what, cl, ei, viv_row, mixed) LOGICAL, INTENT(IN), OPTIONAL :: mixed LOGICAL :: ok CHARACTER(1024) :: msg - IF (PRESENT(viv_row)) THEN - CALL write_deck('wod_bad.dat', rows, 1.0_wp, cl=cl, viv_row=viv_row) - ELSE IF (PRESENT(cl)) THEN - CALL write_deck('wod_bad.dat', rows, 1.0_wp, cl=cl) - ELSE IF (PRESENT(ei)) THEN - CALL write_deck('wod_bad.dat', rows, 1.0_wp, ei=ei) - ELSE IF (PRESENT(mixed)) THEN - CALL write_deck('wod_bad.dat', rows, 1.0_wp, mixed=mixed) - ELSE - CALL write_deck('wod_bad.dat', rows, 1.0_wp) - END IF + ! an absent optional passes on absent + CALL write_deck('wod_bad.dat', rows, 1.0_wp, cl=cl, ei=ei, viv_row=viv_row, mixed=mixed) CALL run('wod_bad.dat', 'wod_bad', ok, msg) CALL require(.NOT. ok .AND. INDEX(msg, needle) > 0, 'W4: '//what//' is refused: '//TRIM(msg)) END SUBROUTINE refused