Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ All notable changes to CableDyn are recorded in this file. The format follows
frequency in mode-1 lock-in and stays in mode 1 where that string jumps to mode 2. The
multibody march carries it too (a cable on a Rigid6 body or rod, or beside free points), with
the same lock-in. A finite-EI line with two moving ends refuses `Cl > 0`.
- LINES Outputs flag `V` (MoorDyn's): the cross-flow VIV lift force at the nodes of a line,
written to `<root>.Line<L>.V.out` on dynamic runs of the standalone routes that carry VIV. On
a finite-EI line each element's lift is lumped to its nodes; at the interior nodes of a taut
line in lock-in it matches the `EI = 0` line's within 0.1 %. Upper case only, as in MoorDyn,
whose `v` (node velocities) CableDyn does not write.
- Cross-flow VIV on the coupled routes: OpenFAST (`CompMooring = 5`), FAST.Farm and the
standalone runner of a mixed `EI = 0` / finite-EI deck carry the lift on both line kinds, with
the host's fluid field. The phases, running mean squares and averaging time are part of the
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,10 @@ cabledyn_msg_test(weightless_finite_ei msg_weightless_finite_ei.dat 0
cabledyn_msg_test(weightless_finite_ei_vertical msg_weightless_finite_ei_vertical.dat 2
"weightless .neutrally buoyant. line is longer than its vertical span;nothing chooses the side of the bow;offset its ends horizontally"
"net-heavy")
# MoorDyn's line flag v (node velocities) is not written; V (the VIV lift) is upper case.
cabledyn_msg_test(line_flag_velocity msg_line_flag_velocity.dat 1
"supported line-output flags are p, t, r and V .the VIV lift, upper case as MoorDyn's."
"net-heavy")
# An EI=0 line type rejected as net-buoyant whose mass is a relative 4e-9 below the displaced water
# mass is named weightless and slack; one a relative 2e-6 below it keeps the plain message.
cabledyn_msg_test(weightless_ei0 msg_weightless_ei0.dat 1
Expand Down
2 changes: 1 addition & 1 deletion app/cabledyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ SUBROUTINE run_mixed_held_deck(deck, root, dt, has_dt, run_time, has_run_time, h
RETURN
END IF
IF (line_outputs) THEN
run_msg = 'CableDyn_driver: mixed-deck LINE Outputs p/t are not supported; '// &
run_msg = 'CableDyn_driver: mixed-deck LINE Outputs p/t/V are not supported; '// &
'use main OUTPUTS channels or remove the per-line flags'
RETURN
END IF
Expand Down
5 changes: 5 additions & 0 deletions doc/migrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ Keyword map
types and as a distributed lift on finite-EI types (:ref:`theory-viv`); the running-RMS
window is ``VIVrmsWindow`` seconds, by default
500 steps of ``dtM`` as MoorDyn's
* - ``LINES`` ``Outputs`` flags ``p``, ``t``, ``V``
- the same quantities, one file per flag where MoorDyn writes one file per line:
``<root>.Line<L>.p.out``, ``.t.out`` and ``.V.out`` (the VIV lift at the nodes), on the
standalone routes (:doc:`outputs`); MoorDyn's other line flags (``v``, ``U``, ``D``,
``c``, ``s``, ``d``, ...) are not written and are a parse error
* - ``ElasticMod 2/3`` viscoelastic ``EA``/``BA``
- ``Es|Ed`` / ``Es|alphaMBL|vbeta`` in ``EA`` and ``BA_s|BA_d`` in ``BA``
* - Syrope line type and ``SYROPE IC``
Expand Down
20 changes: 16 additions & 4 deletions doc/outputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,11 @@ B)``, header row, units row, data (12 columns):
Per-line files (``LINES`` ``Outputs`` flag)
-------------------------------------------

Set the ``Outputs`` column of a ``LINES`` row to any combination of the letters below
(case-insensitive, e.g. ``ptr``); ``-`` or an empty field requests nothing. Any other letter is a
parse error. Mixed ``EI = 0`` + finite-EI decks reject the ``p`` and ``t`` flags (use main-file
channels instead) and accept ``r``.
Set the ``Outputs`` column of a ``LINES`` row to any combination of the letters below (e.g.
``ptr``); ``-`` or an empty field requests nothing. ``p``, ``t`` and ``r`` are case-insensitive;
``V`` is upper case, as in MoorDyn, whose lower-case ``v`` (node velocities) CableDyn does not
write. Any other letter is a parse error. Mixed ``EI = 0`` + finite-EI decks reject the ``p``,
``t`` and ``V`` flags (use main-file channels instead) and accept ``r``.

.. list-table::
:header-rows: 1
Expand All @@ -338,6 +339,14 @@ channels instead) and accept ``r``.
- segment (element) tensions, End A → End B; on a finite-EI line the mean of the axial
components of the element's own two equilibrium end forces (``OutputRecovery element``:
the axial resultant at the element midpoint)
* - ``V``
- ``<out_root>.Line<L>.V.out``
- cross-flow VIV lift force at the nodes, End A → End B, on dynamic runs (MoorDyn's line
flag ``V``; a static run carries no lift and writes no file). On an ``EI = 0`` line the
end nodes carry none, as in MoorDyn; on a finite-EI line each element's lift is lumped to
its two nodes (the translational part of its consistent load), so the end nodes carry
the lift of their half-elements. Zero on a line without VIV (``Cl = 0``); a finite-EI
line with two moving ends carries no VIV and refuses the flag
* - ``r``
- ``<out_root>.Line<L>.range.out``
- range graph: minimum, maximum and mean over the run of the node tension, curvature, bend
Expand Down Expand Up @@ -365,6 +374,9 @@ deck node of that node, 0 for a node the refinement added.
* - ``.t.out``
- ``Segment Tension(N)``
- ``Time(s) Segment1Tension(N) Segment2Tension(N) … Segment<N−1>Tension(N)``
* - ``.V.out``
- (none)
- ``Time(s) Node1LiftX(N) Node1LiftY(N) Node1LiftZ(N) Node2LiftX(N) … Node<N>LiftZ(N)``

Dynamic per-line rows are written at the same times as ``.out``.

Expand Down
35 changes: 30 additions & 5 deletions python/cabledyn/deck_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2614,6 +2614,7 @@ def numeric(token: str, row: DeckRecord, field: str) -> float:
# Cl > 0 on an EI = 0 row (native init_one_model, which needs the line's Morison drag in
# water)
has_viv_ei0 = False
viv_type_names: set[str] = set()
for row in self.line_types:
for index in (1, 2, *range(5, len(row.tokens))):
numeric(row.tokens[index], row, f"LINE TYPES column {index + 1}")
Expand Down Expand Up @@ -2702,6 +2703,8 @@ def numeric(token: str, row: DeckRecord, field: str) -> float:
"working-curve model"
)
has_viv_ei0 = has_viv_ei0 or (cl > 0.0 and not ei > 0.0)
if cl > 0.0:
viv_type_names.add(row.tokens[0].lower())
if ei > 0.0 and (is_syrope or len(ea_parts) > 1):
model = "Syrope" if is_syrope else "viscoelastic stiffness"
raise DeckFormatError(f"{self._at(row)}: {model} is not supported with EI > 0")
Expand Down Expand Up @@ -2891,7 +2894,8 @@ def end_key(token: str) -> str:
# lines whose stock anchor-first row the native reader turns around (its ends swap)
swapped_lines: set[str] = set()
range_lines = 0
series_lines = 0 # lines with per-line time-series files (flags p, t)
lift_lines = 0 # lines with the VIV lift file (flag V)
series_lines = 0 # lines with per-line time-series files (flags p, t, V)
for row in self.lines:
if len(row.tokens) not in {3, 4, 7}:
raise DeckFormatError(f"{self._at(row)}: LINES row needs 3, 4, or 7 fields")
Expand All @@ -2900,14 +2904,17 @@ def end_key(token: str) -> str:
if len(row.tokens) == 7
else (row.tokens[3] if len(row.tokens) == 4 else "-")
)
if output_flags != "-" and not re.fullmatch(r"[pPtTrR]+", output_flags):
# V (the VIV lift) is case-sensitive, as MoorDyn's v (node velocities) is not written
if output_flags != "-" and not re.fullmatch(r"[pPtTrRV]+", output_flags):
raise DeckFormatError(
f"{self._at(row)}: LINE Outputs accepts only '-', 'p', 't', and 'r'"
f"{self._at(row)}: LINE Outputs accepts only '-', 'p', 't', 'r', and 'V'"
)
if "r" in output_flags.lower():
range_lines += 1
if "p" in output_flags.lower() or "t" in output_flags.lower():
if "p" in output_flags.lower() or "t" in output_flags.lower() or "V" in output_flags:
series_lines += 1
if "V" in output_flags:
lift_lines += 1
if len(row.tokens) == 7:
line_type = row.tokens[1]
endpoints: tuple[str, ...] = row.tokens[2:4]
Expand Down Expand Up @@ -3546,7 +3553,7 @@ def end_key(token: str) -> str:
if series_lines:
raise DeckFormatError(
f"{self._label}: a mixed EI=0/finite-EI deck writes no per-line files; "
"use OUTPUTS channels instead of the LINES Outputs flags p and t"
"use OUTPUTS channels instead of the LINES Outputs flags p, t and V"
)

# Native deck_needs_multibody: a dynamic deck that no single-family march covers
Expand Down Expand Up @@ -3589,6 +3596,24 @@ def is_body_kind(kind: str, pinned: bool) -> bool:
)
elif has_rigid6:
needs_multibody = non_rigid6_points
if deck_driver_route and has_dtm and has_tmax and line_ids and all(finite_lines):
# native run_deck_driver: a finite-EI deck the multibody march does not take, with a
# line whose End B moves, runs on the compatibility route, which carries no VIV
moving_end_b = not needs_multibody and any(
point_types[node_b] != "fixed" for _, node_b in normalized_line_endpoints.values()
)
if moving_end_b and any(
viv_type_names.intersection(types) for types in section_types_by_line.values()
):
raise DeckFormatError(
f"{self._label}: VIV (LINE TYPES Cl > 0) of a finite-EI line needs its End B "
"fixed (the cubic-Hermite march); set Cl = 0 for a line with two moving ends"
)
if moving_end_b and lift_lines:
raise DeckFormatError(
f"{self._label}: the LINES Outputs flag V (VIV lift) needs a line that carries "
"VIV, which a finite-EI line with two moving ends does not"
)
if failures and deck_driver_route:
# native CD_Run_Deck_Driver: FAILURE runs on the point-system object graph only
if not has_dtm:
Expand Down
34 changes: 33 additions & 1 deletion python/tests/test_deck_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,19 @@ def test_attachments_accept_an_axial_drag_area_and_a_deck_current(tmp_path):
DeckFile.from_text(text)


def test_viv_lift_flag_is_upper_case_and_standalone():
# V writes the VIV lift file; as MoorDyn's line flags it is case-sensitive (v, MoorDyn's
# node velocities, is not written)
deck = DeckFile.from_text(_edit(_DYNAMIC, ("1 2 1 -\n", "1 2 1 pV\n")))
assert deck.lines[0].tokens[3] == "pV"
with pytest.raises(DeckFormatError, match="accepts only '-', 'p', 't', 'r', and 'V'"):
DeckFile.from_text(_edit(_DYNAMIC, ("1 2 1 -\n", "1 2 1 pv\n")))
# a mixed EI=0/finite-EI deck writes no per-line files
mixed = _ATTACHMENT_DECK.format(rows="1 60.0 100 0.1 0.1 1.0", options="")
with pytest.raises(DeckFormatError, match="flags p, t and V"):
DeckFile.from_text(mixed.replace("1 2 1 -\n", "1 2 1 V\n"))


def test_attachments_are_accepted_on_the_coupled_route(tmp_path):
path = tmp_path / "attachments-coupled.dat"
path.write_text(
Expand Down Expand Up @@ -2467,7 +2480,7 @@ def test_range_flag_and_range_start_follow_native_rules():
("50.0 WtrDpth\n", "50.0 WtrDpth\n0 RangeStart\n"),
)
)
with pytest.raises(DeckFormatError, match="accepts only '-', 'p', 't', and 'r'"):
with pytest.raises(DeckFormatError, match="accepts only '-', 'p', 't', 'r', and 'V'"):
DeckFile.from_text(_edit(_STATIC, ("1 2 1 -\n", "1 2 1 rx\n")))
assert DeckFile.from_text(_edit(_STATIC, ("1 2 1 -\n", "1 2 1 r\n"))).lines[0].tokens[3] == "r"

Expand Down Expand Up @@ -4076,6 +4089,25 @@ def test_reserved_windows_device_names_are_refused(monkeypatch, tmp_path):
)


def test_viv_and_lift_flag_refused_on_a_finite_ei_line_with_two_moving_ends():
# native run_deck_driver: a farm-shared finite-EI line (Turbine1 to Turbine2) runs on the
# compatibility route, which carries no VIV: Cl > 0 and the lift file V are refused
shared = _edit(
_TURBINE_DECK,
("chain 0.1 20.0 1.0e9 -1.0 0.0 1.2", "chain 0.1 20.0 1.0e9 -1.0 1.0e4 1.2"),
("1 1 3 -\n2 2 3 -\n", "1 1 2 -\n"),
("1 chain 380 20\n2 chain 380 20\n", "1 chain 620 30\n"),
("100 WtrDpth\n", "100 WtrDpth\n0.1 dtM\n10.0 TMax\n"),
)
DeckFile.from_text(shared)
with pytest.raises(DeckFormatError, match="needs its End B fixed"):
DeckFile.from_text(_edit(shared, ("1.2 0.2 1.0 0.0\n", "1.2 0.2 1.0 0.0 0.8\n")))
with pytest.raises(DeckFormatError, match=r"flag V \(VIV lift\) needs a line that carries VIV"):
DeckFile.from_text(_edit(shared, ("1 1 2 -\n", "1 1 2 V\n")))
# the same flag on a line with a Fixed End B is accepted
DeckFile.from_text(_edit(_DYNAMIC, ("1 2 1 -\n", "1 2 1 V\n")))


@pytest.mark.parametrize(
("edit", "message"),
[
Expand Down
Loading
Loading