diff --git a/CHANGELOG.md b/CHANGELOG.md index a729c12..4a24cd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ All notable changes to CableDyn are recorded in this file. The format follows 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. +- The cross-flow VIV columns `Cl [dF cF]` may follow the 14-column finite-EI `LINE TYPES` row + (15 or 17 columns), so a line restrained in torsion can carry VIV; such a row free in torsion + runs as the 13-column one. The Python deck reader and builder take it. - 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/cli.rst b/doc/cli.rst index 9abd967..675af90 100644 --- a/doc/cli.rst +++ b/doc/cli.rst @@ -1016,8 +1016,8 @@ native reader's rules. - ``LINE TYPES`` row ``NAME``; fields ``name``, ``diam``, ``mass``, ``ea``, ``ba``, ``ei`` followed by ``cdn``, ``cdt``, ``can``, ``cat`` (CableDyn columns), ``cd``, ``ca``, ``cdax``, ``caax`` (MoorDyn-style columns), or ``gas``, ``gj``, ``irt``, - ``irn``, ``cdn``, ``cdt``, ``can``, ``cat`` (14-column rows); an 11- or 13-column row - adds ``cl`` or ``cl``, ``df``, ``cf`` (VIV). + ``irn``, ``cdn``, ``cdt``, ``can``, ``cat`` (14-column rows); an 11- or 13-column row, or + a 15- or 17-column one, adds ``cl`` or ``cl``, ``df``, ``cf`` (VIV). * - ``section.LINE.OCCURRENCE.FIELD`` - The ``OCCURRENCE``-th section (1-based, End A to End B) of line ``LINE``; fields ``lineid``, ``linetype``, ``length``, ``numsegs``. A 7-column ``LINES`` row counts as a diff --git a/doc/driver_format.md b/doc/driver_format.md index ee2cb91..956f7b9 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -291,12 +291,13 @@ frequency `f` [Hz], `Bb = ζ EI/(π f)`, set once per line type (it does not dep rates). **Cross-flow VIV columns (MoorDyn v2).** A 10-column row may end with `Cl` (11 columns) or -`Cl dF cF` (13 columns): the lift coefficient of the vortex-shedding synchronisation model and +`Cl dF cF` (13 columns), and a 14-column row likewise (15 or 17 columns, so a line restrained in +torsion can carry VIV): the lift coefficient of the vortex-shedding synchronisation model and the half-range and centre of its band in non-dimensional frequency (MoorDyn's `dF = 0.08` and `cF = 0.18` when only `Cl` is given). `Cl = 0` is no VIV; `Cl > 0` needs `cF > 0` and `0 <= dF < cF`, and the line's drag in water. It acts in the dynamics on `EI = 0` lines and -finite-EI cables (see [Cross-flow VIV](theory.rst)); the 14-column row has no VIV columns. The -in-line force of a type is a [VIV](#viv-optional) section row. +finite-EI cables (see [Cross-flow VIV](theory.rst)). The in-line force of a type is a +[VIV](#viv-optional) section row. **Viscoelastic axial stiffness (MoorDyn `ElasticMod`).** The EA and BA columns accept bar-separated parts: diff --git a/python/cabledyn/builder.py b/python/cabledyn/builder.py index 7612a0a..32d9aab 100644 --- a/python/cabledyn/builder.py +++ b/python/cabledyn/builder.py @@ -206,8 +206,9 @@ class LineType: cl, df, cf : float | None Optional cross-flow VIV columns of a type (MoorDyn's lift coefficient and the half-range and centre of the synchronisation band - in non-dimensional frequency). ``cl`` set writes the 13-column row, with - MoorDyn's ``df = 0.08`` and ``cf = 0.18`` where they are ``None``. + in non-dimensional frequency). ``cl`` set writes them after the ten or + fourteen columns (the 13- or 17-column row), with MoorDyn's + ``df = 0.08`` and ``cf = 0.18`` where they are ``None``. clx, il_alpha : float | None Optional in-line VIV of a type, a ``VIV`` section row ``Name ClX [alpha]``: the in-line shedding coefficient (it needs ``cl``, @@ -2717,9 +2718,6 @@ def _line_type_table(self) -> tuple[str, str, list[list[str]]]: raise ValueError(f"{what}: give all of gas, gj, irt, irn or none") row += [_num(v, what) for v in (item.cdn, item.cdt, item.can, item.cat)] if item.cl is not None: - if all(value is not None for value in extra): - # a LINE TYPES row has 10, 11, 13 or 14 columns: no VIV on the wide row - raise ValueError(f"{what}: cl, df and cf do not combine with gas, gj, irt, irn") viv = True df = 0.08 if item.df is None else item.df cf = 0.18 if item.cf is None else item.cf @@ -2730,6 +2728,9 @@ def _line_type_table(self) -> tuple[str, str, list[list[str]]]: if wide: header = "Name Diam Mass EA BA EI GAs GJ Irt Irn Cd_n Cd_t Ca_n Ca_t" units = "(-) (m) (kg/m) (N) (N-s) (N-m^2) (N) (N-m^2) (kg-m) (kg-m) (-) (-) (-) (-)" + if viv: + header += " Cl dF cF" + units += " (-) (-) (-)" elif viv: header = "Name Diam Mass EA BA EI Cd_n Cd_t Ca_n Ca_t Cl dF cF" units = "(-) (m) (kg/m) (N) (N-s) (N-m^2) (-) (-) (-) (-) (-) (-) (-)" diff --git a/python/cabledyn/deck_file.py b/python/cabledyn/deck_file.py index c2dc68f..13f6239 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -3780,7 +3780,11 @@ def effective(key: str, default: float) -> float: raise DeckFormatError( f"{self._label}: standalone OPTION frictionMu requires dtM and TMax" ) - allowed_widths = {"LINE TYPES": {10, 11, 13, 14}, "POINTS": {5, 9}, "LINES": {3, 4, 7}} + allowed_widths = { + "LINE TYPES": {10, 11, 13, 14, 15, 17}, + "POINTS": {5, 9}, + "LINES": {3, 4, 7}, + } # Every row present is checked, also in a line-free deck of bodies and rods: the # native reader parses each table row whether or not a line uses it. for name in sorted(allowed_widths): @@ -3808,7 +3812,7 @@ def numeric(token: str, row: DeckRecord, field: str) -> float: viv_type_names: set[str] = set() for row in self.line_types: for index in (1, 2, *range(5, len(row.tokens))): - if len(row.tokens) == 14 and index == 7: + if len(row.tokens) >= 14 and index == 7: continue # the GJ column, GJ, GJ|K or GJ|K|Bt, is read below if index == 5: continue # the EI column, EI, EI|Bb or EI|-zeta|f, is read below @@ -3861,9 +3865,9 @@ def numeric(token: str, row: DeckRecord, field: str) -> float: f"{self._at(row)}: Syrope BA_s and BA_d must be non-negative " "with a positive sum" ) - # Native append_type: drag and added-mass coefficients (columns 7-10, the last - # four of a 14-column row, in either column order) must be non-negative. - hydro_start = len(row.tokens) - 4 if len(row.tokens) == 14 else 6 + # Native append_type: drag and added-mass coefficients (columns 7-10, or 11-14 of + # a 14-column row, in either column order) must be non-negative. + hydro_start = 10 if len(row.tokens) >= 14 else 6 hydro = [ numeric(row.tokens[index], row, f"LINE TYPES column {index + 1}") for index in range(hydro_start, hydro_start + 4) @@ -3910,12 +3914,14 @@ def numeric(token: str, row: DeckRecord, field: str) -> float: f"{self._at(row)}: LINE TYPES {row.tokens[0]}: bending damping (EI|Bb) needs " "a finite-EI cable (EI > 0)" ) - if len(row.tokens) in (11, 13): - # Native check_viv_columns: MoorDyn's cross-flow VIV columns Cl [dF cF] - cl = numeric(row.tokens[10], row, "Cl") + if len(row.tokens) in (11, 13, 15, 17): + # Native check_viv_columns: MoorDyn's cross-flow VIV columns Cl [dF cF], after + # the ten standard columns or the fourteen of a finite-EI row + at = 10 if len(row.tokens) in (11, 13) else 14 + cl = numeric(row.tokens[at], row, "Cl") d_f, c_f = ( - (numeric(row.tokens[11], row, "dF"), numeric(row.tokens[12], row, "cF")) - if len(row.tokens) == 13 + (numeric(row.tokens[at + 1], row, "dF"), numeric(row.tokens[at + 2], row, "cF")) + if len(row.tokens) in (13, 17) else (0.08, 0.18) ) if cl < 0.0: @@ -3934,7 +3940,7 @@ def numeric(token: str, row: DeckRecord, field: str) -> float: model = "Syrope" if is_syrope else "viscoelastic stiffness" raise DeckFormatError(f"{self._at(row)}: {model} is not supported with EI > 0") gj_value = 0.0 - if len(row.tokens) == 14: + if len(row.tokens) >= 14: # the GJ column is GJ, GJ|K or GJ|K|Bt (K the torque-tension coupling, N m; # Bt the torsional damping, N m^2 s, negative: -zeta) gj_parts = row.tokens[7].split("|") @@ -4091,7 +4097,7 @@ def unique(records: tuple[DeckRecord, ...], label: str, numeric: bool) -> set[st type_names = unique(self.line_types, "line type", False) if any( - len(row.tokens) == 14 and self._stock_line_type_columns(row) for row in self.line_types + len(row.tokens) >= 14 and self._stock_line_type_columns(row) for row in self.line_types ): raise DeckFormatError( f"{self._label}: 14-column LINE TYPES rows require CableDyn hydro-column order" @@ -6185,10 +6191,13 @@ def _check_torsion_lines( def _line_type_fields(self, record: DeckRecord) -> tuple[str, ...]: fields = _FIELDS["line_type"] - if len(record.tokens) == 14: - return (*fields[:6], "gas", "gj", "irt", "irn", "cdn", "cdt", "can", "cat") - # MoorDyn's optional cross-flow VIV columns follow the ten standard ones - viv = {11: ("cl",), 13: ("cl", "df", "cf")}.get(len(record.tokens), ()) + # MoorDyn's optional cross-flow VIV columns follow the ten standard ones, or the + # fourteen of a finite-EI row + viv = {11: ("cl",), 13: ("cl", "df", "cf"), 15: ("cl",), 17: ("cl", "df", "cf")}.get( + len(record.tokens), () + ) + if len(record.tokens) >= 14: + return (*fields[:6], "gas", "gj", "irt", "irn", "cdn", "cdt", "can", "cat", *viv) if self._stock_line_type_columns(record): return (*fields[:6], "cd", "ca", "cdax", "caax", *viv) return (*fields, *viv) diff --git a/python/tests/test_builder.py b/python/tests/test_builder.py index 7d0e851..8569fdf 100644 --- a/python/tests/test_builder.py +++ b/python/tests/test_builder.py @@ -185,7 +185,7 @@ def test_build_single_catenary_validates_and_saves(tmp_path: Path) -> None: assert model.save(target, overwrite=True) == target -def test_viv_columns_do_not_combine_with_the_wide_finite_ei_row(tmp_path: Path) -> None: +def test_viv_columns_follow_the_wide_finite_ei_row(tmp_path: Path) -> None: model = _chain_model(tmp_path) model.add_line_type( "cable", @@ -197,10 +197,20 @@ def test_viv_columns_do_not_combine_with_the_wide_finite_ei_row(tmp_path: Path) gj=1.0e3, irt=0.1, irn=0.05, - cl=0.0, + cl=0.8, + cf=0.17, ) - with pytest.raises(ValueError, match="do not combine with gas, gj, irt, irn"): - model.to_text(validate=False) + text = model.to_text() + deck = DeckFile.from_text(text, path=tmp_path / "deck.dat") + rows = {row.tokens[0].upper(): row.tokens for row in deck.line_types} + # the 14 finite-EI columns, then Cl dF cF (MoorDyn's dF = 0.08 where df is None) + assert len(rows["CABLE"]) == 17 + assert [float(value) for value in rows["CABLE"][14:]] == [0.8, 0.08, 0.17] + assert len(rows["CHAIN"]) == 10 + loaded = DeckModel.from_text(text, path=tmp_path / "deck.dat") + cable = loaded.line_types["CABLE"] + assert (cable.gj, cable.irn, cable.cl, cable.df, cable.cf) == (1.0e3, 0.05, 0.8, 0.08, 0.17) + assert loaded.to_text() == text def test_build_spread_mooring_with_multi_section_lines() -> None: diff --git a/python/tests/test_deck_file.py b/python/tests/test_deck_file.py index 6b69c46..c304a81 100644 --- a/python/tests/test_deck_file.py +++ b/python/tests/test_deck_file.py @@ -4614,7 +4614,7 @@ def test_line_free_object_deck_checks_line_type_rows_without_crashing(): ("1 2 1 -\n", ""), ("1 chain 410.0 41\n", ""), ) - with pytest.raises(DeckFormatError, match="LINE TYPES row needs 10, 11, 13, 14 fields"): + with pytest.raises(DeckFormatError, match="LINE TYPES row needs 10, 11, 13, 14, 15, 17 fields"): DeckFile.from_text(_with_section(no_lines, "BODIES", *body_rows)) # a header-only LINES section does not make the deck a line deck (the rule counts rows) with pytest.raises(DeckFormatError) as caught: @@ -4791,7 +4791,7 @@ def test_line_type_viv_columns_are_read_and_kept(tmp_path, columns, expected): (" -0.1", "Cl must be non-negative"), (" 0.8 0.2 0.18", "needs cF > 0 and 0 <= dF < cF"), (" 0.8 0.05 0.0", "needs cF > 0 and 0 <= dF < cF"), - (" 0.8 0.08", "LINE TYPES row needs 10, 11, 13, 14 fields"), + (" 0.8 0.08", "LINE TYPES row needs 10, 11, 13, 14, 15, 17 fields"), ], ) def test_line_type_viv_columns_follow_the_native_checks(columns, message): @@ -4811,6 +4811,48 @@ 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) +# the 14-column finite-EI row (GAs GJ Irt Irn) takes the same VIV columns after its last +_WIDE_VIV_ROW = ( + "chain 0.252 390.0 1.674e9 -1.0 1.0e4 1.0e8 1.0e3|0|-0.01 0.1 0.05 1.37 0.64 1.0 0.0" +) + + +@pytest.mark.parametrize( + "columns, expected", + [ + (" 0.8", (0.8, None, None)), + (" 0.8 0.05 0.2", (0.8, 0.05, 0.2)), + ], +) +def test_line_type_viv_columns_follow_the_finite_ei_row(tmp_path, columns, expected): + from cabledyn import DeckModel + + row = "chain 0.252 390.0 1.674e9 -1.0 1.0e4 1.37 0.64 1.0 0.0" + text = _edit(_DYNAMIC, (row, _WIDE_VIV_ROW + columns)) + record = DeckFile.from_text(text).line_types[0] + assert len(record.tokens) == 14 + len(columns.split()) + path = tmp_path / "viv_wide.dat" + path.write_text(text, encoding="utf-8") + line_type = DeckModel.load(path).line_types["chain"] + assert (line_type.gj, line_type.irn) == ((1.0e3, 0.0, -0.01), 0.05) + assert (line_type.cl, line_type.df, line_type.cf) == expected + assert (line_type.cdn, line_type.cdt, line_type.can, line_type.cat) == (1.37, 0.64, 1.0, 0.0) + + +@pytest.mark.parametrize( + "columns, message", + [ + (" -0.1", "Cl must be non-negative"), + (" 0.8 0.2 0.18", "needs cF > 0 and 0 <= dF < cF"), + (" 0.8 0.08", "LINE TYPES row needs 10, 11, 13, 14, 15, 17 fields"), + ], +) +def test_finite_ei_row_viv_columns_follow_the_native_checks(columns, message): + row = "chain 0.252 390.0 1.674e9 -1.0 1.0e4 1.37 0.64 1.0 0.0" + with pytest.raises(DeckFormatError, match=re.escape(message)): + DeckFile.from_text(_edit(_DYNAMIC, (row, _WIDE_VIV_ROW + columns))) + + def test_viv_is_accepted_on_the_coupled_route(): text = _edit(_STATIC, (_VIV_ROW, _VIV_ROW + " 0.8")) DeckFile.from_text(text) diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index c5fa434..7dbb381 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -15833,11 +15833,11 @@ SUBROUTINE append_type(line, types, nt, stock_cols, ErrStat, ErrMsg) INTEGER :: ios, ntok ErrStat = 0; ErrMsg = '' ntok = count_tokens(line) - IF (ntok /= 10 .AND. ntok /= 11 .AND. ntok /= 13 .AND. ntok /= 14) THEN + IF (ntok /= 10 .AND. ntok /= 11 .AND. ntok /= 13 .AND. ntok /= 14 .AND. ntok /= 15 .AND. ntok /= 17) THEN CALL fail(ErrStat, ErrMsg, 'LINE TYPES row needs 10 cols '// & - '(Name Diam MassDenInAir EA BA/-zeta EI Cd_n Cd_t Ca_n Ca_t), 11 or 13 cols (the same '// & - 'followed by MoorDyn''s VIV columns Cl [dF cF]) or 14 cols '// & - '(Name Diam MassDenInAir EA BA/-zeta EI GAs GJ Irt Irn Cd_n Cd_t Ca_n Ca_t)'); RETURN + '(Name Diam MassDenInAir EA BA/-zeta EI Cd_n Cd_t Ca_n Ca_t) or 14 cols '// & + '(Name Diam MassDenInAir EA BA/-zeta EI GAs GJ Irt Irn Cd_n Cd_t Ca_n Ca_t), either '// & + 'followed by MoorDyn''s VIV columns Cl [dF cF] (11, 13, 15 or 17 cols)'); RETURN END IF ! EA and BA read as STRINGS: MoorDyn's viscoelastic syntax carries ! bar-separated parts (Es|Ed[|alpha], Bs|Bd) that a numeric read cannot see. @@ -15868,18 +15868,28 @@ SUBROUTINE append_type(line, types, nt, stock_cols, ErrStat, ErrMsg) END IF ELSE IF (stock_cols) THEN - CALL fail(ErrStat, ErrMsg, 'the 14-column LINE TYPES row is a CableDyn form (... Cd_n Cd_t '// & - 'Ca_n Ca_t); it does not combine with a stock-order header (Cd Ca CdAx CaAx)'); RETURN + CALL fail(ErrStat, ErrMsg, 'the 14-column LINE TYPES row (15 or 17 with VIV) is a CableDyn form '// & + '(... Cd_n Cd_t Ca_n Ca_t); it does not combine with a stock-order header (Cd Ca CdAx CaAx)') + RETURN + END IF + ! the CableDyn finite-EI row, with MoorDyn's VIV columns Cl or Cl dF cF after it + IF (ntok == 14) THEN + READ (line, *, IOSTAT=ios) t%name, t%diam, t%mass, ea_str, ba_str, ei_str, t%gas, gj_str, t%i_rt, t%i_rn, & + t%cdn, t%cdt, t%can, t%cat + ELSE IF (ntok == 15) THEN + READ (line, *, IOSTAT=ios) t%name, t%diam, t%mass, ea_str, ba_str, ei_str, t%gas, gj_str, t%i_rt, t%i_rn, & + t%cdn, t%cdt, t%can, t%cat, t%cl + ELSE + READ (line, *, IOSTAT=ios) t%name, t%diam, t%mass, ea_str, ba_str, ei_str, t%gas, gj_str, t%i_rt, t%i_rn, & + t%cdn, t%cdt, t%can, t%cat, t%cl, t%viv_df, t%viv_cf END IF - READ (line, *, IOSTAT=ios) t%name, t%diam, t%mass, ea_str, ba_str, ei_str, t%gas, gj_str, t%i_rt, t%i_rn, & - t%cdn, t%cdt, t%can, t%cat END IF IF (ios /= 0) THEN CALL fail(ErrStat, ErrMsg, 'malformed LINE TYPES row'); RETURN END IF CALL parse_ei_column(ei_str, t, ErrStat, ErrMsg) IF (ErrStat /= 0) RETURN - IF (ntok == 14) THEN + IF (ntok >= 14) THEN CALL parse_gj_column(gj_str, t, ErrStat, ErrMsg) IF (ErrStat /= 0) RETURN END IF @@ -15891,7 +15901,7 @@ SUBROUTINE append_type(line, types, nt, stock_cols, ErrStat, ErrMsg) END IF CALL parse_stiffness_columns(ea_str, ba_str, t, ErrStat, ErrMsg) IF (ErrStat /= 0) RETURN - IF (ntok == 11 .OR. ntok == 13) THEN + IF (ntok == 11 .OR. ntok == 13 .OR. ntok == 15 .OR. ntok == 17) THEN CALL check_viv_columns(t, ErrStat, ErrMsg) IF (ErrStat /= 0) RETURN END IF diff --git a/tests/test_viv_inline_deck.f90 b/tests/test_viv_inline_deck.f90 index 25e0675..fe43375 100644 --- a/tests/test_viv_inline_deck.f90 +++ b/tests/test_viv_inline_deck.f90 @@ -17,7 +17,12 @@ PROGRAM test_viv_inline_deck !! 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. + !! Chh on a type without in-line VIV and a negative Chh are refused; + !! D6 the cross-flow columns after the 14-column finite-EI row (GAs GJ Irt Irn): a 17-column row + !! free in torsion is the 13-column deck, to the printed digits; a 15-column row (Cl alone) is + !! the 17-column one with MoorDyn's dF 0.08 and cF 0.18; and on the line restrained in + !! torsion at both ends (nodal twist) the lift still locks the cable in, with the cross-flow + !! amplitude and frequency of the line free in torsion. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_DECKDRV_OK IMPLICIT NONE @@ -70,11 +75,14 @@ SUBROUTINE write_current(path) CLOSE (u) END SUBROUTINE write_current - SUBROUTINE write_deck(path, viv_rows, tmax, ei, cl) - !! viv_rows: the VIV section's data rows, ';'-separated ('' for no section). + SUBROUTINE write_deck(path, viv_rows, tmax, ei, cl, wide, ends) + !! viv_rows: the VIV section's data rows, ';'-separated ('' for no section). wide: the VIV + !! columns written after the 14-column finite-EI row (GAs GJ Irt Irn in the CableDyn hydro + !! order) instead of the 10 stock-order ones; ends: restrain both ends in torsion. CHARACTER(*), INTENT(IN) :: path, viv_rows REAL(wp), INTENT(IN) :: tmax - CHARACTER(*), INTENT(IN), OPTIONAL :: ei, cl + CHARACTER(*), INTENT(IN), OPTIONAL :: ei, cl, wide + LOGICAL, INTENT(IN), OPTIONAL :: ends CHARACTER(32) :: ei_col, cl_col INTEGER :: u, i0, i1 ei_col = '1.0' @@ -85,10 +93,17 @@ SUBROUTINE write_deck(path, viv_rows, tmax, ei, cl) WRITE (u, '(A)') '--------------------- CableDyn Input File ---------------------------------' WRITE (u, '(A)') 'in-line VIV deck gate: taut cable in a uniform current' WRITE (u, '(A)') '----------------------- LINE TYPES ------------------------------------------' - WRITE (u, '(A)') 'TypeName Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx Cl dF cF' - WRITE (u, '(A)') '(name) (m) (kg/m) (N) (N-s/-) (-) (-) (-) (-) (-) (-) (-) (-)' - WRITE (u, '(A)') 'riser 0.10 10.0 5.0e7 -0.8 '//TRIM(ei_col)//' 1.2 1.0 0.0 0.0 '// & - TRIM(cl_col)//' 0.08 0.18' + IF (PRESENT(wide)) THEN + ! GJ = EI/1.3, Irn = m D^2/8, Irt = m D^2/16, GAs = EA/2.6: the circular-section closure + WRITE (u, '(A)') 'TypeName Diam Mass/m EA BA/-zeta EI GAs GJ Irt Irn Cd_n Cd_t Ca_n Ca_t Cl [dF cF]' + WRITE (u, '(A)') 'riser 0.10 10.0 5.0e7 -0.8 '//TRIM(ei_col)//' 1.9230769e7 0.76923077 0.00625 0.0125 '// & + '1.2 0.0 1.0 0.0 '//wide + ELSE + WRITE (u, '(A)') 'TypeName Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx Cl dF cF' + WRITE (u, '(A)') '(name) (m) (kg/m) (N) (N-s/-) (-) (-) (-) (-) (-) (-) (-) (-)' + WRITE (u, '(A)') 'riser 0.10 10.0 5.0e7 -0.8 '//TRIM(ei_col)//' 1.2 1.0 0.0 0.0 '// & + TRIM(cl_col)//' 0.08 0.18' + END IF WRITE (u, '(A)') '----------------------- POINTS ----------------------------------------------' WRITE (u, '(A)') 'ID Attachment X Y Z M V CdA CA' WRITE (u, '(A)') '(#) (-) (m) (m) (m) (kg) (m^3) (m^2) (-)' @@ -98,6 +113,15 @@ SUBROUTINE write_deck(path, viv_rows, tmax, ei, cl) WRITE (u, '(A)') 'ID LineType AttachA AttachB UnstrLen NumSegs Outputs' WRITE (u, '(A)') '(#) (name) (#) (#) (m) (-) (-)' WRITE (u, '(A)') '1 riser 1 2 99.900100 50 -' + IF (PRESENT(ends)) THEN + IF (ends) THEN + ! pinned in bending, rigid in torsion, the zero-twist normal along z + WRITE (u, '(A)') '----------------------- END CONNECTIONS ---------------------------------------' + WRITE (u, '(A)') 'LineID End Stiffness EzX EzY EzZ TorsStiffness NxX NxY NxZ Pretwist' + WRITE (u, '(A)') '1 A 0 1.0 0.0 0.0 Rigid 0.0 0.0 1.0 0.0' + WRITE (u, '(A)') '1 B 0 1.0 0.0 0.0 Rigid 0.0 0.0 1.0 0.0' + END IF + END IF IF (LEN_TRIM(viv_rows) > 0) THEN WRITE (u, '(A)') '----------------------- VIV -------------------------------------------------' WRITE (u, '(A)') 'TypeName ClX alpha' @@ -291,8 +315,55 @@ SUBROUTINE check_runs() 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 + CALL check_wide_rows(tc, nc) END SUBROUTINE check_runs + SUBROUTINE check_wide_rows(tc, nc) + !! D6 against the cross-flow-only deck tc (the 13-column row, no VIV section). + REAL(wp), INTENT(IN) :: tc(:, :) + INTEGER, INTENT(IN) :: nc + REAL(wp), ALLOCATABLE :: tw(:, :), t15(:, :), t17(:, :), tr(:, :), tt(:), z(:), y(:) + INTEGER :: nw, n15, n17, nr + REAL(wp) :: az_c, fz_c, az_r, fz_r + LOGICAL :: ok + CHARACTER(1024) :: msg + CALL write_deck('vid_w13.dat', '', 100.0_wp, wide='0.8 0.08 0.18') + CALL run('vid_w13.dat', 'vid_w13', ok, msg) + CALL require(ok, 'D6: the 17-column deck runs: '//TRIM(msg)) + CALL read_out('vid_w13.out', tw, nw) + CALL require(nw == nc, 'D6: the 17-column run wrote the rows of the 13-column one') + IF (nw /= nc) RETURN + CALL require(ALL(tw(:, 1:nw) == tc(:, 1:nc)), 'D6: a 17-column row free in torsion is the 13-column row') + CALL write_deck('vid_w15.dat', '', 30.0_wp, wide='0.8', ends=.TRUE.) + CALL run('vid_w15.dat', 'vid_w15', ok, msg) + CALL require(ok, 'D6: the 15-column deck restrained in torsion runs: '//TRIM(msg)) + CALL write_deck('vid_w17.dat', '', 30.0_wp, wide='0.8 0.08 0.18', ends=.TRUE.) + CALL run('vid_w17.dat', 'vid_w17', ok, msg) + CALL require(ok, 'D6: the 17-column deck restrained in torsion runs: '//TRIM(msg)) + CALL read_out('vid_w15.out', t15, n15) + CALL read_out('vid_w17.out', t17, n17) + CALL require(n15 > 100 .AND. n15 == n17, 'D6: the 15- and 17-column runs wrote matching rows') + IF (.NOT. (n15 > 100 .AND. n15 == n17)) RETURN + CALL require(ALL(t15(:, 1:n15) == t17(:, 1:n17)), 'D6: a 15-column row takes dF 0.08 and cF 0.18') + CALL write_deck('vid_wr.dat', '', 100.0_wp, wide='0.8 0.08 0.18', ends=.TRUE.) + CALL run('vid_wr.dat', 'vid_wr', ok, msg) + CALL require(ok, 'D6: the VIV deck restrained in torsion runs: '//TRIM(msg)) + CALL read_out('vid_wr.out', tr, nr) + CALL require(nr == nc, 'D6: the run restrained in torsion wrote the same rows') + IF (nr /= nc) RETURN + CALL window(tc, nc, 50.0_wp, tt, z, y) + az_c = 0.5_wp*(MAXVAL(z) - MINVAL(z)) + fz_c = peak_frequency(tt, z) + CALL window(tr, nr, 50.0_wp, tt, z, y) + az_r = 0.5_wp*(MAXVAL(z) - MINVAL(z)) + fz_r = peak_frequency(tt, z) + WRITE (*, '(A,2F8.4,A,2F8.4)') 'D6: mid-span CF amplitude/D and frequency [Hz], restrained in torsion ', & + az_r/D, fz_r, ', free ', az_c/D, fz_c + CALL require(az_r > 0.3_wp*D, 'D6: the lift locks in the cable restrained in torsion') + CALL require(ABS(az_r/az_c - 1.0_wp) <= 0.02_wp .AND. ABS(fz_r - fz_c) <= 0.01_wp, & + 'D6: with the amplitude (2 %) and frequency (0.01 Hz) of the cable free in torsion') + END SUBROUTINE check_wide_rows + 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