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
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ All notable changes to CableDyn are recorded in this file. The format follows
with the same phase start and running-RMS window (`VIVrmsWindow`, default 500 steps of
`dtM`). On a taut 100 m line in a uniform current it follows MoorDyn-F's lock-in amplitude
and frequency to two to three digits through mode-1 and mode-3 lock-in, at any `dtM` from
5e-4 to 1e-2 s. The Python deck tools read and keep the columns. The coupled and mixed
routes refuse `Cl > 0` by name.
5e-4 to 1e-2 s. The Python deck tools read and keep the columns.
- Cross-flow VIV of finite-EI cables in the standalone driver: the same LINE TYPES columns on an
`EI > 0` type give a distributed lift, Gauss-integrated over each cubic-Hermite element with
exact tangents, and a shedding phase at each node driven along the node's own tangent. A taut
line with `EI` near zero reproduces the `EI = 0` lock-in to three digits, at any `dtM` from
5e-4 to 1e-2 s without smoothing; a bending-stiff line matches the string of equal first-mode
frequency in mode-1 lock-in and stays in mode 1 where that string jumps to mode 2. A finite-EI
line with two moving ends, or beside bodies, rods or free points, refuses `Cl > 0`.
- 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
checkpoint state and of the correction rewind, so a restart continues bit for bit. A riser and
a cable in a 0.15 m/s host current lock in at A/D 0.665 and 0.292 Hz, MoorDyn-F's 0.662 and
0.293 Hz.
- Bend stiffeners (`STIFFENERS` table): a tapered polyurethane sleeve over an end of a finite-EI
line, given as conical segments from the root outward (outer diameters, bore, modulus,
density). Each element it covers takes the compliance average of the cable-plus-sleeve
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,11 @@ target_link_libraries(test_hermite_viv PRIVATE cabledyn_core)
add_test(NAME hermite_viv COMMAND test_hermite_viv)
set_tests_properties(hermite_viv PROPERTIES LABELS "fortran;dynamic;viv")

add_executable(test_viv_coupled tests/test_viv_coupled.f90)
target_link_libraries(test_viv_coupled PRIVATE cabledyn_core)
add_test(NAME viv_coupled COMMAND test_viv_coupled WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(viv_coupled PROPERTIES LABELS "fortran;integration;dynamic;viv;openfast")

add_executable(test_hfmf_mirror tests/test_hfmf_mirror.f90)
target_link_libraries(test_hfmf_mirror PRIVATE cabledyn_core)
add_test(NAME hfmf_mirror COMMAND test_hfmf_mirror WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
Expand Down
10 changes: 5 additions & 5 deletions doc/capabilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ Line and constitutive capability
``EI = 0`` lines, or all finite-EI lines on the Hermite route; flat seabed); a deck with
torsion is rejected
* - Cross-flow VIV (LINE TYPES ``Cl``, ``dF``, ``cF``)
- Standalone only
- Standalone and coupled
- MoorDyn v2's synchronisation model on ``EI = 0`` lines and, as a distributed lift, on
finite-EI cables of the Hermite march (:ref:`theory-viv`); in-line VIV is not provided;
the coupled OpenFAST and FAST.Farm routes, mixed ``EI = 0`` / finite-EI decks, finite-EI
lines with two moving ends and finite-EI lines beside bodies, rods or free points refuse
``Cl > 0`` by name
finite-EI cables of the Hermite march (:ref:`theory-viv`), with the host's fluid field
on the coupled routes and its state in the checkpoint; in-line VIV is not provided;
finite-EI lines with two moving ends and finite-EI lines beside bodies, rods or free
points refuse ``Cl > 0`` by name

Loads and environment
---------------------
Expand Down
3 changes: 1 addition & 2 deletions doc/coupling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ solve is mathematically incorrect; changing ``NumCrctn`` does not change that de
- deck ``waves``/``wavetrain`` OPTIONS (the host SeaState supplies the waves), and a deck
``current`` except as a steady current on a single-turbine, pure ``EI = 0`` deck without
Rigid6 bodies or rods in a SeaState without waves or current (a WaterKin ``CurrentMod 1``
table remains available),
- cross-flow VIV (a LINE TYPES ``Cl > 0``), which runs in the standalone driver only, and
table remains available), and
- fluid-source combinations that the nodewise SeaState field cannot separate without double
counting.

Expand Down
2 changes: 1 addition & 1 deletion doc/migrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Keyword map
- same row; the native order is ``Cd_n Cd_t Ca_n Ca_t`` and the header decides which is
meant. ``EI > 0`` switches the line to the bending element.
* - ``LINE TYPES`` VIV columns ``Cl`` or ``Cl dF cF``
- same columns and the same synchronisation model in the standalone driver, on ``EI = 0``
- same columns and the same synchronisation model, standalone and coupled, on ``EI = 0``
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
Expand Down
6 changes: 3 additions & 3 deletions doc/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,10 @@ Ambient fluid and prescribed motion
- ``0``
- finite, ≥ 0; the averaging time of the running RMS cross-flow velocity and acceleration
of the VIV synchronisation model (:ref:`theory-viv`). ``0`` takes MoorDyn's 500 steps of
``dtM`` (of the first step when the deck has no ``dtM``); set it to compare runs at
the deck ``dtM``, also where OpenFAST steps CableDyn at a ``dtM`` adjusted to its ``DT``
(500 steps of the first step when the deck has no ``dtM``); set it to compare runs at
different ``dtM`` with the same averaging time
- standalone lines (``EI = 0``, or finite-EI on the Hermite march) with a LINE TYPES
``Cl > 0``
- lines with a LINE TYPES ``Cl > 0``, on every route
- ``0.25 VIVrmsWindow``
* - ``motionFile``
- path, or ``0``/``none``
Expand Down
8 changes: 6 additions & 2 deletions doc/theory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,12 @@ pump, and the response is the same from ``dtM`` 5e-4 to 1e-2 s. A finite-EI line
carries it, including deck waves and current through its held fluid field; a finite-EI line
with two moving ends, or beside bodies, rods or free points, refuses :math:`C_L > 0`.

VIV runs in the standalone driver; the coupled and mixed aggregate routes refuse a deck with
:math:`C_L > 0`.
VIV runs on every route that carries the line: the standalone driver, the coupled OpenFAST
and FAST.Farm routes and the standalone runner of a mixed ``EI = 0`` / finite-EI deck. On the
coupled routes the phase follows the host's fluid field (a SeaState current or waves), and the
phases, the running mean squares and the averaging time are part of the checkpoint state, so a
restart continues the uninterrupted run bit for bit. The OpenFAST correction iterations rewind
them with the rest of the state.

Buoyancy and wetting
~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 0 additions & 4 deletions doc/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,6 @@ aborts with a CableDyn fatal error, check whether the deck uses one of these com
- linearise a pinned-hang-off, uncontrolled variant of the deck; time-domain runs support both
* - a ``Rigid`` end-connection direction reversed by exactly 180 degrees in one host update
- drive the platform through intermediate orientations
* - VIV on the coupled or mixed route (``VIV (LINE TYPES Cl > 0) runs in the standalone driver
of an EI = 0 or finite-EI deck``)
- run the VIV study on a standalone ``EI = 0`` or finite-EI deck, or set ``Cl = 0`` for the
coupled run
* - VIV on a finite-EI line with two moving ends (``needs its End B fixed``) or beside
bodies, rods or free points (``does not run with bodies, rods or free points yet``)
- fix End B of the line, or set ``Cl = 0`` for its line type
Expand Down
17 changes: 5 additions & 12 deletions python/cabledyn/deck_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2611,9 +2611,8 @@ def numeric(token: str, row: DeckRecord, field: str) -> float:
line_type_scales: dict[str, tuple[float, float]] = {} # name -> (BA, max Cd/Ca)
line_type_meta: dict[str, tuple[float, float, float, float]] = {}
line_type_gj: dict[str, float] = {} # name -> explicit GJ of a 14-column row, else 0
# Cl > 0 on any LINE TYPES row (native CD_Init_Deck_Aggregate), and on an EI = 0 row
# (native init_one_model, which needs the line's Morison drag in water)
has_viv = False
# 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:
Expand Down Expand Up @@ -2703,7 +2702,6 @@ def numeric(token: str, row: DeckRecord, field: str) -> float:
f"{self._at(row)}: VIV (Cl > 0) does not combine with the Syrope "
"working-curve model"
)
has_viv = has_viv or cl > 0.0
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())
Expand Down Expand Up @@ -3490,12 +3488,6 @@ def end_key(token: str) -> str:
)
if not line_ids:
raise DeckFormatError(f"{self._label}: the coupled route needs at least one line")
if has_viv:
raise DeckFormatError(
f"{self._label}: VIV (LINE TYPES Cl > 0) runs in the standalone driver of an "
"EI = 0 or finite-EI deck; the coupled OpenFAST and FAST.Farm routes and mixed "
"EI = 0 / finite-EI decks do not carry it yet. Set Cl = 0 for this run"
)
if self.caller_driven:
# native CD_Init_Deck_Aggregate: nothing on the coupled route evaluates deck
# waves (the host SeaState supplies them). A deck current is a steady field on a
Expand All @@ -3515,9 +3507,10 @@ def end_key(token: str) -> str:
"single-turbine pure EI=0 deck without Rigid6 bodies or rods; remove the "
"deck current OPTION (the host SeaState supplies the current)"
)
if has_viv_ei0 and deck_driver_route:
if has_viv_ei0 and not self.caller_driven:
# native init_one_model: the lift acts with the line's Morison drag, which the
# deck switches on with water (a depth or bathymetry, a current, or waves)
# deck switches on with water (a depth or bathymetry, a current, or waves); on the
# coupled route the host supplies the water
waterkin_option = option_by_key.get("waterkin")
waterkin_text = "" if waterkin_option is None else waterkin_option.values[0]
has_water = (
Expand Down
7 changes: 4 additions & 3 deletions python/tests/test_deck_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4603,11 +4603,12 @@ def test_line_type_viv_is_accepted_on_a_finite_ei_line_type(tmp_path):
assert (line_type.ei, line_type.cl) == (1.0e4, 0.8)


def test_viv_is_refused_on_the_coupled_route():
def test_viv_is_accepted_on_the_coupled_route():
text = _edit(_STATIC, (_VIV_ROW, _VIV_ROW + " 0.8"))
DeckFile.from_text(text)
with pytest.raises(DeckFormatError, match="runs in the standalone driver"):
DeckFile.from_text(text, caller_driven=True)
DeckFile.from_text(text, caller_driven=True)
# the host supplies the water, so a deck without a depth is not refused there
DeckFile.from_text(_edit(text, ("50.0 WtrDpth\n", "")), caller_driven=True)


def test_viv_needs_water_on_an_ei0_line():
Expand Down
24 changes: 9 additions & 15 deletions src/CableDyn_DeckDriver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3182,11 +3182,14 @@ RECURSIVE SUBROUTINE build_one_hermite_cable(ln, sections, types, points, opts,
CALL fail(ErrStat, ErrMsg, 'finite-EI cable drag wiring failed: '//TRIM(em)); RETURN
END IF
! Cross-flow VIV on the Cl > 0 sections, with the drag's diameters (CableDyn_VIV); an
! OPTION VIVrmsWindow of 0 takes MoorDyn's 500 time steps.
! OPTION VIVrmsWindow of 0 takes MoorDyn's 500 time steps of the deck dtM, as the EI = 0
! lines do (init_one_model), and of the coupling step dt where the deck gives none: a
! coupled host may step the cable at a dt adjusted from the deck dtM.
IF (PRESENT(install_viv)) THEN
IF (install_viv .AND. ANY(viv_cl > CD_ZERO)) THEN
CALL CD_HermiteCable_Dyn_Set_VIV(cable%line, viv_cl, viv_cf, viv_df, &
MERGE(opts%viv_rms_window, REAL(CD_VIV_NM, wp)*dt, &
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)
IF (es /= CD_HCDYN_OK) THEN
CALL fail(ErrStat, ErrMsg, 'finite-EI cable VIV wiring failed: '//TRIM(em)); RETURN
Expand Down Expand Up @@ -6754,8 +6757,8 @@ SUBROUTINE CD_Init_Deck_HermiteCable(deck_path, dt, cable, coupled_node, ErrStat
'use the aggregate facade with its external SeaState field'); RETURN
END IF
IF (line_has_viv(lines(1), types, sections)) THEN
CALL fail(ErrStat, ErrMsg, 'CD_Init_Deck_HermiteCable: VIV (LINE TYPES Cl > 0) runs in the standalone '// &
'deck driver; set Cl = 0 for this entry'); RETURN
CALL fail(ErrStat, ErrMsg, 'CD_Init_Deck_HermiteCable: VIV (LINE TYPES Cl > 0) acts with an ambient '// &
'fluid field, which this single-cable entry does not apply; use the aggregate facade'); RETURN
END IF
IF (opts%has_bathymetry_file) THEN
CALL load_bathymetry_file(path_join(deck_dir(deck_path), opts%bathymetry_file), bathymetry, ErrStat, ErrMsg, &
Expand Down Expand Up @@ -6984,16 +6987,6 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi
'EI=0/finite-EI decks reject deck water kinematics)')
RETURN
END IF
! Cross-flow VIV runs in the standalone driver (EI = 0 decks and finite-EI decks): the aggregate
! route (OpenFAST, FAST.Farm, mixed EI = 0 / finite-EI decks) neither checkpoints its shedding
! phase nor feeds it the host's fluid field yet.
IF (ANY(types%cl > CD_ZERO)) THEN
CALL fail(ErrStat, ErrMsg, 'VIV (LINE TYPES Cl > 0) runs in the standalone driver of an EI = 0 or '// &
'finite-EI deck; '// &
'the coupled OpenFAST and FAST.Farm routes and mixed EI = 0 / finite-EI decks do not carry it '// &
'yet. Set Cl = 0 for this run')
RETURN
END IF

IF (opts%waterkin_seastate) THEN
IF (.NOT. PRESENT(external_fluid)) THEN
Expand Down Expand Up @@ -7445,12 +7438,13 @@ SUBROUTINE CD_Init_Deck_Aggregate(deck_path, dt, agg, ErrStat, ErrMsg, env_gravi
IF (opts%has_bathymetry_file) THEN
CALL build_one_hermite_cable(lines(i), sections, types, points, opts, dt, agg%cables(c), cn, es, em, &
bathymetry=bathymetry, fairlead_orientation=fairlead_dcm, &
init_note=agg%cable_note(c), &
init_note=agg%cable_note(c), install_viv=.TRUE., &
fold_support=MERGE(FOLD_FRICTION_NONE, FOLD_FRICTION_FULL, &
deck_has_dynamic_points(points)))
ELSE
Comment thread
SMI-Lab-Inha marked this conversation as resolved.
Resolved
CALL build_one_hermite_cable(lines(i), sections, types, points, opts, dt, agg%cables(c), cn, es, em, &
fairlead_orientation=fairlead_dcm, init_note=agg%cable_note(c), &
install_viv=.TRUE., &
fold_support=MERGE(FOLD_FRICTION_NONE, FOLD_FRICTION_FULL, &
deck_has_dynamic_points(points)))
END IF
Expand Down
77 changes: 77 additions & 0 deletions src/CableDyn_Model.f90
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ MODULE CableDyn_Model
PUBLIC :: CD_Set_Model_Syrope_State
PUBLIC :: CD_Set_Model_VIV
PUBLIC :: CD_Latch_Model_VIV_Window
PUBLIC :: CD_Get_Model_VIV_State, CD_Set_Model_VIV_State, CD_Model_Has_VIV
PUBLIC :: CD_Get_Model_Tension
PUBLIC :: CD_Get_Model_EndForces
PUBLIC :: CD_Get_Model_EndNodeMassDiag
Expand Down Expand Up @@ -3991,6 +3992,82 @@ SUBROUTINE CD_Latch_Model_VIV_Window(model, dt)
model%viv_tw = REAL(CD_VIV_NM, wp)*dt
END SUBROUTINE CD_Latch_Model_VIV_Window

SUBROUTINE CD_Get_Model_VIV_State(model, phi, ms, t_window, ErrStat, ErrMsg)
!! Copy the committed VIV state for a checkpoint: the shedding phase per node (n_nodes),
!! the running mean squares of the cross-flow velocity and acceleration (2, n_nodes), and
!! the averaging time (0 while unlatched). A model without VIV returns zeros.
TYPE(CD_ModelType), INTENT(IN) :: model
REAL(wp), INTENT(OUT) :: phi(:), ms(:, :), t_window
INTEGER, INTENT(OUT) :: ErrStat
CHARACTER(*), INTENT(OUT) :: ErrMsg
phi = CD_ZERO
ms = CD_ZERO
t_window = CD_ZERO
ErrStat = CD_MODEL_OK
ErrMsg = ''
IF (.NOT. model%initialized) THEN
ErrStat = CD_MODEL_NOT_INITIALIZED
ErrMsg = 'CableDyn_Model: model is not initialized'
RETURN
END IF
IF (SIZE(phi) /= model%n_dof/3 .OR. SIZE(ms, 1) /= 2 .OR. SIZE(ms, 2) /= model%n_dof/3) THEN
CALL fail(ErrStat, ErrMsg, 'VIV state outputs must have shapes (n_nodes) and (2, n_nodes)')
RETURN
END IF
IF (.NOT. model%has_viv) RETURN
phi = model%viv_phi
ms = model%viv_ms
t_window = model%viv_tw
END SUBROUTINE CD_Get_Model_VIV_State

SUBROUTINE CD_Set_Model_VIV_State(model, phi, ms, t_window, ErrStat, ErrMsg)
!! Overwrite the committed VIV state from a checkpoint (see CD_Get_Model_VIV_State).
!! Fails closed on a model without VIV, a shape mismatch, non-finite values, a negative
!! mean square or averaging time.
TYPE(CD_ModelType), INTENT(INOUT) :: model
REAL(wp), INTENT(IN) :: phi(:), ms(:, :), t_window
INTEGER, INTENT(OUT) :: ErrStat
CHARACTER(*), INTENT(OUT) :: ErrMsg
ErrStat = CD_MODEL_OK
ErrMsg = ''
IF (.NOT. model%initialized) THEN
ErrStat = CD_MODEL_NOT_INITIALIZED
ErrMsg = 'CableDyn_Model: model is not initialized'
RETURN
END IF
IF (.NOT. model%has_viv) THEN
CALL fail(ErrStat, ErrMsg, 'model carries no VIV state to set')
RETURN
END IF
IF (SIZE(phi) /= model%n_dof/3 .OR. SIZE(ms, 1) /= 2 .OR. SIZE(ms, 2) /= model%n_dof/3) THEN
CALL fail(ErrStat, ErrMsg, 'VIV state inputs must have shapes (n_nodes) and (2, n_nodes)')
RETURN
END IF
IF (.NOT. (CD_All_Finite(phi) .AND. CD_All_Finite(ms) .AND. CD_Is_Finite(t_window))) THEN
CALL fail(ErrStat, ErrMsg, 'VIV state mirror must be finite')
RETURN
END IF
IF (ANY(ms < CD_ZERO) .OR. t_window < CD_ZERO) THEN
CALL fail(ErrStat, ErrMsg, 'VIV mean squares and averaging time must be non-negative')
RETURN
END IF
model%viv_phi = phi
model%viv_ms = ms
model%viv_tw = t_window
! the rollback and recovery twins follow (see CD_Set_Model_VE_Dl1)
model%viv_phi_rollback = phi
model%viv_ms_rollback = ms
model%recovery_viv_phi = phi
model%recovery_viv_ms = ms
model%viv_phi_eval = phi
END SUBROUTINE CD_Set_Model_VIV_State

PURE LOGICAL FUNCTION CD_Model_Has_VIV(model) RESULT(has)
!! True if the model carries the cross-flow VIV phase state.
TYPE(CD_ModelType), INTENT(IN) :: model
has = model%has_viv
END FUNCTION CD_Model_Has_VIV

SUBROUTINE viv_node_coef(model, q, nd, coef, uu)
!! 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
Expand Down
Loading
Loading