diff --git a/CHANGELOG.md b/CHANGELOG.md index 530f4aa..4b20c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,16 @@ All notable changes to CableDyn are recorded in this file. The format follows with its source, its test data and the line-type columns it maps to, and Thorsen et al.'s excitation curve as a `VIV AMPLITUDE` table. +- Wake oscillator for moving cables: an optional `VIV FRAME` section, rows `TypeName Tf`, takes + the free stream of a line type's VIV model relative to the cable's velocity low-pass filtered + over `Tf` [s] (first order). The wake frequency then follows a cable towed or moved by its + floater through still water, which the ambient flow alone never made shed. A taut cable towed + at 0.15 m/s with `Tf` 10 s locks in as the cable held in a 0.15 m/s current (A/D within + 0.6 %); on a held cable `Tf` changes A/D by 0.03 %. On `EI = 0` lines and finite-EI cables, + the filtered velocity in the step-recovery, snapshot and checkpoint state; `Tf` 0 or no row + leaves runs unchanged to the bit. The Python deck reader and builder (`viv_frame_tf`) take the + section. + ### Fixed - The statics of a finite-EI line through the free surface could fail at isolated currents: diff --git a/doc/capabilities.rst b/doc/capabilities.rst index fd73d2a..b66ba3e 100644 --- a/doc/capabilities.rst +++ b/doc/capabilities.rst @@ -159,7 +159,9 @@ 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, - on ``EI = 0`` lines and 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; a + ``VIV FRAME`` row (``Tf``) takes its frequency from the flow relative to the cable's + filtered motion (a towed or floater-driven cable) (: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 7d5502d..1867df7 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -134,7 +134,7 @@ exist. A conventional layout is: LINE TYPES → BODIES → EXTERNAL LOADS → ROD TYPES → RODS → POINTS → TURBINES → LINES → SYROPE IC → SECTIONS → END CONNECTIONS / EQUIVALENT BUOYANCY / ATTACHMENTS / STIFFENERS / VIV / WAKE OSCILLATOR / -VIV AMPLITUDE / VIV DIAMETER / VIV DAMPING / FAILURE / CONTROL → OPTIONS → OUTPUTS +VIV AMPLITUDE / VIV DIAMETER / VIV DAMPING / VIV FRAME / FAILURE / CONTROL → OPTIONS → OUTPUTS Within LINE TYPES, the header row must precede the data rows because it selects their column order. @@ -215,6 +215,7 @@ are collapsed. It must match one of the spellings below; any other name fails wi | VIV AMPLITUDE | `VIV AMPLITUDE`, `VIV AMPLITUDES` | | VIV DIAMETER | `VIV DIAMETER`, `VIV DIAMETERS` | | VIV DAMPING | `VIV DAMPING` | +| VIV FRAME | `VIV FRAME`, `VIV FRAMES` | | FAILURE | `FAILURE`, `FAILURES` | | CONTROL | `CONTROL`, `CONTROLS` | | TURBINES | `TURBINES`, `TURBINE` | @@ -1355,6 +1356,40 @@ Behaviour: finite-EI cables, standalone and coupled. A row fails if it is not `TypeName Dviv`, names an undefined or already named type or one without VIV, or holds a value out of range. +### VIV FRAME (optional) + +The flow frame of the VIV model of a line type: the flow the model takes as its free stream, the +ambient flow by default. A cable moved through the water by a tow or by its floater sees no +ambient flow, so its wake oscillator never shed; with a filter time `Tf` the free stream is the +ambient flow relative to the cable's own slow motion (see [Wake oscillator](theory.rst)). + +```text +--------------------- VIV FRAME ---------------------------------------- +TypeName Tf +(-) (s) +cable 10 +``` + +| Column | Meaning | +|--------|---------| +| `TypeName` | an existing LINE TYPES name (case-insensitive) with a WAKE OSCILLATOR row, at most one row each | +| `Tf` | filter time >= 0 [s], at most 1e15; `0` is the ambient flow | + +Behaviour: + +- With `Tf > 0` the wake frequency `2 pi St U_a/D` takes `U_a` = the speed normal to the line of + the ambient flow less the node's velocity low-pass filtered over `Tf` (first order, started at + the node's initial velocity). The slow motion then counts as flow; the cable's own VIV + velocity, much faster than `Tf`, does not modulate the frequency. +- Take `Tf` several VIV periods long and short against the motion. A taut cable towed at 0.15 m/s + through still water (VIV at 0.28 Hz) with `Tf` 10 s locks in as the same cable held in a + 0.15 m/s current, A/D within 0.6 % and frequency within 0.001 Hz, where the ambient flow gave it + no lock-in. On a held cable in a current `Tf` changes A/D by 0.03 %. +- The filtered velocity is part of the step-recovery, snapshot and checkpoint state. A row with + `Tf = 0` leaves the run exactly as without it. It acts on `EI = 0` lines and finite-EI cables, + standalone and coupled. A row fails if it is not `TypeName Tf`, names an undefined or already + named type or one without a WAKE OSCILLATOR row, or holds a value out of range. + ### VIV DAMPING (optional, finite-EI lines) Splits the normal Morison drag of a line type into an in-line and a cross-flow part in the frame diff --git a/doc/theory.rst b/doc/theory.rst index 2702128..401839d 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1289,7 +1289,23 @@ mass): with :math:`U_a` the speed of the ambient flow (current and host field) normal to the line, the free stream of the paper, so that the cable's own cross-flow velocity does not modulate the wake frequency, and :math:`\ddot y` along the cross-flow axis :math:`\mathbf t\times\mathbf v_n/U` of -the synchronisation model. The lift per unit length acts across the relative normal flow +the synchronisation model. The ambient flow sets no frequency for a cable moved through still +water, which then never sheds; a ``VIV FRAME`` row with the filter time :math:`T_f > 0` takes +:math:`U_a` relative to the node's velocity low-pass filtered over :math:`T_f`, + +.. math:: + + U_a = \bigl|(\mathbf u - \bar{\mathbf v})_n\bigr|,\qquad + \bar{\mathbf v}_{n+1} = \bar{\mathbf v}_n + \bigl(1 - e^{-\delta t/T_f}\bigr) + (\mathbf v_{n+1} - \bar{\mathbf v}_n), + +the exact first-order filter of the converged end velocity held over the step, started at the +node's initial velocity. The slow motion (a tow, a floater's response) then counts as flow, and the +VIV velocity, far faster than :math:`T_f`, is filtered out. On a cable towed at 0.15 m/s through +still water (the taut cable of the deck gate, VIV at 0.28 Hz) :math:`T_f` 10 s gives the lock-in of +the cable held in a 0.15 m/s current to 0.6 % in A/D and 0.001 Hz, where the ambient flow gave no +lock-in; on the held cable it changes A/D by 0.03 %. :math:`\bar{\mathbf v}` is part of the wake +state. The lift per unit length acts across the relative normal flow :math:`\mathbf v_n` of speed :math:`U`, as the synchronisation lift does: .. math:: @@ -1318,7 +1334,8 @@ its exact position and velocity derivatives in the tangent at fixed :math:`q`. O 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 +the line's VIV state (with :math:`T_f`, :math:`\bar{\mathbf v}` the next three statistics, and three +more state rows on a finite-EI cable). :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. diff --git a/python/cabledyn/builder.py b/python/cabledyn/builder.py index 53d184f..7efb186 100644 --- a/python/cabledyn/builder.py +++ b/python/cabledyn/builder.py @@ -229,6 +229,12 @@ class LineType: synchronisation lift, so ``cl`` stays ``None`` or 0, and acts on ``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_frame_tf : float | None + Optional flow frame of a type's VIV model, a ``VIV FRAME`` section row + ``Name Tf``: the filter time [s] of the cable velocity the model's free + stream is taken relative to (0: the ambient flow; set it for a cable + moved through the water by a tow or its floater). It sets the wake + oscillator's frequency, so it needs ``wake_cl0``. ``None`` writes no row. viv_amplitude : list of tuples | None Optional amplitude-dependent VIV coefficients of a type (Thorsen et al. 2016), the rows of a ``VIV AMPLITUDE`` section table ``Name AD Cv @@ -275,6 +281,7 @@ class LineType: wake_a: float | None = None viv_amplitude: list[tuple[float, ...]] | None = None viv_diameter: float | None = None + viv_frame_tf: float | None = None viv_damping: tuple[float, ...] | None = None @@ -1701,6 +1708,7 @@ def add_line_type( wake_a: float | None = None, viv_amplitude: list[tuple[float, ...]] | None = None, viv_diameter: float | None = None, + viv_frame_tf: float | None = None, viv_damping: tuple[float, ...] | None = None, ) -> LineType: """Add a ``LINE TYPES`` row; see :class:`LineType` for the fields. @@ -1744,6 +1752,7 @@ def add_line_type( wake_a, None if viv_amplitude is None else [tuple(row) for row in viv_amplitude], viv_diameter, + viv_frame_tf, None if viv_damping is None else tuple(viv_damping), ) self._line_types.append(item) @@ -2639,6 +2648,7 @@ def to_text(self, *, validate: bool = True) -> str: _emit(out, "WAKE OSCILLATOR", *self._wake_table()) _emit(out, "VIV AMPLITUDE", *self._viv_amp_table()) _emit(out, "VIV DIAMETER", *self._viv_diam_table()) + _emit(out, "VIV FRAME", *self._viv_frame_table()) _emit(out, "VIV DAMPING", *self._viv_damp_table()) _emit(out, "FAILURE", *self._failure_table()) _emit(out, "CONTROL", *self._control_table()) @@ -3086,6 +3096,19 @@ def _viv_diam_table(self) -> tuple[str, str, list[list[str]]]: rows.append([_text(item.name, what), _num(item.viv_diameter, what)]) return "Name Dviv", "(-) (m)", rows + def _viv_frame_table(self) -> tuple[str, str, list[list[str]]]: + rows: list[list[str]] = [] + for item in self._line_types: + if item.viv_frame_tf is None: + continue + what = f"line type {item.name!r}" + if item.wake_cl0 is None: + raise ValueError( + f"{what}: viv_frame_tf sets the frame of its wake oscillator, set wake_cl0" + ) + rows.append([_text(item.name, what), _num(item.viv_frame_tf, what)]) + return "Name Tf", "(-) (s)", rows + def _syrope_table(self) -> tuple[str, str, list[list[str]]]: rows = [ [_line_list(row.lines), _num(row.tmax0, "SYROPE IC"), _num(row.tmean0, "SYROPE IC")] @@ -3309,6 +3332,9 @@ def load(self) -> None: for row in self.rows("VIV DIAMETER"): t = row.tokens model.line_types[t[0]].viv_diameter = _f(t[1]) + for row in self.rows("VIV FRAME"): + t = row.tokens + model.line_types[t[0]].viv_frame_tf = _f(t[1]) for row in self.rows("ATTACHMENTS"): t = row.tokens arc: float | tuple[float, float, float] diff --git a/python/cabledyn/deck_file.py b/python/cabledyn/deck_file.py index e337f94..48a258e 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -87,6 +87,8 @@ "VIV DIAMETER": "VIV DIAMETER", "VIV DIAMETERS": "VIV DIAMETER", "VIV DAMPING": "VIV DAMPING", + "VIV FRAME": "VIV FRAME", + "VIV FRAMES": "VIV FRAME", } # Table sections whose rows the native reader takes through a Fortran # list-directed READ. Their descriptive and units rows are recognized by the @@ -120,6 +122,7 @@ "VIV AMPLITUDE", "VIV DIAMETER", "VIV DAMPING", + "VIV FRAME", } ) _TABLE_SECTIONS = _LIST_DIRECTED_SECTIONS | _WHITESPACE_TABLE_SECTIONS @@ -3384,6 +3387,44 @@ def _check_viv_diam_section(self, viv_type_names: set[str]) -> None: "VIV: give the type LINE TYPES Cl > 0 or a WAKE OSCILLATOR row" ) + def _check_viv_frame_section(self, wake_type_names: set[str]) -> None: + """Native ``apply_type_viv_frame`` for the VIV FRAME section. + + A row ``TypeName Tf`` sets the flow frame of a line type's VIV model: with the filter + time ``Tf > 0`` [s] the free stream is the ambient flow relative to the cable's velocity + low-pass filtered over ``Tf`` (0: the ambient flow), at most 1e15. It sets the wake + oscillator's frequency, so the type needs a WAKE OSCILLATOR row with ``CL0 > 0``; a type + takes one row. + """ + types = {row.tokens[0].lower(): row.tokens[0] for row in self.line_types} + named: set[str] = set() + for row in self._rows("VIV FRAME"): + where = self._at(row) + if len(row.tokens) != 2: + raise DeckFormatError(f"{where}: VIV FRAME rows must be: TypeName Tf") + name = row.tokens[0].lower() + if name not in types: + raise DeckFormatError( + f'{where}: VIV FRAME row names undefined LINE TYPE "{row.tokens[0]}"' + ) + if name in named: + raise DeckFormatError(f'{where}: VIV FRAME names LINE TYPE "{types[name]}" twice') + named.add(name) + try: + value = _native_float(row.tokens[1]) + except ValueError as exc: + raise DeckFormatError(f"{where}: VIV FRAME Tf must be a plain number") from exc + if not (math.isfinite(value) and 0.0 <= value <= _NATIVE_MAX_COEFFICIENT): + raise DeckFormatError( + f"{where}: VIV FRAME filter time Tf must be >= 0 (0 = the ambient flow), " + "at most 1e15" + ) + if name not in wake_type_names: + raise DeckFormatError( + f'{where}: VIV FRAME of LINE TYPE "{types[name]}" sets the flow frame of its ' + "wake oscillator: give the type a WAKE OSCILLATOR row" + ) + def _check_viv_damp_section(self, amp_type_names: set[str]) -> set[str]: """Native ``apply_type_viv_damp`` for the VIV DAMPING section; the types it names. @@ -4783,6 +4824,7 @@ def end_key(token: str) -> str: wake_type_names = self._check_wake_section(viv_type_names) amp_type_names = self._check_viv_amp_section(viv_type_names) self._check_viv_diam_section(viv_type_names | wake_type_names) + self._check_viv_frame_section(wake_type_names) damp_type_names = self._check_viv_damp_section(amp_type_names) amp_lines = { line_id diff --git a/python/tests/test_builder.py b/python/tests/test_builder.py index 99e8280..556cbf3 100644 --- a/python/tests/test_builder.py +++ b/python/tests/test_builder.py @@ -281,6 +281,26 @@ def test_viv_amplitude_rows_are_written_with_the_values_given(tmp_path: Path) -> model.to_text(validate=False) +def test_viv_frame_rows_are_written(tmp_path: Path) -> None: + model = _chain_model(tmp_path) + model.add_line_type( + "towed", + diam=0.1, + mass=10.0, + ea=5.0e7, + ei=1.0, + cdn=1.2, + can=1.0, + wake_cl0=0.3, + viv_frame_tf=8.0, + ) + deck = DeckFile.from_text(model.to_text(validate=False), path=tmp_path / "deck.dat") + assert [row.tokens for row in deck._rows("VIV FRAME")] == [("towed", "8.0")] + model.add_line_type("plain", diam=0.1, mass=10.0, ea=5.0e7, viv_frame_tf=8.0) + with pytest.raises(ValueError, match="set wake_cl0"): + model.to_text(validate=False) + + def test_viv_diameter_rows_are_written(tmp_path: Path) -> None: model = _chain_model(tmp_path) model.add_line_type( diff --git a/python/tests/test_deck_file.py b/python/tests/test_deck_file.py index f06061e..3e62ec3 100644 --- a/python/tests/test_deck_file.py +++ b/python/tests/test_deck_file.py @@ -4991,6 +4991,40 @@ def test_viv_diameter_takes_a_wake_oscillator_type(): DeckFile.from_text(_with_section(text, "VIV DIAMETER", "chain 0.9")) +def test_viv_frame_rows_are_read_and_kept(tmp_path): + from cabledyn import DeckModel + + text = _with_section( + _with_section(_DYNAMIC, "WAKE OSCILLATOR", "chain 0.3"), + "VIV FRAME", + "TypeName Tf", + "chain 8", + ) + DeckFile.from_text(text) + path = tmp_path / "frame.dat" + path.write_text(text, encoding="utf-8") + assert DeckModel.load(path).line_types["chain"].viv_frame_tf == 8.0 + saved = tmp_path / "saved.dat" + DeckModel.load(path).save(saved) + assert DeckModel.load(saved).line_types["chain"].viv_frame_tf == 8.0 + + +@pytest.mark.parametrize( + "wake, rows, message", + [ + (True, ("chain 8 1",), "rows must be: TypeName Tf"), + (True, ("cable 8",), 'undefined LINE TYPE "cable"'), + (True, ("chain 8", "chain 4"), 'names LINE TYPE "chain" twice'), + (True, ("chain -1",), "filter time Tf must be >= 0"), + (False, ("chain 8",), "give the type a WAKE OSCILLATOR row"), + ], +) +def test_viv_frame_rows_follow_the_native_checks(wake, rows, message): + text = _with_section(_DYNAMIC, "WAKE OSCILLATOR", "chain 0.3") if wake else _DYNAMIC + with pytest.raises(DeckFormatError, match=re.escape(message)): + DeckFile.from_text(_with_section(text, "VIV FRAME", *rows)) + + _DAMP_BASE = _with_section( _edit(_DYNAMIC, (_LIFT_ROW, _LIFT_ROW + " 0.8")), "VIV AMPLITUDE", diff --git a/python/tests/test_end_to_end.py b/python/tests/test_end_to_end.py index fd3c2bd..91c9699 100644 --- a/python/tests/test_end_to_end.py +++ b/python/tests/test_end_to_end.py @@ -345,6 +345,28 @@ def _dia_rows(*rows: str) -> tuple[str, str]: _AMP_PARITY += _DIA_PARITY +def _frame_rows(*rows: str) -> tuple[str, str]: + """The edit that puts a VIV FRAME section with ``rows`` before OPTIONS.""" + block = "--------------------- VIV FRAME -----\n" + "".join(f"{row}\n" for row in rows) + return _AMP_OPTIONS, block + _AMP_OPTIONS + + +_WAKE_RISER = ("riser 0.85 0.15", "riser 0.3") +_FRAME_PARITY = [ + ("frame-accepted", [_WAKE_LIFT, _WAKE_SECTION, _WAKE_RISER, _frame_rows("riser 8")], True), + ("frame-zero", [_WAKE_LIFT, _WAKE_SECTION, _WAKE_RISER, _frame_rows("riser 0")], True), + ("frame-negative", [_WAKE_LIFT, _WAKE_SECTION, _WAKE_RISER, _frame_rows("riser -1")], False), + ( + "frame-three-columns", + [_WAKE_LIFT, _WAKE_SECTION, _WAKE_RISER, _frame_rows("riser 8 1")], + False, + ), + ("frame-sync-type", [_frame_rows("riser 8")], False), +] + +_AMP_PARITY += _FRAME_PARITY + + def _damp_rows(*rows: str) -> tuple[str, str]: """The edit that puts a VIV DAMPING section with ``rows`` before OPTIONS.""" block = "--------------------- VIV DAMPING -----\n" + "".join(f"{row}\n" for row in rows) diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 7814c4e..17ce2b7 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -462,6 +462,11 @@ MODULE CableDyn_DeckDriver ! has_wake_row marks a type the section names. REAL(wp) :: wo_cl0 = CD_ZERO, wo_st = CD_VIV_WAKE_DEFAULT_ST, wo_eps = CD_VIV_WAKE_DEFAULT_EPS REAL(wp) :: wo_a = CD_VIV_WAKE_DEFAULT_A + ! The VIV frame of a line type (the optional VIV FRAME section, a row per type: TypeName Tf): + ! the filter time Tf [s] of the cable velocity that the VIV model's flow frame moves with + ! (0: the ambient flow); has_vivf_row marks a type the section names. + REAL(wp) :: viv_tf = CD_ZERO + LOGICAL :: has_vivf_row = .FALSE. LOGICAL :: has_wake_row = .FALSE. ! Amplitude-dependent VIV coefficients (the optional VIV AMPLITUDE section, rows TypeName AD Cv ! [CdAmp]): amp_n rows of (A/D, C_v, drag factor) in amp_tab, A/D increasing; amp_cols the @@ -1917,7 +1922,7 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, REAL(wp), ALLOCATABLE :: viv_cl(:), viv_cf(:), viv_df(:), viv_clx(:), viv_al(:), viv_hh(:) REAL(wp), ALLOCATABLE :: viv_tix(:), viv_amp3(:, :, :), viv_dva(:), cdy_a(:), cdy_b(:), cdy_c(:) INTEGER, ALLOCATABLE :: viv_ampn(:) - REAL(wp), ALLOCATABLE :: wo_cl0(:), wo_st(:), wo_eps(:), wo_a(:) + REAL(wp), ALLOCATABLE :: wo_cl0(:), wo_st(:), wo_eps(:), wo_a(:), wo_tf(:) REAL(wp), ALLOCATABLE :: ba_raw(:), ba(:), dry_b(:), bb_el(:) REAL(wp) :: mode1_omega REAL(wp), ALLOCATABLE :: contact_kn(:), contact_cn(:) @@ -3316,8 +3321,8 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, ALLOCATE (viv_cl(SIZE(l0)), viv_cf(SIZE(l0)), viv_df(SIZE(l0)), viv_clx(SIZE(l0)), viv_al(SIZE(l0)), & viv_hh(SIZE(l0))) CALL finite_viv_arrays(ln, sections, types, viv_cl, viv_cf, viv_df, viv_clx, viv_al, viv_hh) - ALLOCATE (wo_cl0(SIZE(l0)), wo_st(SIZE(l0)), wo_eps(SIZE(l0)), wo_a(SIZE(l0))) - CALL finite_wake_arrays(ln, sections, types, wo_cl0, wo_st, wo_eps, wo_a) + ALLOCATE (wo_cl0(SIZE(l0)), wo_st(SIZE(l0)), wo_eps(SIZE(l0)), wo_a(SIZE(l0)), wo_tf(SIZE(l0))) + CALL finite_wake_arrays(ln, sections, types, wo_cl0, wo_st, wo_eps, wo_a, wo_tf) ALLOCATE (viv_tix(SIZE(l0))) CALL viv_amp_type_index(ln, sections, types, viv_tix) ALLOCATE (viv_dva(SIZE(l0))) @@ -3334,6 +3339,7 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, CALL remap_elem_by_reference_arc(wo_st, l0, l0_am) CALL remap_elem_by_reference_arc(wo_eps, l0, l0_am) CALL remap_elem_by_reference_arc(wo_a, l0, l0_am) + CALL remap_elem_by_reference_arc(wo_tf, l0, l0_am) CALL remap_elem_by_reference_arc(viv_cl, l0, l0_am) CALL remap_elem_by_reference_arc(viv_cf, l0, l0_am) CALL remap_elem_by_reference_arc(viv_df, l0, l0_am) @@ -3712,7 +3718,8 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, REAL(CD_VIV_NM, wp)*MERGE(opts%dtM, dt, opts%has_dtm), & opts%viv_rms_window > CD_ZERO), es, em, phase_seed=seed, & tangent_reversed=.NOT. ln%ends_swapped, & - wake=RESHAPE([wo_st, wo_eps, wo_a], [3, SIZE(wo_st)], ORDER=[2, 1]), & + wake=RESHAPE([wo_st, wo_eps, wo_a, wo_tf], [4, SIZE(wo_st)], & + ORDER=[2, 1]), & dviv=viv_dva) ELSE IF (ANY(viv_clx > CD_ZERO)) THEN CALL CD_HermiteCable_Dyn_Set_VIV(cable%line, viv_cl, viv_cf, viv_df, & @@ -10449,7 +10456,7 @@ 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) + ! the WAKE OSCILLATOR rows per element (C_L0, St, eps, A, Tf; C_L0 0 where none) REAL(wp), ALLOCATABLE :: viv_wo(:, :) INTEGER, ALLOCATABLE :: viv_ampn(:) LOGICAL, ALLOCATABLE :: syr_el(:) @@ -10491,7 +10498,7 @@ 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_wo(4, SIZE(l0))) + viv_tix(SIZE(l0)), viv_dia(SIZE(l0)), viv_wo(5, SIZE(l0))) viv_tix = CD_ZERO viv_wo = CD_ZERO viv_dia = CD_ZERO @@ -10561,7 +10568,8 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er 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] + types(line_section_type(sections, ln%id, i))%wo_a, & + types(line_section_type(sections, ln%id, i))%viv_tf] 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 '// & @@ -10892,7 +10900,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er 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, :)) + phase_seed=seed, tangent_reversed=.NOT. ln%ends_swapped, wake=viv_wo(2:5, :)) 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, & @@ -11740,13 +11748,13 @@ SUBROUTINE finite_viv_arrays(ln, sections, types, cl, cf, df, clx, il_alpha, chh chh = chh(SIZE(chh):1:-1) END SUBROUTINE finite_viv_arrays - SUBROUTINE finite_wake_arrays(ln, sections, types, cl0, st, eps, a) - !! Expand the WAKE OSCILLATOR rows (CL0, St, eps, A) to finite-EI element arrays, in the + SUBROUTINE finite_wake_arrays(ln, sections, types, cl0, st, eps, a, tf) + !! Expand the WAKE OSCILLATOR rows (CL0, St, eps, A, Tf) to finite-EI element arrays, in the !! element order of finite_hydro_arrays. TYPE(DeckLine), INTENT(IN) :: ln TYPE(DeckSection), INTENT(IN) :: sections(:) TYPE(DeckLineType), INTENT(IN) :: types(:) - REAL(wp), INTENT(OUT) :: cl0(:), st(:), eps(:), a(:) + REAL(wp), INTENT(OUT) :: cl0(:), st(:), eps(:), a(:), tf(:) INTEGER :: i, j, e, tidx e = 0 @@ -11759,12 +11767,14 @@ SUBROUTINE finite_wake_arrays(ln, sections, types, cl0, st, eps, a) st(e) = types(tidx)%wo_st eps(e) = types(tidx)%wo_eps a(e) = types(tidx)%wo_a + tf(e) = types(tidx)%viv_tf END DO END DO cl0 = cl0(SIZE(cl0):1:-1) st = st(SIZE(st):1:-1) eps = eps(SIZE(eps):1:-1) a = a(SIZE(a):1:-1) + tf = tf(SIZE(tf):1:-1) END SUBROUTINE finite_wake_arrays SUBROUTINE viv_amp_type_index(ln, sections, types, tix) @@ -13993,6 +14003,9 @@ SUBROUTINE parse_deck(path, types, bodies, rod_types, rods, points, lines, secti INTEGER :: n_vdmp INTEGER, ALLOCATABLE :: vdia_lines(:) INTEGER :: n_vdia + CHARACTER(DECK_RECLEN), ALLOCATABLE :: vfrm_rows(:) + INTEGER, ALLOCATABLE :: vfrm_lines(:) + INTEGER :: n_vfrm CHARACTER(2*NAMELEN), ALLOCATABLE :: channel_keys(:) LOGICAL :: ext_march, types_stock_cols, rodtypes_legacy_cols, turb_ok, static_finite_ok, tors_marched INTEGER :: unit, ios, section, nt, nb, nrt, nr, np, nlin, nsec, neq, nch, nfl, nct, nec, lineno @@ -14011,7 +14024,7 @@ SUBROUTINE parse_deck(path, types, bodies, rod_types, rods, points, lines, secti SEC_EQUIV = 10, SEC_FAILURE = 11, SEC_CONTROL = 12, SEC_SYROPE_IC = 13, & SEC_ENDCONN = 14, SEC_TURBINES = 15, SEC_EXTLOADS = 16, SEC_ATTACH = 17, & SEC_STIFF = 18, SEC_VIV = 19, SEC_WAKE = 20, SEC_VIVAMP = 21, SEC_VIVDIA = 22, & - SEC_VIVDAMP = 23 + SEC_VIVDAMP = 23, SEC_VIVFRAME = 25 ErrStat = 0; ErrMsg = '' ext_march = .FALSE. @@ -14041,6 +14054,8 @@ SUBROUTINE parse_deck(path, types, bodies, rod_types, rods, points, lines, secti ALLOCATE (vdia_rows(0), vdia_lines(0)) ALLOCATE (vdmp_rows(0), vdmp_lines(0)) n_vdmp = 0 + ALLOCATE (vfrm_rows(0), vfrm_lines(0)) + n_vfrm = 0 n_vdia = 0 n_wake = 0 nt = 0; nb = 0; nrt = 0; nr = 0; np = 0; nlin = 0; nsec = 0; neq = 0; nch = 0; nfl = 0; nct = 0; nec = 0 @@ -14204,6 +14219,15 @@ SUBROUTINE parse_deck(path, types, bodies, rod_types, rods, points, lines, secti END IF vdmp_rows(n_vdmp) = line(1:MIN(LEN(line), DECK_RECLEN)) vdmp_lines(n_vdmp) = lineno + CASE (SEC_VIVFRAME) + IF (.NOT. has_numeric_token(line)) CYCLE + n_vfrm = n_vfrm + 1 + IF (n_vfrm > SIZE(vfrm_rows)) THEN + vfrm_rows = [vfrm_rows, [(REPEAT(' ', DECK_RECLEN), i_ch=1, 8)]] + vfrm_lines = [vfrm_lines, [(0, i_ch=1, 8)]] + END IF + vfrm_rows(n_vfrm) = line(1:MIN(LEN(line), DECK_RECLEN)) + vfrm_lines(n_vfrm) = lineno CASE (SEC_VIVDIA) IF (.NOT. has_numeric_token(line)) CYCLE n_vdia = n_vdia + 1 @@ -14345,6 +14369,13 @@ SUBROUTINE parse_deck(path, types, bodies, rod_types, rods, points, lines, secti RETURN END IF END DO + DO i_ch = 1, n_vfrm + CALL apply_type_viv_frame(vfrm_rows(i_ch), types, ErrStat, ErrMsg) + IF (ErrStat /= 0) THEN + CALL add_row_context('deck', vfrm_lines(i_ch), vfrm_rows(i_ch), ErrMsg) + RETURN + END IF + END DO DO i_ch = 1, SIZE(types) IF (types(i_ch)%amp_n == 1) THEN CALL fail(ErrStat, ErrMsg, 'VIV AMPLITUDE gives LINE TYPE "'//TRIM(types(i_ch)%name)//'" one row: a '// & @@ -16026,6 +16057,8 @@ SUBROUTINE set_section(secname, section, ErrStat, ErrMsg) section = 22 CASE ('VIV DAMPING') section = 23 + CASE ('VIV FRAME', 'VIV FRAMES') + section = 25 CASE ('WAKE OSCILLATOR', 'WAKE OSCILLATORS', 'WAKE') section = 20 CASE DEFAULT @@ -17632,7 +17665,7 @@ SUBROUTINE apply_type_wake(row, types, ErrStat, ErrMsg) !! type (Facchinetti et al. 2004; the defaults St 0.2, eps 0.3, A 12 are theirs): the reference !! lift coefficient C_L0 >= 0 (0 = off; the lift of a fixed cylinder is C_L0 U^2 rho D/2), the !! Strouhal number St > 0 of the wake frequency 2 pi St U/D, the van der Pol eps > 0 and the - !! acceleration coupling A >= 0. The wake oscillator replaces the synchronisation model, so the + !! acceleration coupling A >= 0 (U: the flow of the type's VIV FRAME, the ambient flow without one). The wake oscillator replaces the synchronisation model, so the !! type takes no LINE TYPES lift Cl (and so no in-line VIV, which needs it). A type takes one !! row. CHARACTER(*), INTENT(IN) :: row @@ -17847,6 +17880,51 @@ SUBROUTINE apply_type_viv_diam(row, types, ErrStat, ErrMsg) types(it)%has_vivd_row = .TRUE. END SUBROUTINE apply_type_viv_diam + SUBROUTINE apply_type_viv_frame(row, types, ErrStat, ErrMsg) + !! One VIV FRAME row: TypeName Tf -- the flow frame of a line type's VIV model: with the filter + !! time Tf > 0 [s] (at most 1e15) the flow the model takes as the free stream is the ambient + !! flow relative to the cable's velocity low-pass filtered over Tf (first order), so that a + !! cable moved through the water by a tow or its floater sees that motion as flow, and its own + !! VIV velocity, much faster than Tf, does not count; Tf 0 is the ambient flow. It sets the + !! wake oscillator's frequency; the type needs a WAKE OSCILLATOR row. A type takes one row. + CHARACTER(*), INTENT(IN) :: row + TYPE(DeckLineType), INTENT(INOUT) :: types(:) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + CHARACTER(DECK_RECLEN) :: tok + INTEGER :: it + REAL(wp) :: v + LOGICAL :: found, ok + + ErrStat = 0; ErrMsg = '' + IF (count_tokens(row) /= 2) THEN + CALL fail(ErrStat, ErrMsg, 'VIV FRAME rows must be: TypeName Tf'); RETURN + END IF + CALL get_token(row, 1, tok, found) + it = find_type(types, TRIM(tok)) + IF (it == 0) THEN + CALL fail(ErrStat, ErrMsg, 'VIV FRAME row names undefined LINE TYPE "'//TRIM(tok)//'"'); RETURN + END IF + IF (types(it)%has_vivf_row) THEN + CALL fail(ErrStat, ErrMsg, 'VIV FRAME names LINE TYPE "'//TRIM(types(it)%name)//'" twice'); RETURN + END IF + CALL get_token(row, 2, tok, found) + CALL parse_real_token(tok, v, ok) + IF (.NOT. ok) THEN + CALL fail(ErrStat, ErrMsg, 'VIV FRAME Tf must be a plain number'); RETURN + END IF + IF (.NOT. (IEEE_IS_FINITE(v) .AND. v >= CD_ZERO .AND. v <= MAX_COEFFICIENT)) THEN + CALL fail(ErrStat, ErrMsg, 'VIV FRAME filter time Tf must be >= 0 (0 = the ambient flow), at most 1e15') + RETURN + END IF + IF (.NOT. (types(it)%wo_cl0 > CD_ZERO)) THEN + CALL fail(ErrStat, ErrMsg, 'VIV FRAME of LINE TYPE "'//TRIM(types(it)%name)//'" sets the flow frame of '// & + 'its wake oscillator: give the type a WAKE OSCILLATOR row'); RETURN + END IF + types(it)%viv_tf = v + types(it)%has_vivf_row = .TRUE. + END SUBROUTINE apply_type_viv_frame + SUBROUTINE append_line_stiffener(row, lines, ErrStat, ErrMsg) !! One STIFFENERS row: LineID End Length RootOD TipOD InnerD E Density -- a conical segment of !! the bend stiffener sleeving End A or End B of a finite-EI line. The rows of one line end diff --git a/src/CableDyn_HermiteCableDynamic.f90 b/src/CableDyn_HermiteCableDynamic.f90 index 8058345..fb7b558 100644 --- a/src/CableDyn_HermiteCableDynamic.f90 +++ b/src/CableDyn_HermiteCableDynamic.f90 @@ -358,9 +358,14 @@ MODULE CableDyn_HermiteCableDynamic ! van der Pol eps and coupling A (length-weighted over its lifting elements), the state ! wo_s(:, k) = (q, dq/dt), q at the step's evaluation point (wo_q_eval, as viv_phi_eval), the ! step-start cross-flow acceleration and wake frequency (wo_ydd0, wo_om0) the step end - ! integrates from, and the recovery and snapshot copies of the state. - LOGICAL :: viv_wake = .FALSE. + ! integrates from, and the recovery and snapshot copies of the state. With a filter time + ! wo_tf(k) > 0 on some node (wo_filter) wo_s has three more rows, the node's velocity + ! low-pass filtered over wo_tf (first order), and the wake frequency takes the flow normal to + ! the line relative to it: a cable moved through still water sheds, the cable's own VIV + ! velocity (much faster than wo_tf) does not modulate it. + LOGICAL :: viv_wake = .FALSE., wo_filter = .FALSE. REAL(wp), ALLOCATABLE :: wo_st(:), wo_eps(:), wo_a(:), wo_s(:, :), wo_q_eval(:), wo_ydd0(:), wo_om0(:) + REAL(wp), ALLOCATABLE :: wo_tf(:) REAL(wp), ALLOCATABLE :: ws_recovery_wo_s(:, :), snap_wo_s(:, :) ! Amplitude-dependent VIV coefficients (Set_VIV amp, amp_n; VIV AMPLITUDE section): per element ! a table of viv_amp_n rows (A/D, C_v, drag factor) in viv_amp(:, 1:n, e). With it viv_ms carries @@ -1174,7 +1179,9 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err !! df unused. The lift per unit length is 1/4 rho D C_L0 q U^2 along the cross-flow axis, with !! q'' + eps om (q^2 - 1) q' + om^2 q = (A/D) y'' at each lifting node (om = 2 pi St U/D, y'' !! its cross-flow acceleration); q starts on its limit cycle at the phase seed, q = 2 cos(phi_0) - !! and q' = 0. + !! and q' = 0. U is the ambient flow normal to the line; an optional fourth row wake(4, e) = Tf + !! [s] > 0 takes U relative to the node velocity low-pass filtered over Tf (first order), for + !! a cable moved through the water (0: the ambient flow). !! !! Amplitude-dependent coefficients (both or neither; not with the wake oscillator): amp (3, !! CD_VIV_AMP_MAXP, ne) and amp_n (ne), per element a table of amp_n rows (0: none; only where @@ -1209,7 +1216,8 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err INTEGER, INTENT(IN), OPTIONAL :: amp_n(:) REAL(wp), INTENT(IN), OPTIONAL :: dviv(:) REAL(wp), INTENT(IN), OPTIONAL :: cdy(:, :) - INTEGER :: e, k, ne, nn, es, nms + INTEGER :: e, k, ne, nn, es, nms, nw + LOGICAL :: had_filter REAL(wp) :: wsum, tw_old, rest_old LOGICAL :: had_viv, had_il, want_il, had_wake, want_wake, bad_band, had_amp, want_amp CHARACTER(LEN=1024) :: em @@ -1223,7 +1231,7 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err x_ms_next(:, :), x_rec_phi(:), x_rec_ms(:, :), x_snap_phi(:), x_snap_ms(:, :), & x_hcx(:), x_hk(:) REAL(wp), ALLOCATABLE :: w_st(:), w_eps(:), w_a(:), w_s(:, :), w_qe(:), w_y0(:), w_om(:), w_rec(:, :), & - w_snap(:, :) + w_snap(:, :), w_tf(:) LOGICAL, ALLOCATABLE :: o_node(:), x_node(:) ErrStat = CD_HCDYN_OK; ErrMsg = '' @@ -1242,13 +1250,22 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err END IF want_wake = PRESENT(wake) IF (want_wake) THEN - IF (SIZE(wake, 1) /= 3 .OR. SIZE(wake, 2) /= ne) THEN + IF ((SIZE(wake, 1) /= 3 .AND. SIZE(wake, 1) /= 4) .OR. SIZE(wake, 2) /= ne) THEN ErrStat = CD_HCDYN_BADINPUT - ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: wake must be shaped (3, ne): St, eps, A per element'; RETURN + ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: wake must be shaped (3 or 4, ne): St, eps, A[, Tf] per element' + RETURN END IF - IF (.NOT. CD_All_Finite(RESHAPE(wake, [3*ne]))) THEN + IF (.NOT. CD_All_Finite(RESHAPE(wake, [SIZE(wake)]))) THEN ErrStat = CD_HCDYN_BADINPUT; ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: wake must be finite'; RETURN END IF + IF (SIZE(wake, 1) == 4) THEN + IF (ANY(wake(4, :) < CD_ZERO) .OR. ANY(wake(4, :) > 1.0e15_wp)) THEN + ErrStat = CD_HCDYN_BADINPUT + ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: the wake filter time Tf must be >= 0 (0 = the ambient flow) and '// & + 'at most 1e15' + RETURN + END IF + END IF IF (ANY(cl > CD_ZERO .AND. .NOT. (wake(1, :) > CD_ZERO .AND. wake(2, :) > CD_ZERO .AND. & wake(3, :) >= CD_ZERO))) THEN ErrStat = CD_HCDYN_BADINPUT @@ -1387,6 +1404,7 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err had_viv = model%has_viv had_il = model%has_viv_il had_wake = model%viv_wake + had_filter = model%wo_filter had_amp = model%has_viv_amp tw_old = model%viv_tw rest_old = model%viv_phi_rest @@ -1483,8 +1501,25 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err model%has_viv_il = .TRUE. END IF IF (want_wake) THEN - ALLOCATE (model%wo_st(nn), model%wo_eps(nn), model%wo_a(nn), model%wo_s(2, nn), model%wo_q_eval(nn), & - model%wo_ydd0(nn), model%wo_om0(nn), model%ws_recovery_wo_s(2, nn), model%snap_wo_s(2, nn)) + ! the filter time per node, length-weighted over its lifting elements like St, eps and A + ALLOCATE (model%wo_tf(nn)) + model%wo_tf = CD_ZERO + IF (SIZE(wake, 1) == 4) THEN + DO k = 1, nn + IF (.NOT. model%viv_node(k)) CYCLE + wsum = CD_ZERO + DO e = MAX(1, k - 1), MIN(ne, k) + IF (.NOT. (cl(e) > CD_ZERO)) CYCLE + wsum = wsum + model%l0(e) + model%wo_tf(k) = model%wo_tf(k) + model%l0(e)*wake(4, e) + END DO + model%wo_tf(k) = model%wo_tf(k)/wsum + END DO + END IF + model%wo_filter = ANY(model%wo_tf > CD_ZERO) + nw = MERGE(5, 2, model%wo_filter) + ALLOCATE (model%wo_st(nn), model%wo_eps(nn), model%wo_a(nn), model%wo_s(nw, nn), model%wo_q_eval(nn), & + model%wo_ydd0(nn), model%wo_om0(nn), model%ws_recovery_wo_s(nw, nn), model%snap_wo_s(nw, nn)) ! the lift scale 1/2 rho D viv_cl is then 1/4 rho D C_L0, the lift 1/4 rho D C_L0 q U^2 model%viv_cl = 0.5_wp*cl model%wo_st = CD_ZERO @@ -1506,6 +1541,8 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err model%wo_a(k) = model%wo_a(k)/wsum ! on the limit cycle at the node's phase seed model%wo_s(1, k) = 2.0_wp*COS(model%viv_phi(k)) + ! the filtered velocity starts at the node's velocity + IF (model%wo_filter) model%wo_s(3:5, k) = model%v(6*(k - 1) + 1:6*(k - 1) + 3) END DO model%wo_q_eval = model%wo_s(1, :) model%wo_ydd0 = CD_ZERO @@ -1538,6 +1575,7 @@ SUBROUTINE refresh_acceleration() model%has_viv = had_viv model%has_viv_il = had_il model%viv_wake = had_wake + model%wo_filter = had_filter model%has_viv_amp = had_amp model%viv_tw = tw_old model%viv_phi_rest = rest_old @@ -1570,7 +1608,7 @@ SUBROUTINE move_viv(back) CALL MOVE_ALLOC(w_a, model%wo_a); CALL MOVE_ALLOC(w_s, model%wo_s) CALL MOVE_ALLOC(w_qe, model%wo_q_eval); CALL MOVE_ALLOC(w_y0, model%wo_ydd0) CALL MOVE_ALLOC(w_om, model%wo_om0); CALL MOVE_ALLOC(w_rec, model%ws_recovery_wo_s) - CALL MOVE_ALLOC(w_snap, model%snap_wo_s) + CALL MOVE_ALLOC(w_snap, model%snap_wo_s); CALL MOVE_ALLOC(w_tf, model%wo_tf) CALL MOVE_ALLOC(p_amp, model%viv_amp); CALL MOVE_ALLOC(p_ampn, model%viv_amp_n) CALL MOVE_ALLOC(p_dv, model%viv_dv) CALL MOVE_ALLOC(p_cdy, model%viv_cdy) @@ -1595,7 +1633,7 @@ SUBROUTINE move_viv(back) CALL MOVE_ALLOC(model%wo_a, w_a); CALL MOVE_ALLOC(model%wo_s, w_s) CALL MOVE_ALLOC(model%wo_q_eval, w_qe); CALL MOVE_ALLOC(model%wo_ydd0, w_y0) CALL MOVE_ALLOC(model%wo_om0, w_om); CALL MOVE_ALLOC(model%ws_recovery_wo_s, w_rec) - CALL MOVE_ALLOC(model%snap_wo_s, w_snap) + CALL MOVE_ALLOC(model%snap_wo_s, w_snap); CALL MOVE_ALLOC(model%wo_tf, w_tf) CALL MOVE_ALLOC(model%viv_amp, p_amp); CALL MOVE_ALLOC(model%viv_amp_n, p_ampn) CALL MOVE_ALLOC(model%viv_dv, p_dv) CALL MOVE_ALLOC(model%viv_cdy, p_cdy) @@ -1619,6 +1657,8 @@ SUBROUTINE clear_viv(model) IF (ALLOCATED(model%vhh_k)) DEALLOCATE (model%vhh_cx, model%vhh_k) IF (ALLOCATED(model%wo_s)) DEALLOCATE (model%wo_st, model%wo_eps, model%wo_a, model%wo_s, model%wo_q_eval, & model%wo_ydd0, model%wo_om0, model%ws_recovery_wo_s, model%snap_wo_s) + IF (ALLOCATED(model%wo_tf)) DEALLOCATE (model%wo_tf) + model%wo_filter = .FALSE. IF (ALLOCATED(model%viv_amp)) DEALLOCATE (model%viv_amp) IF (ALLOCATED(model%viv_amp_n)) DEALLOCATE (model%viv_amp_n) IF (ALLOCATED(model%viv_dv)) DEALLOCATE (model%viv_dv) @@ -1747,16 +1787,19 @@ REAL(wp) FUNCTION viv_node_ambient_yd(model, k) RESULT(yd) yd = CD_VIV_Ambient_Crossflow_Rate(model%q(i0 + 4:i0 + 6), model%v(i0 + 1:i0 + 3), uu) END FUNCTION viv_node_ambient_yd - REAL(wp) FUNCTION viv_node_ambient_speed(model, k) RESULT(ua) + REAL(wp) FUNCTION viv_node_ambient_speed(model, k, vslow) RESULT(ua) !! Speed of the ambient flow (current plus a held field) normal to node k's tangent (the slope - !! DOFs) at the committed state; 0 for a degenerate tangent. + !! DOFs) at the committed state, relative to the velocity vslow (optional; the node's filtered + !! velocity of the wake filter); 0 for a degenerate tangent. TYPE(CD_HermiteCableDynType), INTENT(IN) :: model INTEGER, INTENT(IN) :: k + REAL(wp), INTENT(IN), OPTIONAL :: vslow(3) REAL(wp) :: uu(3), t(3), un(3), speed INTEGER :: i0 i0 = 6*(k - 1) uu = model%current IF (model%has_held_field) uu = uu + model%hf_u(:, k) + IF (PRESENT(vslow)) uu = uu - vslow speed = NORM2(model%q(i0 + 4:i0 + 6)) ua = CD_ZERO IF (.NOT. (speed > CD_ZERO)) RETURN @@ -1816,10 +1859,20 @@ SUBROUTINE viv_step_begin(model, dt, ErrStat, ErrMsg) ErrStat = CD_HCDYN_NOCONVERGE; ErrMsg = 'VIV wake oscillator: degenerate node tangent'; RETURN END IF ! the wake frequency of the ambient flow normal to the line (the free stream of the - ! paper), not of the relative flow, which the cable's own cross-flow motion modulates - model%wo_om0(k) = CD_VIV_TWO_PI*model%wo_st(k)*viv_node_ambient_speed(model, k)/model%viv_dn(k) + ! paper), not of the relative flow, which the cable's own cross-flow motion modulates; with + ! the wake filter, of the flow relative to the node's slowly filtered motion + IF (model%wo_filter) THEN + IF (model%wo_tf(k) > CD_ZERO) THEN + model%wo_om0(k) = CD_VIV_TWO_PI*model%wo_st(k)*viv_node_ambient_speed(model, k, model%wo_s(3:5, k))/ & + model%viv_dn(k) + ELSE + model%wo_om0(k) = CD_VIV_TWO_PI*model%wo_st(k)*viv_node_ambient_speed(model, k)/model%viv_dn(k) + END IF + ELSE + model%wo_om0(k) = CD_VIV_TWO_PI*model%wo_st(k)*viv_node_ambient_speed(model, k)/model%viv_dn(k) + END IF model%wo_ydd0(k) = ydd - sw = model%wo_s(:, k) + sw = model%wo_s(1:2, k) CALL CD_VIV_Wake_Advance(sw, model%wo_om0(k), model%wo_eps(k), model%wo_a(k)/model%viv_dn(k), ydd, ydd, & frac*dt) model%wo_q_eval(k) = sw(1) @@ -1876,15 +1929,22 @@ SUBROUTINE viv_step_end(model, dt) IF (.NOT. model%viv_node(k)) CYCLE CALL viv_node_motion(model, k, yd, ydd, un, ok) IF (.NOT. (ok .AND. CD_Is_Finite(ydd))) ydd = model%wo_ydd0(k) - sw = model%wo_s(:, k) + sw = model%wo_s(1:2, k) CALL CD_VIV_Wake_Advance(sw, model%wo_om0(k), model%wo_eps(k), model%wo_a(k)/model%viv_dn(k), & model%wo_ydd0(k), ydd, dt) IF (.NOT. (CD_Is_Finite(sw(1)) .AND. CD_Is_Finite(sw(2)))) THEN - sw = model%wo_s(:, k) + sw = model%wo_s(1:2, k) CALL CD_VIV_Wake_Advance(sw, model%wo_om0(k), model%wo_eps(k), model%wo_a(k)/model%viv_dn(k), & model%wo_ydd0(k), model%wo_ydd0(k), dt) END IF - model%wo_s(:, k) = sw + model%wo_s(1:2, k) = sw + ! the filtered velocity, exact for the first-order filter of the converged end velocity + ! held over the step (a non-finite end velocity keeps it) + IF (model%wo_filter) THEN + IF (model%wo_tf(k) > CD_ZERO .AND. CD_All_Finite(model%v(6*(k - 1) + 1:6*(k - 1) + 3))) & + model%wo_s(3:5, k) = model%wo_s(3:5, k) + (CD_ONE - EXP(-dt/model%wo_tf(k)))* & + (model%v(6*(k - 1) + 1:6*(k - 1) + 3) - model%wo_s(3:5, k)) + END IF END DO model%wo_q_eval = model%wo_s(1, :) RETURN diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index 195ff8d..702eed5 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -445,9 +445,12 @@ MODULE CableDyn_Model ! 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(:) + ! the step-start cross-flow acceleration (row 2 of viv_ms stays 0). With a wake filter time + ! wo_tf > 0 on some node (wo_filter) viv_ms has CD_VIV_NMS_AMP rows, rows 3:5 the node's + ! velocity low-pass filtered over wo_tf (first order), and the wake frequency takes the flow + ! normal to the line relative to it (a line moved through still water sheds). + LOGICAL :: viv_wake = .FALSE., wo_filter = .FALSE. + REAL(wp), ALLOCATABLE :: wo_st(:), wo_eps(:), wo_a(:), wo_tf(:) 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 @@ -4004,7 +4007,7 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, REAL(wp), INTENT(IN), OPTIONAL :: wake(:, :) INTEGER :: n_nodes, n_elem, e, nd, istat, k, nms REAL(wp) :: wsum - LOGICAL :: want_il, want_amp, want_wake + LOGICAL :: want_il, want_amp, want_wake, want_filter CHARACTER(160) :: amsg ErrStat = CD_MODEL_OK @@ -4093,13 +4096,14 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, want_amp = ANY(amp_n > 0) END IF want_wake = .FALSE. + want_filter = .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)') + IF ((SIZE(wake, 1) /= 3 .AND. SIZE(wake, 1) /= 4) .OR. SIZE(wake, 2) /= n_elem) THEN + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator wake must have shape (3 or 4, 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') + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator St, eps, A and Tf must be finite') RETURN END IF DO e = 1, n_elem @@ -4110,6 +4114,14 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, '1e15, where cl > 0') RETURN END IF + IF (SIZE(wake, 1) == 4) THEN + IF (wake(4, e) < CD_ZERO) THEN + CALL fail(ErrStat, ErrMsg, 'the VIV wake oscillator filter time Tf must be >= 0 (0 = the ambient '// & + 'flow) and at most 1e15') + RETURN + END IF + IF (wake(4, e) > CD_ZERO) want_filter = .TRUE. + END IF END DO want_wake = ANY(cl > CD_ZERO) IF (want_wake .AND. want_il) THEN @@ -4146,7 +4158,7 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, RETURN END IF END DO - nms = MERGE(CD_VIV_NMS_AMP, CD_VIV_NMS, want_amp) + nms = MERGE(CD_VIV_NMS_AMP, CD_VIV_NMS, want_amp .OR. (want_wake .AND. want_filter)) ALLOCATE (model%viv_cl(n_elem), model%viv_d(n_elem), model%viv_node(n_nodes), model%viv_cf(n_nodes), & model%viv_df(n_nodes), model%viv_dn(n_nodes), model%viv_phi(n_nodes), model%viv_ms(nms, n_nodes), & model%viv_phi_rollback(n_nodes), model%viv_ms_rollback(nms, n_nodes), & @@ -4211,7 +4223,7 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, 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) + ALLOCATE (model%wo_st(n_nodes), model%wo_eps(n_nodes), model%wo_a(n_nodes), model%wo_tf(n_nodes), STAT=istat) IF (istat /= 0) THEN CALL clear_viv(model) CALL alloc_fail(ErrStat, ErrMsg, 'VIV wake oscillator storage allocation failed') @@ -4223,6 +4235,8 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, model%wo_st = CD_ZERO model%wo_eps = CD_ZERO model%wo_a = CD_ZERO + model%wo_tf = CD_ZERO + model%wo_filter = want_filter DO nd = 2, n_nodes - 1 IF (.NOT. model%viv_node(nd)) CYCLE wsum = CD_ZERO @@ -4232,12 +4246,16 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, 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) + IF (want_filter) model%wo_tf(nd) = model%wo_tf(nd) + model%l0(k)*wake(4, 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 + model%wo_tf(nd) = model%wo_tf(nd)/wsum ! on the limit cycle at the node's start phase model%viv_phi(nd) = 2.0_wp*COS(model%viv_phi(nd)) + ! the filtered velocity starts at the node's (smoothed) velocity + IF (want_filter) model%viv_ms(3:5, nd) = smoothed(model%v, 3*nd - 2) END DO model%viv_cf = CD_ZERO model%viv_df = CD_ZERO @@ -4245,6 +4263,9 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, model%recovery_viv_phi = model%viv_phi model%viv_phi_eval = model%viv_phi model%viv_phi_next = model%viv_phi + model%viv_ms_rollback = model%viv_ms + model%recovery_viv_ms = model%viv_ms + model%viv_ms_next = model%viv_ms model%viv_wake = .TRUE. END IF model%has_viv = .TRUE. @@ -4388,7 +4409,7 @@ SUBROUTINE CD_Set_Model_VIV_State(model, phi, ms, t_window, ErrStat, ErrMsg, phi 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 (SIZE(ms, 1) >= 5 .AND. .NOT. model%viv_wake) 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') RETURN @@ -4617,10 +4638,10 @@ END FUNCTION CD_Model_Has_VIV PURE INTEGER FUNCTION CD_Model_VIV_NMS(model) RESULT(n) !! Rows of the VIV motion statistics of a node in the VIV state (CD_Get_Model_VIV_State ms): - !! CD_VIV_NMS_AMP with amplitude tables (the amplitude estimate after the mean squares), - !! CD_VIV_NMS otherwise. + !! CD_VIV_NMS_AMP with amplitude tables (the amplitude estimate after the mean squares) or the + !! wake filter (the filtered velocity in rows 3:5), CD_VIV_NMS otherwise. TYPE(CD_ModelType), INTENT(IN) :: model - n = MERGE(CD_VIV_NMS_AMP, CD_VIV_NMS, model%has_viv_amp) + n = MERGE(CD_VIV_NMS_AMP, CD_VIV_NMS, model%has_viv_amp .OR. model%wo_filter) END FUNCTION CD_Model_VIV_NMS SUBROUTINE CD_Get_Model_VIV_Amplitude(model, amp, ErrStat, ErrMsg) @@ -4766,6 +4787,10 @@ SUBROUTINE viv_step_begin(model, dt, ErrStat, ErrMsg) ! 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 + IF (model%wo_filter) THEN + ! with the wake filter, of the flow relative to the node's slowly filtered motion + IF (model%wo_tf(nd) > CD_ZERO) uu = uu - model%viv_ms(3:5, nd) + END IF 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)] @@ -4800,7 +4825,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), sw(2), ydd0 + REAL(wp) :: w, yd, ydd, un, coef, uu(3), ms1, ms2, rate_end, xd, xdd, rate_end_x, st(4), sw(2), ydd0, vsm(3) LOGICAL :: ok ErrStat = CD_MODEL_OK ErrMsg = '' @@ -4830,6 +4855,14 @@ SUBROUTINE viv_step_end(model, dt, ErrStat, ErrMsg) END IF model%viv_phi_next(nd) = sw(1) model%viv_ms_next(1, nd) = sw(2) + ! the filtered velocity, exact for the first-order filter of the converged end velocity + ! held over the step (a non-finite end velocity keeps it) + IF (model%wo_filter) THEN + vsm = smoothed(model%v_step, ia) + IF (model%wo_tf(nd) > CD_ZERO .AND. CD_All_Finite(vsm)) & + model%viv_ms_next(3:5, nd) = model%viv_ms(3:5, nd) + (CD_ONE - EXP(-dt/model%wo_tf(nd)))* & + (vsm - model%viv_ms(3:5, nd)) + END IF CYCLE END IF IF (.NOT. ok) THEN @@ -4943,7 +4976,9 @@ SUBROUTINE clear_viv(model) 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) + IF (ALLOCATED(model%wo_tf)) DEALLOCATE (model%wo_tf) model%viv_wake = .FALSE. + model%wo_filter = .FALSE. model%has_viv_amp = .FALSE. model%has_viv_il = .FALSE. model%has_viv = .FALSE. @@ -7711,6 +7746,9 @@ SUBROUTINE CD_Copy_Model(src, dst, 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 + CALL copy_real1(src%wo_tf, work%wo_tf, 'wo_tf', ErrStat, ErrMsg) + IF (ErrStat /= CD_MODEL_OK) RETURN + work%wo_filter = src%wo_filter 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 @@ -7905,6 +7943,8 @@ SUBROUTINE commit_model_copy(from, to) 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) + CALL MOVE_ALLOC(from%wo_tf, to%wo_tf) + to%wo_filter = from%wo_filter 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/src/CableDyn_OpenFAST_HermiteFMF.f90 b/src/CableDyn_OpenFAST_HermiteFMF.f90 index 1dd2aca..95749dd 100644 --- a/src/CableDyn_OpenFAST_HermiteFMF.f90 +++ b/src/CableDyn_OpenFAST_HermiteFMF.f90 @@ -2262,7 +2262,7 @@ INTEGER FUNCTION CD_HFMF_VIVMirrorSize(self) RESULT(n) IF (.NOT. self%initialized) RETURN IF (self%line%has_viv) n = (1 + SIZE(self%line%viv_ms, 1))*self%line%nn + 1 IF (self%line%has_viv_il) n = n + 3*self%line%nn - IF (self%line%viv_wake) n = n + 2*self%line%nn + IF (self%line%viv_wake) n = n + SIZE(self%line%wo_s) END FUNCTION CD_HFMF_VIVMirrorSize INTEGER FUNCTION CD_HFMF_FrictionMirrorSize(self) RESULT(n) @@ -2352,8 +2352,8 @@ SUBROUTINE CD_HFMF_PackMirror(self, buf, ErrStat, ErrMsg) k = k + 3*self%line%nn END IF IF (self%line%viv_wake) THEN - buf(k + 1:k + 2*self%line%nn) = RESHAPE(self%line%wo_s, [2*self%line%nn]) - k = k + 2*self%line%nn + buf(k + 1:k + SIZE(self%line%wo_s)) = RESHAPE(self%line%wo_s, [SIZE(self%line%wo_s)]) + k = k + SIZE(self%line%wo_s) END IF IF (self%line%torsion%active) THEN buf(k + 1) = self%line%torsion%theta @@ -2545,10 +2545,10 @@ SUBROUTINE CD_HFMF_UnpackMirror(self, buf, t, ErrStat, ErrMsg) k = k + 3*self%line%nn END IF IF (self%line%viv_wake) THEN - self%line%wo_s = RESHAPE(buf(k + 1:k + 2*self%line%nn), [2, self%line%nn]) + self%line%wo_s = RESHAPE(buf(k + 1:k + SIZE(self%line%wo_s)), SHAPE(self%line%wo_s)) self%line%wo_q_eval = self%line%wo_s(1, :) self%line%ws_recovery_wo_s = self%line%wo_s - k = k + 2*self%line%nn + k = k + SIZE(self%line%wo_s) END IF IF (self%line%torsion%active) THEN self%line%torsion%theta = buf(k + 1) diff --git a/tests/test_viv_coupled.f90 b/tests/test_viv_coupled.f90 index 31da211..b18bf10 100644 --- a/tests/test_viv_coupled.f90 +++ b/tests/test_viv_coupled.f90 @@ -34,7 +34,9 @@ PROGRAM test_viv_coupled !! 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; + !! repeats; with the wake filter (Tf 5 s) the cable's block carries the filtered velocity too + !! (5 per node) and the riser's VIV block its rows 3-5 (6 motion statistics per node), with the + !! same restart and rewind checks; !! * 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, @@ -58,13 +60,14 @@ PROGRAM test_viv_coupled INTEGER :: nfail ! the deck of the restart and rewind cases, and whether its lines carry in-line VIV CHARACTER(32) :: deck_name = 'viv_coupled.dat' - LOGICAL :: il_case = .FALSE., wake_case = .FALSE., amp_case = .FALSE. + LOGICAL :: il_case = .FALSE., wake_case = .FALSE., amp_case = .FALSE., wakef_case = .FALSE. nfail = 0 CALL write_deck('viv_coupled.dat', 0.8_wp) CALL write_deck('viv_coupled_nolift.dat', 0.0_wp) CALL write_deck('viv_coupled_il.dat', 0.8_wp, inline=.TRUE.) CALL write_deck('viv_coupled_wake.dat', 0.8_wp, wake=.TRUE.) + CALL write_deck('viv_coupled_wakef.dat', 0.8_wp, wake=.TRUE., wake_tf='5.0') CALL write_deck('viv_coupled_amp.dat', 0.8_wp, amp=.TRUE.) CALL case_lockin() CALL case_restart() @@ -80,8 +83,13 @@ PROGRAM test_viv_coupled wake_case = .TRUE. CALL case_restart() CALL case_rewind() + deck_name = 'viv_coupled_wakef.dat' + wakef_case = .TRUE. + CALL case_restart() + CALL case_rewind() deck_name = 'viv_coupled_amp.dat' wake_case = .FALSE. + wakef_case = .FALSE. amp_case = .TRUE. CALL case_restart() CALL case_rewind() @@ -372,7 +380,7 @@ LOGICAL FUNCTION rebuild(a, b, with_viv) RESULT(ok) a_interior=aL(4:ndof - 3)) ok = ok .AND. es == CD_SYSTEM_OK nv = CD_System_Line_VIV_MirrorSize(a%sys%fast%system, il) - ok = ok .AND. nv == (MERGE(6, 3, il_case) + MERGE(4, 0, amp_case))*(ndof/3) + 1 + ok = ok .AND. nv == (MERGE(6, 3, il_case) + MERGE(4, 0, amp_case .OR. wakef_case))*(ndof/3) + 1 IF (with_viv .AND. nv > 0) THEN ALLOCATE (buf(nv)) CALL CD_Get_System_Line_VIV_State(a%sys%fast%system, il, buf, es, em) @@ -385,8 +393,8 @@ LOGICAL FUNCTION rebuild(a, b, with_viv) RESULT(ok) ALLOCATE (buf(CD_HFMF_MirrorSize(a%cables(1))), fresh(CD_HFMF_MirrorSize(b%cables(1)))) CALL CD_HFMF_PackMirror(a%cables(1), buf, es, em) nvc = CD_HFMF_VIVMirrorSize(a%cables(1)) - ok = ok .AND. nvc == (MERGE(6, 3, il_case) + MERGE(2, 0, wake_case) + MERGE(4, 0, amp_case))* & - a%cables(1)%line%nn + 1 + ok = ok .AND. nvc == (MERGE(6, 3, il_case) + MERGE(MERGE(5, 2, wakef_case), 0, wake_case) + & + MERGE(4, 0, amp_case))*a%cables(1)%line%nn + 1 IF (.NOT. with_viv) THEN ! the cable's VIV block as the fresh build has it (the torsion-free cable ends with it) CALL CD_HFMF_PackMirror(b%cables(1), fresh, es, em) @@ -404,6 +412,9 @@ LOGICAL FUNCTION identical(a, b) RESULT(same) MAXVAL(ABS(a%sys%fast%system%lines(1)%viv_phi - b%sys%fast%system%lines(1)%viv_phi)) <= 0.0_wp .AND. & 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. wakef_case) same = a%cables(1)%line%wo_filter .AND. SIZE(a%cables(1)%line%wo_s, 1) == 5 .AND. & + a%sys%fast%system%lines(1)%wo_filter .AND. & + SIZE(a%sys%fast%system%lines(1)%viv_ms, 1) == 6 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 .AND. & a%sys%fast%system%lines(1)%viv_wake .AND. & @@ -444,7 +455,7 @@ SUBROUTINE response(z, ad, f) IF (n > 1) f = REAL(n - 1, wp)/(t1 - t0) END SUBROUTINE response - SUBROUTINE write_deck(path, cl, window, dtm, anchor_first, inline, wake, amp) + SUBROUTINE write_deck(path, cl, window, dtm, anchor_first, inline, wake, amp, wake_tf) !! 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 both types @@ -454,6 +465,8 @@ SUBROUTINE write_deck(path, cl, window, dtm, anchor_first, inline, wake, amp) REAL(wp), INTENT(IN) :: cl REAL(wp), INTENT(IN), OPTIONAL :: window, dtm LOGICAL, INTENT(IN), OPTIONAL :: anchor_first, inline, wake, amp + ! the VIV FRAME filter time Tf of both types (no section without it) + CHARACTER(*), INTENT(IN), OPTIONAL :: wake_tf INTEGER :: u LOGICAL :: stock, wo REAL(wp) :: tw @@ -506,6 +519,12 @@ SUBROUTINE write_deck(path, cl, window, dtm, anchor_first, inline, wake, amp) 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' + IF (PRESENT(wake_tf)) THEN + WRITE (u, '(A)') '--------------------- VIV FRAME ---' + WRITE (u, '(A)') 'TypeName Tf' + WRITE (u, '(A)') 'riser '//wake_tf + WRITE (u, '(A)') 'cable '//wake_tf + END IF END IF IF (PRESENT(amp)) THEN IF (amp) THEN diff --git a/tests/test_viv_wake_deck.f90 b/tests/test_viv_wake_deck.f90 index aefad2f..89583ee 100644 --- a/tests/test_viv_wake_deck.f90 +++ b/tests/test_viv_wake_deck.f90 @@ -3,7 +3,7 @@ ! 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 cable of the in-line VIV gate (100 m, D 0.1 m, + !! [A]]], and the VIV FRAME section, TypeName Tf; 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. @@ -19,13 +19,23 @@ PROGRAM test_viv_wake_deck !! A out of range, a type that keeps its synchronisation lift (Cl > 0, which in-line VIV !! 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. + !! and 0.003 Hz of its frequency, and so does its uncoupled response; + !! W6 a finite-EI cable towed through still water: both ends move at 0.15 m/s against y (a + !! 10 s half-cosine ramp), no current. With the filter time Tf 10 s the wake frequency takes + !! the flow relative to the cable's filtered motion, and the cable locks in as the fixed + !! cable in the 0.15 m/s current does (A/D within 5 %, frequency within 0.003 Hz); without + !! it (the ambient flow, zero) the wake does not lock in (A/D below a tenth of that). The + !! fixed cable in the current with Tf 10 s locks in as without it (the filter removes the + !! VIV velocity: A/D within 2 %, frequency within 0.002 Hz), on both cores, and the two + !! cores agree there as in W5 (an EI = 0 line cannot run between two moving points); + !! W7 VIV FRAME refusals by name: a malformed row, an unknown or repeated type, + !! a negative Tf, and a type without a WAKE OSCILLATOR row. 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 + REAL(wp) :: ad_fe(4) = 0.0_wp, ad_l(4) = 0.0_wp, af_fe(2) = 0.0_wp, af_l(2) = 0.0_wp CALL write_current('wod_current.dat') CALL check_runs('1.0', 'wod', ad_fe) @@ -36,6 +46,12 @@ PROGRAM test_viv_wake_deck '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 write_tow('wod_tow.txt') + CALL check_tow('wodt', ad_fe) + CALL check_filter_fixed('1.0', 'wodf', ad_fe, af_fe) + CALL check_filter_fixed('0.0', 'wodf0', ad_l, af_l) + CALL require(ABS(af_l(1)/af_fe(1) - 1.0_wp) <= 0.03_wp .AND. ABS(af_l(2) - af_fe(2)) <= 0.003_wp, & + 'W6: with Tf the EI = 0 line locks in as the finite-EI cable') CALL check_refusals() IF (nfail > 0) THEN WRITE (*, '(A,I0,A)') 'FAIL: ', nfail, ' assertion(s) failed' @@ -80,23 +96,28 @@ SUBROUTINE write_current(path) CLOSE (u) END SUBROUTINE write_current - SUBROUTINE write_deck(path, wake_rows, tmax, cl, ei, viv_row, mixed) + SUBROUTINE write_deck(path, wake_rows, tmax, cl, ei, viv_row, mixed, tow, frame_rows) !! wake_rows: the WAKE OSCILLATOR section's data rows, ';'-separated ('' for no section); cl the !! type's LINE TYPES Cl (default 0), ei its EI (default 1), viv_row a VIV section row, mixed: - !! the line in two sections, the second of a type 'lift' with Cl 0.8. + !! the line in two sections, the second of a type 'lift' with Cl 0.8; tow: no current, both + !! ends Coupled and moved by the motion file wod_tow.txt; frame_rows: the VIV FRAME section's + !! data rows, ';'-separated (none without it). CHARACTER(*), INTENT(IN) :: path, wake_rows REAL(wp), INTENT(IN) :: tmax CHARACTER(*), INTENT(IN), OPTIONAL :: cl, ei, viv_row - LOGICAL, INTENT(IN), OPTIONAL :: mixed + LOGICAL, INTENT(IN), OPTIONAL :: mixed, tow + CHARACTER(*), INTENT(IN), OPTIONAL :: frame_rows CHARACTER(32) :: cl_col, ei_col INTEGER :: u, i0, i1 - LOGICAL :: two + LOGICAL :: two, towed cl_col = '0.0' IF (PRESENT(cl)) cl_col = cl ei_col = '1.0' IF (PRESENT(ei)) ei_col = ei two = .FALSE. IF (PRESENT(mixed)) two = mixed + towed = .FALSE. + IF (PRESENT(tow)) towed = tow OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') WRITE (u, '(A)') '--------------------- CableDyn Input File ---------------------------------' WRITE (u, '(A)') 'wake-oscillator deck gate: taut cable in a uniform current' @@ -109,7 +130,11 @@ SUBROUTINE write_deck(path, wake_rows, tmax, cl, ei, viv_row, mixed) WRITE (u, '(A)') '----------------------- POINTS ----------------------------------------------' WRITE (u, '(A)') 'ID Attachment X Y Z M V CdA CA' WRITE (u, '(A)') '1 Coupled 0.0 0.0 -50.0 0 0 0 0' - WRITE (u, '(A)') '2 Fixed 100.0 0.0 -50.0 0 0 0 0' + IF (towed) THEN + WRITE (u, '(A)') '2 Coupled 100.0 0.0 -50.0 0 0 0 0' + ELSE + WRITE (u, '(A)') '2 Fixed 100.0 0.0 -50.0 0 0 0 0' + END IF WRITE (u, '(A)') '----------------------- LINES -----------------------------------------------' WRITE (u, '(A)') 'ID NodeA NodeB Outputs' WRITE (u, '(A)') '1 1 2 -' @@ -140,12 +165,31 @@ SUBROUTINE write_deck(path, wake_rows, tmax, cl, ei, viv_row, mixed) i0 = i0 + i1 END DO END IF + IF (PRESENT(frame_rows)) THEN + WRITE (u, '(A)') '----------------------- VIV FRAME -------------------------------------------' + WRITE (u, '(A)') 'TypeName Tf' + WRITE (u, '(A)') '(-) (s)' + i0 = 1 + DO + i1 = INDEX(frame_rows(i0:), ';') + IF (i1 == 0) THEN + WRITE (u, '(A)') TRIM(frame_rows(i0:)) + EXIT + END IF + WRITE (u, '(A)') frame_rows(i0:i0 + i1 - 2) + i0 = i0 + i1 + END DO + END IF WRITE (u, '(A)') '---------------------- OPTIONS ----------------------------------------------' WRITE (u, '(A)') '0.01 dtM' WRITE (u, '(A)') '100.0 WtrDpth' WRITE (u, '(A)') '1025.0 rhoW' WRITE (u, '(A)') '9.80665 g' - WRITE (u, '(A)') 'wod_current.dat WaterKin' + IF (towed) THEN + WRITE (u, '(A)') 'wod_tow.txt motionFile' + ELSE + WRITE (u, '(A)') 'wod_current.dat WaterKin' + END IF WRITE (u, '(A,F8.3,A)') ' ', tmax, ' TMax' WRITE (u, '(A)') '---------------------- OUTPUTS -----------------------------------------------' WRITE (u, '(A)') 'L1N25PZ' @@ -281,8 +325,100 @@ SUBROUTINE check_runs(ei, tag, res) 'W3: a row with CL0 0 is the deck without the section'//lab) END SUBROUTINE check_runs + SUBROUTINE write_tow(path) + !! Both ends (points 1 and 2) moved along -y at 0.15 m/s after a 10 s half-cosine velocity ramp, + !! every 0.01 s to 100 s: y = -U (t/2 - T sin(pi t/T)/(2 pi)) in the ramp (T 10 s). + CHARACTER(*), INTENT(IN) :: path + REAL(wp), PARAMETER :: U = 0.15_wp, TR = 10.0_wp + INTEGER :: u_, k + REAL(wp) :: t, y, v, a + OPEN (NEWUNIT=u_, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u_, '(A)') '# time point x y z vx vy vz ax ay az' + DO k = 0, 10000 + t = 0.01_wp*REAL(k, wp) + IF (t < TR) THEN + y = -U*(0.5_wp*t - TR*SIN(PI*t/TR)/(2.0_wp*PI)) + v = -U*0.5_wp*(1.0_wp - COS(PI*t/TR)) + a = -U*0.5_wp*(PI/TR)*SIN(PI*t/TR) + ELSE + y = -U*(0.5_wp*TR + (t - TR)) + v = -U + a = 0.0_wp + END IF + WRITE (u_, '(F9.3,A,3ES17.9,A,ES17.9,A,ES17.9,A)') t, ' 1 ', 0.0_wp, y, -50.0_wp, ' 0 ', v, ' 0 0 ', a, ' 0' + WRITE (u_, '(F9.3,A,3ES17.9,A,ES17.9,A,ES17.9,A)') t, ' 2 ', 100.0_wp, y, -50.0_wp, ' 0 ', v, ' 0 0 ', a, ' 0' + END DO + CLOSE (u_) + END SUBROUTINE write_tow + + SUBROUTINE check_tow(tag, ref) + !! W6 on the finite-EI cable: towed with Tf 10 s against the fixed cable in the current (ref, + !! from check_runs), and without Tf. + CHARACTER(*), INTENT(IN) :: tag + REAL(wp), INTENT(IN) :: ref(4) + CHARACTER(*), PARAMETER :: ei = '1.0' + REAL(wp), ALLOCATABLE :: tf(:, :), t0(:, :) + INTEGER :: nf, n0 + REAL(wp) :: ad_f, f_f, ad_0, f_0 + LOGICAL :: ok + CHARACTER(1024) :: msg + CHARACTER(:), ALLOCATABLE :: lab + lab = ' (EI '//ei//')' + CALL write_deck(tag//'_tf.dat', 'riser 0.3', 100.0_wp, ei=ei, tow=.TRUE., frame_rows='riser 10') + CALL run(tag//'_tf.dat', tag//'_tf', ok, msg) + CALL require(ok, 'W6: the towed deck with Tf runs'//lab//': '//TRIM(msg)) + CALL write_deck(tag//'_amb.dat', 'riser 0.3', 100.0_wp, ei=ei, tow=.TRUE.) + CALL run(tag//'_amb.dat', tag//'_amb', ok, msg) + CALL require(ok, 'W6: the towed deck without Tf runs'//lab//': '//TRIM(msg)) + CALL read_out(tag//'_tf.out', tf, nf) + CALL read_out(tag//'_amb.out', t0, n0) + CALL require(nf > 1000 .AND. n0 == nf, 'W6: the towed runs wrote matching rows'//lab) + IF (.NOT. (nf > 1000 .AND. n0 == nf)) RETURN + CALL window_stats(tf, nf, 50.0_wp, 75.0_wp, ad_f, f_f) + CALL window_stats(t0, n0, 50.0_wp, 75.0_wp, ad_0, f_0) + WRITE (*, '(A,2F8.4,A,2F8.4,A,F8.4)') 'W6'//lab//': towed A/D, f [Hz] with Tf ', ad_f, f_f, & + '; in the current ', ref(1:2), '; towed without Tf A/D ', ad_0 + CALL require(ABS(ad_f/ref(1) - 1.0_wp) <= 0.05_wp .AND. ABS(f_f - ref(2)) <= 0.003_wp, & + 'W6: towed with Tf, the cable locks in as the fixed cable in the current'//lab) + CALL require(ad_0 < 0.1_wp*ref(1), 'W6: towed without Tf (the ambient flow), the wake does not lock in'//lab) + END SUBROUTINE check_tow + + SUBROUTINE check_filter_fixed(ei, tag, ref, res) + !! W6 on the fixed cable of EI ei in the current: with Tf 10 s against without it (ref, from + !! check_runs); res = (A/D, f) with Tf. + CHARACTER(*), INTENT(IN) :: ei, tag + REAL(wp), INTENT(IN) :: ref(4) + REAL(wp), INTENT(OUT) :: res(2) + REAL(wp), ALLOCATABLE :: tf(:, :) + INTEGER :: nf + LOGICAL :: ok + CHARACTER(1024) :: msg + CHARACTER(:), ALLOCATABLE :: lab + lab = ' (EI '//ei//')' + res = 0.0_wp + CALL write_deck(tag//'.dat', 'riser 0.3', 100.0_wp, ei=ei, frame_rows='riser 10') + CALL run(tag//'.dat', tag, ok, msg) + CALL require(ok, 'W6: the fixed cable with Tf runs'//lab//': '//TRIM(msg)) + CALL read_out(tag//'.out', tf, nf) + CALL require(nf > 1000, 'W6: the fixed run with Tf wrote its rows'//lab) + IF (nf <= 1000) RETURN + CALL window_stats(tf, nf, 50.0_wp, 75.0_wp, res(1), res(2)) + WRITE (*, '(A,2F8.4,A,2F8.4)') 'W6'//lab//': fixed in the current A/D, f [Hz] with Tf ', res, '; without ', & + ref(1:2) + CALL require(ABS(res(1)/ref(1) - 1.0_wp) <= 0.02_wp .AND. ABS(res(2) - ref(2)) <= 0.002_wp, & + 'W6: fixed in the current, Tf leaves the lock-in as the ambient flow gives it'//lab) + END SUBROUTINE check_filter_fixed + SUBROUTINE check_refusals() CALL refused('riser 0.3 0.2 0.3 12 1', 'TypeName CL0 [St [eps [A]]]', 'a row of six columns') + CALL refused('riser 0.3', 'VIV FRAME rows must be: TypeName Tf', 'W7: a VIV FRAME row of three columns', & + frame_rows='riser 10 1') + CALL refused('riser 0.3', 'VIV FRAME row names undefined LINE TYPE', 'W7: an unknown type', & + frame_rows='cable 10') + CALL refused('riser 0.3', 'VIV FRAME names LINE TYPE', 'W7: a repeated type', frame_rows='riser 10;riser 5') + CALL refused('riser 0.3', 'filter time Tf must be >= 0', 'W7: a negative Tf', frame_rows='riser -1') + CALL refused('', 'give the type a WAKE OSCILLATOR row', 'W7: a type without the wake oscillator', & + cl='0.8', frame_rows='riser 10') CALL refused('riser 0.3 x', 'plain numbers', 'a non-numeric St') CALL refused('cable 0.3', 'undefined LINE TYPE', 'an unknown type') CALL refused('riser 0.3;riser 0.2', 'twice', 'a repeated type') @@ -298,14 +434,14 @@ SUBROUTINE check_refusals() ei='0.0') END SUBROUTINE check_refusals - SUBROUTINE refused(rows, needle, what, cl, ei, viv_row, mixed) + SUBROUTINE refused(rows, needle, what, cl, ei, viv_row, mixed, frame_rows) CHARACTER(*), INTENT(IN) :: rows, needle, what - CHARACTER(*), INTENT(IN), OPTIONAL :: cl, ei, viv_row + CHARACTER(*), INTENT(IN), OPTIONAL :: cl, ei, viv_row, frame_rows LOGICAL, INTENT(IN), OPTIONAL :: mixed LOGICAL :: ok CHARACTER(1024) :: msg ! 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 write_deck('wod_bad.dat', rows, 1.0_wp, cl=cl, ei=ei, viv_row=viv_row, mixed=mixed, frame_rows=frame_rows) 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