diff --git a/CHANGELOG.md b/CHANGELOG.md index 1179d05..a729c12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,11 @@ All notable changes to CableDyn are recorded in this file. The format follows finite-EI cables alike (within 1 % of each other). Exact Jacobians; the phase is in the step-recovery, snapshot and checkpoint state; the Python deck reader and builder take the section. +- The higher-harmonic VIV force of Ulveseter et al. (2019): a fourth `VIV` section column `Chh` + adds `1/2 rho D Chh cos(phi + phi_x) U (t x v_n)`, the lift's form at the sum of the cross-flow + and in-line phases, on `EI = 0` lines and finite-EI cables. On the in-line example `Chh` 1.0 + raises the quarter-span in-line response at four times the cross-flow frequency fourfold. The + Python deck reader and builder take the column. - Load power channels `VIVPow`, `DragPow` and `DampPow` [W], and `N` per unit length about a node [W/m]: the power the VIV loads, the drag and the structural damping (`BA`, `Bb`) deliver to a line at the committed state, on `EI = 0` lines and finite-EI cables, diff --git a/doc/capabilities.rst b/doc/capabilities.rst index 34720cb..2d95412 100644 --- a/doc/capabilities.rst +++ b/doc/capabilities.rst @@ -146,7 +146,8 @@ Line and constitutive capability host's fluid field on the coupled routes and its state in the checkpoint * - In-line VIV (``VIV`` section ``ClX``, ``alpha``) - Standalone and coupled - - the in-line shedding force of Ulveseter et al. (2018) at twice the cross-flow frequency, on + - the in-line shedding force of Ulveseter et al. (2018) at twice the cross-flow frequency, and + the optional higher-harmonic force of Ulveseter et al. (2019) (``Chh``), on ``EI = 0`` lines and finite-EI cables wherever the cross-flow lift runs (:ref:`theory-viv-inline`), its state in the checkpoint diff --git a/doc/driver_format.md b/doc/driver_format.md index 70cc394..ee2cb91 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -1154,9 +1154,9 @@ relative flow, the direction of the drag, at twice the cross-flow frequency (Ulv ```text --------------------- VIV ---------------------------------------------- -TypeName ClX alpha -(-) (-) (-) -cable 0.85 0.15 +TypeName ClX alpha Chh +(-) (-) (-) (-) +cable 0.85 0.15 0.5 ``` | Column | Meaning | @@ -1164,6 +1164,7 @@ cable 0.85 0.15 | `TypeName` | an existing LINE TYPES name (case-insensitive), at most one row each | | `ClX` | in-line shedding coefficient `C_x` >= 0, at most 1e15; `0` is no in-line VIV | | `alpha` | optional frequency band of the in-line phase about twice the cross-flow one, `0 <= alpha < 1` (default 0.15) | +| `Chh` | optional higher-harmonic coefficient `C_hh` >= 0, at most 1e15 (default 0, none); `Chh > 0` needs `ClX > 0` | Behaviour: @@ -1171,16 +1172,33 @@ Behaviour: flow and `U` its speed; its phase follows `dphi_x/dt = 2 (dphi/dt) [1 + alpha sin(phi_xd - phi_x)]`, `phi` the cross-flow phase and `phi_xd` the phase of the in-line motion. Ulveseter et al. take `ClX = 0.85` and `alpha = 0.15` with `Cl = 0.65`. +- `Chh` adds the higher-harmonic force of Ulveseter et al. (2019), the lift's form + `1/2 rho D Chh cos(phi + phi_x) U (t x v_n)` at the sum of the two phases: across the flow at + three times the cross-flow frequency (and once and five times, through the in-line motion), + along it at twice and four times. It needs no state of its own. Ulveseter et al. use `Chh` + from 0 to 1.5. - The Outputs flag `V` file carries the in-line force with the lift, and the phase is part of the step-recovery, snapshot and checkpoint state. A row with `ClX = 0` leaves the run exactly as without it. - It acts wherever the cross-flow lift does: on `EI = 0` lines (a node force over the node's half elements, as the lift) and on finite-EI cables (integrated with the lift), standalone and - coupled. A row fails if it is not `TypeName ClX [alpha]`, - names an undefined or already named type, or holds a value out of range, and `ClX > 0` fails - on a type without the cross-flow lift. + coupled. A row fails if it is not `TypeName ClX [alpha [Chh]]`, + names an undefined or already named type, or holds a value out of range; `ClX > 0` fails + on a type without the cross-flow lift, and `Chh > 0` with `ClX = 0`. - See `examples/viv_taut_cable_inline.dat`. +**Published coefficient sets.** The synchronisation band of the LINE TYPES columns is the +`f0 +/- df` of the papers (`cF` = `f0`, `dF` = `df`), and their Morison inertia coefficient +`C_M` is `1 + Ca`. Two published sets, as LINE TYPES and VIV columns: + +| Source | `Cd` | `Ca` | `Cl` | `dF` | `cF` | `ClX` | `alpha` | `Chh` | +|--------|------|------|------|------|------|-------|---------|-------| +| Ulveseter et al. (2018), Table 3: a 10 m riser model in current and in current and waves | 1.2 | 1.0 | 0.65 | 0.08 | 0.18 | 0.85 | 0.15 | 0 | +| Ulveseter et al. (2019), Table 1 and Section 4: the NDP high-mode riser in uniform current | 1.2 | 1.0 | 0.85 | 0.064 | 0.144 | 0.75 | 0.15 | 1.5 | + +Each was fitted to its experiments by the authors and is a starting point, not a universal set; +MoorDyn's band defaults (`dF` 0.08, `cF` 0.18) are those of the first. + ### FAILURE (optional, EI = 0 decks) A FAILURE row detaches line ends from a point during a dynamic run, with MoorDyn's trigger rules. diff --git a/doc/references.rst b/doc/references.rst index 9e68e89..594b5da 100644 --- a/doc/references.rst +++ b/doc/references.rst @@ -95,6 +95,12 @@ Hydrodynamics and ocean environment simulation of riser VIV in current and irregular waves. *Marine Structures* **60**, 241–260. https://doi.org/10.1016/j.marstruc.2018.04.001 +.. _ref-ulveseter2019: + +- **Ulveseter, J. V., Thorsen, M. J., Sævik, S. & Larsen, C. M. (2019).** Simulating fundamental + and higher harmonic VIV of slender structures. *Applied Ocean Research* **90**, 101856. + https://doi.org/10.1016/j.apor.2019.101856 + .. _ref-feeny2008: - **Feeny, B. F. (2008).** A complex orthogonal decomposition for wave motion analysis. diff --git a/doc/theory.rst b/doc/theory.rst index a35635f..2f23ec5 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1214,6 +1214,24 @@ run exactly as without the row. On the taut line of ``viv_taut_cable_inline.dat` span moves in line at twice the cross-flow frequency, A/D 0.19 against 0.03 with the cross-flow lift alone, and the same line as an ``EI = 0`` line gives the cable's amplitudes within 1 %. +A fourth column ``Chh`` adds the higher-harmonic force of +:ref:`Ulveseter et al. (2019) `, the lift's form at the sum of the two phases, + +.. math:: + + \mathbf{f}_{hh} = \tfrac{1}{2}\rho\,d\,C_{hh}\cos(\phi + \phi_x)\;U\, + (\mathbf{t}\times\mathbf{v}_n) . + +With the cross-flow phase at the frequency :math:`\omega` and the in-line one at :math:`2\omega` +it acts across the flow at :math:`3\omega`, and, through the turn of the relative flow by the +motion, at :math:`\omega` and :math:`5\omega` across and :math:`2\omega` and :math:`4\omega` along the flow. It takes no +state of its own: on a finite-EI cable it adds :math:`k_{hh}\cos(\phi + \phi_x)` to the node +values of the lift scale the element integrates, on an ``EI = 0`` line it is a second node lift +at the phase sum, and its derivatives enter the tangent with the lift's. Ulveseter et al. use +:math:`C_{hh}` from 0 to 1.5 (with :math:`C_{v,y}` 0.85 and :math:`C_{v,x}` 0.75). On the +in-line example with ``Chh`` 1.0 the quarter-span in-line response at four times the cross-flow +frequency grows from A/D 0.002 to 0.007, the same on an ``EI = 0`` line. + .. _theory-dry-buoyancy: Buoyancy and wetting diff --git a/python/cabledyn/builder.py b/python/cabledyn/builder.py index fe34ed6..7612a0a 100644 --- a/python/cabledyn/builder.py +++ b/python/cabledyn/builder.py @@ -214,6 +214,10 @@ class LineType: the in-line phase running at twice the cross-flow one) and the frequency band of that phase, ``0 <= il_alpha < 1``; ``None`` leaves alpha out of the row (the solver takes 0.15). + chh : float | None + Optional higher-harmonic coefficient of the ``VIV`` row (``Name ClX alpha + Chh``, Ulveseter et al. 2019; it needs ``clx``); ``None`` leaves it out + (0). With ``chh`` set and ``il_alpha`` ``None`` the row writes alpha 0.15. """ name: str @@ -235,6 +239,7 @@ class LineType: cf: float | None = None clx: float | None = None il_alpha: float | None = None + chh: float | None = None @dataclass(eq=False) @@ -1653,6 +1658,7 @@ def add_line_type( cf: float | None = None, clx: float | None = None, il_alpha: float | None = None, + chh: float | None = None, ) -> LineType: """Add a ``LINE TYPES`` row; see :class:`LineType` for the fields. @@ -1688,6 +1694,7 @@ def add_line_type( cf, clx, il_alpha, + chh, ) self._line_types.append(item) return item @@ -2949,12 +2956,16 @@ def _viv_table(self) -> tuple[str, str, list[list[str]]]: if item.clx is None: if item.il_alpha is not None: raise ValueError(f"{what}: il_alpha needs the in-line VIV coefficient clx") + if item.chh is not None: + raise ValueError(f"{what}: chh needs the in-line VIV coefficient clx") continue row = [_text(item.name, what), _num(item.clx, what)] - if item.il_alpha is not None: - row.append(_num(item.il_alpha, what)) + if item.il_alpha is not None or item.chh is not None: + row.append(_num(0.15 if item.il_alpha is None else item.il_alpha, what)) + if item.chh is not None: + row.append(_num(item.chh, what)) rows.append(row) - return "Name ClX alpha", "(-) (-) (-)", rows + return "Name ClX alpha Chh", "(-) (-) (-) (-)", rows def _syrope_table(self) -> tuple[str, str, list[list[str]]]: rows = [ @@ -3158,7 +3169,8 @@ def load(self) -> None: t = row.tokens item = model.line_types[t[0]] item.clx = _f(t[1]) - item.il_alpha = _f(t[2]) if len(t) == 3 else None + item.il_alpha = _f(t[2]) if len(t) >= 3 else None + item.chh = _f(t[3]) if len(t) == 4 else None 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 fa595d9..c2dc68f 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -3201,16 +3201,17 @@ def _check_viv_section( ) -> None: """Native ``apply_type_viv`` for the VIV section. - A row ``TypeName ClX [alpha]`` gives a line type in-line VIV: the in-line shedding - coefficient ``ClX >= 0`` (0 = off) and the band ``0 <= alpha < 1`` (default 0.15) of - its phase about twice the cross-flow one, so ``ClX > 0`` needs the type's LINE TYPES - lift ``Cl > 0``. A type takes one row. + A row ``TypeName ClX [alpha [Chh]]`` gives a line type in-line VIV: the in-line + shedding coefficient ``ClX >= 0`` (0 = off) and the band ``0 <= alpha < 1`` (default + 0.15) of its phase about twice the cross-flow one, so ``ClX > 0`` needs the type's LINE + TYPES lift ``Cl > 0``; and the higher-harmonic coefficient ``Chh >= 0`` (default 0), + which needs ``ClX > 0``. A type takes one row. """ named: set[str] = set() for row in self._rows("VIV"): where = self._at(row) - if len(row.tokens) not in (2, 3): - raise DeckFormatError(f"{where}: VIV rows must be: TypeName ClX [alpha]") + if len(row.tokens) not in (2, 3, 4): + raise DeckFormatError(f"{where}: VIV rows must be: TypeName ClX [alpha [Chh]]") name = row.tokens[0].lower() if name not in line_type_meta: raise DeckFormatError( @@ -3221,11 +3222,14 @@ def _check_viv_section( named.add(name) try: clx = _native_float(row.tokens[1]) - alpha = _native_float(row.tokens[2]) if len(row.tokens) == 3 else 0.15 + alpha = _native_float(row.tokens[2]) if len(row.tokens) >= 3 else 0.15 + chh = _native_float(row.tokens[3]) if len(row.tokens) == 4 else 0.0 except ValueError as exc: - raise DeckFormatError(f"{where}: VIV ClX and alpha must be plain numbers") from exc - if not (math.isfinite(clx) and math.isfinite(alpha)): - raise DeckFormatError(f"{where}: VIV ClX and alpha must be finite") + raise DeckFormatError( + f"{where}: VIV ClX, alpha and Chh must be plain numbers" + ) from exc + if not (math.isfinite(clx) and math.isfinite(alpha) and math.isfinite(chh)): + raise DeckFormatError(f"{where}: VIV ClX, alpha and Chh must be finite") if clx < 0.0 or clx > _NATIVE_MAX_COEFFICIENT: raise DeckFormatError( f"{where}: VIV in-line coefficient ClX must be non-negative (0 = in-line VIV " @@ -3235,6 +3239,16 @@ def _check_viv_section( raise DeckFormatError( f"{where}: VIV in-line frequency band alpha must satisfy 0 <= alpha < 1" ) + if chh < 0.0 or chh > _NATIVE_MAX_COEFFICIENT: + raise DeckFormatError( + f"{where}: VIV higher-harmonic coefficient Chh must be non-negative (0 = off) " + "and at most 1e15" + ) + if chh > 0.0 and not clx > 0.0: + raise DeckFormatError( + f'{where}: VIV higher-harmonic force of LINE TYPE "{row.tokens[0]}" needs its ' + "in-line VIV (ClX > 0): it runs at the cross-flow plus in-line phase" + ) if clx > 0.0 and name not in lift_type_names: raise DeckFormatError( f'{where}: VIV in-line VIV of LINE TYPE "{row.tokens[0]}" needs its ' diff --git a/python/tests/test_builder.py b/python/tests/test_builder.py index dea9ad8..7d0e851 100644 --- a/python/tests/test_builder.py +++ b/python/tests/test_builder.py @@ -1037,6 +1037,36 @@ def test_inline_viv_round_trips_in_the_viv_section( assert (loaded.clx, loaded.il_alpha) == (clx, il_alpha) +@pytest.mark.parametrize(("il_alpha", "written_alpha"), [(0.2, 0.2), (None, 0.15)]) +def test_higher_harmonic_viv_round_trips( + tmp_path: Path, il_alpha: float | None, written_alpha: float +) -> None: + model = _chain_model(tmp_path) + model.add_line_type( + "cable", + diam=0.2, + mass=40.0, + ea=5.0e8, + ei=1.0e4, + cl=0.8, + clx=0.85, + il_alpha=il_alpha, + chh=1.2, + ) + target = model.save(tmp_path / "higher_harmonic.dat") + row = next(r for r in DeckFile.read(target)._rows("VIV") if r.tokens[0] == "cable") + assert [float(v) for v in row.tokens[1:]] == [0.85, written_alpha, 1.2] + loaded = next(t for t in DeckModel.load(target).line_types if t.name == "cable") + assert (loaded.clx, loaded.il_alpha, loaded.chh) == (0.85, written_alpha, 1.2) + + +def test_higher_harmonic_needs_the_inline_coefficient(tmp_path: Path) -> None: + model = _chain_model(tmp_path) + model.add_line_type("cable", diam=0.2, mass=40.0, ea=5.0e8, ei=1.0e4, cl=0.8, chh=1.0) + with pytest.raises(ValueError, match="chh needs the in-line VIV coefficient clx"): + model.to_text() + + def test_inline_viv_alpha_needs_the_coefficient(tmp_path: Path) -> None: model = _chain_model(tmp_path) model.add_line_type("cable", diam=0.2, mass=40.0, ea=5.0e8, ei=1.0e4, cl=0.8, il_alpha=0.15) diff --git a/python/tests/test_deck_native_parity.py b/python/tests/test_deck_native_parity.py index e5fad9d..8cd8743 100644 --- a/python/tests/test_deck_native_parity.py +++ b/python/tests/test_deck_native_parity.py @@ -989,7 +989,15 @@ def test_bending_damping_rows_are_native(ei, message): @pytest.mark.parametrize( - "rows", [("riser 0.85 0.15",), ("riser 0.85",), ("riser 0",), ("RISER 0.5 0.0",)] + "rows", + [ + ("riser 0.85 0.15",), + ("riser 0.85",), + ("riser 0",), + ("RISER 0.5 0.0",), + ("riser 0.85 0.15 1.0",), + ("riser 0 0.15 0",), + ], ) def test_inline_viv_rows_are_accepted(rows): DeckFile.from_text(_section(_VIV_CABLE, "VIV", "TypeName ClX alpha", "(-) (-) (-)", *rows)) @@ -998,10 +1006,13 @@ def test_inline_viv_rows_are_accepted(rows): @pytest.mark.parametrize( ("rows", "message"), [ - (("riser 0.85 0.15 7",), "VIV rows must be: TypeName ClX [alpha]"), + (("riser 0.85 0.15 7 1",), "VIV rows must be: TypeName ClX [alpha [Chh]]"), (("cable 0.85",), 'VIV row names undefined LINE TYPE "cable"'), (("riser 0.85", "riser 0.5"), 'VIV names LINE TYPE "riser" twice'), - (("riser 0.85 x",), "VIV ClX and alpha must be plain numbers"), + (("riser 0.85 x",), "VIV ClX, alpha and Chh must be plain numbers"), + (("riser 0.85 0.15 y",), "VIV ClX, alpha and Chh must be plain numbers"), + (("riser 0.85 0.15 -1",), "Chh must be non-negative"), + (("riser 0 0.15 1",), "needs its in-line VIV (ClX > 0)"), (("riser -0.1",), "ClX must be non-negative"), (("riser 2.0e15",), "ClX must be non-negative"), (("riser 0.85 1.0",), "alpha must satisfy 0 <= alpha < 1"), diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index ed0c0ff..c5fa434 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -450,7 +450,7 @@ MODULE CableDyn_DeckDriver ! al., Mar. Struct. 60, 2018): the in-line shedding coefficient C_vx (0 = off) and the ! frequency band alpha of its phase about twice the cross-flow one; has_viv_row marks a type ! the section names. - REAL(wp) :: clx = CD_ZERO, il_alpha = CD_VIV_DEFAULT_IL_ALPHA + REAL(wp) :: clx = CD_ZERO, il_alpha = CD_VIV_DEFAULT_IL_ALPHA, chh = CD_ZERO LOGICAL :: has_viv_row = .FALSE. ! Deck file line of the row (0 when not read from a file), for error messages. INTEGER :: deck_line = 0 @@ -1884,7 +1884,7 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, REAL(wp), ALLOCATABLE :: gas(:), gj(:), rho_a(:), i_rt(:), i_rn(:), w(:), nodes_ref(:, :), q0(:), q_static(:) REAL(wp), ALLOCATABLE :: q_sequence(:) REAL(wp), ALLOCATABLE :: curv(:), cdn(:), cdt(:), can(:), cat(:), catenary_pos(:) - REAL(wp), ALLOCATABLE :: viv_cl(:), viv_cf(:), viv_df(:), viv_clx(:), viv_al(:) + REAL(wp), ALLOCATABLE :: viv_cl(:), viv_cf(:), viv_df(:), viv_clx(:), viv_al(:), viv_hh(:) REAL(wp), ALLOCATABLE :: ba_raw(:), ba(:), dry_b(:), bb_el(:) REAL(wp) :: mode1_omega REAL(wp), ALLOCATABLE :: contact_kn(:), contact_cn(:) @@ -3280,14 +3280,16 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, ! property of the original element containing its reference-arc midpoint. ALLOCATE (cdn(SIZE(l0)), cdt(SIZE(l0)), can(SIZE(l0)), cat(SIZE(l0))) CALL finite_hydro_arrays(ln, sections, types, diam, cdn, cdt, can, cat) - ALLOCATE (viv_cl(SIZE(l0)), viv_cf(SIZE(l0)), viv_df(SIZE(l0)), viv_clx(SIZE(l0)), viv_al(SIZE(l0))) - CALL finite_viv_arrays(ln, sections, types, viv_cl, viv_cf, viv_df, viv_clx, viv_al) + 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) IF (SIZE(l0_am) /= SIZE(l0)) THEN 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) CALL remap_elem_by_reference_arc(viv_clx, l0, l0_am) CALL remap_elem_by_reference_arc(viv_al, l0, l0_am) + CALL remap_elem_by_reference_arc(viv_hh, l0, l0_am) CALL remap_elem_by_reference_arc(rho_a, l0, l0_am) CALL remap_elem_by_reference_arc(diam, l0, l0_am) CALL remap_elem_by_reference_arc(cdn, l0, l0_am) @@ -3606,7 +3608,8 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts, MERGE(opts%viv_rms_window, & 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, clx=viv_clx, il_alpha=viv_al) + tangent_reversed=.NOT. ln%ends_swapped, clx=viv_clx, il_alpha=viv_al, & + chh=viv_hh) ELSE CALL CD_HermiteCable_Dyn_Set_VIV(cable%line, viv_cl, viv_cf, viv_df, & MERGE(opts%viv_rms_window, & @@ -10368,7 +10371,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er REAL(wp), ALLOCATABLE :: ba(:), fluid_velocity(:, :), fluid_acceleration(:, :), drag_waterline(:) REAL(wp), ALLOCATABLE :: hydro_diam(:), hydro_cdn(:), hydro_cdt(:), hydro_can(:), hydro_cat(:) 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(:) + REAL(wp), ALLOCATABLE :: viv_cl(:), viv_cf(:), viv_df(:), viv_clx(:), viv_al(:), viv_hh(:) LOGICAL, ALLOCATABLE :: syr_el(:) REAL(wp) :: anchor(3), fairlead(3), mode1_omega REAL(wp), PARAMETER :: factors(4) = [0.25_wp, 0.5_wp, 0.75_wp, CD_ONE] @@ -10407,12 +10410,13 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er ALLOCATE (ba(SIZE(l0)), hydro_diam(SIZE(l0)), hydro_cdn(SIZE(l0)), hydro_cdt(SIZE(l0)), & 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_df(SIZE(l0)), syr_el(SIZE(l0)), viv_clx(SIZE(l0)), viv_al(SIZE(l0)), viv_hh(SIZE(l0))) viv_cl = CD_ZERO viv_cf = CD_ZERO viv_df = CD_ZERO viv_clx = CD_ZERO viv_al = CD_ZERO + viv_hh = CD_ZERO ve_ead = CD_ZERO ve_bas = CD_ZERO ve_bad = CD_ZERO @@ -10473,6 +10477,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er viv_df(e) = types(line_section_type(sections, ln%id, i))%viv_df viv_clx(e) = types(line_section_type(sections, ln%id, i))%clx viv_al(e) = types(line_section_type(sections, ln%id, i))%il_alpha + viv_hh(e) = types(line_section_type(sections, ln%id, i))%chh syr_el(e) = types(line_section_type(sections, ln%id, i))%is_syrope END DO END DO @@ -10482,6 +10487,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er viv_df = viv_df(SIZE(viv_df):1:-1) viv_clx = viv_clx(SIZE(viv_clx):1:-1) viv_al = viv_al(SIZE(viv_al):1:-1) + viv_hh = viv_hh(SIZE(viv_hh):1:-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) @@ -10775,7 +10781,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er IF (ANY(viv_clx > CD_ZERO)) THEN CALL CD_Set_Model_VIV(model, opts%rhoW, viv_cl, hydro_diam, viv_cf, viv_df, tw, es, em, & phase_seed=seed, tangent_reversed=.NOT. ln%ends_swapped, clx=viv_clx, & - il_alpha=viv_al) + il_alpha=viv_al, chh=viv_hh) ELSE CALL CD_Set_Model_VIV(model, opts%rhoW, viv_cl, hydro_diam, viv_cf, viv_df, tw, es, em, & phase_seed=seed, tangent_reversed=.NOT. ln%ends_swapped) @@ -11587,13 +11593,13 @@ SUBROUTINE finite_hydro_arrays(ln, sections, types, diam, cdn, cdt, can, cat) cat = cat(SIZE(cat):1:-1) END SUBROUTINE finite_hydro_arrays - SUBROUTINE finite_viv_arrays(ln, sections, types, cl, cf, df, clx, il_alpha) - !! Expand the section VIV columns (Cl dF cF) and the VIV section's in-line ClX and alpha to - !! finite-EI element arrays, in the element order of finite_hydro_arrays. + SUBROUTINE finite_viv_arrays(ln, sections, types, cl, cf, df, clx, il_alpha, chh) + !! Expand the section VIV columns (Cl dF cF) and the VIV section's in-line ClX and alpha and + !! higher-harmonic Chh 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) :: cl(:), cf(:), df(:), clx(:), il_alpha(:) + REAL(wp), INTENT(OUT) :: cl(:), cf(:), df(:), clx(:), il_alpha(:), chh(:) INTEGER :: i, j, e, tidx e = 0 @@ -11607,6 +11613,7 @@ SUBROUTINE finite_viv_arrays(ln, sections, types, cl, cf, df, clx, il_alpha) df(e) = types(tidx)%viv_df clx(e) = types(tidx)%clx il_alpha(e) = types(tidx)%il_alpha + chh(e) = types(tidx)%chh END DO END DO cl = cl(SIZE(cl):1:-1) @@ -11614,6 +11621,7 @@ SUBROUTINE finite_viv_arrays(ln, sections, types, cl, cf, df, clx, il_alpha) df = df(SIZE(df):1:-1) clx = clx(SIZE(clx):1:-1) il_alpha = il_alpha(SIZE(il_alpha):1:-1) + chh = chh(SIZE(chh):1:-1) END SUBROUTINE finite_viv_arrays LOGICAL FUNCTION line_has_viv(ln, types, sections) RESULT(has) @@ -17194,24 +17202,26 @@ SUBROUTINE append_line_attachment(row, lines, ErrStat, ErrMsg) END SUBROUTINE append_line_attachment SUBROUTINE apply_type_viv(row, types, ErrStat, ErrMsg) - !! One VIV row: TypeName ClX [alpha] -- the in-line VIV of a line type (Ulveseter et al. 2018): - !! the in-line shedding coefficient C_vx >= 0 (0 = off) and the frequency band 0 <= alpha < 1 - !! of its phase about twice the cross-flow one (default 0.15). The in-line phase rate is - !! slaved to the cross-flow one, so ClX > 0 needs the type's LINE TYPES lift Cl > 0. A type - !! takes one row. + !! One VIV row: TypeName ClX [alpha [Chh]] -- the in-line VIV of a line type (Ulveseter et al. + !! 2018): the in-line shedding coefficient C_vx >= 0 (0 = off) and the frequency band + !! 0 <= alpha < 1 of its phase about twice the cross-flow one (default 0.15); and the + !! higher-harmonic coefficient C_hh >= 0 (Ulveseter et al. 2019; default 0), a force of the + !! lift's form at the cross-flow plus in-line phase. The in-line phase rate is slaved to the + !! cross-flow one, so ClX > 0 needs the type's LINE TYPES lift Cl > 0, and Chh > 0 needs + !! ClX > 0. 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, ntok - REAL(wp) :: clx, alpha + REAL(wp) :: clx, alpha, chh LOGICAL :: found, ok ErrStat = 0; ErrMsg = '' ntok = count_tokens(row) - IF (ntok /= 2 .AND. ntok /= 3) THEN - CALL fail(ErrStat, ErrMsg, 'VIV rows must be: TypeName ClX [alpha]'); RETURN + IF (ntok < 2 .OR. ntok > 4) THEN + CALL fail(ErrStat, ErrMsg, 'VIV rows must be: TypeName ClX [alpha [Chh]]'); RETURN END IF CALL get_token(row, 1, tok, found) it = find_type(types, TRIM(tok)) @@ -17224,15 +17234,20 @@ SUBROUTINE apply_type_viv(row, types, ErrStat, ErrMsg) CALL get_token(row, 2, tok, found) CALL parse_real_token(tok, clx, ok) alpha = CD_VIV_DEFAULT_IL_ALPHA - IF (ok .AND. ntok == 3) THEN + chh = CD_ZERO + IF (ok .AND. ntok >= 3) THEN CALL get_token(row, 3, tok, found) CALL parse_real_token(tok, alpha, ok) END IF + IF (ok .AND. ntok == 4) THEN + CALL get_token(row, 4, tok, found) + CALL parse_real_token(tok, chh, ok) + END IF IF (.NOT. ok) THEN - CALL fail(ErrStat, ErrMsg, 'VIV ClX and alpha must be plain numbers'); RETURN + CALL fail(ErrStat, ErrMsg, 'VIV ClX, alpha and Chh must be plain numbers'); RETURN END IF - IF (.NOT. (IEEE_IS_FINITE(clx) .AND. IEEE_IS_FINITE(alpha))) THEN - CALL fail(ErrStat, ErrMsg, 'VIV ClX and alpha must be finite'); RETURN + IF (.NOT. (IEEE_IS_FINITE(clx) .AND. IEEE_IS_FINITE(alpha) .AND. IEEE_IS_FINITE(chh))) THEN + CALL fail(ErrStat, ErrMsg, 'VIV ClX, alpha and Chh must be finite'); RETURN END IF IF (clx < CD_ZERO .OR. clx > MAX_COEFFICIENT) THEN CALL fail(ErrStat, ErrMsg, 'VIV in-line coefficient ClX must be non-negative (0 = in-line VIV off) and at '// & @@ -17241,12 +17256,21 @@ SUBROUTINE apply_type_viv(row, types, ErrStat, ErrMsg) IF (.NOT. (alpha >= CD_ZERO .AND. alpha < CD_ONE)) THEN CALL fail(ErrStat, ErrMsg, 'VIV in-line frequency band alpha must satisfy 0 <= alpha < 1'); RETURN END IF + IF (chh < CD_ZERO .OR. chh > MAX_COEFFICIENT) THEN + CALL fail(ErrStat, ErrMsg, 'VIV higher-harmonic coefficient Chh must be non-negative (0 = off) and at '// & + 'most 1e15'); RETURN + END IF + IF (chh > CD_ZERO .AND. .NOT. (clx > CD_ZERO)) THEN + CALL fail(ErrStat, ErrMsg, 'VIV higher-harmonic force of LINE TYPE "'//TRIM(types(it)%name)//'" needs its '// & + 'in-line VIV (ClX > 0): it runs at the cross-flow plus in-line phase'); RETURN + END IF IF (clx > CD_ZERO .AND. .NOT. (types(it)%cl > CD_ZERO)) THEN CALL fail(ErrStat, ErrMsg, 'VIV in-line VIV of LINE TYPE "'//TRIM(types(it)%name)//'" needs its '// & 'cross-flow lift (LINE TYPES Cl > 0): the in-line phase runs at twice the cross-flow one'); RETURN END IF types(it)%clx = clx types(it)%il_alpha = alpha + types(it)%chh = chh types(it)%has_viv_row = .TRUE. END SUBROUTINE apply_type_viv diff --git a/src/CableDyn_HermiteCableDynamic.f90 b/src/CableDyn_HermiteCableDynamic.f90 index 5fd1185..6f40c37 100644 --- a/src/CableDyn_HermiteCableDynamic.f90 +++ b/src/CableDyn_HermiteCableDynamic.f90 @@ -336,6 +336,9 @@ MODULE CableDyn_HermiteCableDynamic ! the cross-flow state's eval, rate, next, recovery and snapshot twins. Its phase rate is ! twice the cross-flow one, so it lives on cross-flow (viv_node) nodes only. LOGICAL :: has_viv_il = .FALSE. + ! the higher-harmonic force of Ulveseter et al. (2019): per element its coefficient vhh_cx + ! (0 = none) and scale vhh_k = 1/2 rho D C_hh, allocated with the in-line VIV + REAL(wp), ALLOCATABLE :: vhh_cx(:), vhh_k(:) REAL(wp), ALLOCATABLE :: vil_cx(:), vil_k(:), vil_alpha(:), vil_phi(:), vil_phi_eval(:), vil_rate(:) REAL(wp), ALLOCATABLE :: vil_ms(:, :), vil_ms_next(:, :), ws_recovery_vil_phi(:), ws_recovery_vil_ms(:, :) REAL(wp), ALLOCATABLE :: snap_vil_phi(:), snap_vil_ms(:, :) @@ -1098,7 +1101,7 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_Friction_Axial(model, mu_axial, ErrStat, ErrM END SUBROUTINE CD_HermiteCable_Dyn_Set_Friction_Axial SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, ErrMsg, phase_seed, tangent_reversed, & - clx, il_alpha) + clx, il_alpha, chh) !! Install the cross-flow VIV synchronisation model (CableDyn_VIV) on a cable with drag: !! per element the lift coefficient cl (0: no lift) and the band df/cf, and the running-RMS !! averaging time t_window (s; 0 takes 500 steps of the first step). The lift acts on the @@ -1117,7 +1120,9 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err !! In-line VIV (Ulveseter et al. 2018; both or neither): clx, per element, the in-line shedding !! coefficient C_vx (0: none; > 0 only where cl > 0, the in-line phase rate being twice the !! cross-flow one) and il_alpha its frequency band (0 <= alpha < 1). The in-line phase of a - !! node starts at twice its cross-flow phase. + !! node starts at twice its cross-flow phase. chh (optional, with clx), per element, the + !! coefficient C_hh >= 0 of the higher-harmonic force of Ulveseter et al. (2019), the lift's + !! form at the phase sum phi_y + phi_x (0: none; > 0 only where clx > 0). TYPE(CD_HermiteCableDynType), INTENT(INOUT) :: model REAL(wp), INTENT(IN) :: cl(:), cf(:), df(:), t_window INTEGER, INTENT(OUT) :: ErrStat @@ -1127,7 +1132,7 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err !! MoorDyn's node tangent, so a node at rest takes the cross-flow phase pi !! (CD_VIV_Phase_Rate phi_rest); .FALSE. on a line the reader turned around LOGICAL, INTENT(IN), OPTIONAL :: tangent_reversed - REAL(wp), INTENT(IN), OPTIONAL :: clx(:), il_alpha(:) + REAL(wp), INTENT(IN), OPTIONAL :: clx(:), il_alpha(:), chh(:) INTEGER :: e, k, ne, nn, es REAL(wp) :: wsum, tw_old, rest_old LOGICAL :: had_viv, had_il, want_il @@ -1136,7 +1141,8 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err o_rate(:), o_ms(:, :), o_ms_next(:, :), o_rec_phi(:), o_rec_ms(:, :), & o_snap_phi(:), o_snap_ms(:, :) REAL(wp), ALLOCATABLE :: x_cx(:), x_k(:), x_al(:), x_phi(:), x_phi_eval(:), x_rate(:), x_ms(:, :), & - x_ms_next(:, :), x_rec_phi(:), x_rec_ms(:, :), x_snap_phi(:), x_snap_ms(:, :) + x_ms_next(:, :), x_rec_phi(:), x_rec_ms(:, :), x_snap_phi(:), x_snap_ms(:, :), & + x_hcx(:), x_hk(:) LOGICAL, ALLOCATABLE :: o_node(:), x_node(:) ErrStat = CD_HCDYN_OK; ErrMsg = '' @@ -1198,6 +1204,24 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err END IF want_il = ANY(clx > CD_ZERO) END IF + IF (PRESENT(chh)) THEN + IF (.NOT. PRESENT(clx)) THEN + ErrStat = CD_HCDYN_BADINPUT + ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: the higher-harmonic chh needs the in-line clx'; RETURN + END IF + IF (SIZE(chh) /= ne) THEN + ErrStat = CD_HCDYN_BADINPUT + ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: chh must have one value per element'; RETURN + END IF + IF (.NOT. CD_All_Finite(chh)) THEN + ErrStat = CD_HCDYN_BADINPUT; ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: chh must be finite'; RETURN + END IF + IF (ANY(chh < CD_ZERO) .OR. ANY(chh > CD_ZERO .AND. .NOT. (clx > CD_ZERO))) THEN + ErrStat = CD_HCDYN_BADINPUT + ErrMsg = 'CD_HermiteCable_Dyn_Set_VIV: need chh >= 0, and chh > 0 only where clx > 0 (the '// & + 'higher-harmonic force runs at the cross-flow plus in-line phase)'; RETURN + END IF + END IF ! the previous configuration and state, kept for a rollback had_viv = model%has_viv had_il = model%has_viv_il @@ -1245,8 +1269,10 @@ SUBROUTINE CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, t_window, ErrStat, Err ALLOCATE (model%vil_cx(ne), model%vil_k(ne), model%vil_alpha(nn), model%vil_phi(nn), model%vil_phi_eval(nn), & model%vil_rate(nn), model%vil_ms(2, nn), model%vil_ms_next(2, nn), model%ws_recovery_vil_phi(nn), & model%ws_recovery_vil_ms(2, nn), model%snap_vil_phi(nn), model%snap_vil_ms(2, nn), & - model%vil_node(nn)) + model%vil_node(nn), model%vhh_cx(ne), model%vhh_k(ne)) model%vil_cx = clx + model%vhh_cx = CD_ZERO + IF (PRESENT(chh)) model%vhh_cx = chh model%vil_alpha = CD_ZERO model%vil_node = .FALSE. model%vil_phi = CD_ZERO @@ -1322,6 +1348,7 @@ SUBROUTINE move_viv(back) CALL MOVE_ALLOC(x_rec_phi, model%ws_recovery_vil_phi); CALL MOVE_ALLOC(x_rec_ms, model%ws_recovery_vil_ms) CALL MOVE_ALLOC(x_snap_phi, model%snap_vil_phi); CALL MOVE_ALLOC(x_snap_ms, model%snap_vil_ms) CALL MOVE_ALLOC(x_node, model%vil_node) + CALL MOVE_ALLOC(x_hcx, model%vhh_cx); CALL MOVE_ALLOC(x_hk, model%vhh_k) ELSE CALL MOVE_ALLOC(model%viv_cl, o_cl); CALL MOVE_ALLOC(model%viv_k, o_k) CALL MOVE_ALLOC(model%viv_cf, o_cf); CALL MOVE_ALLOC(model%viv_df, o_df) @@ -1338,6 +1365,7 @@ SUBROUTINE move_viv(back) CALL MOVE_ALLOC(model%ws_recovery_vil_phi, x_rec_phi); CALL MOVE_ALLOC(model%ws_recovery_vil_ms, x_rec_ms) CALL MOVE_ALLOC(model%snap_vil_phi, x_snap_phi); CALL MOVE_ALLOC(model%snap_vil_ms, x_snap_ms) CALL MOVE_ALLOC(model%vil_node, x_node) + CALL MOVE_ALLOC(model%vhh_cx, x_hcx); CALL MOVE_ALLOC(model%vhh_k, x_hk) END IF END SUBROUTINE move_viv END SUBROUTINE CD_HermiteCable_Dyn_Set_VIV @@ -1355,6 +1383,7 @@ SUBROUTINE clear_viv(model) model%vil_phi_eval, model%vil_rate, model%vil_ms, model%vil_ms_next, & model%ws_recovery_vil_phi, model%ws_recovery_vil_ms, & model%snap_vil_phi, model%snap_vil_ms, model%vil_node) + IF (ALLOCATED(model%vhh_k)) DEALLOCATE (model%vhh_cx, model%vhh_k) model%has_viv = .FALSE. model%has_viv_il = .FALSE. model%viv_tw = CD_ZERO @@ -1370,6 +1399,7 @@ SUBROUTINE viv_drag_terms(model) REAL(wp) :: wsum model%viv_k = 0.5_wp*model%rho_w*model%diam*model%viv_cl IF (model%has_viv_il) model%vil_k = 0.5_wp*model%rho_w*model%diam*model%vil_cx + IF (model%has_viv_il) model%vhh_k = 0.5_wp*model%rho_w*model%diam*model%vhh_cx model%viv_dn = CD_ZERO DO k = 1, model%nn IF (.NOT. model%viv_node(k)) CYCLE @@ -1504,7 +1534,8 @@ END SUBROUTINE viv_step_end SUBROUTINE viv_element_lift(model, q_cfg, v_cfg, e, flift, ErrStat, ErrMsg, djq, djv) !! The VIV lift load of element e at the phase viv_phi_eval in the flow the drag sees (current, !! held field), with its Jacobians djq, djv (both or neither); with in-line VIV it includes the - !! in-line shedding force at the phase vil_phi_eval. + !! in-line shedding force at the phase vil_phi_eval, and the higher-harmonic force of + !! Ulveseter et al. (2019), the lift's form at the phase sum viv_phi_eval + vil_phi_eval. TYPE(CD_HermiteCableDynType), INTENT(IN) :: model REAL(wp), INTENT(IN) :: q_cfg(:), v_cfg(:) INTEGER, INTENT(IN) :: e @@ -1532,6 +1563,10 @@ SUBROUTINE viv_element_lift(model, q_cfg, v_cfg, e, flift, ErrStat, ErrMsg, djq, il = .FALSE. IF (model%has_viv_il) il = model%vil_k(e) > CD_ZERO IF (il) THEN + IF (model%vhh_k(e) > CD_ZERO) THEN + kn = kn + model%vhh_k(e)*[COS(model%viv_phi_eval(e) + model%vil_phi_eval(e)), & + COS(model%viv_phi_eval(e + 1) + model%vil_phi_eval(e + 1))] + END IF knx = model%vil_k(e)*[COS(model%vil_phi_eval(e)), COS(model%vil_phi_eval(e + 1))] IF (PRESENT(djq)) THEN CALL CD_HermiteCable_VIV_Lift_Element(qe, ve, model%l0(e), uu, wl, kn, flift, djq, djv, ErrStat, ErrMsg, & diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index 90fde80..c90536d 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -420,6 +420,8 @@ MODULE CableDyn_Model ! cross-flow node next to a vil_cx > 0 element. LOGICAL :: has_viv_il = .FALSE. REAL(wp), ALLOCATABLE :: vil_cx(:), vil_alpha(:) + ! the higher-harmonic coefficient C_hh per element (Ulveseter et al. 2019), with in-line VIV + REAL(wp), ALLOCATABLE :: vhh_cx(:) LOGICAL, ALLOCATABLE :: vil_node(:) REAL(wp), ALLOCATABLE :: vil_phi(:), vil_ms(:, :), vil_phi_rollback(:), vil_ms_rollback(:, :) REAL(wp), ALLOCATABLE :: recovery_vil_phi(:), recovery_vil_ms(:, :) @@ -3926,7 +3928,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) + tangent_reversed, clx, il_alpha, chh) !! 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; @@ -3945,7 +3947,9 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, !! In-line VIV (Ulveseter et al. 2018; both or neither): clx, per element, the in-line shedding !! coefficient (0: none; > 0 only where cl > 0, the in-line phase running at twice the !! cross-flow one) and il_alpha its band (0 <= alpha < 1); the in-line phase of a node starts at - !! twice its cross-flow phase. + !! twice its cross-flow phase. chh (optional, with clx), per element, the coefficient C_hh >= 0 + !! of the higher-harmonic force of Ulveseter et al. (2019), the lift's form at the phase sum + !! phi_y + phi_x (0: none; > 0 only where clx > 0). TYPE(CD_ModelType), INTENT(INOUT) :: model REAL(wp), INTENT(IN) :: rho, cl(:), diameter(:), cf(:), df(:), t_window INTEGER, INTENT(OUT) :: ErrStat @@ -3955,7 +3959,7 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, !! MoorDyn's, so a node at rest takes the cross-flow phase pi (CD_VIV_Phase_Rate phi_rest); !! .FALSE. on a line the reader turned around, whose tangent runs as MoorDyn's LOGICAL, INTENT(IN), OPTIONAL :: tangent_reversed - REAL(wp), INTENT(IN), OPTIONAL :: clx(:), il_alpha(:) + REAL(wp), INTENT(IN), OPTIONAL :: clx(:), il_alpha(:), chh(:) INTEGER :: n_nodes, n_elem, e, nd, istat, k REAL(wp) :: wsum LOGICAL :: want_il @@ -4017,6 +4021,21 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, END IF want_il = ANY(clx > CD_ZERO) END IF + IF (PRESENT(chh)) THEN + IF (.NOT. PRESENT(clx)) THEN + CALL fail(ErrStat, ErrMsg, 'the higher-harmonic VIV chh needs the in-line clx') + RETURN + END IF + IF (SIZE(chh) /= n_elem .OR. .NOT. CD_All_Finite(chh)) THEN + CALL fail(ErrStat, ErrMsg, 'the higher-harmonic VIV chh must be finite with shape (n_elem)') + RETURN + END IF + IF (ANY(chh < CD_ZERO) .OR. ANY(chh > CD_ZERO .AND. .NOT. (clx > CD_ZERO))) THEN + CALL fail(ErrStat, ErrMsg, 'the higher-harmonic VIV needs chh >= 0, and chh > 0 only where clx > 0 '// & + '(it runs at the cross-flow plus in-line phase)') + 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 @@ -4098,13 +4117,16 @@ SUBROUTINE CD_Set_Model_VIV(model, rho, cl, diameter, cf, df, t_window, ErrStat, ALLOCATE (model%vil_cx(n_elem), model%vil_alpha(n_nodes), model%vil_node(n_nodes), model%vil_phi(n_nodes), & model%vil_ms(2, n_nodes), model%vil_phi_rollback(n_nodes), model%vil_ms_rollback(2, n_nodes), & model%recovery_vil_phi(n_nodes), model%recovery_vil_ms(2, n_nodes), model%vil_phi_eval(n_nodes), & - model%vil_rate(n_nodes), model%vil_ms_next(2, n_nodes), model%vil_phi_next(n_nodes), STAT=istat) + model%vil_rate(n_nodes), model%vil_ms_next(2, n_nodes), model%vil_phi_next(n_nodes), & + model%vhh_cx(n_elem), STAT=istat) IF (istat /= 0) THEN CALL clear_viv(model) CALL alloc_fail(ErrStat, ErrMsg, 'in-line VIV storage allocation failed') RETURN END IF model%vil_cx = MERGE(clx, CD_ZERO, clx > CD_ZERO) + model%vhh_cx = CD_ZERO + IF (PRESENT(chh)) model%vhh_cx = MERGE(chh, CD_ZERO, chh > CD_ZERO) model%vil_alpha = CD_ZERO model%vil_node = .FALSE. model%vil_phi = CD_ZERO @@ -4387,13 +4409,13 @@ SUBROUTINE viv_node_load(model, q, v, nd, in_step, force, ok, jac_v, jac_prev, j REAL(wp), INTENT(OUT) :: force(3) LOGICAL, INTENT(OUT) :: ok REAL(wp), INTENT(OUT), OPTIONAL :: jac_v(3, 3), jac_prev(3, 3), jac_next(3, 3) - REAL(wp) :: coef, coefx, uu(3), phi, fx(3), jv(3, 3), jp(3, 3), jn(3, 3) + REAL(wp) :: coef, coefx, coefh, uu(3), phi, fx(3), jv(3, 3), jp(3, 3), jn(3, 3) INTEGER :: ia LOGICAL :: il il = .FALSE. IF (model%has_viv_il) il = model%vil_node(nd) IF (il) THEN - CALL viv_node_coef(model, q, nd, coef, uu, coefx) + CALL viv_node_coef(model, q, nd, coef, uu, coefx, coefh) ELSE CALL viv_node_coef(model, q, nd, coef, uu) END IF @@ -4418,6 +4440,22 @@ SUBROUTINE viv_node_load(model, q, v, nd, in_step, force, ok, jac_v, jac_prev, j CALL CD_VIV_Node_Inline(q(ia - 3:ia - 1), q(ia + 3:ia + 5), smoothed(v, ia), uu, coefx, phi, fx, ok) END IF force = force + fx + IF (.NOT. (ok .AND. coefh > CD_ZERO)) RETURN + ! the higher-harmonic force: the lift's form at the phase sum (Ulveseter et al. 2019, Eq. 6) + IF (in_step) THEN + phi = model%viv_phi_eval(nd) + model%vil_phi_eval(nd) + ELSE + phi = model%viv_phi(nd) + model%vil_phi(nd) + 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, coefh, phi, fx, ok, jv, jp, jn) + jac_v = jac_v + jv + jac_prev = jac_prev + jp + jac_next = jac_next + jn + ELSE + CALL CD_VIV_Node_Lift(q(ia - 3:ia - 1), q(ia + 3:ia + 5), smoothed(v, ia), uu, coefh, phi, fx, ok) + END IF + force = force + fx END SUBROUTINE viv_node_load PURE LOGICAL FUNCTION CD_Model_Has_VIV(model) RESULT(has) @@ -4426,20 +4464,22 @@ PURE LOGICAL FUNCTION CD_Model_Has_VIV(model) RESULT(has) has = model%has_viv END FUNCTION CD_Model_Has_VIV - SUBROUTINE viv_node_coef(model, q, nd, coef, uu, coefx) + SUBROUTINE viv_node_coef(model, q, nd, coef, uu, coefx, coefh) !! Lift scale of interior node nd at positions q, sum over its two elements of !! (1/2 l0_e w_e)(1/2 rho D_e Cl_e) with w_e the wetted fraction under the drag waterline !! (as MoorDyn's 1/4 rho d Cl (F_i l_i + F_i+1 l_i+1)), and the ambient fluid velocity there; - !! coefx (optional, in-line VIV) the same sum with the in-line coefficient C_x. + !! coefx (optional, in-line VIV) the same sum with the in-line coefficient C_x, and coefh + !! (optional, with coefx) with the higher-harmonic coefficient C_hh. TYPE(CD_ModelType), INTENT(IN) :: model REAL(wp), INTENT(IN) :: q(:) INTEGER, INTENT(IN) :: nd REAL(wp), INTENT(OUT) :: coef, uu(3) - REAL(wp), INTENT(OUT), OPTIONAL :: coefx + REAL(wp), INTENT(OUT), OPTIONAL :: coefx, coefh INTEGER :: e REAL(wp) :: wla, wlb, frac coef = CD_ZERO IF (PRESENT(coefx)) coefx = CD_ZERO + IF (PRESENT(coefh)) coefh = CD_ZERO DO e = nd - 1, nd IF (.NOT. (model%viv_cl(e) > CD_ZERO)) CYCLE wla = CD_ZERO @@ -4451,6 +4491,7 @@ SUBROUTINE viv_node_coef(model, q, nd, coef, uu, coefx) CALL CD_Submerged_Fraction(q(3*e) - wla, q(3*e + 3) - wlb, frac) coef = coef + 0.25_wp*model%viv_rho*model%viv_d(e)*model%viv_cl(e)*model%l0(e)*frac IF (PRESENT(coefx)) coefx = coefx + 0.25_wp*model%viv_rho*model%viv_d(e)*model%vil_cx(e)*model%l0(e)*frac + IF (PRESENT(coefh)) coefh = coefh + 0.25_wp*model%viv_rho*model%viv_d(e)*model%vhh_cx(e)*model%l0(e)*frac END DO uu = CD_ZERO IF (ALLOCATED(model%fluid_velocity)) uu = model%fluid_velocity(:, nd) @@ -4598,6 +4639,7 @@ SUBROUTINE clear_viv(model) IF (ALLOCATED(model%viv_ms_next)) DEALLOCATE (model%viv_ms_next) IF (ALLOCATED(model%viv_phi_next)) DEALLOCATE (model%viv_phi_next) IF (ALLOCATED(model%vil_cx)) DEALLOCATE (model%vil_cx) + IF (ALLOCATED(model%vhh_cx)) DEALLOCATE (model%vhh_cx) IF (ALLOCATED(model%vil_alpha)) DEALLOCATE (model%vil_alpha) IF (ALLOCATED(model%vil_node)) DEALLOCATE (model%vil_node) IF (ALLOCATED(model%vil_phi)) DEALLOCATE (model%vil_phi) @@ -7372,6 +7414,8 @@ SUBROUTINE CD_Copy_Model(src, dst, ErrStat, ErrMsg) work%has_viv_il = src%has_viv_il CALL copy_real1(src%vil_cx, work%vil_cx, 'vil_cx', ErrStat, ErrMsg) IF (ErrStat /= CD_MODEL_OK) RETURN + CALL copy_real1(src%vhh_cx, work%vhh_cx, 'vhh_cx', ErrStat, ErrMsg) + IF (ErrStat /= CD_MODEL_OK) RETURN CALL copy_real1(src%vil_alpha, work%vil_alpha, 'vil_alpha', ErrStat, ErrMsg) IF (ErrStat /= CD_MODEL_OK) RETURN CALL copy_logical1(src%vil_node, work%vil_node, 'vil_node', ErrStat, ErrMsg) @@ -7554,6 +7598,7 @@ SUBROUTINE commit_model_copy(from, to) CALL MOVE_ALLOC(from%viv_phi_next, to%viv_phi_next) to%has_viv_il = from%has_viv_il CALL MOVE_ALLOC(from%vil_cx, to%vil_cx) + CALL MOVE_ALLOC(from%vhh_cx, to%vhh_cx) CALL MOVE_ALLOC(from%vil_alpha, to%vil_alpha) CALL MOVE_ALLOC(from%vil_node, to%vil_node) CALL MOVE_ALLOC(from%vil_phi, to%vil_phi) diff --git a/tests/test_hermite_load_power.f90 b/tests/test_hermite_load_power.f90 index 1f0305a..e97efcd 100644 --- a/tests/test_hermite_load_power.f90 +++ b/tests/test_hermite_load_power.f90 @@ -12,7 +12,8 @@ PROGRAM test_hermite_load_power !! L1 the free decay of the first bending mode with the bending dashpot Bb; !! L2 the free decay of the first axial mode with the axial dashpot BA (its own time step); !! L3 the bending decay in still water with Morison drag and no dashpots; - !! L4 a cable starting straight in a 0.5 m/s current with the cross-flow and in-line VIV loads, + !! L4 a cable starting straight in a 0.5 m/s current with the cross-flow, in-line and + !! higher-harmonic (Chh 1) VIV loads, !! the drag and the bending dashpot; !! each within 0.5 % of the largest work; the damping power is never positive at any node, and !! the VIV and drag powers are zero without those loads. L5 power arrays of the wrong size are @@ -81,7 +82,7 @@ SUBROUTINE balance_case(label, what) INTEGER, INTENT(IN) :: what TYPE(CD_HermiteCableDynType) :: model REAL(wp) :: kk, period, dt, ek, es0, e0, e1, p_prev(3), p_now(3), work(3), res, scale, pm_max - REAL(wp) :: cl(NE), cf(NE), df(NE), clx(NE), alx(NE) + REAL(wp) :: cl(NE), cf(NE), df(NE), clx(NE), alx(NE), chh(NE) INTEGER :: n, k, es, it CHARACTER(512) :: em LOGICAL :: zero_viv, zero_drag, ok @@ -109,8 +110,8 @@ SUBROUTINE balance_case(label, what) CALL require(es == CD_HCDYN_OK, label//': drag: '//TRIM(em)) END IF IF (what == VIV) THEN - cl = 0.8_wp; cf = 0.18_wp; df = 0.08_wp; clx = 0.85_wp; alx = 0.15_wp - CALL CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, 0.25_wp, es, em, clx=clx, il_alpha=alx) + cl = 0.8_wp; cf = 0.18_wp; df = 0.08_wp; clx = 0.85_wp; alx = 0.15_wp; chh = 1.0_wp + CALL CD_HermiteCable_Dyn_Set_VIV(model, cl, cf, df, 0.25_wp, es, em, clx=clx, il_alpha=alx, chh=chh) CALL require(es == CD_HCDYN_OK, label//': VIV: '//TRIM(em)) END IF IF (es /= CD_HCDYN_OK) RETURN diff --git a/tests/test_viv_inline_deck.f90 b/tests/test_viv_inline_deck.f90 index 39162cf..25e0675 100644 --- a/tests/test_viv_inline_deck.f90 +++ b/tests/test_viv_inline_deck.f90 @@ -12,7 +12,12 @@ PROGRAM test_viv_inline_deck !! and alpha outside [0, 1) are refused by name; !! D4 the same deck as an EI = 0 line (the lumped node force, neighbour-averaged kinematics) !! matches the finite-EI cable: cross-flow and in-line amplitudes within 2 %, the same - !! frequencies within one 0.01 Hz bin. + !! frequencies within one 0.01 Hz bin; + !! D5 a higher-harmonic coefficient Chh 1.0 (Ulveseter et al. 2019, the fourth column) at + !! least triples the quarter-span in-line response at four times the cross-flow frequency + !! (the in-line share of the force at the cross-flow plus in-line phase), on the cable and + !! the EI = 0 line alike (within 5 %); Chh 0 is the row without it, to the printed digits; + !! Chh on a type without in-line VIV and a negative Chh are refused. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_DECKDRV_OK IMPLICIT NONE @@ -253,16 +258,66 @@ SUBROUTINE check_runs() CALL require(ABS(peak_frequency(tt, z) - fz_f) <= 0.01_wp .AND. ABS(peak_frequency(tt, y) - fy_f) <= 0.01_wp, & 'D4: and its frequencies within 0.01 Hz') END BLOCK + ! D5: the higher-harmonic force + BLOCK + REAL(wp), ALLOCATABLE :: th(:, :), t0h(:, :), te(:, :) + INTEGER :: nh, n0h, neh + REAL(wp) :: f1, a4_il, a4_hh, a4_e + CALL write_deck('vid_hh.dat', 'riser 0.85 0.15 1.0', 100.0_wp) + CALL run('vid_hh.dat', 'vid_hh', ok, msg) + CALL require(ok, 'D5: the Chh deck runs: '//TRIM(msg)) + CALL write_deck('vid_hh0.dat', 'riser 0.85 0.15 0.0', 100.0_wp) + CALL run('vid_hh0.dat', 'vid_hh0', ok, msg) + CALL require(ok, 'D5: the Chh 0 deck runs: '//TRIM(msg)) + CALL write_deck('vid_hhe.dat', 'riser 0.85 0.15 1.0', 100.0_wp, ei='0.0') + CALL run('vid_hhe.dat', 'vid_hhe', ok, msg) + CALL require(ok, 'D5: the EI = 0 Chh deck runs: '//TRIM(msg)) + CALL read_out('vid_hh.out', th, nh) + CALL read_out('vid_hh0.out', t0h, n0h) + CALL read_out('vid_hhe.out', te, neh) + CALL require(nh == ni .AND. n0h == ni .AND. neh == ni, 'D5: the runs wrote the same rows') + IF (.NOT. (nh == ni .AND. n0h == ni .AND. neh == ni)) RETURN + CALL require(ALL(t0h(:, 1:n0h) == ti(:, 1:ni)), 'D5: a VIV row with Chh 0 is the row without it') + CALL window(ti, ni, 50.0_wp, tt, z, y) + f1 = peak_frequency(tt, z) + a4_il = fourier_amplitude(tt, y, 4.0_wp*f1) + CALL window(th, nh, 50.0_wp, tt, z, y) + f1 = peak_frequency(tt, z) + a4_hh = fourier_amplitude(tt, y, 4.0_wp*f1) + CALL window(te, neh, 50.0_wp, tt, z, y) + a4_e = fourier_amplitude(tt, y, 4.0_wp*peak_frequency(tt, z)) + WRITE (*, '(A,3F8.4)') 'D5: quarter-span in-line amplitude/D at 4 f, Chh 0, Chh 1, Chh 1 EI = 0: ', & + a4_il/D, a4_hh/D, a4_e/D + CALL require(a4_hh >= 3.0_wp*a4_il, 'D5: Chh raises the fourth in-line harmonic at least threefold') + CALL require(ABS(a4_e/a4_hh - 1.0_wp) <= 0.05_wp, 'D5: the EI = 0 line takes it within 5 %') + END BLOCK END SUBROUTINE check_runs + REAL(wp) FUNCTION fourier_amplitude(tt, x, f) RESULT(a) + !! The amplitude of x - mean(x) at frequency f (Hann window, so a sine of amplitude A gives A). + REAL(wp), INTENT(IN) :: tt(:), x(:), f + REAL(wp) :: w(SIZE(x)), xm(SIZE(x)), re, im + INTEGER :: i, n + n = SIZE(x) + DO i = 1, n + w(i) = 0.5_wp - 0.5_wp*COS(2.0_wp*PI*REAL(i - 1, wp)/REAL(n - 1, wp)) + END DO + xm = x - SUM(x)/REAL(n, wp) + re = SUM(w*xm*COS(2.0_wp*PI*f*tt)) + im = SUM(w*xm*SIN(2.0_wp*PI*f*tt)) + a = 2.0_wp*SQRT(re*re + im*im)/SUM(w) + END FUNCTION fourier_amplitude + SUBROUTINE check_refusals() - CALL refused('riser 0.85 0.15 7', 'TypeName ClX [alpha]', 'a row of four columns') + CALL refused('riser 0.85 0.15 7 1', 'TypeName ClX [alpha [Chh]]', 'a row of five columns') CALL refused('cable 0.85', 'undefined LINE TYPE', 'an unknown type') CALL refused('riser 0.85;riser 0.5', 'twice', 'a repeated type') CALL refused('riser -0.1', 'non-negative', 'a negative ClX') CALL refused('riser 0.85 1.0', '0 <= alpha < 1', 'alpha = 1') CALL refused('riser 0.85 x', 'plain numbers', 'a non-numeric alpha') CALL refused('riser 0.85', 'cross-flow lift', 'ClX on a type without the cross-flow lift', cl='0.0') + CALL refused('riser 0.0 0.15 1.0', 'needs its in-line VIV', 'Chh without in-line VIV') + CALL refused('riser 0.85 0.15 -1.0', 'Chh must be non-negative', 'a negative Chh') END SUBROUTINE check_refusals SUBROUTINE refused(rows, needle, what, ei, cl)