From 8c84d96a03aae00493f26e146c04f09828527fdc Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Wed, 18 Nov 2026 06:37:39 +0900 Subject: [PATCH] fix: CableDyn deck reader takes the 0.4.x LINE TYPES grammar read_cabledyn_deck rejected GJ|K and GJ|K|Bt in the GJ column (torque-tension coupling and torsional damping, CableDyn 0.4.0) and EI|Bb, EI|-zeta|f and EI|-zeta|f1|f2 in the EI column (bending and Rayleigh damping) as "not numeric", so no deck using them could be read. The line type now keeps the numeric EI and GJ and the extra parts as CableDyn resolves them (bending_damping_Nm2s, mass_damping_1_s, torque_tension_coupling_Nm, torsional_damping, polar_inertia_kg_m, and the columns as written), with CableDyn's checks. The tables are read by position, as CableDyn reads them, instead of by header name: a row without a number token is a header or units row and the token count selects the row form. An 11-column LINE TYPES row is the 10 columns and the VIV Cl, so a header naming its last column GJ no longer turns Cl into a GJ, and stock-MoorDyn headers read. END CONNECTIONS TorsStiffness Free, Zero or 0 now leaves the end free in torsion (any token but none, - and 0 restrained it), EndA/End_A name End A, and the restrained ends follow the anchor-first swap (CableDynLine.torsion_restrained_ends). A finite-EI line from a Fixed point to a rod end is swapped as CableDyn swaps it, an END row closes the OUTPUTS list, a quoted name may hold spaces, exponents may be written with D, and a duplicate line type or line id is refused. A line solved in torsion whose type couples torque and tension twists as it stretches, so read_cabledyn_sections needs its Twist channels even when only one end is restrained, and section_channels lists Twist/Torq for a line restrained at either end. tests/data/cabledyn/lw24g.* is a CableDyn 0.4.2 run (development build 4b94321) of a deck with these tokens: Rayleigh and Kelvin-Voigt bending damping, GJ|K|Bt, End A restrained in torsion, END in OUTPUTS. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 24 ++ doc/global_local_guide.md | 20 +- src/cablexsec/io/cabledyn.py | 444 +++++++++++++++++++------ tests/data/cabledyn/lw24g.Line1.p.out | 13 + tests/data/cabledyn/lw24g.Line1.t.out | 13 + tests/data/cabledyn/lw24g.dat | 127 +++++++ tests/data/cabledyn/lw24g.elements.out | 27 ++ tests/data/cabledyn/lw24g.out | 13 + tests/data/cabledyn/lw24g.static.out | 28 ++ tests/test_cabledyn_inputs.py | 215 +++++++++++- tests/test_cabledyn_reader.py | 93 +++++- validation/validation_report.md | 2 +- 12 files changed, 911 insertions(+), 108 deletions(-) create mode 100644 tests/data/cabledyn/lw24g.Line1.p.out create mode 100644 tests/data/cabledyn/lw24g.Line1.t.out create mode 100644 tests/data/cabledyn/lw24g.dat create mode 100644 tests/data/cabledyn/lw24g.elements.out create mode 100644 tests/data/cabledyn/lw24g.out create mode 100644 tests/data/cabledyn/lw24g.static.out diff --git a/CHANGELOG.md b/CHANGELOG.md index f23dda0..3fcc7d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -430,6 +430,30 @@ All notable changes to CableXSec are recorded in this file. The format follows `.elements.out` is no longer refused: the files show whether the mesh was refined. Real CableDyn 0.4.2 output of the refined run is in `tests/data/cabledyn/lw24r.*`; from the refined positions the curvature meets every `Curv` channel within the default 5 %. +- `read_cabledyn_deck` reads the LINE TYPES tokens of CableDyn 0.4.x: `GJ|K` and `GJ|K|Bt` + (torque–tension coupling and torsional damping, CableDyn 0.4.0) in the `GJ` column, and + `EI|Bb`, `EI|-zeta|f` and `EI|-zeta|f1|f2` (bending and Rayleigh damping) in the `EI` column. + It rejected them as "not numeric", so no deck using them could be read. The line type keeps + the numeric `EI` and `GJ` and the extra parts as CableDyn resolves them + (`bending_damping_Nm2s`, `mass_damping_1_s`, `torque_tension_coupling_Nm`, + `torsional_damping`, `polar_inertia_kg_m`, and the columns as written in `ei_token` and + `gj_token`), with CableDyn's checks (`0 < ζ < 1`, positive frequencies, damping and coupling + only on a finite-EI type, `K² < EA·GJ`). The tables are now read by position, as CableDyn + reads them, instead of by header name: a row without a number token is a header or units + row, and the token count selects the row form. An 11-column LINE TYPES row is the 10 columns + and the VIV `Cl`, so a header naming its last column `GJ` no longer turns `Cl` into a `GJ` + (CableDyn reads `GJ` only from the 14-column row), and stock-MoorDyn headers (`Mass/m`, + `Cd Ca CdAx CaAx`) read. END CONNECTIONS `TorsStiffness` `Free`, `Zero` or `0` now leaves the + end free in torsion (any token but `none`, `-` and `0` restrained it, so a deck with `Free` + was refused for want of `Twist` channels), `EndA`/`End_A` name End A, and the restrained ends + follow the anchor-first swap (`CableDynLine.torsion_restrained_ends`). A finite-EI line from + a `Fixed` point to a rod end is swapped as CableDyn swaps it, an `END` row closes the OUTPUTS + list, a quoted name may hold spaces, exponents may be written with `D`, and a duplicate line + type or line id is refused. A line solved in torsion whose type couples torque and tension + twists as it stretches, so `read_cabledyn_sections` needs its `Twist` channels even when only + one end is restrained, and `section_channels` lists `Twist`/`Torq` for a line restrained at + either end. `tests/data/cabledyn/lw24g.*` is a CableDyn 0.4.2 run of a deck with these + tokens. - `read_cabledyn_sections` closes every output file it reads. The per-line `.p.out` and `.t.out` readers were left open after a read (and after a failed one) until garbage collection, which raised `ResourceWarning`. The files of one run must now also end on the same diff --git a/doc/global_local_guide.md b/doc/global_local_guide.md index 40626eb..42cc85b 100644 --- a/doc/global_local_guide.md +++ b/doc/global_local_guide.md @@ -20,8 +20,9 @@ bend stiffener); the hysteretic two-way element is stage 2 (Section 7). From the CableDyn manual (`doc/driver_format.md`, `doc/outputs.rst`, `doc/theory.rst`) for CableDyn 0.4.x. The genuine runs in `tests/data/cabledyn/` were written by the CableDyn 0.1.0 driver (`lw24`, `lw128_v010`) and a -CableDyn 0.4.2 build (`lw128`, and `lw24r` on a mesh the static solve -refined); where a later release changed a channel, the item says so. +CableDyn 0.4.2 build (`lw128`; `lw24r` on a mesh the static solve +refined; `lw24g` with the 0.4.x LINE TYPES tokens); where a later release +changed a channel, the item says so. - **Files.** Standalone driver: `.out` (title line, header `Time(s)` and the deck `OUTPUTS` tokens, no units row); @@ -68,6 +69,21 @@ refined); where a later release changed a channel, the item says so. dynamics it varies along the line) and `TwistN`, the material twist accumulated from End A in degrees. - **Pressure.** Not written. +- **Deck.** `read_cabledyn_deck` reads the tables by position, as CableDyn + does: a row without a number token is a column-name or units row, and the + token count selects the row form (LINE TYPES 10 or 14 columns, either + followed by `Cl [dF cF]`; POINTS 5 or 9; LINES 3, 4 or the stock 7; + SECTIONS 4; END CONNECTIONS 6, 10 or 11). The `EI` column may carry + bending damping (`EI|Bb`, `EI|-zeta|f`, `EI|-zeta|f1|f2`), the `GJ` column + of a 14-column row the torque–tension coupling `K` and torsional damping + `Bt` (`GJ|K`, `GJ|K|Bt`); the line type keeps them, resolved as CableDyn + resolves them (`bending_damping_Nm2s`, `mass_damping_1_s`, + `torque_tension_coupling_Nm`, `torsional_damping`), and they leave the + reconstructed histories unchanged, since these come from CableDyn's + solution. A line solved in torsion whose type couples torque and tension + twists as it stretches, so the reader needs its `Twist` channels even when + only one end is restrained. `TorsStiffness` `Free`, `Zero` or `0` leaves an + end free in torsion. ## 2. Section history diff --git a/src/cablexsec/io/cabledyn.py b/src/cablexsec/io/cabledyn.py index 8b40bbe..eb48667 100644 --- a/src/cablexsec/io/cabledyn.py +++ b/src/cablexsec/io/cabledyn.py @@ -85,7 +85,9 @@ When the line is restrained in torsion and ``TwistN`` channels bracket the section, the material axes are :math:`(\mathbf{e}_1,\mathbf{e}_2)` turned right-handed about :math:`\mathbf{t}` by the material twist from End A. A line -restrained in torsion without these channels is rejected. +restrained in torsion at both ends without these channels is rejected, and so +is one restrained at either end whose line type couples torque and tension +(``GJ|K``): its twist follows the stretch. The returned ``rotation_curvature_x/y`` are the components of the rotation-curvature (Darboux bending) vector :math:`\boldsymbol{\kappa}` on the @@ -195,7 +197,23 @@ # --------------------------------------------------------------------------- # @dataclass(frozen=True) class CableDynLineType: - """One ``LINE TYPES`` row (SI).""" + """One ``LINE TYPES`` row (SI), read by position as CableDyn reads it. + + ``ea_N`` is ``None`` for a viscoelastic (``Es|Ed``, ``Es|alphaMBL|vbeta``) + or Syrope ``EA`` column. ``gj_Nm2`` is the ``GJ`` of a 14-column row + (``None`` on a 10-column row). The damping and coupling parts of the + ``EI`` and ``GJ`` columns are kept as CableDyn resolves them: + ``bending_damping_Nm2s`` is the ``Bb`` of ``EI|Bb``, ``EI|-zeta|f`` + (``Bb = zeta EI/(pi f)``) or ``EI|-zeta|f1|f2`` + (``Bb = zeta EI/(pi (f1 + f2))``), ``mass_damping_1_s`` the + mass-proportional ``alpha = 4 pi zeta f1 f2/(f1 + f2)`` of the Rayleigh + form, ``torque_tension_coupling_Nm`` the ``K`` of ``GJ|K`` + (``T = EA eps + K tau``, ``M = GJ tau + K eps``) and ``torsional_damping`` + the ``Bt`` of ``GJ|K|Bt`` [N m² s] (negative: ``-zeta`` of the critical + torsional damping of an element). ``polar_inertia_kg_m`` is the ``Irn`` + [kg m²/m] of a 14-column row. ``ei_token`` and ``gj_token`` are the + columns as written. + """ name: str diameter_m: float @@ -203,6 +221,13 @@ class CableDynLineType: ea_N: float | None ei_Nm2: float gj_Nm2: float | None + bending_damping_Nm2s: float = 0.0 + mass_damping_1_s: float = 0.0 + torque_tension_coupling_Nm: float = 0.0 + torsional_damping: float = 0.0 + polar_inertia_kg_m: float | None = None + ei_token: str = "" + gj_token: str | None = None @dataclass(frozen=True) @@ -216,7 +241,12 @@ class CableDynSection: @dataclass(frozen=True) class CableDynLine: - """A deck line in public order (End A -> End B, after any anchor-first swap).""" + """A deck line in public order (End A -> End B, after any anchor-first swap). + + ``torsion_restrained`` is a line restrained in torsion at both ends; + ``torsion_restrained_ends`` names every restrained end (``"a"``, ``"b"``, + public order). CableDyn solves the torsion of a line restrained at either. + """ line_id: int end_a: str @@ -225,6 +255,7 @@ class CableDynLine: sections: tuple[CableDynSection, ...] torsion_restrained: bool reversed_by_parser: bool + torsion_restrained_ends: frozenset[str] = frozenset() @property def n_elements(self) -> int: @@ -353,18 +384,209 @@ def _option_record(row: Sequence[str]) -> tuple[str, str] | None: return None +#: A decimal real as CableDyn spells one: sign, digits, point, exponent e/E/d/D. +_REAL = re.compile(r"[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]?\d+)?") +_INTEGER = re.compile(r"[+-]?\d+") +_NOT_FINITE = ("inf", "infinity", "nan") +#: Tokens: a quoted text (it may hold spaces) or a run of non-space characters. +_TOKEN = re.compile(r"\"[^\"]*\"|'[^']*'|\S+") + + +def _unquote(token: str) -> str: + if len(token) >= 2 and token[0] == token[-1] and token[0] in "\"'": + return token[1:-1] + return token.replace('"', "").replace("'", "") + + +def _numeric_shape(token: str) -> bool: + """CableDyn's test of a number token (the header rows have none).""" + word = token[1:] if token[:1] in "+-" else token + return bool(_REAL.fullmatch(token)) or word.casefold() in _NOT_FINITE + + def _float(token: str, what: str, path: Path) -> float: - try: - value = float(token) - except ValueError: - raise CableSchemaError( - f"{path.name}: {what} is not numeric: {token!r}" - ) from None + if not _REAL.fullmatch(token): + word = token[1:] if token[:1] in "+-" else token + if word.casefold() in _NOT_FINITE: + raise CableSchemaError(f"{path.name}: {what} is not finite: {token!r}") + raise CableSchemaError(f"{path.name}: {what} is not numeric: {token!r}") + value = float(token.replace("d", "e").replace("D", "e")) if not math.isfinite(value): raise CableSchemaError(f"{path.name}: {what} is not finite: {token!r}") return value +def _int(token: str, what: str, path: Path) -> int: + if not _INTEGER.fullmatch(token): + raise CableSchemaError(f"{path.name}: {what} is not an integer: {token!r}") + return int(token) + + +def _bars(token: str, what: str, path: Path, most: int) -> list[float]: + """The ``|``-separated numbers of one column (at most ``most`` of them).""" + parts = token.split("|") + if len(parts) > most: + raise CableSchemaError( + f"{path.name}: {what} {token!r} has {len(parts)} '|'-separated parts, " + f"at most {most}" + ) + return [_float(part, what, path) for part in parts] + + +def _ei_column(token: str, name: str, path: Path) -> tuple[float, float, float]: + """``EI``, bending damping ``Bb`` and mass-proportional ``alpha`` of the + ``EI`` column: ``EI``, ``EI|Bb``, ``EI|-zeta|f`` or ``EI|-zeta|f1|f2`` + (CableDyn ``doc/driver_format.md``, LINE TYPES).""" + what = f"LINE TYPES EI column of {name}" + parts = _bars(token, what, path, 4) + ei, bb, alpha = parts[0], 0.0, 0.0 + if ei < 0.0: + raise CableSchemaError(f"{path.name}: {what} {token!r}: EI must be >= 0") + if len(parts) == 2: + if parts[1] < 0.0: + raise CableSchemaError( + f"{path.name}: {what} {token!r}: a negative bending damping is -zeta " + "and needs the frequency it holds at, EI|-zeta|f" + ) + bb = parts[1] + elif len(parts) >= 3: + zeta, frequencies = -parts[1], parts[2:] + if not 0.0 < zeta < 1.0 or min(frequencies) <= 0.0: + raise CableSchemaError( + f"{path.name}: {what} {token!r}: EI|-zeta|f[|f2] takes a damping ratio " + "0 < zeta < 1, written negative, and positive frequencies [Hz]" + ) + if len(parts) == 3: + bb = zeta * ei / (math.pi * frequencies[0]) + else: + f1, f2 = frequencies + bb = zeta * ei / (math.pi * (f1 + f2)) + alpha = 4.0 * math.pi * zeta * f1 * f2 / (f1 + f2) + if (len(parts) >= 3 or bb > 0.0) and not ei > 0.0: + raise CableSchemaError( + f"{path.name}: LINE TYPES {name}: bending damping (EI|Bb) needs a " + "finite-EI cable (EI > 0)" + ) + return ei, bb, alpha + + +def _plain_ea(token: str, path: Path, name: str) -> float | None: + """The ``EA`` of a linear-elastic type; ``None`` for the viscoelastic + (``Es|Ed``, ``Es|alphaMBL|vbeta``) and Syrope (``SYROPE:file|a|b``) forms.""" + if "|" in token or token.casefold().startswith("syrope:"): + return None + return _float(token, f"EA of {name}", path) + + +def _data_rows(rows: list[list[str]]) -> list[list[str]]: + """Rows of a table section with a number token: CableDyn skips the others + (column-name and units rows), wherever they stand.""" + return [row for row in rows if any(_numeric_shape(token) for token in row)] + + +def _end_token(token: str, path: Path, line_id: int) -> str: + end = token.casefold() + if end in ("a", "enda", "end_a"): + return "a" + if end in ("b", "endb", "end_b"): + return "b" + raise CableSchemaError( + f"{path.name}: END CONNECTIONS End of line {line_id} must be A or B: {token!r}" + ) + + +def _torsion_restrained(token: str, path: Path, line_id: int) -> bool: + """``TorsStiffness``: Free/Zero/0 (none), Rigid/Infinity/Inf or a stiffness.""" + word = token.casefold() + if word in ("free", "zero", "none", "-"): + return False + if word in ("rigid", "infinity", "inf"): + return True + value = _float(token, f"END CONNECTIONS TorsStiffness of line {line_id}", path) + if value < 0.0: + raise CableSchemaError( + f"{path.name}: END CONNECTIONS TorsStiffness of line {line_id} must be " + f"Free, Rigid or a stiffness >= 0: {token!r}" + ) + return value > 0.0 + + +#: Token counts of a LINE TYPES row: 10 or 14 columns, either followed by the +#: VIV columns Cl or Cl dF cF. +_LINE_TYPE_COLUMNS = (10, 11, 13, 14, 15, 17) + + +def _line_type(row: list[str], path: Path) -> CableDynLineType: + """One LINE TYPES row by position, as CableDyn reads it: + ``Name Diam MassDenInAir EA BA/-zeta EI [GAs GJ Irt Irn] Cd_n Cd_t Ca_n Ca_t + [Cl [dF cF]]``.""" + name = row[0] + if len(row) not in _LINE_TYPE_COLUMNS: + raise CableSchemaError( + f"{path.name}: LINE TYPES row {name!r} has {len(row)} columns; CableDyn " + "reads 10 (Name Diam MassDenInAir EA BA/-zeta EI Cd_n Cd_t Ca_n Ca_t) " + "or 14 (Name Diam MassDenInAir EA BA/-zeta EI GAs GJ Irt Irn Cd_n Cd_t " + "Ca_n Ca_t), either followed by Cl [dF cF] (11, 13, 15 or 17)" + ) + # The plain numeric columns, named by position (BA may hold Bs|Bd). + finite_ei_row = len(row) >= 14 + names = (["GAs", "GJ", "Irt", "Irn"] if finite_ei_row else []) + [ + "Cd_n", + "Cd_t", + "Ca_n", + "Ca_t", + "Cl", + "dF", + "cF", + ] + for column, label in zip(row[6:], names, strict=False): + if label not in ("GJ", "Irn"): + _float(column, f"{label} of {name}", path) + ea = _plain_ea(row[3], path, name) + ei, bb, alpha = _ei_column(row[5], name, path) + gj: float | None = None + coupling = torsional_damping = 0.0 + polar_inertia: float | None = None + gj_token: str | None = None + if finite_ei_row: + gj_token = row[7] + what = f"LINE TYPES GJ column of {name}" + parts = _bars(gj_token, what, path, 3) + gj = parts[0] + coupling = parts[1] if len(parts) > 1 else 0.0 + torsional_damping = parts[2] if len(parts) > 2 else 0.0 + polar_inertia = _float(row[9], f"Irn of {name}", path) + if coupling != 0.0 and not ( + ei > 0.0 and ea is not None and gj > 0.0 and ea * gj > coupling**2 + ): + raise CableSchemaError( + f"{path.name}: LINE TYPES {name}: torque-tension coupling (GJ|K) " + "needs a finite-EI, linear-elastic cable with GJ > 0 and K^2 < EA GJ" + ) + if torsional_damping != 0.0 and not ( + ei > 0.0 and gj > 0.0 and polar_inertia > 0.0 + ): + raise CableSchemaError( + f"{path.name}: LINE TYPES {name}: torsional damping (GJ|K|Bt) needs a " + "finite-EI cable with GJ > 0 and Irn > 0" + ) + return CableDynLineType( + name=name, + diameter_m=_float(row[1], f"Diam of {name}", path), + mass_kg_m=_float(row[2], f"mass of {name}", path), + ea_N=ea, + ei_Nm2=ei, + gj_Nm2=gj, + bending_damping_Nm2s=bb, + mass_damping_1_s=alpha, + torque_tension_coupling_Nm=coupling, + torsional_damping=torsional_damping, + polar_inertia_kg_m=polar_inertia, + ei_token=row[5], + gj_token=gj_token, + ) + + def _deck_blocks(path: Path) -> dict[str, list[list[str]]]: """Split a deck into recognised sections of token rows (comments removed).""" blocks: dict[str, list[list[str]]] = {} @@ -385,27 +607,27 @@ def _deck_blocks(path: Path) -> dict[str, list[list[str]]]: continue text = _strip_comment(line) if text: - blocks[current].append(text.replace('"', " ").replace("'", " ").split()) + # A quoted token counts once, spaces and all, as in CableDyn; + # stray quotes elsewhere are dropped. + blocks[current].append([_unquote(token) for token in _TOKEN.findall(text)]) return blocks -def _table( - rows: list[list[str]], path: Path, section: str -) -> tuple[list[str], list[list[str]]]: - """Header names (case-folded) and data rows; the units row is dropped.""" - if not rows: - raise CableSchemaError(f"{path.name}: deck section {section} is empty") - header = [name.casefold() for name in rows[0]] - data = [row for row in rows[1:] if not row[0].startswith("(")] - return header, data - - def read_cabledyn_deck(path: str | Path) -> CableDynDeck: """Read line types, lines, sections, end connections, options and outputs. + The tables are read by position, as CableDyn reads them: a row without a + number token is a column-name or units row and is skipped, and the token + count selects the row form (LINE TYPES 10, 11, 13, 14, 15 or 17 columns; + POINTS 5 or 9; LINES 3, 4 or the stock 7; SECTIONS 4; END CONNECTIONS 6, + 10 or 11). The ``EI`` column may carry bending damping (``EI|Bb``, + ``EI|-zeta|f``, ``EI|-zeta|f1|f2``) and the ``GJ`` column of a 14-column + row torque-tension coupling and torsional damping (``GJ|K``, + ``GJ|K|Bt``); :class:`CableDynLineType` keeps them. + Applies CableDyn's anchor-first swap (a line whose ``NodeA`` is ``Fixed`` and - whose ``NodeB`` moves is reversed, with its sections), so node 1 is End A - as in every output file. + whose ``NodeB`` moves is reversed, with its sections and end connections), + so node 1 is End A as in every output file. """ deck_path = Path(path) if not deck_path.is_file(): @@ -415,90 +637,89 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: if required not in blocks: raise CableSchemaError(f"{deck_path.name}: no {required.upper()} section") - header, rows = _table(blocks["line types"], deck_path, "LINE TYPES") - for column in ("typename", "diam", "massdeninair", "ea", "ei"): - if column not in header: + line_types: dict[str, CableDynLineType] = {} + for row in _data_rows(blocks["line types"]): + line_type = _line_type(row, deck_path) + key = line_type.name.casefold() + if key in line_types: raise CableSchemaError( - f"{deck_path.name}: LINE TYPES lacks column {column!r}; found {header}" + f"{deck_path.name}: LINE TYPES defines {line_type.name!r} twice" ) - line_types: dict[str, CableDynLineType] = {} - for row in rows: - values = dict(zip(header, row, strict=False)) - try: - ea: float | None = float(values["ea"]) - except ValueError: - ea = None # viscoelastic or Syrope constitutive token - gj_token = values.get("gj") - name = values["typename"] - line_types[name.casefold()] = CableDynLineType( - name=name, - diameter_m=_float(values["diam"], f"Diam of {name}", deck_path), - mass_kg_m=_float(values["massdeninair"], f"mass of {name}", deck_path), - ea_N=ea, - ei_Nm2=_float(values["ei"], f"EI of {name}", deck_path), - gj_Nm2=None if gj_token is None else _float(gj_token, "GJ", deck_path), - ) + line_types[key] = line_type + if not line_types: + raise CableSchemaError(f"{deck_path.name}: LINE TYPES has no data rows") point_types: dict[str, str] = {} - if "points" in blocks: - p_header, p_rows = _table(blocks["points"], deck_path, "POINTS") - if "id" not in p_header or not ({"type", "attachment"} & set(p_header)): - raise CableSchemaError(f"{deck_path.name}: POINTS needs ID and Type") - type_column = "type" if "type" in p_header else "attachment" - for row in p_rows: - values = dict(zip(p_header, row, strict=False)) - point_types[values["id"]] = values[type_column].casefold() - - l_header, l_rows = _table(blocks["lines"], deck_path, "LINES") - seven_column = "linetype" in l_header + point_rows = _data_rows(blocks.get("points", [])) + if "points" in blocks and not point_rows: + raise CableSchemaError(f"{deck_path.name}: POINTS has no data rows") + for row in point_rows: + if len(row) not in (5, 9): + raise CableSchemaError( + f"{deck_path.name}: POINTS row {row[0]!r} has {len(row)} columns; " + "CableDyn reads 5 (ID Type X Y Z) or 9 (ID Type X Y Z Mass Vol CdA Ca)" + ) + point_types[row[0]] = row[1].casefold() + sections_by_line: dict[int, list[CableDynSection]] = {} - if "sections" in blocks: - s_header, s_rows = _table(blocks["sections"], deck_path, "SECTIONS") - for column in ("lineid", "linetype", "length", "numsegs"): - if column not in s_header: - raise CableSchemaError(f"{deck_path.name}: SECTIONS lacks {column!r}") - for row in s_rows: - values = dict(zip(s_header, row, strict=False)) - sections_by_line.setdefault(int(values["lineid"]), []).append( - CableDynSection( - line_type=values["linetype"], - length_m=_float(values["length"], "section Length", deck_path), - n_segments=int(values["numsegs"]), - ) + for row in _data_rows(blocks.get("sections", [])): + if len(row) != 4: + raise CableSchemaError( + f"{deck_path.name}: SECTIONS row has {len(row)} columns; CableDyn " + "reads 4 (LineID LineType Length NumSegs)" + ) + sections_by_line.setdefault( + _int(row[0], "SECTIONS LineID", deck_path), [] + ).append( + CableDynSection( + line_type=row[1], + length_m=_float(row[2], "section Length", deck_path), + n_segments=_int(row[3], "section NumSegs", deck_path), ) - torsion_ends: dict[int, set[str]] = {} - if "end connections" in blocks: - e_header, e_rows = _table( - blocks["end connections"], deck_path, "END CONNECTIONS" ) - if "torsstiffness" in e_header: - for row in e_rows: - values = dict(zip(e_header, row, strict=False)) - token = values.get("torsstiffness", "none").casefold() - if token not in ("none", "-", "0", "0.0"): - torsion_ends.setdefault(int(values["lineid"]), set()).add( - values["end"].casefold() - ) + torsion_ends: dict[int, set[str]] = {} + for row in _data_rows(blocks.get("end connections", [])): + if len(row) not in (6, 10, 11): + raise CableSchemaError( + f"{deck_path.name}: END CONNECTIONS row has {len(row)} columns; " + "CableDyn reads 6 (LineID End Stiffness EzX EzY EzZ), or 10 or 11 " + "with the torsion columns (... TorsStiffness NxX NxY NxZ [Pretwist])" + ) + line_id = _int(row[0], "END CONNECTIONS LineID", deck_path) + end = _end_token(row[1], deck_path, line_id) + if len(row) >= 10 and _torsion_restrained(row[6], deck_path, line_id): + torsion_ends.setdefault(line_id, set()).add(end) lines: dict[int, CableDynLine] = {} - for row in l_rows: - values = dict(zip(l_header, row, strict=False)) - line_id = int(values["id"]) - if seven_column: - end_a, end_b = values.get("attacha", ""), values.get("attachb", "") + for row in _data_rows(blocks["lines"]): + line_id = _int(row[0], "LINES ID", deck_path) + if line_id in lines: + raise CableSchemaError( + f"{deck_path.name}: LINES lists line {line_id} twice" + ) + if len(row) == 7: + # Stock form: ID LineType AttachA AttachB UnstrLen NumSegs Outputs. + end_a, end_b, outputs = row[2], row[3], row[6] sections = [ CableDynSection( - line_type=values["linetype"], - length_m=_float(values["unstrlen"], "UnstrLen", deck_path), - n_segments=int(values["numsegs"]), + line_type=row[1], + length_m=_float(row[4], "UnstrLen", deck_path), + n_segments=_int(row[5], "NumSegs", deck_path), ) ] if line_id in sections_by_line: raise CableSchemaError( f"{deck_path.name}: line {line_id} has a 7-column row and SECTIONS" ) - else: - end_a, end_b = values.get("nodea", ""), values.get("nodeb", "") + elif len(row) in (3, 4): + end_a, end_b = row[1], row[2] + outputs = row[3] if len(row) == 4 else "-" sections = sections_by_line.get(line_id, []) + else: + raise CableSchemaError( + f"{deck_path.name}: LINES row of line {line_id} has {len(row)} " + "columns; CableDyn reads 3 (ID NodeA NodeB), 4 (+Outputs) or the " + "stock 7 (ID LineType AttachA AttachB UnstrLen NumSegs Outputs)" + ) if not sections: raise CableSchemaError(f"{deck_path.name}: line {line_id} has no sections") for sec in sections: @@ -511,24 +732,31 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: raise CableSchemaError( f"{deck_path.name}: invalid section of {line_id}" ) + finite_ei = any( + line_types[sec.line_type.casefold()].ei_Nm2 > 0.0 for sec in sections + ) type_a = point_types.get(end_a, "") type_b = point_types.get(end_b, "") swap = type_a == "fixed" and ( type_b in _MOVING_POINTS or type_b.startswith("body") or type_b.startswith("turbine") + or (finite_ei and re.fullmatch(r"r\d+[ab]", end_b.casefold()) is not None) ) + ends = torsion_ends.get(line_id, set()) if swap: end_a, end_b = end_b, end_a sections = sections[::-1] + ends = {"b" if end == "a" else "a" for end in ends} lines[line_id] = CableDynLine( line_id=line_id, end_a=end_a, end_b=end_b, - outputs=values.get("outputs", "-"), + outputs=outputs, sections=tuple(sections), - torsion_restrained=torsion_ends.get(line_id, set()) >= {"a", "b"}, + torsion_restrained=ends >= {"a", "b"}, reversed_by_parser=swap, + torsion_restrained_ends=frozenset(ends), ) records = [ @@ -540,9 +768,15 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: options: dict[str, str] = {} for key, value in records: options[key] = value + # A row whose first token is END closes the channel list (stock decks). + output_rows = blocks.get("outputs", []) + stop = next( + (i for i, row in enumerate(output_rows) if row[0].casefold() == "end"), + len(output_rows), + ) channels = tuple( token - for row in blocks.get("outputs", []) + for row in output_rows[:stop] for token in " ".join(row).replace(",", " ").split() ) defaults = [] @@ -1676,6 +1910,24 @@ def has_position(node: int) -> bool: f"line {line_id} is restrained in torsion; the material frame needs " f"Twist{line_id}N channels at the nodes bracketing every section" ) + coupled = sorted( + { + sec.line_type + for sec in line.sections + if deck_obj.line_type(sec.line_type).torque_tension_coupling_Nm != 0.0 + } + ) + if coupled and line.torsion_restrained_ends and not twist_available: + # Solved in torsion, a coupled line twists as it stretches + # (Twist = -sum (K/GJ)(l - L) with one end free): the twist-free + # frame would miss it. + raise CableSchemaError( + f"line {line_id} couples torque and tension (GJ|K of {', '.join(coupled)}) " + "and is restrained in torsion at End " + f"{' and '.join(sorted(line.torsion_restrained_ends)).upper()}: its " + "material twist follows the stretch, so the material frame needs " + f"Twist{line_id}N channels at the nodes bracketing every section" + ) # Main-table column plan. main_cols: list[int] = [0] @@ -2218,8 +2470,8 @@ def section_channels( For every section: ``LNDec``/``Azi`` on the spline window, ``TenN`` and (``positions``) ``LNp{x,y,z}`` at the two bracketing nodes, ``CurvN`` there for the consistency check, and - ``Twist``/``Torq`` on a line restrained in torsion. With these channels - alone use ``frame="section"``; the default ``frame="arc"`` also needs the + ``Twist``/``Torq`` on a line restrained in torsion at either end. With these + channels alone use ``frame="section"``; the default ``frame="arc"`` also needs the ``p`` flag of the line (node positions from End A to the section). """ deck_obj = deck if isinstance(deck, CableDynDeck) else read_cabledyn_deck(deck) @@ -2245,7 +2497,7 @@ def add(name: str) -> None: if positions: for axis in "xyz": add(f"L{line_id}N{node}p{axis}") - if line.torsion_restrained: + if line.torsion_restrained_ends: add(f"Twist{line_id}N{node}") add(f"Torq{line_id}N{node}") return tuple(names) diff --git a/tests/data/cabledyn/lw24g.Line1.p.out b/tests/data/cabledyn/lw24g.Line1.p.out new file mode 100644 index 0000000..5dd71a8 --- /dev/null +++ b/tests/data/cabledyn/lw24g.Line1.p.out @@ -0,0 +1,13 @@ +# CableDyn finite-EI Hermite line node positions; public node order EndA -> EndB +Time(s) Node1X(m) Node1Y(m) Node1Z(m) Node2X(m) Node2Y(m) Node2Z(m) Node3X(m) Node3Y(m) Node3Z(m) Node4X(m) Node4Y(m) Node4Z(m) Node5X(m) Node5Y(m) Node5Z(m) Node6X(m) Node6Y(m) Node6Z(m) Node7X(m) Node7Y(m) Node7Z(m) Node8X(m) Node8Y(m) Node8Z(m) Node9X(m) Node9Y(m) Node9Z(m) Node10X(m) Node10Y(m) Node10Z(m) Node11X(m) Node11Y(m) Node11Z(m) Node12X(m) Node12Y(m) Node12Z(m) Node13X(m) Node13Y(m) Node13Z(m) Node14X(m) Node14Y(m) Node14Z(m) Node15X(m) Node15Y(m) Node15Z(m) Node16X(m) Node16Y(m) Node16Z(m) Node17X(m) Node17Y(m) Node17Z(m) Node18X(m) Node18Y(m) Node18Z(m) Node19X(m) Node19Y(m) Node19Z(m) Node20X(m) Node20Y(m) Node20Z(m) Node21X(m) Node21Y(m) Node21Z(m) Node22X(m) Node22Y(m) Node22Z(m) Node23X(m) Node23Y(m) Node23Z(m) Node24X(m) Node24Y(m) Node24Z(m) Node25X(m) Node25Y(m) Node25Z(m) + 0.0000000000000000E+000 5.0000000E+000 0.0000000E+000 -1.4000000E+001 6.0332233E+000 0.0000000E+000 -2.0732647E+001 7.2017371E+000 0.0000000E+000 -2.7443020E+001 8.5572193E+000 0.0000000E+000 -3.4117984E+001 1.0170676E+001 0.0000000E+000 -4.0735010E+001 1.2160994E+001 0.0000000E+000 -4.7247777E+001 1.4754038E+001 0.0000000E+000 -5.3542003E+001 1.8423744E+001 0.0000000E+000 -5.9260903E+001 2.3861953E+001 0.0000000E+000 -6.3247033E+001 3.0543006E+001 0.0000000E+000 -6.3628066E+001 3.6500256E+001 0.0000000E+000 -6.0439522E+001 4.1386772E+001 0.0000000E+000 -5.6545485E+001 4.6873034E+001 0.0000000E+000 -5.3591906E+001 5.2984510E+001 0.0000000E+000 -5.2436533E+001 5.9126679E+001 0.0000000E+000 -5.3410896E+001 6.4665044E+001 0.0000000E+000 -5.6260154E+001 6.9332437E+001 0.0000000E+000 -6.0399396E+001 7.3197310E+001 0.0000000E+000 -6.5304238E+001 7.6534525E+001 0.0000000E+000 -7.0587646E+001 8.2242452E+001 0.0000000E+000 -7.7064410E+001 9.0268299E+001 0.0000000E+000 -8.0004660E+001 9.8950371E+001 0.0000000E+000 -8.0012880E+001 1.0763331E+002 0.0000000E+000 -8.0008610E+001 1.1631657E+002 0.0000000E+000 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 1.0000000000000001E-001 5.0002477E+000 1.4462026E-004 -1.3999930E+001 6.0331812E+000 -2.0552893E-005 -2.0732622E+001 7.2017298E+000 -3.7134644E-006 -2.7442989E+001 8.5572153E+000 -1.1172236E-006 -3.4117953E+001 1.0170672E+001 -4.9513629E-007 -4.0734979E+001 1.2160990E+001 -1.8676837E-007 -4.7247746E+001 1.4754034E+001 4.5500629E-008 -5.3541972E+001 1.8423739E+001 2.6097016E-007 -5.9260873E+001 2.3861944E+001 4.9298906E-007 -6.3247010E+001 3.0542996E+001 7.7296361E-007 -6.3628055E+001 3.6500253E+001 1.3691288E-006 -6.0439524E+001 4.1386773E+001 1.8980612E-006 -5.6545491E+001 4.6873035E+001 2.2610467E-006 -5.3591911E+001 5.2984511E+001 2.5112752E-006 -5.2436537E+001 5.9126680E+001 2.6084299E-006 -5.3410897E+001 6.4665046E+001 2.5583416E-006 -5.6260153E+001 6.9332440E+001 2.4129503E-006 -6.0399395E+001 7.3197313E+001 2.2246244E-006 -6.5304237E+001 7.6534527E+001 1.8087030E-006 -7.0587644E+001 8.2242453E+001 1.2920521E-006 -7.7064410E+001 9.0268299E+001 1.0963218E-006 -8.0004660E+001 9.8950371E+001 8.7891935E-007 -8.0012880E+001 1.0763331E+002 5.8710918E-007 -8.0008610E+001 1.1631657E+002 2.4739181E-007 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 2.0000000000000001E-001 5.0009469E+000 5.5229668E-004 -1.3999688E+001 6.0330806E+000 -6.8083298E-005 -2.0732502E+001 7.2017168E+000 -8.8440581E-006 -2.7442855E+001 8.5571970E+000 -4.3949284E-006 -3.4117820E+001 1.0170653E+001 -2.6987109E-006 -4.0734847E+001 1.2160972E+001 -1.2957530E-006 -4.7247614E+001 1.4754017E+001 -1.0166078E-007 -5.3541840E+001 1.8423718E+001 1.0083714E-006 -5.9260743E+001 2.3861905E+001 2.1756601E-006 -6.3246908E+001 3.0542954E+001 3.5628796E-006 -6.3628007E+001 3.6500241E+001 6.4880547E-006 -6.0439530E+001 4.1386776E+001 9.0785662E-006 -5.6545516E+001 4.6873037E+001 1.0909455E-005 -5.3591935E+001 5.2984512E+001 1.2200710E-005 -5.2436552E+001 5.9126683E+001 1.2742885E-005 -5.3410901E+001 6.4665052E+001 1.2553558E-005 -5.6260151E+001 6.9332449E+001 1.1889222E-005 -6.0399389E+001 7.3197323E+001 1.1014809E-005 -6.5304230E+001 7.6534536E+001 8.9595535E-006 -7.0587639E+001 8.2242453E+001 6.4409535E-006 -7.7064411E+001 9.0268299E+001 5.5162130E-006 -8.0004661E+001 9.8950371E+001 4.5311850E-006 -8.0012880E+001 1.0763331E+002 3.1239183E-006 -8.0008610E+001 1.1631657E+002 1.4593367E-006 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 3.0000000000000004E-001 5.0020189E+000 1.1764812E-003 -1.3999231E+001 6.0329798E+000 -1.1295993E-004 -2.0732225E+001 7.2016869E+000 -1.4854286E-005 -2.7442565E+001 8.5571427E+000 -1.4726119E-005 -3.4117535E+001 1.0170608E+001 -9.7071396E-006 -4.0734559E+001 1.2160934E+001 -5.0682289E-006 -4.7247324E+001 1.4753980E+001 -1.3289758E-006 -5.3541550E+001 1.8423672E+001 2.0100622E-006 -5.9260459E+001 2.3861819E+001 5.4142349E-006 -6.3246686E+001 3.0542861E+001 9.3411951E-006 -6.3627901E+001 3.6500213E+001 1.7585541E-005 -6.0439544E+001 4.1386785E+001 2.4885284E-005 -5.6545575E+001 4.6873043E+001 3.0192435E-005 -5.3591987E+001 5.2984515E+001 3.4034267E-005 -5.2436588E+001 5.9126690E+001 3.5769591E-005 -5.3410913E+001 6.4665068E+001 3.5412569E-005 -5.6260146E+001 6.9332471E+001 3.3690237E-005 -6.0399376E+001 7.3197349E+001 3.1392469E-005 -6.5304214E+001 7.6534555E+001 2.5554782E-005 -7.0587627E+001 8.2242454E+001 1.8474949E-005 -7.7064415E+001 9.0268299E+001 1.5991005E-005 -8.0004662E+001 9.8950371E+001 1.3479152E-005 -8.0012880E+001 1.0763331E+002 9.5690420E-006 -8.0008610E+001 1.1631657E+002 4.8894735E-006 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 4.0000000000000002E-001 5.0033701E+000 1.9617121E-003 -1.3998523E+001 6.0329777E+000 -1.0169125E-004 -2.0731726E+001 7.2015830E+000 -4.0544275E-005 -2.7442080E+001 8.5570324E+000 -4.2038039E-005 -3.4117052E+001 1.0170533E+001 -2.5797027E-005 -4.0734068E+001 1.2160862E+001 -1.3971177E-005 -4.7246833E+001 1.4753912E+001 -5.1685938E-006 -5.3541056E+001 1.8423590E+001 2.4701992E-006 -5.9259976E+001 2.3861669E+001 1.0088725E-005 -6.3246306E+001 3.0542700E+001 1.8554943E-005 -6.3627724E+001 3.6500163E+001 3.6283459E-005 -6.0439570E+001 4.1386801E+001 5.2006935E-005 -5.6545679E+001 4.6873053E+001 6.3745924E-005 -5.3592082E+001 5.2984521E+001 7.2492808E-005 -5.2436653E+001 5.9126702E+001 7.6712272E-005 -5.3410937E+001 6.4665095E+001 7.6354172E-005 -5.6260139E+001 6.9332511E+001 7.2982870E-005 -6.0399354E+001 7.3197396E+001 6.8439959E-005 -6.5304186E+001 7.6534589E+001 5.5784589E-005 -7.0587608E+001 8.2242454E+001 4.0519076E-005 -7.7064423E+001 9.0268299E+001 3.5478201E-005 -8.0004665E+001 9.8950371E+001 3.0692472E-005 -8.0012879E+001 1.0763331E+002 2.2358525E-005 -8.0008610E+001 1.1631657E+002 1.2344873E-005 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 5.0000000000000000E-001 5.0048933E+000 2.8447922E-003 -1.3997536E+001 6.0331541E+000 1.6633494E-005 -2.0730946E+001 7.2013290E+000 -1.2244664E-004 -2.7441371E+001 8.5568702E+000 -9.3358019E-005 -3.4116325E+001 1.0170415E+001 -5.4400607E-005 -4.0733331E+001 1.2160742E+001 -3.0985078E-005 -4.7246095E+001 1.4753809E+001 -1.3826031E-005 -5.3540313E+001 1.8423462E+001 9.8789835E-007 -5.9259250E+001 2.3861441E+001 1.5554304E-005 -6.3245732E+001 3.0542456E+001 3.1141841E-005 -6.3627459E+001 3.6500087E+001 6.3522799E-005 -6.0439613E+001 4.1386822E+001 9.2328576E-005 -5.6545842E+001 4.6873069E+001 1.1440382E-004 -5.3592232E+001 5.2984528E+001 1.3136653E-004 -5.2436758E+001 5.9126720E+001 1.4003980E-004 -5.3410976E+001 6.4665138E+001 1.4018633E-004 -5.6260130E+001 6.9332574E+001 1.3463788E-004 -6.0399322E+001 7.3197471E+001 1.2710117E-004 -6.5304145E+001 7.6534640E+001 1.0379741E-004 -7.0587580E+001 8.2242452E+001 7.5695722E-005 -7.7064438E+001 9.0268299E+001 6.7056497E-005 -8.0004668E+001 9.8950371E+001 5.9506575E-005 -8.0012878E+001 1.0763331E+002 4.4318322E-005 -8.0008610E+001 1.1631657E+002 2.6190440E-005 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 6.0000000000000009E-001 5.0064707E+000 3.7561987E-003 -1.3996250E+001 6.0335333E+000 2.6427756E-004 -2.0729845E+001 7.2008881E+000 -2.9147126E-004 -2.7440407E+001 8.5566670E+000 -1.6743711E-004 -3.4115316E+001 1.0170225E+001 -9.9892946E-005 -4.0732317E+001 1.2160568E+001 -6.0537506E-005 -4.7245077E+001 1.4753660E+001 -3.0364354E-005 -5.3539284E+001 1.8423279E+001 -4.4612355E-006 -5.9258247E+001 2.3861121E+001 2.0602378E-005 -6.3244937E+001 3.0542114E+001 4.6586624E-005 -6.3627094E+001 3.6499977E+001 9.9548288E-005 -6.0439679E+001 4.1386848E+001 1.4685418E-004 -5.6546074E+001 4.6873089E+001 1.8411634E-004 -5.3592451E+001 5.2984538E+001 2.1365897E-004 -5.2436911E+001 5.9126744E+001 2.2955630E-004 -5.3411039E+001 6.4665197E+001 2.3119915E-004 -5.6260121E+001 6.9332664E+001 2.2311972E-004 -6.0399279E+001 7.3197580E+001 2.1202825E-004 -6.5304086E+001 7.6534711E+001 1.7360447E-004 -7.0587544E+001 8.2242448E+001 1.2709513E-004 -7.7064462E+001 9.0268299E+001 1.1379971E-004 -8.0004671E+001 9.8950371E+001 1.0354157E-004 -8.0012876E+001 1.0763331E+002 7.8554168E-005 -8.0008610E+001 1.1631657E+002 4.9329098E-005 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 7.0000000000000007E-001 5.0079761E+000 4.6216999E-003 -1.3994657E+001 6.0340837E+000 6.2696995E-004 -2.0728399E+001 7.2002896E+000 -5.4862471E-004 -2.7439157E+001 8.5563980E+000 -2.6375630E-004 -3.4113999E+001 1.0169930E+001 -1.7213228E-004 -4.0731006E+001 1.2160343E+001 -1.0874183E-004 -4.7243746E+001 1.4753451E+001 -5.8381060E-005 -5.3537946E+001 1.8423032E+001 -1.6352655E-005 -5.9256937E+001 2.3860694E+001 2.3481188E-005 -6.3243899E+001 3.0541662E+001 6.3940039E-005 -6.3626623E+001 3.6499826E+001 1.4386910E-004 -6.0439773E+001 4.1386877E+001 2.1564971E-004 -5.6546386E+001 4.6873113E+001 2.7391007E-004 -5.3592751E+001 5.2984547E+001 3.2152235E-004 -5.2437125E+001 5.9126774E+001 3.4831657E-004 -5.3411130E+001 6.4665276E+001 3.5307811E-004 -5.6260116E+001 6.9332784E+001 3.4241004E-004 -6.0399224E+001 7.3197728E+001 3.2744322E-004 -6.5304010E+001 7.6534805E+001 2.6898545E-004 -7.0587501E+001 8.2242439E+001 1.9777154E-004 -7.7064497E+001 9.0268298E+001 1.7861258E-004 -8.0004675E+001 9.8950371E+001 1.6667387E-004 -8.0012874E+001 1.0763331E+002 1.2833104E-004 -8.0008611E+001 1.1631657E+002 8.5149127E-005 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 8.0000000000000004E-001 5.0092781E+000 5.3641441E-003 -1.3992758E+001 6.0347363E+000 1.0643327E-003 -2.0726601E+001 7.1996064E+000 -8.6154086E-004 -2.7437589E+001 8.5559909E+000 -3.9907113E-004 -3.4112372E+001 1.0169533E+001 -2.8543499E-004 -4.0729377E+001 1.2160055E+001 -1.8108983E-004 -4.7242085E+001 1.4753173E+001 -1.0135204E-004 -5.3536280E+001 1.8422714E+001 -3.7483433E-005 -5.9255303E+001 2.3860150E+001 2.1914410E-005 -6.3242602E+001 3.0541088E+001 8.1792031E-005 -6.3626041E+001 3.6499629E+001 1.9520366E-004 -6.0439899E+001 4.1386904E+001 2.9780825E-004 -5.6546786E+001 4.6873139E+001 3.8386130E-004 -5.3593143E+001 5.2984555E+001 4.5619296E-004 -5.2437408E+001 5.9126807E+001 4.9854174E-004 -5.3411257E+001 6.4665373E+001 5.0881030E-004 -5.6260115E+001 6.9332937E+001 4.9594084E-004 -6.0399159E+001 7.3197920E+001 4.7701901E-004 -6.5303914E+001 7.6534920E+001 3.9339407E-004 -7.0587452E+001 8.2242424E+001 2.9072512E-004 -7.7064548E+001 9.0268298E+001 2.6403651E-004 -8.0004680E+001 9.8950371E+001 2.5312621E-004 -8.0012872E+001 1.0763331E+002 1.9695453E-004 -8.0008612E+001 1.1631657E+002 1.3743836E-004 -8.0010299E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 9.0000000000000002E-001 5.0102434E+000 5.9053753E-003 -1.3990566E+001 6.0353999E+000 1.5230223E-003 -2.0724455E+001 7.1989155E+000 -1.1832909E-003 -2.7435678E+001 8.5553607E+000 -6.1202469E-004 -3.4110444E+001 1.0169067E+001 -4.4937796E-004 -4.0727413E+001 1.2159667E+001 -2.8055356E-004 -4.7240095E+001 1.4752830E+001 -1.6307626E-004 -5.3534272E+001 1.8422312E+001 -7.1221243E-005 -5.9253339E+001 2.3859482E+001 1.3073723E-005 -6.3241036E+001 3.0540386E+001 9.8277297E-005 -6.3625350E+001 3.6499377E+001 2.5147273E-004 -6.0440061E+001 4.1386925E+001 3.9144706E-004 -5.6547282E+001 4.6873165E+001 5.1307032E-004 -5.3593639E+001 5.2984558E+001 6.1792252E-004 -5.2437770E+001 5.9126841E+001 6.8153937E-004 -5.3411428E+001 6.4665488E+001 7.0058421E-004 -5.6260125E+001 6.9333126E+001 6.8652424E-004 -6.0399084E+001 7.3198159E+001 6.6378142E-004 -6.5303799E+001 7.6535059E+001 5.4986498E-004 -7.0587398E+001 8.2242402E+001 4.0885449E-004 -7.7064615E+001 9.0268297E+001 3.7200480E-004 -8.0004685E+001 9.8950371E+001 3.6769897E-004 -8.0012870E+001 1.0763331E+002 2.8764253E-004 -8.0008613E+001 1.1631657E+002 2.1027115E-004 -8.0010298E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 + 1.0000000000000000E+000 5.0107401E+000 6.1682217E-003 -1.3988103E+001 6.0359728E+000 1.9423893E-003 -2.0721982E+001 7.1982699E+000 -1.4763889E-003 -2.7433416E+001 8.5544572E+000 -9.4689861E-004 -3.4108229E+001 1.0168544E+001 -6.6157587E-004 -4.0725108E+001 1.2159151E+001 -4.1064046E-004 -4.7237786E+001 1.4752427E+001 -2.4917765E-004 -5.3531919E+001 1.8421815E+001 -1.2163372E-004 -5.9251052E+001 2.3858687E+001 -6.2955014E-006 -6.3239201E+001 3.0539549E+001 1.1116493E-004 -6.3624555E+001 3.6499065E+001 3.0985137E-004 -6.0440262E+001 4.1386934E+001 4.9373108E-004 -5.6547879E+001 4.6873188E+001 6.5963724E-004 -5.3594247E+001 5.2984553E+001 8.0592060E-004 -5.2438221E+001 5.9126874E+001 8.9764673E-004 -5.3411650E+001 6.4665620E+001 9.2970137E-004 -5.6260149E+001 6.9333351E+001 9.1627820E-004 -6.0399001E+001 7.3198446E+001 8.9003088E-004 -6.5303666E+001 7.6535219E+001 7.4092943E-004 -7.0587343E+001 8.2242372E+001 5.5490336E-004 -7.7064701E+001 9.0268295E+001 5.0348496E-004 -8.0004690E+001 9.8950370E+001 5.1613899E-004 -8.0012868E+001 1.0763331E+002 4.0335230E-004 -8.0008614E+001 1.1631657E+002 3.0788122E-004 -8.0010298E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 diff --git a/tests/data/cabledyn/lw24g.Line1.t.out b/tests/data/cabledyn/lw24g.Line1.t.out new file mode 100644 index 0000000..ee10527 --- /dev/null +++ b/tests/data/cabledyn/lw24g.Line1.t.out @@ -0,0 +1,13 @@ +# CableDyn finite-EI Hermite segment tensions; public order EndA -> EndB +Time(s) Segment1Tension(N) Segment2Tension(N) Segment3Tension(N) Segment4Tension(N) Segment5Tension(N) Segment6Tension(N) Segment7Tension(N) Segment8Tension(N) Segment9Tension(N) Segment10Tension(N) Segment11Tension(N) Segment12Tension(N) Segment13Tension(N) Segment14Tension(N) Segment15Tension(N) Segment16Tension(N) Segment17Tension(N) Segment18Tension(N) Segment19Tension(N) Segment20Tension(N) Segment21Tension(N) Segment22Tension(N) Segment23Tension(N) Segment24Tension(N) + 0.0000000000000000E+000 8.7856536E+003 7.7249259E+003 6.6687321E+003 5.6197721E+003 4.5832045E+003 3.5704262E+003 2.6112944E+003 1.8042169E+003 1.4251237E+003 1.6940464E+003 1.8329203E+003 1.5449766E+003 1.3700049E+003 1.3620413E+003 1.5236178E+003 1.8133245E+003 2.1819729E+003 2.5945053E+003 2.2664628E+003 1.5163781E+003 1.3144438E+003 1.3208572E+003 1.3202350E+003 1.3201021E+003 + 1.0000000000000001E-001 8.8101211E+003 7.7456627E+003 6.6863697E+003 5.6345230E+003 4.5952227E+003 3.5798423E+003 2.6182669E+003 1.8090711E+003 1.4285737E+003 1.6968755E+003 1.8353842E+003 1.5469825E+003 1.3715216E+003 1.3630983E+003 1.5242682E+003 1.8136297E+003 2.1819976E+003 2.5942977E+003 2.2661083E+003 1.5159290E+003 1.3138610E+003 1.3201615E+003 1.3194629E+003 1.3192990E+003 + 2.0000000000000001E-001 8.8314975E+003 7.7647707E+003 6.7029295E+003 5.6485826E+003 4.6068164E+003 3.5890145E+003 2.6251226E+003 1.8139161E+003 1.4320435E+003 1.6996822E+003 1.8377844E+003 1.5489653E+003 1.3730870E+003 1.3642624E+003 1.5250680E+003 1.8141128E+003 2.1822092E+003 2.5942743E+003 2.2659176E+003 1.5156239E+003 1.3134524E+003 1.3196475E+003 1.3188630E+003 1.3186404E+003 + 3.0000000000000004E-001 8.8308018E+003 7.7635154E+003 6.7016423E+003 5.6473794E+003 4.6057804E+003 3.5882029E+003 2.6245774E+003 1.8136548E+003 1.4319441E+003 1.6995763E+003 1.8376668E+003 1.5488764E+003 1.3729623E+003 1.3640204E+003 1.5246645E+003 1.8135494E+003 2.1815165E+003 2.5934870E+003 2.2651001E+003 1.5147844E+003 1.3125236E+003 1.3186100E+003 1.3177287E+003 1.3174319E+003 + 4.0000000000000002E-001 8.8517280E+003 7.7819680E+003 6.7175197E+003 5.6607619E+003 4.6167468E+003 3.5968289E+003 2.6309804E+003 1.8180990E+003 1.4350458E+003 1.7020331E+003 1.8397577E+003 1.5505714E+003 1.3742576E+003 1.3649199E+003 1.5251834E+003 1.8137167E+003 2.1813746E+003 2.5930811E+003 2.2645068E+003 1.5140679E+003 1.3116901E+003 1.3176299E+003 1.3166159E+003 1.3162125E+003 + 5.0000000000000000E-001 8.8562313E+003 7.7860086E+003 6.7212224E+003 5.6640724E+003 4.6196219E+003 3.5992279E+003 2.6328945E+003 1.8195729E+003 1.4361573E+003 1.7028965E+003 1.8404950E+003 1.5512261E+003 1.3747772E+003 1.3652394E+003 1.5252560E+003 1.8135410E+003 2.1809732E+003 2.5924886E+003 2.2637864E+003 1.5132787E+003 1.3108214E+003 1.3166344E+003 1.3154924E+003 1.3149729E+003 + 6.0000000000000009E-001 8.8640674E+003 7.7927114E+003 6.7268281E+003 5.6686978E+003 4.6233515E+003 3.6021388E+003 2.6350629E+003 1.8211083E+003 1.4372018E+003 1.7036093E+003 1.8410291E+003 1.5516506E+003 1.3750496E+003 1.3653080E+003 1.5250727E+003 1.8130982E+003 2.1802960E+003 2.5916202E+003 2.2627968E+003 1.5122266E+003 1.3096696E+003 1.3153292E+003 1.3140326E+003 1.3133724E+003 + 7.0000000000000007E-001 8.8694039E+003 7.7978133E+003 6.7315812E+003 5.6730046E+003 4.6270977E+003 3.6052550E+003 2.6375182E+003 1.8229224E+003 1.4385007E+003 1.7045640E+003 1.8418259E+003 1.5523548E+003 1.3756104E+003 1.3656636E+003 1.5251665E+003 1.8129146E+003 2.1798516E+003 2.5909511E+003 2.2619658E+003 1.5113177E+003 1.3086839E+003 1.3141964E+003 1.3127420E+003 1.3119294E+003 + 8.0000000000000004E-001 8.8704593E+003 7.7988297E+003 6.7324866E+003 5.6738266E+003 4.6278209E+003 3.6058825E+003 2.6380734E+003 1.8233633E+003 1.4387861E+003 1.7046182E+003 1.8417908E+003 1.5523545E+003 1.3755871E+003 1.3655372E+003 1.5248543E+003 1.8123846E+003 2.1791120E+003 2.5900386E+003 2.2609401E+003 1.5102548E+003 1.3075583E+003 1.3129271E+003 1.3113117E+003 1.3103360E+003 + 9.0000000000000002E-001 8.8702060E+003 7.7990746E+003 6.7330024E+003 5.6745136E+003 4.6285669E+003 3.6066158E+003 2.6387460E+003 1.8239062E+003 1.4391203E+003 1.7047084E+003 1.8417848E+003 1.5523868E+003 1.3755999E+003 1.3654510E+003 1.5245794E+003 1.8118832E+003 2.1783868E+003 2.5891256E+003 2.2598956E+003 1.5091668E+003 1.3064140E+003 1.3116338E+003 1.3098486E+003 1.3086981E+003 + 1.0000000000000000E+000 8.8665112E+003 7.7962893E+003 6.7308604E+003 5.6729325E+003 4.6274383E+003 3.6058826E+003 2.6383150E+003 1.8237149E+003 1.4389193E+003 1.7043270E+003 1.8413711E+003 1.5521036E+003 1.3753782E+003 1.3651996E+003 1.5241922E+003 1.8113080E+003 2.1776163E+003 2.5881918E+003 2.2588443E+003 1.5080929E+003 1.3053151E+003 1.3104013E+003 1.3084537E+003 1.3071264E+003 diff --git a/tests/data/cabledyn/lw24g.dat b/tests/data/cabledyn/lw24g.dat new file mode 100644 index 0000000..288b576 --- /dev/null +++ b/tests/data/cabledyn/lw24g.dat @@ -0,0 +1,127 @@ +--------------------- CableDyn Input File ------------------------------------ +Lazy-wave power cable with a clamped hang-off on a vessel moving with its RAOs in a JONSWAP sea +-- Geometry and properties match lozon_gomex80_power_cable.dat. The vessel moves as the response of +-- a displacement RAO table to the deck sea; the same wave components load the cable, so the +-- vessel and the line see one sea. The RAO values in sample_rao.txt are illustrative. +-- The hang-off is clamped (Rigid) along the static fairlead tangent, so the clamp turns with the +-- vessel and BendMom1N1 reports the connection moment at End A. +--------------------- LINE TYPES --------------------------------------------- +TypeName Diam MassDenInAir EA BA EI GAs GJ Irt Irn Cd_n Cd_t Ca_n Ca_t +(-) (m) (kg/m) (N) (-) (N-m2) (N) (N-m2) (kg-m) (kg-m) (-) (-) (-) (-) +bare 0.160 36.70 4.69e8 0.0 1.99e4|-0.02|0.2|2.0 1.8e8 1.5e4|2.0e3|-0.01 0.06 0.12 1.2 0.1 1.0 0.0 +buoy 0.290 59.53 4.69e8 0.0 1.99e4|5.0e2 1.8e8 1.5e4|2.0e3|20.0 0.31 0.63 1.2 0.1 1.0 0.0 +--------------------- POINTS ------------------------------------------------ +ID Type X Y Z +(-) (-) (m) (m) (m) +1 Coupled 5.0 0.0 -14.0 +2 Fixed 125.0 0.0 -80.0 +--------------------- LINES ------------------------------------------------- +ID NodeA NodeB Outputs +(-) (-) (-) (-) +1 1 2 pt +--------------------- SECTIONS ---------------------------------------------- +LineID LineType Length NumSegs +(-) (-) (m) (-) +1 bare 68.114 10 +1 buoy 50.000 8 +1 bare 52.101 6 +--------------------- END CONNECTIONS --------------------------------------- +-- End A is clamped along the static hang-off tangent (81.6 deg below horizontal, toward End B). +LineID End Stiffness EzX EzY EzZ TorsStiffness NxX NxY NxZ +(-) (-) (N-m/rad) (-) (-) (-) (N-m/rad) (-) (-) (-) +1 EndA Rigid 0.1461 0.0 -0.9893 Rigid 0.0 1.0 0.0 +--------------------- OPTIONS ----------------------------------------------- +9.80665 g - Gravitational acceleration (m/s^2) [default: 9.80665] +1025.0 rhoW - Water density (kg/m^3) [default: 1025] +80.0 WtrDpth - Water depth for the flat seabed (m) [default: absent standalone; host-owned OpenFAST] +1.0e5 kBot - Seabed penalty stiffness base (Pa/m) [default: 1.0e5] +1.0e4 cBot - Seabed normal damping base (Pa-s/m) [default: 1.0e4] +0.4 rhoInf - Generalised-alpha spectral radius {0<=rhoInf<=1} [default: 0.4] +False modified_newton - Tangent-reuse mode {False=full Newton; True=guarded reuse} [default: False] +0.1 dtM - CableDyn internal time step (s) [default: omitted standalone; 0.1 s target OpenFAST] +1.0 TMax - Standalone simulation duration (s) +sample_rao.txt vesselRAO - Displacement RAO table: vessel motion from the deck waves +0.0|0.0|0.0 vesselRef - Vessel reference point, rotation centre and RAO origin (m) [default: 0|0|0] +False adaptive_mesh - Automatic finite-EI refinement {False; True} [default: False] +False tensile_safety - Refine and reject local axial compression [default: False] +dynamic_solver 1.0e-4 1.0e-14 100 12 - Relative tolerance, absolute tolerance, max iterations, backtracks +none frictionMu - Seabed friction coefficient {none; value>=0} [default: none] +none current - Current model and velocity (m/s) {none; uniform; profile} [default: none] +jonswap 4.0 10.0 3.3 30.0 waves - Wave model, JONSWAP Hs, Tp, gamma, and direction (m, s, deg) {none; airy; jonswap} +1 WaveSeed - Seed of the random sea [default: 1] +5.0 rampTime - Half-cosine start-up ramp of the wave amplitudes (s) [default: 0] +0 WaterKin - Water-kinematics source {0/none; file; SEASTATE coupled only} [default: no policy] +-- Complete option/default reference: cabledyn_options_reference.dat and doc/options.rst. +--------------------- OUTPUTS ----------------------------------------------- +"FairTen1" +"Twist1N1" +"Torq1N1" +"Twist1N2" +"Torq1N2" +"Twist1N3" +"Torq1N3" +"Twist1N4" +"Torq1N4" +"Twist1N5" +"Torq1N5" +"Twist1N6" +"Torq1N6" +"Twist1N7" +"Torq1N7" +"Twist1N8" +"Torq1N8" +"Twist1N9" +"Torq1N9" +"Twist1N10" +"Torq1N10" +"Twist1N11" +"Torq1N11" +"Twist1N12" +"Torq1N12" +"Twist1N13" +"Torq1N13" +"AnchTen1" +"Curv1N2" +"Curv1N3" +"Curv1N4" +"Curv1N8" +"Curv1N10" +"Curv1N12" +"Ten1N2" +"Ten1N3" +"Ten1N4" +"Ten1N8" +"Ten1N9" +"Ten1N10" +"Ten1N12" +"L1N1Dec" +"L1N1Azi" +"L1N2Dec" +"L1N2Azi" +"L1N3Dec" +"L1N3Azi" +"L1N4Dec" +"L1N4Azi" +"L1N5Dec" +"L1N5Azi" +"L1N6Dec" +"L1N6Azi" +"L1N7Dec" +"L1N7Azi" +"L1N8Dec" +"L1N8Azi" +"L1N9Dec" +"L1N9Azi" +"L1N10Dec" +"L1N10Azi" +"L1N11Dec" +"L1N11Azi" +"L1N12Dec" +"L1N12Azi" +"L1N13Dec" +"L1N13Azi" +"L1N14Dec" +"L1N14Azi" +END +"Ignored1" +--------------------- need this line ---------------------------------------- diff --git a/tests/data/cabledyn/lw24g.elements.out b/tests/data/cabledyn/lw24g.elements.out new file mode 100644 index 0000000..df44393 --- /dev/null +++ b/tests/data/cabledyn/lw24g.elements.out @@ -0,0 +1,27 @@ +CableDyn continuous Hermite-element extrema (public order End A -> End B) +LineID Element ReferenceArcStart ReferenceArcEnd PeakXi PeakReferenceArc PeakCurvature BendMomentAtPeak MinimumAxialResultant MinimumXi MaximumAxialResultant MaximumXi +(-) (-) (m) (m) (-) (m) (1/m) (N.m) (N) (-) (N) (-) +1 1 0.0000000E+000 6.8114000E+000 1.0000000E+000 6.8114000E+000 3.2534413E-003 6.4743483E+001 6.2317708E+003 0.0000000E+000 1.0467965E+004 2.9296875E-001 +1 2 6.8114000E+000 1.3622800E+001 1.0000000E+000 1.3622800E+001 3.6220160E-003 7.2078119E+001 6.6843681E+003 8.3007812E-001 9.2616106E+003 1.5625000E-002 +1 3 1.3622800E+001 2.0434200E+001 1.0000000E+000 2.0434200E+001 4.8859643E-003 9.7230690E+001 5.4081734E+003 8.4863281E-001 7.8039794E+003 1.9238281E-001 +1 4 2.0434200E+001 2.7245600E+001 1.0000000E+000 2.7245600E+001 6.8400917E-003 1.3611782E+002 4.0759183E+003 8.3691406E-001 7.0058652E+003 2.0703125E-001 +1 5 2.7245600E+001 3.4057000E+001 1.0000000E+000 3.4057000E+001 1.0315327E-002 2.0527501E+002 2.7206368E+003 8.2714844E-001 6.2723066E+003 2.1093750E-001 +1 6 3.4057000E+001 4.0868400E+001 1.0000000E+000 4.0868400E+001 1.7581985E-002 3.4988150E+002 1.0101502E+003 8.5449219E-001 5.5656736E+003 2.2949219E-001 +1 7 4.0868400E+001 4.7679800E+001 1.0000000E+000 4.7679800E+001 3.5769372E-002 7.1181049E+002 -2.2016838E+003 7.0996094E-001 2.1587787E+004 1.0000000E+000 +1 8 4.7679800E+001 5.4491200E+001 1.0000000E+000 5.4491200E+001 7.4531054E-002 1.4831680E+003 -2.1507426E+004 7.7441406E-001 1.1371167E+005 1.0000000E+000 +1 9 5.4491200E+001 6.1302600E+001 0.0000000E+000 5.4491200E+001 9.9439464E-002 1.9788453E+003 -7.6322968E+004 8.4277344E-001 1.1371167E+005 0.0000000E+000 +1 10 6.1302600E+001 6.8114000E+001 0.0000000E+000 6.1302600E+001 6.6306317E-002 1.3194957E+003 -1.9694006E+004 2.5097656E-001 1.0848215E+005 0.0000000E+000 +1 11 6.8114000E+001 7.4364000E+001 1.0000000E+000 7.4364000E+001 1.5170100E-002 3.0188499E+002 -1.4801344E+004 0.0000000E+000 2.1634705E+004 1.0000000E+000 +1 12 7.4364000E+001 8.0614000E+001 0.0000000E+000 7.4364000E+001 4.3920679E-002 8.7402151E+002 4.7551806E+002 7.6269531E-001 2.1634705E+004 0.0000000E+000 +1 13 8.0614000E+001 8.6864000E+001 1.0000000E+000 8.6864000E+001 5.5288652E-002 1.1002442E+003 -4.2617930E+003 8.1835938E-001 1.4840428E+004 1.0000000E+000 +1 14 8.6864000E+001 9.3114000E+001 0.0000000E+000 8.6864000E+001 5.5970324E-002 1.1138095E+003 -4.1716989E+003 1.7871094E-001 1.4840428E+004 0.0000000E+000 +1 15 9.3114000E+001 9.9364000E+001 0.0000000E+000 9.3114000E+001 4.6685124E-002 9.2903398E+002 -1.8521127E+003 2.0410156E-001 1.1203152E+004 0.0000000E+000 +1 16 9.9364000E+001 1.0561400E+002 0.0000000E+000 9.9364000E+001 3.4023326E-002 6.7706419E+002 -3.5624075E+002 2.1875000E-001 5.6026126E+003 0.0000000E+000 +1 17 1.0561400E+002 1.1186400E+002 1.0000000E+000 1.1186400E+002 2.3307388E-002 4.6381702E+002 1.2457797E+003 4.6093750E-001 1.1708572E+004 1.0000000E+000 +1 18 1.1186400E+002 1.1811400E+002 0.0000000E+000 1.1186400E+002 1.1222250E-002 2.2332278E+002 -9.8382025E+003 1.0000000E+000 1.1708572E+004 0.0000000E+000 +1 19 1.1811400E+002 1.2679750E+002 1.0000000E+000 1.2679750E+002 4.4130674E-002 8.7820041E+002 -1.2315382E+004 7.2558594E-001 7.9768040E+004 1.0000000E+000 +1 20 1.2679750E+002 1.3548100E+002 1.0000000E+000 1.3548100E+002 7.3459534E-002 1.4618447E+003 -5.8806833E+004 1.5429688E-001 1.1457470E+005 1.0000000E+000 +1 21 1.3548100E+002 1.4416450E+002 0.0000000E+000 1.3548100E+002 1.3452236E-002 2.6769950E+002 -4.1413225E+004 2.8613281E-001 1.1457470E+005 0.0000000E+000 +1 22 1.4416450E+002 1.5284800E+002 0.0000000E+000 1.4416450E+002 6.3476435E-003 1.2631811E+002 -2.4066030E+004 9.8632812E-002 1.7972945E+004 7.3632812E-001 +1 23 1.5284800E+002 1.6153150E+002 0.0000000E+000 1.5284800E+002 4.9890083E-003 9.9281265E+001 -1.1639855E+004 1.4648438E-001 1.0669334E+004 7.2167969E-001 +1 24 1.6153150E+002 1.7021500E+002 0.0000000E+000 1.6153150E+002 2.5125777E-003 5.0000296E+001 -5.7642648E+003 0.0000000E+000 4.2315214E+003 6.5136719E-001 diff --git a/tests/data/cabledyn/lw24g.out b/tests/data/cabledyn/lw24g.out new file mode 100644 index 0000000..05cfce8 --- /dev/null +++ b/tests/data/cabledyn/lw24g.out @@ -0,0 +1,13 @@ +# CableDyn driver output (finite-EI dynamic; production cubic-Hermite route) +Time(s) FairTen1 Twist1N1 Torq1N1 Twist1N2 Torq1N2 Twist1N3 Torq1N3 Twist1N4 Torq1N4 Twist1N5 Torq1N5 Twist1N6 Torq1N6 Twist1N7 Torq1N7 Twist1N8 Torq1N8 Twist1N9 Torq1N9 Twist1N10 Torq1N10 Twist1N11 Torq1N11 Twist1N12 Torq1N12 Twist1N13 Torq1N13 AnchTen1 Curv1N2 Curv1N3 Curv1N4 Curv1N8 Curv1N10 Curv1N12 Ten1N2 Ten1N3 Ten1N4 Ten1N8 Ten1N9 Ten1N10 Ten1N12 L1N1Dec L1N1Azi L1N2Dec L1N2Azi L1N3Dec L1N3Azi L1N4Dec L1N4Azi L1N5Dec L1N5Azi L1N6Dec L1N6Azi L1N7Dec L1N7Azi L1N8Dec L1N8Azi L1N9Dec L1N9Azi L1N10Dec L1N10Azi L1N11Dec L1N11Azi L1N12Dec L1N12Azi L1N13Dec L1N13Azi L1N14Dec L1N14Azi + 0.0000000000000000E+000 9.3169968E+003 0.0000000E+000 -2.2383934E-017 -9.5140468E-004 -5.5959836E-018 -1.8165697E-003 3.7306557E-018 -2.5525639E-003 5.5959836E-018 -3.1703355E-003 9.3266393E-018 -3.6724648E-003 0.0000000E+000 -4.0527604E-003 1.8653279E-018 -4.4619546E-003 -1.8653279E-018 -4.9725565E-003 1.8653279E-018 -4.3645530E-003 1.1191967E-017 -4.8161517E-003 -9.4830583E-018 -5.0176489E-003 -3.0493186E-018 -5.3286184E-003 1.7787692E-017 1.3200345E+003 2.9580965E-003 4.0150449E-003 5.4673736E-003 5.0087199E-002 9.7042047E-002 3.5014937E-002 8.2544032E+003 7.1954486E+003 6.1420156E+003 2.1506169E+003 1.4578169E+003 1.3924305E+003 1.6701784E+003 1.7159927E+002 0.0000000E+000 1.7079572E+002 0.0000000E+000 1.6943150E+002 0.0000000E+000 1.6758917E+002 0.0000000E+000 1.6498326E+002 0.0000000E+000 1.6101240E+002 0.0000000E+000 1.5419495E+002 0.0000000E+000 1.4039752E+002 0.0000000E+000 1.1202830E+002 0.0000000E+000 7.4502052E+001 0.0000000E+000 4.9269465E+001 0.0000000E+000 5.3896279E+001 0.0000000E+000 6.9501894E+001 0.0000000E+000 8.9093741E+001 0.0000000E+000 + 1.0000000000000001E-001 9.3413364E+003 0.0000000E+000 1.3500917E-005 -9.5287520E-004 1.5025624E-005 -1.8207022E-003 1.9329981E-005 -2.5584234E-003 2.2539910E-005 -3.1772458E-003 2.1574810E-005 -3.6801747E-003 1.7396502E-005 -4.0611379E-003 1.0857396E-005 -4.4709210E-003 3.0054745E-006 -4.9821040E-003 -4.3115172E-006 -4.3746910E-003 -8.5947940E-006 -4.8268348E-003 -1.9225945E-006 -5.0284448E-003 1.3423228E-005 -5.3391541E-003 2.1662472E-005 1.3192314E+003 2.9410065E-003 4.0246758E-003 5.4749687E-003 5.0106382E-002 9.7063723E-002 3.5022172E-002 8.2768142E+003 7.2145910E+003 6.1581791E+003 2.1564519E+003 1.4618376E+003 1.3954790E+003 1.6724297E+003 1.7159911E+002 6.4387229E-004 1.7079394E+002 7.7754572E-003 1.6943156E+002 8.9569813E-004 1.6758921E+002 1.2366633E-004 1.6498325E+002 3.2079847E-005 1.6101239E+002 1.5750186E-005 1.5419495E+002 1.0072476E-005 1.4039754E+002 7.2293484E-006 1.1202841E+002 5.2721519E-006 7.4502148E+001 5.8283546E-006 4.9269623E+001 2.5223614E-005 5.3896282E+001 1.1956299E-005 6.9501881E+001 8.0739724E-006 8.9093718E+001 4.2192249E-006 + 2.0000000000000001E-001 9.3628278E+003 0.0000000E+000 -1.1630405E-004 -9.5679982E-004 -1.0713717E-004 -1.8315306E-003 -8.8566601E-005 -2.5736848E-003 -7.3033207E-005 -3.1961960E-003 -6.3842611E-005 -3.7025171E-003 -6.0653076E-005 -4.0864571E-003 -6.2638204E-005 -4.4988456E-003 -6.7847218E-005 -5.0124013E-003 -7.2638832E-005 -4.4070931E-003 -7.2063877E-005 -4.8610567E-003 -4.4114859E-005 -5.0634557E-003 1.2083529E-005 -5.3739112E-003 5.2553535E-005 1.3185727E+003 3.0031930E-003 4.0399033E-003 5.4699221E-003 5.0105805E-002 9.7067099E-002 3.5027823E-002 8.2971017E+003 7.2323960E+003 6.1734696E+003 2.1621890E+003 1.4658001E+003 1.3984803E+003 1.6746261E+003 1.7159864E+002 2.4592768E-003 1.7079299E+002 1.5415397E-002 1.6943243E+002 -7.2348177E-005 1.6758917E+002 -5.4501600E-005 1.6498319E+002 6.1288129E-005 1.6101239E+002 5.7360513E-005 1.5419494E+002 4.0307481E-005 1.4039763E+002 2.8989556E-005 1.1202889E+002 2.0184139E-005 7.4502579E+001 2.1080091E-005 4.9270255E+001 1.0801673E-004 5.3896270E+001 4.7409707E-005 6.9501834E+001 3.3519094E-005 8.9093616E+001 1.8363784E-005 + 3.0000000000000004E-001 9.3620876E+003 0.0000000E+000 -3.9096694E-004 -9.6326942E-004 -3.7818784E-004 -1.8464049E-003 -3.5795075E-004 -2.5944693E-003 -3.4401137E-004 -3.2238792E-003 -3.3107047E-004 -3.7370708E-003 -3.1836773E-004 -4.1274353E-003 -3.0645069E-004 -4.5458654E-003 -2.9522353E-004 -5.0651095E-003 -2.8182496E-004 -4.4649334E-003 -2.6192810E-004 -4.9235122E-003 -1.9335532E-004 -5.1286875E-003 -6.5587004E-005 -5.4400479E-003 4.2147625E-005 1.3173645E+003 3.0924130E-003 4.0120418E-003 5.4507065E-003 5.0081523E-002 9.7045738E-002 3.5026360E-002 8.2959948E+003 7.2310997E+003 6.1722051E+003 2.1617497E+003 1.4655600E+003 1.3983397E+003 1.6745282E+003 1.7159793E+002 5.2360797E-003 1.7079743E+002 4.0353091E-003 1.6943302E+002 -3.3224099E-003 1.6758860E+002 1.1001796E-004 1.6498317E+002 2.8093904E-004 1.6101241E+002 1.6899491E-004 1.5419490E+002 1.0168236E-004 1.4039785E+002 6.9487598E-005 1.1202991E+002 4.6715737E-005 7.4503571E+001 4.5096041E-005 4.9271570E+001 2.6456667E-004 5.3896220E+001 1.0698538E-004 6.9501750E+001 8.0392610E-005 8.9093382E+001 4.6310293E-005 + 4.0000000000000002E-001 9.3831006E+003 0.0000000E+000 -6.8846669E-004 -9.7319784E-004 -6.6190509E-004 -1.8659453E-003 -6.3727691E-004 -2.6222924E-003 -6.4127989E-004 -3.2617466E-003 -6.4353209E-004 -3.7844189E-003 -6.4221882E-004 -4.1842233E-003 -6.3799256E-004 -4.6120612E-003 -6.2983839E-004 -5.1405670E-003 -6.1263021E-004 -4.5492148E-003 -5.8114509E-004 -5.0161343E-003 -4.7049818E-004 -5.2272432E-003 -2.5343866E-004 -5.5419789E-003 -4.6983298E-005 1.3161448E+003 3.1731732E-003 3.9703353E-003 5.4702816E-003 5.0093429E-002 9.7063595E-002 3.5023393E-002 8.3156842E+003 7.2482428E+003 6.1868113E+003 2.1671109E+003 1.4692157E+003 1.4010334E+003 1.6764327E+003 1.7159703E+002 8.7196451E-003 1.7080813E+002 -3.3099123E-002 1.6943092E+002 -2.0652432E-003 1.6758801E+002 1.8318965E-003 1.6498337E+002 7.5248822E-004 1.6101232E+002 3.4451633E-004 1.5419484E+002 1.9825069E-004 1.4039823E+002 1.3416504E-004 1.1203162E+002 9.1046665E-005 7.4505339E+001 8.3018408E-005 4.9273740E+001 4.9997299E-004 5.3896151E+001 1.9070049E-004 6.9501610E+001 1.5325618E-004 8.9092971E+001 9.2275502E-005 + 5.0000000000000000E-001 9.3876360E+003 0.0000000E+000 -1.2036057E-003 -9.8686095E-004 -1.1677688E-003 -1.8930210E-003 -1.1349434E-003 -2.6627600E-003 -1.1323470E-003 -3.3155552E-003 -1.1207164E-003 -3.8504081E-003 -1.1105808E-003 -4.2626892E-003 -1.1026983E-003 -4.7027380E-003 -1.0917454E-003 -5.2434434E-003 -1.0686058E-003 -4.6639289E-003 -1.0253903E-003 -5.1422280E-003 -8.7554039E-004 -5.3622578E-003 -5.6967858E-004 -5.6832884E-003 -2.5342930E-004 1.3149054E+003 3.1970048E-003 3.9568282E-003 5.5006824E-003 5.0074590E-002 9.7053519E-002 3.5015266E-002 8.3199255E+003 7.2521127E+003 6.1903141E+003 2.1687648E+003 1.4704222E+003 1.4019586E+003 1.6771410E+003 1.7159602E+002 1.2616095E-002 1.7082282E+002 -8.6824609E-002 1.6942621E+002 8.9590658E-003 1.6758858E+002 3.6904278E-003 1.6498336E+002 1.0004808E-003 1.6101208E+002 5.4615117E-004 1.5419479E+002 3.4892168E-004 1.4039880E+002 2.3543302E-004 1.1203414E+002 1.6293731E-004 7.4508096E+001 1.4801723E-004 4.9276944E+001 8.1609426E-004 5.3896121E+001 3.0860233E-004 6.9501373E+001 2.6273287E-004 8.9092358E+001 1.6331793E-004 + 6.0000000000000009E-001 9.3955344E+003 0.0000000E+000 -1.8791374E-003 -1.0047166E-003 -1.8407744E-003 -1.9295027E-003 -1.8013728E-003 -2.7177459E-003 -1.7835037E-003 -3.3871394E-003 -1.7535666E-003 -3.9385472E-003 -1.7298921E-003 -4.3673572E-003 -1.7076130E-003 -4.8229779E-003 -1.6802106E-003 -5.3790692E-003 -1.6389851E-003 -4.8142418E-003 -1.5746333E-003 -5.3064740E-003 -1.3792014E-003 -5.5377276E-003 -9.8532538E-004 -5.8675415E-003 -5.6650882E-004 1.3133048E+003 3.1783605E-003 4.0146694E-003 5.4995789E-003 5.0073164E-002 9.7050781E-002 3.5009638E-002 8.3272023E+003 7.2582407E+003 6.1954204E+003 2.1705843E+003 1.4716676E+003 1.4027983E+003 1.6776313E+003 1.7159498E+002 1.6598969E-002 1.7083892E+002 -1.4338735E-001 1.6942186E+002 2.4085304E-002 1.6758999E+002 2.5696868E-003 1.6498251E+002 1.0753404E-003 1.6101195E+002 9.5903820E-004 1.5419467E+002 6.1466469E-004 1.4039962E+002 3.8892640E-004 1.1203756E+002 2.6689175E-004 7.4512061E+001 2.5275877E-004 4.9281274E+001 1.2091660E-003 5.3896206E+001 4.7893079E-004 6.9501003E+001 4.2320664E-004 8.9091522E+001 2.6863055E-004 + 7.0000000000000007E-001 9.4009250E+003 0.0000000E+000 -2.7159886E-003 -1.0264741E-003 -2.6773520E-003 -1.9743716E-003 -2.6235397E-003 -2.7845020E-003 -2.5868862E-003 -3.4741407E-003 -2.5511901E-003 -4.0471773E-003 -2.5192483E-003 -4.4966504E-003 -2.4784638E-003 -4.9721490E-003 -2.4270391E-003 -5.5476455E-003 -2.3592189E-003 -5.0013784E-003 -2.2648253E-003 -5.5110439E-003 -2.0099960E-003 -5.7563411E-003 -1.5111516E-003 -6.0974277E-003 -9.8283560E-004 1.3118616E+003 3.1341721E-003 4.1127737E-003 5.4392206E-003 5.0073376E-002 9.7051517E-002 3.5002598E-002 8.3324565E+003 7.2631592E+003 6.1999744E+003 2.1726902E+003 1.4731876E+003 1.4038813E+003 1.6783942E+003 1.7159399E+002 2.0317161E-002 1.7085449E+002 -1.9369966E-001 1.6942097E+002 3.0285029E-002 1.6759007E+002 -7.9147092E-004 1.6498116E+002 2.3973722E-003 1.6101218E+002 1.8459505E-003 1.5419423E+002 1.0139788E-003 1.4040084E+002 5.9654767E-004 1.1204187E+002 3.9941133E-004 7.4517464E+001 4.0517137E-004 4.9286738E+001 1.6660522E-003 5.3896481E+001 7.1967795E-004 6.9500473E+001 6.4697289E-004 8.9090443E+001 4.1753292E-004 + 8.0000000000000004E-001 9.4020369E+003 0.0000000E+000 -3.6775673E-003 -1.0512238E-003 -3.6428617E-003 -2.0250774E-003 -3.5795673E-003 -2.8597545E-003 -3.5361457E-003 -3.5737859E-003 -3.5057445E-003 -4.1723806E-003 -3.4642692E-003 -4.6458218E-003 -3.4070636E-003 -5.1454471E-003 -3.3382340E-003 -5.7444361E-003 -3.2501862E-003 -5.2212400E-003 -3.1291998E-003 -5.7527009E-003 -2.8131392E-003 -6.0160149E-003 -2.1947251E-003 -6.3717722E-003 -1.5321055E-003 1.3102681E+003 3.0796398E-003 4.2060612E-003 5.3615123E-003 5.0044115E-002 9.7039236E-002 3.4989710E-002 8.3335467E+003 7.2641075E+003 6.2008658E+003 2.1732075E+003 1.4735315E+003 1.4040456E+003 1.6783912E+003 1.7159316E+002 2.3403937E-002 1.7086796E+002 -2.3382203E-001 1.6942490E+002 1.8695493E-002 1.6758712E+002 2.7295967E-006 1.6498051E+002 5.9476346E-003 1.6101232E+002 2.9402332E-003 1.5419352E+002 1.4584100E-003 1.4040249E+002 8.5717674E-004 1.1204710E+002 5.6098000E-004 7.4524480E+001 6.1376416E-004 4.9293312E+001 2.1661618E-003 5.3897030E+001 1.0433420E-003 6.9499764E+001 9.4170889E-004 8.9089111E+001 6.1913770E-004 + 9.0000000000000002E-001 9.4018352E+003 0.0000000E+000 -4.7367232E-003 -1.0786546E-003 -4.7076842E-003 -2.0804139E-003 -4.6409420E-003 -2.9426412E-003 -4.5993466E-003 -3.6845132E-003 -4.5728777E-003 -4.3110837E-003 -4.5181083E-003 -4.8114579E-003 -4.4523387E-003 -5.3384374E-003 -4.3768955E-003 -5.9643485E-003 -4.2771735E-003 -5.4679478E-003 -4.1355467E-003 -6.0248789E-003 -3.7666303E-003 -6.3099841E-003 -3.0339051E-003 -6.6841385E-003 -2.2240277E-003 1.3086300E+003 3.0237291E-003 4.2691476E-003 5.3287305E-003 5.0013714E-002 9.7030728E-002 3.4975912E-002 8.3336205E+003 7.2644955E+003 6.2014976E+003 2.1738593E+003 1.4739649E+003 1.4042690E+003 1.6784195E+003 1.7159256E+002 2.5486739E-002 1.7087798E+002 -2.6164471E-001 1.6943332E+002 -9.5615485E-003 1.6758134E+002 1.0943815E-002 1.6498112E+002 9.8587196E-003 1.6101156E+002 3.5898760E-003 1.5419304E+002 1.9535674E-003 1.4040431E+002 1.2124632E-003 1.1205339E+002 7.6532514E-004 7.4533173E+001 8.8935663E-004 4.9300979E+001 2.6849260E-003 5.3897948E+001 1.4573928E-003 6.9498861E+001 1.3127236E-003 8.9087520E+001 8.8380890E-004 + 1.0000000000000000E+000 9.3981855E+003 0.0000000E+000 -5.9016812E-003 -1.1087492E-003 -5.8792577E-003 -2.1401436E-003 -5.8128745E-003 -3.0332681E-003 -5.7683125E-003 -3.8051860E-003 -5.7341445E-003 -4.4613603E-003 -5.6672872E-003 -4.9917353E-003 -5.5996510E-003 -5.5482528E-003 -5.5168464E-003 -6.2037311E-003 -5.4000001E-003 -5.7364916E-003 -5.2328194E-003 -6.3210959E-003 -4.8108012E-003 -6.6301886E-003 -3.9698321E-003 -7.0251757E-003 -3.0169816E-003 1.3070579E+003 2.9698574E-003 4.2916481E-003 5.3670578E-003 5.0010590E-002 9.7026055E-002 3.4961437E-002 8.3304782E+003 7.2620596E+003 6.1996556E+003 2.1735689E+003 1.4738281E+003 1.4039867E+003 1.6780858E+003 1.7159230E+002 2.6197441E-002 1.7088355E+002 -2.7545442E-001 1.6944513E+002 -4.7203872E-002 1.6757431E+002 3.0608463E-002 1.6498243E+002 1.0723518E-002 1.6100957E+002 4.0256457E-003 1.5419315E+002 2.7992514E-003 1.4040611E+002 1.7267629E-003 1.1206080E+002 1.0235478E-003 7.4543566E+001 1.2371611E-003 4.9309677E+001 3.1952027E-003 5.3899328E+001 1.9671594E-003 6.9497766E+001 1.7664626E-003 8.9085665E+001 1.2241466E-003 diff --git a/tests/data/cabledyn/lw24g.static.out b/tests/data/cabledyn/lw24g.static.out new file mode 100644 index 0000000..e579466 --- /dev/null +++ b/tests/data/cabledyn/lw24g.static.out @@ -0,0 +1,28 @@ +CableDyn standalone static configuration (deformed arc; public node order End A -> End B) +LineID Node ArcLength X Y Z Tension Curvature BendMoment Declination Inclination Azimuth +(-) (-) (m) (m) (m) (m) (N) (1/m) (N.m) (deg) (deg) (deg) +1 1 0.0000000E+000 5.0000000E+000 0.0000000E+000 -1.4000000E+001 9.3169968E+003 9.8025082E-004 1.9506732E+001 1.7159927E+002 8.1599270E+001 0.0000000E+000 +1 2 6.8114675E+000 6.0332233E+000 0.0000000E+000 -2.0732647E+001 8.2544032E+003 2.9580965E-003 5.8864957E+001 1.7079572E+002 8.0795723E+001 0.0000000E+000 +1 3 1.3622820E+001 7.2017371E+000 0.0000000E+000 -2.7443020E+001 7.1954486E+003 4.0150449E-003 7.9898189E+001 1.6943150E+002 7.9431496E+001 0.0000000E+000 +1 4 2.0434023E+001 8.5572193E+000 0.0000000E+000 -3.4117984E+001 6.1420156E+003 5.4673736E-003 1.0879938E+002 1.6758917E+002 7.7589166E+001 0.0000000E+000 +1 5 2.7244917E+001 1.0170676E+001 0.0000000E+000 -4.0735010E+001 5.0975285E+003 7.9567391E-003 1.5833749E+002 1.6498326E+002 7.4983259E+001 0.0000000E+000 +1 6 3.4055019E+001 1.2160994E+001 0.0000000E+000 -4.7247777E+001 4.0688804E+003 1.2604139E-002 2.5082036E+002 1.6101240E+002 7.1012397E+001 0.0000000E+000 +1 7 4.0862454E+001 1.4754038E+001 0.0000000E+000 -5.3542003E+001 3.0719719E+003 2.3201988E-002 4.6171758E+002 1.5419495E+002 6.4194952E+001 0.0000000E+000 +1 8 4.7657492E+001 1.8423744E+001 0.0000000E+000 -5.9260903E+001 2.1506169E+003 5.0087199E-002 9.9668938E+002 1.4039752E+002 5.0397519E+001 0.0000000E+000 +1 9 5.4400144E+001 2.3861953E+001 0.0000000E+000 -6.3247033E+001 1.4578169E+003 9.4278263E-002 1.8756827E+003 1.1202830E+002 2.2028300E+001 0.0000000E+000 +1 10 6.1092054E+001 3.0543006E+001 0.0000000E+000 -6.3628066E+001 1.3924305E+003 9.7042047E-002 1.9306902E+003 7.4502052E+001 -1.5497948E+001 0.0000000E+000 +1 11 6.7848949E+001 3.6500256E+001 0.0000000E+000 -6.0439522E+001 1.9956622E+003 1.9084297E-002 3.7978950E+002 4.9269465E+001 -4.0730535E+001 0.0000000E+000 +1 12 7.4097274E+001 4.1386772E+001 0.0000000E+000 -5.6545485E+001 1.6701784E+003 3.5014937E-002 6.9676511E+002 5.3896279E+001 -3.6103721E+001 0.0000000E+000 +1 13 8.0328061E+001 4.6873034E+001 0.0000000E+000 -5.3591906E+001 1.4197749E+003 5.0782210E-002 1.0105479E+003 6.9501894E+001 -2.0498106E+001 0.0000000E+000 +1 14 8.6547790E+001 5.2984510E+001 0.0000000E+000 -5.2436533E+001 1.3202349E+003 5.7159961E-002 1.1374472E+003 8.9093741E+001 -9.0625859E-001 0.0000000E+000 +1 15 9.2766763E+001 5.9126679E+001 0.0000000E+000 -5.3410896E+001 1.4038477E+003 5.2146077E-002 1.0376821E+003 1.0893041E+002 1.8930410E+001 0.0000000E+000 +1 16 9.8995066E+001 6.4665044E+001 0.0000000E+000 -5.6260154E+001 1.6433879E+003 4.0017834E-002 7.9634539E+002 1.2550896E+002 3.5508960E+001 0.0000000E+000 +1 17 1.0523349E+002 6.9332437E+001 0.0000000E+000 -6.0399396E+001 1.9832610E+003 2.7971300E-002 5.5662663E+002 1.3761637E+002 4.7616373E+001 0.0000000E+000 +1 18 1.1147806E+002 7.3197310E+001 0.0000000E+000 -6.5304238E+001 2.3806847E+003 1.8670864E-002 3.7154092E+002 1.4591926E+002 5.5919263E+001 0.0000000E+000 +1 19 1.1772717E+002 7.6534525E+001 0.0000000E+000 -7.0587646E+001 2.8083260E+003 4.4694428E-003 8.8943778E+001 1.4931791E+002 5.9317909E+001 0.0000000E+000 +1 20 1.2636019E+002 8.2242452E+001 0.0000000E+000 -7.7064410E+001 1.7245995E+003 7.6381672E-002 1.5197368E+003 1.2782747E+002 3.7827466E+001 0.0000000E+000 +1 21 1.3490766E+002 9.0268299E+001 0.0000000E+000 -8.0004660E+001 1.3071787E+003 6.9351504E-002 1.3797579E+003 9.2398084E+001 2.3980844E+000 0.0000000E+000 +1 22 1.4358973E+002 9.8950371E+001 0.0000000E+000 -8.0012880E+001 1.3215393E+003 2.7782655E-002 5.5289882E+002 8.8715051E+001 -1.2849485E+000 0.0000000E+000 +1 23 1.5227267E+002 1.0763331E+002 0.0000000E+000 -8.0008610E+001 1.3207091E+003 1.5626385E-002 3.1096887E+002 9.0906459E+001 9.0645915E-001 0.0000000E+000 +1 24 1.6095594E+002 1.1631657E+002 0.0000000E+000 -8.0010299E+001 1.3202448E+003 4.4719184E-003 8.8992270E+001 8.9461579E+001 -5.3842133E-001 0.0000000E+000 +1 25 1.6963937E+002 1.2500000E+002 0.0000000E+000 -8.0000000E+001 1.3200345E+003 6.8886652E-004 1.3708571E+001 9.0247960E+001 2.4796033E-001 0.0000000E+000 diff --git a/tests/test_cabledyn_inputs.py b/tests/test_cabledyn_inputs.py index ef5659f..6887ab9 100644 --- a/tests/test_cabledyn_inputs.py +++ b/tests/test_cabledyn_inputs.py @@ -88,7 +88,8 @@ def test_at_least_one_section(tmp_path): "--------------------- WIRES ---\n", "no LINES", ), - ("BA EI Cd_n", "BA EX Cd_n", "lacks column 'ei'"), + ("1.2 0.1 1.0 0.0\n", "1.2 0.1 1.0 0.0 7 8\n", "'cable' has 12 columns"), + ("1.2 0.1 1.0 0.0\n", "1.2 0.1 1.0 0x\n", "Ca_t of cable is not numeric"), ("cable 0.2 40.0", "cable abc 40.0", "not numeric"), ("cable 0.2 40.0", "cable inf 40.0", "not finite"), ( @@ -100,13 +101,17 @@ def test_at_least_one_section(tmp_path): ( "ID Type X Y Z\n(-) (-) (m) (m) (m)\n1 Coupled 0 0 -10\n2 Fixed 10 0 -12\n", "", - "POINTS is empty", + "POINTS has no data rows", ), - ("ID Type X Y Z", "ID Kind X Y Z", "POINTS needs ID and Type"), + ("2 Fixed 10 0 -12\n", "2 Fixed 10 0 -12 0\n", "POINTS row '2' has 6"), + ("1 cable 10.0 100\n", "1 cable 10.0 100 5\n", "SECTIONS row has 5"), + ("1 cable 10.0 100\n", "1 cable 10.0 1e2\n", "NumSegs is not an integer"), + ("1 1 2 pt\n", "1 1 2 pt x\n", "LINES row of line 1 has 5 columns"), + ("1 1 2 pt\n", "1 1 2 pt\n1 1 2 pt\n", "lists line 1 twice"), ( - "LineID LineType Length NumSegs", - "LineID LineType Length Segs", - "SECTIONS lacks 'numsegs'", + "--------------------- POINTS ---\n", + "cable 0.2 40.0 5e8 0.0 2e4 1.2 0.1 1.0 0.0\n--------------------- POINTS ---\n", + "defines 'cable' twice", ), ("1 cable 10.0 100\n", "2 cable 10.0 100\n", "line 1 has no sections"), ("1 cable 10.0 100\n", "1 rope 10.0 100\n", "undefined type"), @@ -540,8 +545,202 @@ def test_section_history_exports(tmp_path): wet.window(0.0, 9.0) -def test_non_numeric_axial_stiffness_token(tmp_path): +@pytest.mark.parametrize("token", ["5.0e8|7.0e8", "5e8|0.2|0.3", "SYROPE:owc.txt|2|3"]) +def test_non_numeric_axial_stiffness_token(tmp_path, token): # A viscoelastic or Syrope constitutive token in the EA column. path = _deck(tmp_path / "d.dat") - _edit(path, "cable 0.2 40.0 500000000.0", "cable 0.2 40.0 visco_table") + _edit(path, "cable 0.2 40.0 500000000.0", f"cable 0.2 40.0 {token}") assert read_cabledyn_deck(path).line_type("cable").ea_N is None + _edit(path, f"cable 0.2 40.0 {token}", "cable 0.2 40.0 visco_table") + with pytest.raises(CableSchemaError, match="EA of cable is not numeric"): + read_cabledyn_deck(path) + + +_ROW_10 = "cable 0.2 40.0 500000000.0 0.0 20000.0 1.2 0.1 1.0 0.0\n" + + +def _line_types(tmp_path, row): + path = _deck(tmp_path / "d.dat") + _edit(path, _ROW_10, row) + return path + + +@pytest.mark.parametrize( + ("ei", "bb", "alpha"), + [ + ("2.0e4", 0.0, 0.0), + ("2.0e4|0", 0.0, 0.0), + ("2.0e4|1.5e3", 1.5e3, 0.0), + ("2.0e4|-0.05|0.5", 0.05 * 2.0e4 / (math.pi * 0.5), 0.0), + ( + "2.0e4|-0.02|0.2|2.0", + 0.02 * 2.0e4 / (math.pi * 2.2), + 4.0 * math.pi * 0.02 * 0.2 * 2.0 / 2.2, + ), + ("2.0D4|1.5D3", 1.5e3, 0.0), + ], +) +def test_bending_damping_in_the_ei_column(tmp_path, ei, bb, alpha): + """``EI|Bb``, ``EI|-zeta|f`` and ``EI|-zeta|f1|f2`` (CableDyn 0.4.x).""" + path = _line_types(tmp_path, f"cable 0.2 40.0 5e8 0.0 {ei} 1.2 0.1 1.0 0.0\n") + line_type = read_cabledyn_deck(path).line_type("cable") + assert line_type.ei_Nm2 == 2.0e4 + assert line_type.bending_damping_Nm2s == pytest.approx(bb, rel=1e-15) + assert line_type.mass_damping_1_s == pytest.approx(alpha, rel=1e-15) + assert line_type.ei_token == ei + assert line_type.gj_Nm2 is None + + +@pytest.mark.parametrize( + ("ei", "match"), + [ + ("2.0e4|-0.05", "needs the frequency"), + ("2.0e4|-1.5|0.5", "0 < zeta < 1"), + ("2.0e4|-0.05|0.0", "positive frequencies"), + ("2.0e4|-0.05|0.2|-1", "positive frequencies"), + ("0.0|100", "needs a finite-EI cable"), + ("0.0|-0.05|0.5", "needs a finite-EI cable"), + ("2e4|1|2|3|4", "5 '\\|'-separated parts, at most 4"), + ("-2e4", "EI must be >= 0"), + ("2e4|x", "not numeric"), + ], +) +def test_bending_damping_errors(tmp_path, ei, match): + path = _line_types(tmp_path, f"cable 0.2 40.0 5e8 0.0 {ei} 1.2 0.1 1.0 0.0\n") + with pytest.raises(CableSchemaError, match=match): + read_cabledyn_deck(path) + + +def _row_14(gj, *, ea="5e8", ei="2e4", irn="0.2"): + return f"cable 0.2 40.0 {ea} 0.0 {ei} 1.9e8 {gj} 0.1 {irn} 1.2 0.1 1.0 0.0\n" + + +@pytest.mark.parametrize( + ("gj", "values"), + [ + ("1.5e4", (1.5e4, 0.0, 0.0)), + ("1.5e4|0", (1.5e4, 0.0, 0.0)), + ("1.5e4|50.0", (1.5e4, 50.0, 0.0)), + ("1.5e4|-50.0|-0.01", (1.5e4, -50.0, -0.01)), + ("1.5e4|0|20.0", (1.5e4, 0.0, 20.0)), + ], +) +def test_coupling_and_torsional_damping_in_the_gj_column(tmp_path, gj, values): + """``GJ``, ``GJ|K``, ``GJ|K|Bt`` of the 14-column row (CableDyn 0.4.0).""" + line_type = read_cabledyn_deck(_line_types(tmp_path, _row_14(gj))).line_type( + "cable" + ) + assert ( + line_type.gj_Nm2, + line_type.torque_tension_coupling_Nm, + line_type.torsional_damping, + ) == values + assert (line_type.ea_N, line_type.ei_Nm2) == (5e8, 2e4) + assert line_type.polar_inertia_kg_m == 0.2 + assert line_type.gj_token == gj + + +@pytest.mark.parametrize( + ("row", "match"), + [ + (_row_14("1.5e4|1e7"), "K\\^2 < EA GJ"), + (_row_14("1.5e4|50", ei="0.0"), "coupling \\(GJ\\|K\\) needs"), + (_row_14("1.5e4|50", ea="5e8|6e8"), "linear-elastic"), + (_row_14("0|50"), "GJ > 0"), + (_row_14("1.5e4|0|20", irn="0"), "torsional damping \\(GJ\\|K\\|Bt\\)"), + (_row_14("1.5e4|1|2|3"), "4 '\\|'-separated parts, at most 3"), + (_row_14("1.5e4", irn="x"), "Irn of cable is not numeric"), + ], +) +def test_gj_column_errors(tmp_path, row, match): + with pytest.raises(CableSchemaError, match=match): + read_cabledyn_deck(_line_types(tmp_path, row)) + + +def test_line_type_columns_are_read_by_position(tmp_path): + """CableDyn reads a LINE TYPES row by its token count, not by the header. + + An 11-column row is the 10 columns and the VIV lift coefficient ``Cl``: + a header naming the 11th column ``GJ`` does not make it one, and a + stock-MoorDyn header (``Mass/m``, ``Cd Ca CdAx CaAx``) reads the same row. + """ + path = _deck(tmp_path / "d.dat") + _edit( + path, + "TypeName Diam MassDenInAir EA BA EI Cd_n Cd_t Ca_n Ca_t\n", + "LineType Diam Mass/m EA BA/-zeta EI Cd Ca CdAx CaAx GJ\n", + ) + _edit(path, _ROW_10, _ROW_10.replace(" 0.0\n", " 0.0 0.8\n")) + line_type = read_cabledyn_deck(path).line_type("cable") + assert line_type.gj_Nm2 is None and line_type.ea_N == 5e8 + _edit(path, " 0.0 0.8\n", " 0.0 1.0e4|50.0\n") + with pytest.raises(CableSchemaError, match="Cl of cable is not numeric"): + read_cabledyn_deck(path) + + +def test_quoted_names_and_header_rows_anywhere(tmp_path): + path = _deck(tmp_path / "d.dat") + _edit(path, _ROW_10, _ROW_10.replace("cable", '"armoured cable"')) + _edit(path, "1 cable 10.0 100\n", '(-) (-) (m) (-)\n1 "armoured cable" 10.0 100\n') + deck = read_cabledyn_deck(path) + assert deck.line(1).sections[0].line_type == "armoured cable" + assert deck.line_type("Armoured Cable").ei_Nm2 == 2e4 + + +@pytest.mark.parametrize( + ("row", "ends"), + [ + ("1 A Rigid 1 0 0 Free 0 1 0\n1 B Rigid 1 0 0 Zero 0 1 0\n", set()), + ("1 A Rigid 1 0 0 0 0 1 0\n1 B Rigid 1 0 0 0.0e0 0 1 0 15\n", set()), + ("1 EndA Rigid 1 0 0 Inf 0 1 0\n1 End_B Rigid 1 0 0 2.5e3 0 1 0\n", {"a", "b"}), + ("1 B Pinned 1 0 0 Infinity 0 1 0 0\n", {"b"}), + ("1 A Rigid 1 0 0\n", set()), + ], +) +def test_end_connection_torsion_tokens(tmp_path, row, ends): + """TorsStiffness Free/Zero/0 leaves the end free in torsion (CableDyn).""" + path = _deck(tmp_path / "d.dat", torsion=True) + _edit(path, "1 A Rigid 1 0 0 Rigid 0 1 0 0\n1 B Rigid 1 0 0 Rigid 0 1 0 0\n", row) + line = read_cabledyn_deck(path).line(1) + assert line.torsion_restrained_ends == ends + assert line.torsion_restrained == (ends == {"a", "b"}) + + +@pytest.mark.parametrize( + ("row", "match"), + [ + ("1 C Rigid 1 0 0 Rigid 0 1 0\n", "End of line 1 must be A or B"), + ("1 A Rigid 1 0 0 -5 0 1 0\n", "TorsStiffness of line 1 must be"), + ("1 A Rigid 1 0 0 Rigid 0 1\n", "END CONNECTIONS row has 9 columns"), + ], +) +def test_end_connection_errors(tmp_path, row, match): + path = _deck(tmp_path / "d.dat", torsion=True) + _edit(path, "1 A Rigid 1 0 0 Rigid 0 1 0 0\n1 B Rigid 1 0 0 Rigid 0 1 0 0\n", row) + with pytest.raises(CableSchemaError, match=match): + read_cabledyn_deck(path) + + +def test_anchor_first_swap_also_swaps_the_torsion_ends(tmp_path): + path = _deck(tmp_path / "d.dat", torsion=True) + _edit(path, "1 1 2 pt\n", "1 2 1 pt\n") + _edit(path, "1 B Rigid 1 0 0 Rigid 0 1 0 0\n", "") + line = read_cabledyn_deck(path).line(1) + assert line.reversed_by_parser + assert line.torsion_restrained_ends == {"b"} + + +def test_finite_ei_line_to_a_rod_end_is_swapped(tmp_path): + path = _deck(tmp_path / "d.dat") + _edit(path, "1 1 2 pt\n", "1 2 R1A pt\n") + assert read_cabledyn_deck(path).line(1).reversed_by_parser + path = _deck(tmp_path / "d.dat", ei=0.0) + _edit(path, "1 1 2 pt\n", "1 2 R1A pt\n") + assert not read_cabledyn_deck(path).line(1).reversed_by_parser + + +def test_outputs_end_closes_the_channel_list(tmp_path): + path = _deck(tmp_path / "d.dat", channels=["FairTen1", "END", "AnchTen1"]) + assert read_cabledyn_deck(path).channels == ("FairTen1",) + _edit(path, '"FairTen1"\n', '"FairTen1","Ten1N2" Curv1N2\n') + assert read_cabledyn_deck(path).channels == ("FairTen1", "Ten1N2", "Curv1N2") diff --git a/tests/test_cabledyn_reader.py b/tests/test_cabledyn_reader.py index 3a462d4..ef6f249 100644 --- a/tests/test_cabledyn_reader.py +++ b/tests/test_cabledyn_reader.py @@ -12,7 +12,9 @@ on the same deck (chord tangents), ``lw24`` of the v0.1.0 driver (no tangent channels) and ``lw24r`` of the CableDyn 0.4.2 driver (development build 4b94321) on the ``lw24`` deck (1 s, tangent channels), whose static -solve (``tensile_safety True``) now refines the 24 deck elements to 43. +solve (``tensile_safety True``) now refines the 24 deck elements to 43, and +``lw24g`` of the same build on that deck written with the 0.4.x LINE TYPES +tokens (damping, ``GJ|K|Bt``, End A restrained in torsion). """ from __future__ import annotations @@ -1020,3 +1022,92 @@ def test_deck_node_numberings_must_agree(tmp_path): path.write_text("\n".join(lines) + "\n", encoding="utf-8") with pytest.raises(CableSchemaError, match="DeckNode numberings of line 1 differ"): read_cabledyn_sections(root, deck, {"sag": 58.4}) + + +# --------------------------------------------------------------------------- # +# CableDyn 0.4.x LINE TYPES tokens # +# --------------------------------------------------------------------------- # +def _without_twist(tmp_path, *, coupling=True): + """Copy of the ``lw24g`` run without its ``Twist`` channels.""" + for suffix in ("Line1.p.out", "Line1.t.out", "static.out", "elements.out"): + name = f"lw24g.{suffix}" + (tmp_path / name).write_bytes((DATA / name).read_bytes()) + rows = (DATA / "lw24g.out").read_text(encoding="utf-8").splitlines() + keep = [ + i for i, name in enumerate(rows[1].split("\t")) if not name.startswith("Twist") + ] + (tmp_path / "lw24g.out").write_text( + "\n".join( + [ + rows[0], + *("\t".join(row.split("\t")[i] for i in keep) for row in rows[1:]), + ] + ) + + "\n", + encoding="utf-8", + ) + text = (DATA / "lw24g.dat").read_text(encoding="utf-8") + if not coupling: + text = text.replace("1.5e4|2.0e3|", "1.5e4|0|") + (tmp_path / "lw24g.dat").write_text(text, encoding="utf-8") + return tmp_path / "lw24g", tmp_path / "lw24g.dat" + + +@pytest.mark.full_scale +def test_real_cabledyn_run_with_damped_coupled_line_types(tmp_path): + """``lw24g``: the ``lw24`` deck in the grammar of CableDyn 0.4.x. + + Rayleigh bending damping ``EI|-zeta|f1|f2`` and ``EI|Bb``, 14-column rows + with ``GJ|K|Bt`` (``K`` 2 kN m), End A restrained in torsion (``EndA``, + ``TorsStiffness Rigid``), End B free, and an ``END`` row in OUTPUTS. The + CableDyn 0.4.2 driver (development build 4b94321) read and ran it for + 1 s; restrained at one end, the coupling twists the line as it stretches. + """ + deck = read_cabledyn_deck(DATA / "lw24g.dat") + bare, buoy = deck.line_type("bare"), deck.line_type("buoy") + assert (bare.ei_Nm2, buoy.ei_Nm2) == (1.99e4, 1.99e4) + assert bare.bending_damping_Nm2s == pytest.approx(0.02 * 1.99e4 / (math.pi * 2.2)) + assert bare.mass_damping_1_s == pytest.approx(4 * math.pi * 0.02 * 0.4 / 2.2) + assert (buoy.bending_damping_Nm2s, buoy.mass_damping_1_s) == (500.0, 0.0) + assert (bare.gj_Nm2, bare.torque_tension_coupling_Nm, bare.torsional_damping) == ( + 1.5e4, + 2.0e3, + -0.01, + ) + assert (buoy.torsional_damping, buoy.polar_inertia_kg_m) == (20.0, 0.63) + line = deck.line(1) + assert line.torsion_restrained_ends == {"a"} and not line.torsion_restrained + assert deck.channels[-1] == "L1N14Azi" and "Ignored1" not in deck.channels + + sections = {"upper": 10.0, "sag": 58.4} + read = read_cabledyn_sections( + DATA / "lw24g", deck, sections, curvature_check_rtol=0.5 + ) + rows = (DATA / "lw24g.out").read_text(encoding="utf-8").splitlines() + header = rows[1].split("\t") + channel = np.array( + [ + [float(row.split("\t")[header.index(f"Twist1N{j}")]) for j in (9, 10)] + for row in rows[2:] + ] + ) + weight = (58.4 - 8 * 68.114 / 10) / (68.114 / 10) + twist = read.histories["sag"].twist_rad + np.testing.assert_allclose( + twist, np.radians((1 - weight) * channel[:, 0] + weight * channel[:, 1]) + ) + assert np.all(twist < 0.0) + # Without the Twist channels the coupled line cannot be read; with K = 0 + # its twist-free frame is read as for any line restrained at one end. + (tmp_path / "k").mkdir() + (tmp_path / "plain").mkdir() + with pytest.raises(CableSchemaError, match="couples torque and tension"): + read_cabledyn_sections( + *_without_twist(tmp_path / "k"), sections, curvature_check_rtol=0.5 + ) + plain = read_cabledyn_sections( + *_without_twist(tmp_path / "plain", coupling=False), + sections, + curvature_check_rtol=0.5, + ) + assert plain.histories["sag"].twist_rad is None diff --git a/validation/validation_report.md b/validation/validation_report.md index aec7c22..982437d 100644 --- a/validation/validation_report.md +++ b/validation/validation_report.md @@ -72,7 +72,7 @@ Every row is computed from published data or closed-form references in this repo - analytical_sanity: `1190 passed` - independent_method: `76 passed` -- full_scale: `33 passed` +- full_scale: `34 passed` Run `pytest -m ` to reproduce each group.