diff --git a/CHANGELOG.md b/CHANGELOG.md index 98896df..6e0fbb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -463,6 +463,51 @@ All notable changes to CableXSec are recorded in this file. The format follows 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. +- CableDyn reader, remaining differences from CableDyn's deck reader: + - `EQUIVALENT BUOYANCY` (also `EQUIVALENT SECTIONS`, `BUOYANCY SECTIONS`) was ignored, so a + line type showed the `Diam` and `MassDenInAir` of its LINE TYPES row, not the values CableDyn + ran with. As in CableDyn, a row now replaces the diameter and sets the mass to + `rhoW π D²/4 + w/g` (deck `rhoW` and `g`); `line_types_diameter_m`, `line_types_mass_kg_m` + and `equivalent_submerged_weight_N_m` keep the row's values. CableDyn 0.4.2 gives + byte-identical output for the `lw24` deck with the row `buoy 0.30 -100.0` and for the deck + with `buoy` written with this diameter and mass. Its checks are mirrored (three columns, a + known type, one row per type, `D > 0`, a non-negative mass). + - Records are cut and split as CableDyn cuts and splits them: `--` starts a comment at the + start of a record or after a separator (a LINES row ending in `-- comment` was refused for + its column count), a record holding `---` is a section header named by its other + characters, a byte-order mark is dropped, a section header met again continues the section + (it was refused as a duplicate), and a token opening with a quote runs past its closing + quote to the next separator. `#` and `!` still cut a record anywhere, inside quotes too, as + CableDyn does (its `doc/options.rst` says so for file paths). OUTPUTS rows split on spaces, + tabs and commas with the quotes dropped, and only an unquoted `END` closes the list (CableDyn + reads a quoted one as a channel name). + - LINE TYPES rows with a negative `Cd_n`, `Cd_t`, `Ca_n` or `Ca_t`, or a 14-column row whose + `GAs`, `GJ`, `Irt` and `Irn` are neither all zero nor all positive, are refused, as by + CableDyn. + - A line restrained in torsion at one end only is solved in torsion by CableDyn only when + every section gives `GJ`, End B is `Fixed`, a dynamic run is force-blended and a restrained + End A is on a `Fixed` rod's end or a Rigid6 body if on either; otherwise it runs as without + the torsion columns. `CableDynLine.torsion_solved` and `torsion_note` follow these rules (the + deck's BODIES and RODS rows are read for them), `section_channels` lists `Twist`/`Torq` only + on a solved line (CableDyn refuses them on any other), and `checks["torsion"]` records the + result. A solved line restrained at one end without torque–tension coupling twists in the + dynamics (torsional waves of its polar inertia, the roll of the restrained end's vessel or + body), so a dynamic run of it is now refused without its `Twist` channels, where it was + read twist-free: `tests/data/cabledyn/lw24k.*`, the `lw24g` deck with `K = 0` run by + CableDyn 0.4.2, twists by up to −1.7e-3° in 1 s (0.18° in a 30 s run). Its statics stay + twist-free and are read without them. + - The anchor-first swap of a line from a `Fixed` NodeA to a `Free` or `Connect` NodeB applies + only when NodeA is not above NodeB, as in CableDyn; a weight hung from an overhead point + keeps its written order. A line end on a rod fixed to a body is a point of that body, and a + zero-length rod is the point it collapses to. +- `run_sea_state_batch` compares the deck's `GJ` and torque–tension coupling `K` with the + section's lay torsional stiffness `K_tt` and coupling `K_et` (on a 14-column LINE TYPES row; + the check compared `EA` and `EI` only). `GJ` must lie within `torsion_rtol` (new option, + default 25 %) of `K_tt`, and the coupling ratio `K/sqrt(EA GJ)` within `torsion_rtol` of + `K_et/sqrt(EA_fixed K_tt)`. A mismatch stops the batch, as one of `EA` or `EI` does, unless + `allow_property_mismatch=True`, and the manifest records both values and the ratios. The + tolerance is wider than `property_rtol` because `K_tt` leaves out the components' own torsion + and the radial relaxation of the layers. - `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 42cc85b..1ea5f15 100644 --- a/doc/global_local_guide.md +++ b/doc/global_local_guide.md @@ -80,10 +80,31 @@ changed a channel, the item says so. 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. + solution. `TorsStiffness` `Free`, `Zero` or `0` leaves an end free in + torsion. `CableDynLine.torsion_solved` tells whether CableDyn solves a + line's torsion: restrained at both ends, or at one end when every section + gives `GJ`, End B is `Fixed`, a dynamic run is force-blended and a + restrained End A on a rod or body is on a `Fixed` rod or a Rigid6 body + (CableDyn's rules; otherwise `torsion_note` gives the reason and the line + runs as without the torsion columns). A LINE TYPES row with a negative drag + or added-mass coefficient, or a 14-column row whose `GAs`, `GJ`, `Irt` and + `Irn` are neither all zero nor all positive, is refused, as by CableDyn. +- **Equivalent buoyancy.** An `EQUIVALENT BUOYANCY` row + (`LineType Diam SubmergedWeight`) makes CableDyn run the type with the + row's diameter `D` and the dry mass `rhoW π D²/4 + w/g` of its submerged + weight `w` [N/m]. The line type's `diameter_m` and `mass_kg_m` are these + values; `line_types_diameter_m` and `line_types_mass_kg_m` keep the LINE + TYPES row, and `equivalent_submerged_weight_N_m` the row's `w`. The deck's + `rhoW` and `g` (or CableDyn's defaults) resolve it; in a coupled run whose + host sets other values, CableDyn uses the host's. +- **Records.** As in CableDyn, `#` and `!` start a comment anywhere in a + record, inside a quoted token too (a quoted file path cannot hold them), + and `--` starts one at the start of a record or after a space or tab, + unless the record holds a `---` rule. A record holding `---` is a section + header, named by its other characters; a section met again continues. A + token that opens with a quote runs to its closing quote, spaces included, + and on to the next separator. OUTPUTS names are separated by spaces, tabs + or commas, with the quotes dropped; an unquoted `END` closes the list. ## 2. Section history @@ -124,13 +145,24 @@ time; this is the material frame of a torque-free isotropic rod. `frame="section"` transports the section's own axes in time and needs only the channels near the section. Where `Twist` channels bracket a section the axes are turned right-handed about `t` by the material twist from End A. A -line restrained in torsion at both ends without these channels is rejected; a -line restrained at one end only is read with its `Twist` channels when they -are written; restrained at End B only, its End A turns freely with the line's -twist, which the reader, whose axes start at End A, does not represent. The +line restrained in torsion at both ends without these channels is rejected. +So is a dynamic run of a line restrained at one end whose torsion CableDyn +solves: its statics are twist-free (a free end carries no torque), but in the +dynamics its polar inertia `Irn` carries torsional waves and a roll of the +restrained end's vessel or body twists it (CableDyn `doc/theory.rst`, a free +end). The CableDyn 0.4.2 run `tests/data/cabledyn/lw24k`, a lazy wave clamped +and restrained at End A on a vessel, free in torsion at End B and without +torque–tension coupling, twists by up to −1.7e-3° at the sag bend in 1 s and +0.18° in a 30 s run. With coupling (`GJ|K`) the stretch twists the line in +the statics too, so its channels are needed in any run. A line restrained at +one end whose torsion CableDyn does not solve runs as one without the torsion +columns and is read twist-free; `checks["torsion"]` records which case was +read. Restrained at End B only, a line's End A turns freely with its twist, +which the reader, whose axes start at End A, does not represent. The hang-off's rotation about its own -tangent (vessel yaw at a vertical hang-off) is not visible in the geometry and -is not represented. +tangent (vessel yaw at a vertical hang-off, the roll of a restrained End A) +is not visible in the geometry and is not represented: the `Twist` channels +start at 0 at End A. `rotation_curvature_x/y` are the components of `κ` on (`e1`, `e2`): a lazy wave in the `x–z` plane bends about `e2` (sag bend `κ·e2 < 0`, hog bend @@ -206,9 +238,9 @@ nodes cannot be placed: the positions are read at the deck nodes, **Deck outputs.** `section_channels(deck, sections)` lists the `OUTPUTS` channels the tangent source needs for the section frame: `Dec`/`Azi` on the window, `Ten`, `Curv` and `p{x,y,z}` at the bracketing nodes, and -`Twist`/`Torq` on a line restrained at both ends (request them too on a line -restrained at one end). The arc frame also needs the line's `p` -flag. Adding `t` gives the element tensions. +`Twist`/`Torq` on a line CableDyn solves in torsion (`torsion_solved`; +CableDyn refuses them on any other line). The arc frame also needs the +line's `p` flag. Adding `t` gives the element tensions. ### 2.1 CableDyn 0.4.0 signed curvature components @@ -303,9 +335,17 @@ result.sections["sag"].long_term.annual_damage, result.sections["sag"].life_year probability among its seeds). - Before reading, the deck `EA` at each section is compared with the section's `EA_fixed` and the deck `EI` with the section's full-slip to - no-slip range (`property_rtol`, default 5%); a mismatch stops the batch - unless `allow_property_mismatch=True` is declared, and the comparison is - written to the manifest either way. + no-slip range (`property_rtol`, default 5%). On a 14-column LINE TYPES row + the deck `GJ` is compared with the section's lay torsional stiffness + `K_tt` and its torque–tension coupling `K` with `K_et`, as the coupling + ratio `c = K/sqrt(EA GJ)` against `K_et/sqrt(EA_fixed K_tt)` (`|c| < 1`; + the free-twist axial stiffness is `EA (1 − c²)`), both within + `torsion_rtol` (default 25 %). `K_tt` leaves out the components' own + torsion and the radial relaxation of the layers, which move a section's + torsional stiffness by tens of percent either way (benchmark CH-GJ), hence + the wider tolerance; a 10-column row gives no `GJ` and is not compared. A + mismatch stops the batch unless `allow_property_mismatch=True` is + declared, and the comparison is written to the manifest either way. - Workers: `workers` processes (at most `MAX_WORKERS = 8`), one numerical thread each, spawned; results do not depend on the worker count. - Output folder (must not exist): `manifest.json` (SHA-256 of every CableDyn diff --git a/src/cablexsec/analysis/sea_state_batch.py b/src/cablexsec/analysis/sea_state_batch.py index 5dafc2b..fcced0b 100644 --- a/src/cablexsec/analysis/sea_state_batch.py +++ b/src/cablexsec/analysis/sea_state_batch.py @@ -87,6 +87,7 @@ from cablexsec.cables.schema import CableData from cablexsec.exceptions import CableInputError, CableSchemaError from cablexsec.io.cabledyn import ( + CableDynLineType, CableDynRead, CableDynSectionHistory, CurvatureSource, @@ -189,6 +190,17 @@ class SeaStateBatchOptions: model of :func:`cablexsec.compute_fatigue`, with its notice on non-planar paths (:class:`~cablexsec.provenance.DirectionTiedFrictionWarning`); the manifest and the assessment digests record the model it resolves to. + + The property check compares the deck's ``EA`` with ``EA_fixed`` and its + ``EI`` with the full-slip to no-slip range within ``property_rtol``, and, + on a 14-column ``LINE TYPES`` row, its ``GJ`` with the lay torsional + stiffness ``K_tt`` and its torque-tension coupling ``K`` with ``K_et`` + within ``torsion_rtol``: ``GJ`` relative to ``K_tt``, ``K`` as the + coupling ratio ``c = K/sqrt(EA GJ)`` (``|c| < 1``; the free-twist axial + stiffness is ``EA (1 - c^2)``), against ``K_et/sqrt(EA_fixed K_tt)``. + ``K_tt`` leaves out the components' own torsion and the radial relaxation + of the layers, which move a section's torsional stiffness by tens of + percent either way, hence the wider default. """ n_fibres: int = 32 @@ -209,6 +221,7 @@ class SeaStateBatchOptions: exposure_years: float = 1.0 design_fatigue_factor: float = 1.0 property_rtol: float = 0.05 + torsion_rtol: float = 0.25 allow_property_mismatch: bool = False workers: int = 1 chunk_rows: int = 4096 @@ -228,6 +241,8 @@ def __post_init__(self) -> None: raise CableInputError("external_diameter_m must be positive") if not math.isfinite(self.property_rtol) or self.property_rtol <= 0: raise CableInputError("property_rtol must be positive") + if not math.isfinite(self.torsion_rtol) or self.torsion_rtol <= 0: + raise CableInputError("torsion_rtol must be positive") object.__setattr__( self, "reference_vector", tuple(float(v) for v in self.reference_vector) ) @@ -644,22 +659,78 @@ def _property_check( "local_EI_range_Nm2": [stiffness.ei_min_Nm2, stiffness.ei_max_Nm2], "EA_match": ea_ok, "EI_within_bounds": ei_ok, + **_torsion_check(line_type, stiffness, options.torsion_rtol), } ) - bad = [r for r in records if not (r["EA_match"] and r["EI_within_bounds"])] + bad = [r for r in records if _mismatches(r)] if bad and not options.allow_property_mismatch: first = bad[0] raise CableInputError( "the global line properties do not describe the local section " - f"({first['run']}/{first['section']}: EA {first['global_EA_N']} N " - f"against {first['local_EA_fixed_N']:.4g} N, EI {first['global_EI_Nm2']} " - f"N·m² against [{first['local_EI_range_Nm2'][0]:.4g}, " - f"{first['local_EI_range_Nm2'][1]:.4g}]); set allow_property_mismatch " - "only for a documented comparison" + f"({first['run']}/{first['section']}: {'; '.join(_mismatches(first))}); " + "set allow_property_mismatch only for a documented comparison" ) return records +def _torsion_check( + line_type: CableDynLineType, stiffness: Any, rtol: float +) -> dict[str, Any]: + """``GJ`` and coupling ``K`` of a 14-column row against ``K_tt`` and ``K_et``. + + ``None`` matches where the deck gives no ``GJ`` (a 10-column row, or a + 14-column row without the finite-EI columns) or CableXSec computes no + lay torsional stiffness. + """ + gj, k = line_type.gj_Nm2, line_type.torque_tension_coupling_Nm + local_gj = float(stiffness.gj_Nm2) + local_k = float(stiffness.axial_torsion_coupling_Nm) + record: dict[str, Any] = { + "global_GJ_Nm2": gj, + "local_GJ_Nm2": local_gj, + "global_K_Nm": k if gj is not None else None, + "local_K_Nm": local_k, + "global_coupling_ratio": None, + "local_coupling_ratio": None, + "GJ_match": None, + "K_match": None, + } + if gj is None or not gj > 0.0 or not local_gj > 0.0: + return record + record["GJ_match"] = math.isclose(gj, local_gj, rel_tol=rtol) + ea = line_type.ea_N + local_ratio = local_k / math.sqrt(float(stiffness.ea_fixed_N) * local_gj) + # CableDyn takes K only with a linear-elastic EA, so K = 0 elsewhere. + ratio = 0.0 if k == 0.0 or ea is None or not ea > 0.0 else k / math.sqrt(ea * gj) + record["global_coupling_ratio"] = ratio + record["local_coupling_ratio"] = local_ratio + record["K_match"] = abs(ratio - local_ratio) <= rtol + return record + + +def _mismatches(record: Mapping[str, Any]) -> list[str]: + """The quantities of a property-check record that do not match.""" + out = [] + if not record["EA_match"]: + out.append( + f"EA {record['global_EA_N']} N against {record['local_EA_fixed_N']:.4g} N" + ) + if not record["EI_within_bounds"]: + low, high = record["local_EI_range_Nm2"] + out.append(f"EI {record['global_EI_Nm2']} N·m² against [{low:.4g}, {high:.4g}]") + if record["GJ_match"] is False: + out.append( + f"GJ {record['global_GJ_Nm2']} N·m² against {record['local_GJ_Nm2']:.4g}" + ) + if record["K_match"] is False: + out.append( + f"K {record['global_K_Nm']} N·m (coupling ratio " + f"{record['global_coupling_ratio']:.3g}) against " + f"{record['local_K_Nm']:.4g} N·m ({record['local_coupling_ratio']:.3g})" + ) + return out + + _SPEC_KEYS = {"cable", "runs", "sections", "options"} _RUN_KEYS = { "name", diff --git a/src/cablexsec/io/cabledyn.py b/src/cablexsec/io/cabledyn.py index eb48667..49c45fb 100644 --- a/src/cablexsec/io/cabledyn.py +++ b/src/cablexsec/io/cabledyn.py @@ -86,8 +86,14 @@ 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 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. +is a dynamic run of a line restrained at one end whose torsion CableDyn solves +(:attr:`CableDynLine.torsion_solved`): the polar inertia carries torsional +waves and a roll of the restrained end twists it. Its static state is +twist-free, unless its line type couples torque and tension (``GJ|K``): its +twist then follows the stretch, and the channels are needed in any run. A line +restrained at one end whose torsion CableDyn does not solve (the deck misses +one of CableDyn's rules for it, ``torsion_note``) runs as one without the +torsion columns and is read twist-free. The returned ``rotation_curvature_x/y`` are the components of the rotation-curvature (Darboux bending) vector :math:`\boldsymbol{\kappa}` on the @@ -188,8 +194,15 @@ "solver options": "options", "outputs": "outputs", "output": "outputs", + "bodies": "bodies", + "body": "bodies", + "rods": "rods", + "rod list": "rods", + "rod properties": "rods", + "equivalent buoyancy": "equivalent buoyancy", + "equivalent sections": "equivalent buoyancy", + "buoyancy sections": "equivalent buoyancy", } -_MOVING_POINTS = ("coupled", "vessel", "free", "connect") # --------------------------------------------------------------------------- # @@ -213,6 +226,15 @@ class CableDynLineType: 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. + + ``diameter_m`` and ``mass_kg_m`` are the values CableDyn runs with. An + ``EQUIVALENT BUOYANCY`` row of the type replaces them, as CableDyn does, + by its diameter ``D`` and the dry mass + ``rhoW pi D²/4 + w/g`` of its submerged weight ``w`` [N/m] + (``equivalent_submerged_weight_N_m``; ``None`` without a row), with the + deck's ``rhoW`` and ``g``. ``line_types_diameter_m`` and + ``line_types_mass_kg_m`` keep the ``Diam`` and ``MassDenInAir`` of the + ``LINE TYPES`` row. """ name: str @@ -228,6 +250,16 @@ class CableDynLineType: polar_inertia_kg_m: float | None = None ei_token: str = "" gj_token: str | None = None + line_types_diameter_m: float | None = None + line_types_mass_kg_m: float | None = None + equivalent_submerged_weight_N_m: float | None = None + + def __post_init__(self) -> None: + # A type built by hand runs with the values it is given. + if self.line_types_diameter_m is None: + object.__setattr__(self, "line_types_diameter_m", self.diameter_m) + if self.line_types_mass_kg_m is None: + object.__setattr__(self, "line_types_mass_kg_m", self.mass_kg_m) @dataclass(frozen=True) @@ -245,7 +277,13 @@ class CableDynLine: ``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. + public order). ``torsion_solved`` is a finite-EI line whose torsion + CableDyn solves: restrained at both ends, or at one end under CableDyn's + rules for that case (every section gives ``GJ``, End B is ``Fixed``, a + dynamic run is force-blended, a restrained End A is on no body but a + Rigid6 one and on no rod end but a ``Fixed`` rod's); otherwise + ``torsion_note`` gives CableDyn's reason, and the line runs as without + the torsion columns. """ line_id: int @@ -256,6 +294,8 @@ class CableDynLine: torsion_restrained: bool reversed_by_parser: bool torsion_restrained_ends: frozenset[str] = frozenset() + torsion_solved: bool = False + torsion_note: str = "" @property def n_elements(self) -> int: @@ -334,12 +374,29 @@ def line_type(self, name: str) -> CableDynLineType: ) from None +#: CableDyn's token separators (``is_space``): space, tab, LF, VT, FF, CR. +_SPACES = " \t\n\v\f\r" + + def _strip_comment(text: str) -> str: - for mark in ("#", "!"): - cut = text.find(mark) - if cut >= 0: - text = text[:cut] - return text.strip() + """A record without its comment, as CableDyn's ``scan_comment`` cuts it. + + ``#`` and ``!`` start a comment anywhere, inside a quoted token too (as + in a file path, CableDyn ``doc/options.rst``); ``--`` starts one at the + start of the record or after a separator, unless the record holds a + ``---`` rule (a section header). + """ + cuts = [cut for cut in (text.find("#"), text.find("!")) if cut >= 0] + if "---" not in text: + start = 0 + while (dash := text.find("--", start)) >= 0: + if dash == 0 or text[dash - 1] in _SPACES: + cuts.append(dash) + break + start = dash + 2 + if cuts: + text = text[: min(cuts)] + return text.strip(_SPACES) #: Keywords of the options the reader uses and their CableDyn aliases. @@ -350,6 +407,7 @@ def _strip_comment(text: str) -> str: "dtM": ("dtM", "dt"), "TMax": ("TMax",), "adaptive_mesh": ("adaptive_mesh", "adaptivemesh"), + "alpha_force_blend": ("alpha_force_blend", "alphaforceblend"), } @@ -388,8 +446,14 @@ def _option_record(row: Sequence[str]) -> tuple[str, str] | None: _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+") +#: Tokens as CableDyn's ``token_bounds`` splits a record: a token that opens +#: with a quote runs to the matching quote (separators kept) and on to the next +#: separator, or to the end of the record without one; any other token is a +#: run of non-separators. +_TOKEN = re.compile( + r"\"[^\"]*\"[^ \t\n\v\f\r]*|\"[^\"]*$|'[^']*'[^ \t\n\v\f\r]*|'[^']*$" + r"|[^ \t\n\v\f\r]+" +) def _unquote(token: str) -> str: @@ -539,9 +603,11 @@ def _line_type(row: list[str], path: Path) -> CableDynLineType: "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) + values = { + label: _float(column, f"{label} of {name}", path) + for column, label in zip(row[6:], names, strict=False) + if label != "GJ" + } ea = _plain_ea(row[3], path, name) ei, bb, alpha = _ei_column(row[5], name, path) gj: float | None = None @@ -555,7 +621,15 @@ def _line_type(row: list[str], path: Path) -> CableDynLineType: 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) + polar_inertia = values["Irn"] + # Magnitudes: a negative drag or added-mass coefficient would inject energy. + if min(values[label] for label in ("Cd_n", "Cd_t", "Ca_n", "Ca_t")) < 0.0: + raise CableSchemaError( + f"{path.name}: LINE TYPES {name}: drag and added-mass coefficients " + "(Cd_n Cd_t Ca_n Ca_t) must be non-negative" + ) + if finite_ei_row: + assert gj is not None and polar_inertia is not None if coupling != 0.0 and not ( ei > 0.0 and ea is not None and gj > 0.0 and ea * gj > coupling**2 ): @@ -570,6 +644,13 @@ def _line_type(row: list[str], path: Path) -> CableDynLineType: f"{path.name}: LINE TYPES {name}: torsional damping (GJ|K|Bt) needs a " "finite-EI cable with GJ > 0 and Irn > 0" ) + # CableDyn validates the four finite-EI values together after the row. + extra = (values["GAs"], gj, values["Irt"], polar_inertia) + if max(abs(value) for value in extra) > 0.0 and min(extra) <= 0.0: + raise CableSchemaError( + f"{path.name}: LINE TYPES {name}: explicit finite-EI GAs/GJ/Irt/Irn " + f"must all be > 0 (or all 0): {' '.join(row[6:10])}" + ) return CableDynLineType( name=name, diameter_m=_float(row[1], f"Diam of {name}", path), @@ -587,30 +668,178 @@ def _line_type(row: list[str], path: Path) -> CableDynLineType: ) -def _deck_blocks(path: Path) -> dict[str, list[list[str]]]: - """Split a deck into recognised sections of token rows (comments removed).""" +def _deck_blocks( + path: Path, +) -> tuple[dict[str, list[list[str]]], dict[str, list[str]]]: + """Split a deck into recognised sections of token rows (comments removed). + + As CableDyn reads a deck: the comment is cut first (:func:`_strip_comment`), + a record holding ``---`` is a section header named by its other + characters (every ``-`` dropped), and a section met again continues with + its rows. The records of every section are also returned as text. + """ blocks: dict[str, list[list[str]]] = {} + texts: dict[str, list[str]] = {} current: str | None = None - for raw in path.read_text(encoding="utf-8", errors="strict").splitlines(): - line = raw.strip() - if line.startswith("---"): - name = " ".join(line.strip("-").split()).casefold() + text_all = path.read_text(encoding="utf-8", errors="strict").removeprefix("\ufeff") + for raw in text_all.split("\n"): + line = _strip_comment(raw) + if "---" in line: + name = " ".join(line.replace("-", "").split()).casefold() if not name or name == "end" or "need" in name or "input file" in name: current = None continue current = _SECTION_NAMES.get(name, f"other:{name}") - if current in blocks and not current.startswith("other:"): - raise CableSchemaError(f"{path.name}: duplicate deck section {name!r}") blocks.setdefault(current, []) + texts.setdefault(current, []) continue - if current is None or not line or line.startswith("--"): + if current is None or not line: continue - text = _strip_comment(line) - if text: - # 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 + # A quoted token counts once, separators and all, as in CableDyn; + # stray quotes elsewhere are dropped. + blocks[current].append([_unquote(token) for token in _TOKEN.findall(line)]) + texts[current].append(line) + return blocks, texts + + +#: MoorDyn spellings of the RODS ``Type`` column (CableDyn ``append_rod``). +_ROD_TYPE_ALIASES = { + "anchor": "fixed", + "fix": "fixed", + "pin": "pinned", + "point": "free", + "con": "free", + "ves": "vessel", + "cpld": "coupled", + "cpldpin": "coupledpinned", + "vesselpinned": "coupledpinned", + "vespin": "coupledpinned", +} +#: Host-driven or free BODIES types CableDyn makes Rigid6 bodies. +_RIGID6_BODY_TYPES = frozenset( + {"coupled", "vessel", "cpld", "ves", "coupledpinned", "cpldpin"} + | {"vesselpinned", "vespin"} +) +_ROD_END = re.compile(r"rod(\d+)([ab])") +_BODY_ID = re.compile(r"body(\d+)") +_LOGICAL = { + **dict.fromkeys(("true", "t", "yes", "y", "on", "1"), True), + **dict.fromkeys(("false", "f", "no", "n", "off", "0"), False), +} + + +def _rods(rows: list[list[str]], path: Path) -> dict[int, tuple[str, int]]: + """RODS ``ID -> (Type, NumSegs)`` with CableDyn's spelling of the type.""" + rods: dict[int, tuple[str, int]] = {} + for row in _data_rows(rows): + if len(row) not in (10, 11): + raise CableSchemaError( + f"{path.name}: RODS row has {len(row)} columns; CableDyn reads 10 " + "plus optional Outputs (ID RodType Type XA YA ZA XB YB ZB NumSegs " + "[Outputs])" + ) + kind = row[2].casefold() + kind = _ROD_TYPE_ALIASES.get(kind, kind) + if ( + kind.startswith("body") + and len(kind) > 7 + and kind.endswith("pin") + and not kind.endswith("pinned") + ): + kind += "ned" + rods[_int(row[0], "RODS ID", path)] = (kind, _int(row[9], "NumSegs", path)) + return rods + + +def _bodies(rows: list[list[str]], path: Path) -> dict[int, str]: + """BODIES ``ID -> type``, ``rigid6`` for the types CableDyn makes Rigid6.""" + bodies: dict[int, str] = {} + for row in _data_rows(rows): + if len(row) not in (14, 15, 18): + raise CableSchemaError( + f"{path.name}: BODIES row has {len(row)} columns; CableDyn reads 14 " + "(MoorDyn), 15 or 18" + ) + kind = row[1].casefold() + # The 14-column MoorDyn row also makes a Free body Rigid6. + rigid6 = _RIGID6_BODY_TYPES | ({"free"} if len(row) == 14 else set()) + bodies[_int(row[0], "BODIES ID", path)] = "rigid6" if kind in rigid6 else kind + return bodies + + +def _end_kind( + token: str, + point_types: Mapping[str, str], + rods: Mapping[int, tuple[str, int]], + bodies: Mapping[int, str], +) -> str: + """The point type CableDyn gives a line end: a POINTS type, or a rod end + (``RA``, ``RodB`` or a ``RodA`` point) as ``rod``; a + zero-length rod is the point it collapses to, and an end of a rod fixed + to a body a point of that body (CableDyn ``resolve_rod_end_tokens``).""" + kind = point_types.get(token, "") + if not kind: + word = token.casefold() + if word.startswith("r") and not word.startswith("rod") and len(word) >= 3: + word = "rod" + word[1:] + kind = word if _ROD_END.fullmatch(word) else "" + match = _ROD_END.fullmatch(kind) + if match is None or int(match.group(1)) not in rods: + return kind + rod_type, n_segments = rods[int(match.group(1))] + body = _BODY_ID.match(rod_type) + if body is not None and (n_segments == 0 or int(body.group(1)) in bodies): + return f"body{int(body.group(1))}" + if n_segments == 0: + # CableDyn collapse_zero_length_rods (a CoupledPinned one only on a + # coupled host). + return { + "free": "free", + "fixed": "fixed", + "pinned": "fixed", + "coupled": "coupled", + "vessel": "coupled", + "coupledpinned": "coupled", + }.get(rod_type, kind) + return kind + + +def _one_end_torsion_note( + line: CableDynLine, + line_types: Mapping[str, CableDynLineType], + kinds: tuple[str, str], + rods: Mapping[int, tuple[str, int]], + bodies: Mapping[int, str], + *, + marching: bool, + force_blend: bool, +) -> str: + """Why CableDyn does not solve the torsion of a line restrained at one end + only, or ``""`` when it does (CableDyn ``resolve_one_end_torsion``).""" + types = [line_types[sec.line_type.casefold()] for sec in line.sections] + kind_a, kind_b = kinds + if not all(t.gj_Nm2 is not None and t.gj_Nm2 > 0.0 for t in types): + return "its LINE TYPES rows give no GJ (the 14-column row)" + if kind_b != "fixed": + return "its End B is not a Fixed point (torsion needs a Fixed End B)" + if marching and not force_blend: + return ( + "torsion in a dynamic run needs the force-blended generalised-alpha " + "(alpha_force_blend True)" + ) + if "a" in line.torsion_restrained_ends: + rod = _ROD_END.fullmatch(kind_a) + body = _BODY_ID.fullmatch(kind_a) + if rod is not None and int(rod.group(1)) in rods: + rod_type = rods[int(rod.group(1))][0] + if rod_type in ("coupled", "vessel"): + return "its restrained End A is on a Coupled/Vessel rod end" + if rod_type != "fixed": + return "its restrained End A is on the end of a free or pinned rod" + elif body is not None and int(body.group(1)) in bodies: + if bodies[int(body.group(1))] != "rigid6": + return "its restrained End A is on a body that is not Rigid6" + return "" def read_cabledyn_deck(path: str | Path) -> CableDynDeck: @@ -623,16 +852,20 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: 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. + ``GJ|K|Bt``); :class:`CableDynLineType` keeps them. ``EQUIVALENT + BUOYANCY`` rows replace a type's diameter and mass, as CableDyn does. + Records are cut and split as CableDyn's reader does (:func:`_deck_blocks`). Applies CableDyn's anchor-first swap (a line whose ``NodeA`` is ``Fixed`` and whose ``NodeB`` moves is reversed, with its sections and end connections), - so node 1 is End A as in every output file. + so node 1 is End A as in every output file. The BODIES and RODS rows are + read for the types of the line ends only (the swap and + :attr:`CableDynLine.torsion_solved`). """ deck_path = Path(path) if not deck_path.is_file(): raise FileNotFoundError(f"CableDyn deck not found: {deck_path}") - blocks = _deck_blocks(deck_path) + blocks, texts = _deck_blocks(deck_path) for required in ("line types", "lines"): if required not in blocks: raise CableSchemaError(f"{deck_path.name}: no {required.upper()} section") @@ -650,6 +883,7 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: raise CableSchemaError(f"{deck_path.name}: LINE TYPES has no data rows") point_types: dict[str, str] = {} + point_z: dict[str, float] = {} 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") @@ -660,6 +894,9 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: "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() + point_z[row[0]] = _float(row[4], f"Z of point {row[0]}", deck_path) + rods = _rods(blocks.get("rods", []), deck_path) + bodies = _bodies(blocks.get("bodies", []), deck_path) sections_by_line: dict[int, list[CableDynSection]] = {} for row in _data_rows(blocks.get("sections", [])): @@ -690,6 +927,7 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: 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] = {} + end_kinds: dict[int, tuple[str, str, bool]] = {} for row in _data_rows(blocks["lines"]): line_id = _int(row[0], "LINES ID", deck_path) if line_id in lines: @@ -735,19 +973,28 @@ def read_cabledyn_deck(path: str | Path) -> CableDynDeck: 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, "") + type_a = _end_kind(end_a, point_types, rods, bodies) + type_b = _end_kind(end_b, point_types, rods, bodies) + # CableDyn normalize_stock_endpoint_order: a Free/Connect NodeB swaps + # only when it is not below the Fixed NodeA (a weight hung from an + # overhead point stays as written). swap = type_a == "fixed" and ( - type_b in _MOVING_POINTS + type_b in ("coupled", "vessel") 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) + or (finite_ei and _ROD_END.fullmatch(type_b) is not None) + or ( + type_b in ("free", "connect") + and point_z.get(end_a, math.inf) <= point_z.get(end_b, -math.inf) + ) ) 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} + type_a, type_b = type_b, type_a + end_kinds[line_id] = (type_a, type_b, finite_ei) lines[line_id] = CableDynLine( line_id=line_id, end_a=end_a, @@ -768,16 +1015,22 @@ 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", []) + # As CableDyn's append_channel: names separated by spaces, tabs or + # commas, quotes dropped; a row whose first token (quotes kept) is END + # closes the channel list (stock decks). + output_rows = texts.get("outputs", []) stop = next( - (i for i, row in enumerate(output_rows) if row[0].casefold() == "end"), + ( + i + for i, row in enumerate(output_rows) + if _TOKEN.findall(row)[0].casefold() == "end" + ), len(output_rows), ) channels = tuple( - token + name for row in output_rows[:stop] - for token in " ".join(row).replace(",", " ").split() + for name in re.sub("[\"',]", " ", row).split() ) defaults = [] @@ -813,6 +1066,76 @@ def option(name: str, default: float | None) -> float | None: }: raise CableSchemaError(f"{deck_path.name}: adaptive_mesh {adaptive!r}") assert g is not None and rho is not None + t_max = option("TMax", None) + blend = (last("alpha_force_blend") or "true").casefold() + if blend not in _LOGICAL: + raise CableSchemaError(f"{deck_path.name}: alpha_force_blend {blend!r}") + + # EQUIVALENT BUOYANCY replaces a type's diameter and mass, as CableDyn + # does before it runs (apply_equivalent_buoyancy). + for row in _data_rows(blocks.get("equivalent buoyancy", [])): + if len(row) != 3: + raise CableSchemaError( + f"{deck_path.name}: EQUIVALENT BUOYANCY row needs 3 columns: " + "LineType Diam SubmergedWeightNpm" + ) + key = row[0].casefold() + if key not in line_types: + raise CableSchemaError( + f"{deck_path.name}: EQUIVALENT BUOYANCY references unknown " + f"LineType {row[0]!r}" + ) + if line_types[key].equivalent_submerged_weight_N_m is not None: + raise CableSchemaError( + f"{deck_path.name}: duplicate EQUIVALENT BUOYANCY row for " + f"LineType {row[0]!r}" + ) + diameter = _float(row[1], f"EQUIVALENT BUOYANCY Diam of {row[0]}", deck_path) + weight = _float( + row[2], f"EQUIVALENT BUOYANCY submerged weight of {row[0]}", deck_path + ) + if not diameter > 0.0: + raise CableSchemaError( + f"{deck_path.name}: EQUIVALENT BUOYANCY needs Diam > 0: {row[1]!r}" + ) + if not (g > 0.0 and rho > 0.0): + raise CableSchemaError( + f"{deck_path.name}: EQUIVALENT BUOYANCY needs g > 0 and rhoW > 0" + ) + mass = rho * (math.pi / 4.0) * diameter**2 + weight / g + if mass < 0.0: + raise CableSchemaError( + f"{deck_path.name}: EQUIVALENT BUOYANCY for LineType {row[0]!r}: " + "the equivalent section would require a negative dry mass per length" + ) + line_types[key] = replace( + line_types[key], + diameter_m=diameter, + mass_kg_m=mass, + equivalent_submerged_weight_N_m=weight, + ) + + # Which lines CableDyn solves in torsion (resolve_one_end_torsion). A + # deck without TMax is taken as a coupled (OpenFAST) deck, which marches. + marching = t_max is None or t_max > 0.0 + for line_id, line in list(lines.items()): + kind_a, kind_b, finite_ei = end_kinds[line_id] + if not line.torsion_restrained_ends or not finite_ei: + continue + note = ( + "" + if line.torsion_restrained + else _one_end_torsion_note( + line, + line_types, + (kind_a, kind_b), + rods, + bodies, + marching=marching, + force_blend=_LOGICAL[blend], + ) + ) + lines[line_id] = replace(line, torsion_solved=not note, torsion_note=note) return CableDynDeck( path=deck_path, line_types=MappingProxyType(line_types), @@ -824,7 +1147,7 @@ def option(name: str, default: float | None) -> float | None: rho_w_kg_m3=rho, water_depth_m=option("WtrDpth", None), dt_s=option("dtM", None), - t_max_s=option("TMax", None), + t_max_s=t_max, adaptive_mesh=adaptive.casefold() in {"true", "t", "yes", "y", "on", "1"}, defaults_used=tuple(defaults), ) @@ -1917,17 +2240,36 @@ def has_position(node: int) -> bool: 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: + restrained = " and ".join(sorted(line.torsion_restrained_ends)).upper() + if coupled and line.torsion_solved 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 " + f"and is restrained in torsion at End {restrained}: its " "material twist follows the stretch, so the material frame needs " f"Twist{line_id}N channels at the nodes bracketing every section" ) + marching = deck_obj.t_max_s is None or deck_obj.t_max_s > 0.0 + if line.torsion_solved and marching and not twist_available: + # Restrained at one end, CableDyn solves the nodal twist in the + # dynamics: the polar inertia Irn carries torsional waves, and a roll + # or turn of the restrained end's vessel or body twists the line + # (doc/theory.rst, a free end). Only its statics are twist-free. + raise CableSchemaError( + f"line {line_id} is restrained in torsion at End {restrained} and " + "CableDyn solves its torsion: in the dynamics the line twists " + "(torsional waves of its polar inertia, the roll of the restrained " + "end), so the material frame needs " + f"Twist{line_id}N channels at the nodes bracketing every section" + ) + checks["torsion"] = { + "restrained_ends": sorted(line.torsion_restrained_ends), + "solved": line.torsion_solved, + "not_solved_because": line.torsion_note, + "material_twist": "Twist channels" if twist_available else "none (twist-free)", + } # Main-table column plan. main_cols: list[int] = [0] @@ -2470,7 +2812,9 @@ 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 at either end. With these + ``Twist``/``Torq`` on a line CableDyn solves in torsion + (:attr:`CableDynLine.torsion_solved`; CableDyn refuses them on any other + line). 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). """ @@ -2497,7 +2841,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_ends: + if line.torsion_solved: add(f"Twist{line_id}N{node}") add(f"Torq{line_id}N{node}") return tuple(names) diff --git a/tests/data/cabledyn/lw24k.Line1.p.out b/tests/data/cabledyn/lw24k.Line1.p.out new file mode 100644 index 0000000..f67e0cb --- /dev/null +++ b/tests/data/cabledyn/lw24k.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.5304239E+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.0552892E-005 -2.0732622E+001 7.2017298E+000 -3.7134638E-006 -2.7442989E+001 8.5572153E+000 -1.1172230E-006 -3.4117953E+001 1.0170672E+001 -4.9513544E-007 -4.0734979E+001 1.2160990E+001 -1.8676677E-007 -4.7247746E+001 1.4754034E+001 4.5505092E-008 -5.3541972E+001 1.8423739E+001 2.6098062E-007 -5.9260873E+001 2.3861944E+001 4.9299242E-007 -6.3247010E+001 3.0542996E+001 7.7295340E-007 -6.3628055E+001 3.6500253E+001 1.3691159E-006 -6.0439524E+001 4.1386773E+001 1.8980609E-006 -5.6545491E+001 4.6873035E+001 2.2610475E-006 -5.3591911E+001 5.2984511E+001 2.5112760E-006 -5.2436537E+001 5.9126680E+001 2.6084306E-006 -5.3410897E+001 6.4665046E+001 2.5583420E-006 -5.6260153E+001 6.9332440E+001 2.4129505E-006 -6.0399395E+001 7.3197313E+001 2.2246245E-006 -6.5304237E+001 7.6534527E+001 1.8087026E-006 -7.0587644E+001 8.2242452E+001 1.2920515E-006 -7.7064410E+001 9.0268299E+001 1.0963228E-006 -8.0004660E+001 9.8950371E+001 8.7891938E-007 -8.0012880E+001 1.0763331E+002 5.8710901E-007 -8.0008610E+001 1.1631657E+002 2.4739186E-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.8083293E-005 -2.0732502E+001 7.2017168E+000 -8.8440551E-006 -2.7442855E+001 8.5571970E+000 -4.3949250E-006 -3.4117820E+001 1.0170653E+001 -2.6987056E-006 -4.0734847E+001 1.2160972E+001 -1.2957436E-006 -4.7247614E+001 1.4754017E+001 -1.0163601E-007 -5.3541840E+001 1.8423718E+001 1.0084314E-006 -5.9260743E+001 2.3861905E+001 2.1756841E-006 -6.3246908E+001 3.0542954E+001 3.5628241E-006 -6.3628007E+001 3.6500241E+001 6.4879771E-006 -6.0439530E+001 4.1386776E+001 9.0785639E-006 -5.6545516E+001 4.6873037E+001 1.0909459E-005 -5.3591935E+001 5.2984512E+001 1.2200715E-005 -5.2436552E+001 5.9126683E+001 1.2742890E-005 -5.3410902E+001 6.4665052E+001 1.2553561E-005 -5.6260151E+001 6.9332449E+001 1.1889223E-005 -6.0399389E+001 7.3197323E+001 1.1014810E-005 -6.5304230E+001 7.6534536E+001 8.9595522E-006 -7.0587639E+001 8.2242453E+001 6.4409514E-006 -7.7064411E+001 9.0268299E+001 5.5162166E-006 -8.0004661E+001 9.8950371E+001 4.5311850E-006 -8.0012880E+001 1.0763331E+002 3.1239178E-006 -8.0008610E+001 1.1631657E+002 1.4593368E-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.1295992E-004 -2.0732225E+001 7.2016869E+000 -1.4854278E-005 -2.7442565E+001 8.5571427E+000 -1.4726109E-005 -3.4117535E+001 1.0170608E+001 -9.7071233E-006 -4.0734559E+001 1.2160934E+001 -5.0681992E-006 -4.7247324E+001 1.4753980E+001 -1.3289040E-006 -5.3541550E+001 1.8423672E+001 2.0102373E-006 -5.9260459E+001 2.3861819E+001 5.4143174E-006 -6.3246686E+001 3.0542861E+001 9.3410415E-006 -6.3627901E+001 3.6500213E+001 1.7585302E-005 -6.0439544E+001 4.1386785E+001 2.4885272E-005 -5.6545575E+001 4.6873043E+001 3.0192445E-005 -5.3591987E+001 5.2984515E+001 3.4034282E-005 -5.2436588E+001 5.9126690E+001 3.5769605E-005 -5.3410913E+001 6.4665068E+001 3.5412578E-005 -5.6260146E+001 6.9332471E+001 3.3690241E-005 -6.0399376E+001 7.3197349E+001 3.1392472E-005 -6.5304214E+001 7.6534555E+001 2.5554780E-005 -7.0587627E+001 8.2242454E+001 1.8474945E-005 -7.7064415E+001 9.0268299E+001 1.5991011E-005 -8.0004662E+001 9.8950371E+001 1.3479152E-005 -8.0012880E+001 1.0763331E+002 9.5690411E-006 -8.0008610E+001 1.1631657E+002 4.8894738E-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.0169123E-004 -2.0731726E+001 7.2015830E+000 -4.0544262E-005 -2.7442080E+001 8.5570324E+000 -4.2038018E-005 -3.4117052E+001 1.0170533E+001 -2.5796991E-005 -4.0734068E+001 1.2160862E+001 -1.3971109E-005 -4.7246833E+001 1.4753912E+001 -5.1684390E-006 -5.3541056E+001 1.8423590E+001 2.4705640E-006 -5.9259976E+001 2.3861669E+001 1.0088912E-005 -6.3246306E+001 3.0542700E+001 1.8554635E-005 -6.3627724E+001 3.6500163E+001 3.6282939E-005 -6.0439570E+001 4.1386801E+001 5.2006891E-005 -5.6545679E+001 4.6873053E+001 6.3745937E-005 -5.3592082E+001 5.2984521E+001 7.2492841E-005 -5.2436653E+001 5.9126702E+001 7.6712309E-005 -5.3410937E+001 6.4665095E+001 7.6354198E-005 -5.6260139E+001 6.9332511E+001 7.2982882E-005 -6.0399354E+001 7.3197396E+001 6.8439966E-005 -6.5304186E+001 7.6534589E+001 5.5784592E-005 -7.0587608E+001 8.2242454E+001 4.0519071E-005 -7.7064423E+001 9.0268299E+001 3.5478203E-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.6633524E-005 -2.0730946E+001 7.2013290E+000 -1.2244661E-004 -2.7441371E+001 8.5568702E+000 -9.3357982E-005 -3.4116325E+001 1.0170415E+001 -5.4400543E-005 -4.0733331E+001 1.2160742E+001 -3.0984949E-005 -4.7246095E+001 1.4753809E+001 -1.3825748E-005 -5.3540313E+001 1.8423462E+001 9.8852508E-007 -5.9259250E+001 2.3861441E+001 1.5554634E-005 -6.3245732E+001 3.0542456E+001 3.1141320E-005 -6.3627459E+001 3.6500087E+001 6.3521890E-005 -6.0439613E+001 4.1386822E+001 9.2328466E-005 -5.6545842E+001 4.6873069E+001 1.1440382E-004 -5.3592232E+001 5.2984528E+001 1.3136658E-004 -5.2436758E+001 5.9126720E+001 1.4003987E-004 -5.3410976E+001 6.4665138E+001 1.4018638E-004 -5.6260130E+001 6.9332574E+001 1.3463791E-004 -6.0399322E+001 7.3197471E+001 1.2710118E-004 -6.5304145E+001 7.6534640E+001 1.0379744E-004 -7.0587580E+001 8.2242452E+001 7.5695719E-005 -7.7064438E+001 9.0268299E+001 6.7056476E-005 -8.0004668E+001 9.8950371E+001 5.9506576E-005 -8.0012878E+001 1.0763331E+002 4.4318324E-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.6427760E-004 -2.0729845E+001 7.2008881E+000 -2.9147123E-004 -2.7440407E+001 8.5566670E+000 -1.6743705E-004 -3.4115316E+001 1.0170225E+001 -9.9892848E-005 -4.0732317E+001 1.2160568E+001 -6.0537299E-005 -4.7245077E+001 1.4753660E+001 -3.0363894E-005 -5.3539284E+001 1.8423279E+001 -4.4602756E-006 -5.9258247E+001 2.3861121E+001 2.0602886E-005 -6.3244937E+001 3.0542114E+001 4.6585824E-005 -6.3627094E+001 3.6499977E+001 9.9546900E-005 -6.0439679E+001 4.1386848E+001 1.4685397E-004 -5.6546074E+001 4.6873089E+001 1.8411632E-004 -5.3592451E+001 5.2984538E+001 2.1365905E-004 -5.2436911E+001 5.9126744E+001 2.2955643E-004 -5.3411039E+001 6.4665197E+001 2.3119925E-004 -5.6260122E+001 6.9332664E+001 2.2311978E-004 -6.0399279E+001 7.3197580E+001 2.1202828E-004 -6.5304086E+001 7.6534711E+001 1.7360454E-004 -7.0587544E+001 8.2242448E+001 1.2709514E-004 -7.7064462E+001 9.0268299E+001 1.1379963E-004 -8.0004671E+001 9.8950371E+001 1.0354158E-004 -8.0012876E+001 1.0763331E+002 7.8554176E-005 -8.0008610E+001 1.1631657E+002 4.9329097E-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.2696999E-004 -2.0728399E+001 7.2002896E+000 -5.4862467E-004 -2.7439157E+001 8.5563980E+000 -2.6375622E-004 -3.4113999E+001 1.0169930E+001 -1.7213214E-004 -4.0731006E+001 1.2160343E+001 -1.0874153E-004 -4.7243746E+001 1.4753451E+001 -5.8380379E-005 -5.3537946E+001 1.8423032E+001 -1.6351291E-005 -5.9256937E+001 2.3860694E+001 2.3481911E-005 -6.3243899E+001 3.0541662E+001 6.3938883E-005 -6.3626623E+001 3.6499826E+001 1.4386715E-004 -6.0439773E+001 4.1386877E+001 2.1564935E-004 -5.6546386E+001 4.6873113E+001 2.7391002E-004 -5.3592751E+001 5.2984547E+001 3.2152246E-004 -5.2437125E+001 5.9126774E+001 3.4831676E-004 -5.3411130E+001 6.4665276E+001 3.5307827E-004 -5.6260116E+001 6.9332784E+001 3.4241014E-004 -6.0399224E+001 7.3197728E+001 3.2744328E-004 -6.5304010E+001 7.6534805E+001 2.6898558E-004 -7.0587501E+001 8.2242439E+001 1.9777158E-004 -7.7064497E+001 9.0268298E+001 1.7861239E-004 -8.0004675E+001 9.8950371E+001 1.6667389E-004 -8.0012874E+001 1.0763331E+002 1.2833105E-004 -8.0008611E+001 1.1631657E+002 8.5149124E-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.0643328E-003 -2.0726601E+001 7.1996064E+000 -8.6154080E-004 -2.7437589E+001 8.5559909E+000 -3.9907102E-004 -3.4112372E+001 1.0169533E+001 -2.8543481E-004 -4.0729377E+001 1.2160055E+001 -1.8108944E-004 -4.7242085E+001 1.4753173E+001 -1.0135110E-004 -5.3536280E+001 1.8422714E+001 -3.7481607E-005 -5.9255303E+001 2.3860150E+001 2.1915390E-005 -6.3242602E+001 3.0541088E+001 8.1790456E-005 -6.3626041E+001 3.6499629E+001 1.9520108E-004 -6.0439899E+001 4.1386904E+001 2.9780771E-004 -5.6546786E+001 4.6873139E+001 3.8386122E-004 -5.3593143E+001 5.2984555E+001 4.5619310E-004 -5.2437408E+001 5.9126807E+001 4.9854199E-004 -5.3411258E+001 6.4665373E+001 5.0881053E-004 -5.6260115E+001 6.9332937E+001 4.9594100E-004 -6.0399159E+001 7.3197920E+001 4.7701911E-004 -6.5303914E+001 7.6534920E+001 3.9339429E-004 -7.0587452E+001 8.2242424E+001 2.9072520E-004 -7.7064548E+001 9.0268298E+001 2.6403616E-004 -8.0004680E+001 9.8950371E+001 2.5312625E-004 -8.0012872E+001 1.0763331E+002 1.9695456E-004 -8.0008612E+001 1.1631657E+002 1.3743835E-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.1832908E-003 -2.7435678E+001 8.5553607E+000 -6.1202455E-004 -3.4110444E+001 1.0169067E+001 -4.4937772E-004 -4.0727413E+001 1.2159667E+001 -2.8055306E-004 -4.7240095E+001 1.4752830E+001 -1.6307504E-004 -5.3534272E+001 1.8422312E+001 -7.1218926E-005 -5.9253339E+001 2.3859482E+001 1.3074985E-005 -6.3241036E+001 3.0540386E+001 9.8275267E-005 -6.3625350E+001 3.6499377E+001 2.5146948E-004 -6.0440061E+001 4.1386925E+001 3.9144630E-004 -5.6547282E+001 4.6873165E+001 5.1307023E-004 -5.3593639E+001 5.2984558E+001 6.1792269E-004 -5.2437770E+001 5.9126841E+001 6.8153969E-004 -5.3411428E+001 6.4665488E+001 7.0058452E-004 -5.6260125E+001 6.9333126E+001 6.8652446E-004 -6.0399084E+001 7.3198158E+001 6.6378156E-004 -6.5303799E+001 7.6535059E+001 5.4986529E-004 -7.0587398E+001 8.2242402E+001 4.0885462E-004 -7.7064615E+001 9.0268297E+001 3.7200425E-004 -8.0004685E+001 9.8950371E+001 3.6769908E-004 -8.0012870E+001 1.0763331E+002 2.8764256E-004 -8.0008613E+001 1.1631657E+002 2.1027113E-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.9423894E-003 -2.0721982E+001 7.1982699E+000 -1.4763888E-003 -2.7433416E+001 8.5544572E+000 -9.4689844E-004 -3.4108229E+001 1.0168544E+001 -6.6157555E-004 -4.0725108E+001 1.2159151E+001 -4.1063983E-004 -4.7237786E+001 1.4752427E+001 -2.4917613E-004 -5.3531919E+001 1.8421815E+001 -1.2163092E-004 -5.9251052E+001 2.3858687E+001 -6.2939629E-006 -6.3239201E+001 3.0539549E+001 1.1116245E-004 -6.3624555E+001 3.6499065E+001 3.0984744E-004 -6.0440262E+001 4.1386934E+001 4.9373007E-004 -5.6547879E+001 4.6873188E+001 6.5963713E-004 -5.3594247E+001 5.2984553E+001 8.0592080E-004 -5.2438221E+001 5.9126874E+001 8.9764713E-004 -5.3411650E+001 6.4665620E+001 9.2970176E-004 -5.6260149E+001 6.9333351E+001 9.1627847E-004 -6.0399001E+001 7.3198446E+001 8.9003107E-004 -6.5303666E+001 7.6535219E+001 7.4092982E-004 -7.0587343E+001 8.2242372E+001 5.5490354E-004 -7.7064701E+001 9.0268295E+001 5.0348419E-004 -8.0004690E+001 9.8950370E+001 5.1613920E-004 -8.0012868E+001 1.0763331E+002 4.0335232E-004 -8.0008614E+001 1.1631657E+002 3.0788120E-004 -8.0010298E+001 1.2500000E+002 0.0000000E+000 -8.0000000E+001 diff --git a/tests/data/cabledyn/lw24k.Line1.t.out b/tests/data/cabledyn/lw24k.Line1.t.out new file mode 100644 index 0000000..b8ebcca --- /dev/null +++ b/tests/data/cabledyn/lw24k.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.3640203E+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.8229225E+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.5523869E+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.4389194E+003 1.7043270E+003 1.8413711E+003 1.5521036E+003 1.3753782E+003 1.3651996E+003 1.5241923E+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/lw24k.dat b/tests/data/cabledyn/lw24k.dat new file mode 100644 index 0000000..3e46c3b --- /dev/null +++ b/tests/data/cabledyn/lw24k.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|0|-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|0|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/lw24k.elements.out b/tests/data/cabledyn/lw24k.elements.out new file mode 100644 index 0000000..14ad79a --- /dev/null +++ b/tests/data/cabledyn/lw24k.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.2534412E-003 6.4743481E+001 6.2317693E+003 0.0000000E+000 1.0467966E+004 2.9296875E-001 +1 2 6.8114000E+000 1.3622800E+001 1.0000000E+000 1.3622800E+001 3.6220159E-003 7.2078117E+001 6.6843680E+003 8.3007812E-001 9.2616113E+003 1.5625000E-002 +1 3 1.3622800E+001 2.0434200E+001 1.0000000E+000 2.0434200E+001 4.8859642E-003 9.7230688E+001 5.4081733E+003 8.4863281E-001 7.8039795E+003 1.9238281E-001 +1 4 2.0434200E+001 2.7245600E+001 1.0000000E+000 2.7245600E+001 6.8400916E-003 1.3611782E+002 4.0759182E+003 8.3691406E-001 7.0058653E+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.2723067E+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.0101501E+003 8.5449219E-001 5.5656735E+003 2.2949219E-001 +1 7 4.0868400E+001 4.7679800E+001 1.0000000E+000 4.7679800E+001 3.5769371E-002 7.1181049E+002 -2.2016853E+003 7.0996094E-001 2.1587799E+004 1.0000000E+000 +1 8 4.7679800E+001 5.4491200E+001 1.0000000E+000 5.4491200E+001 7.4531055E-002 1.4831680E+003 -2.1507439E+004 7.7441406E-001 1.1371173E+005 1.0000000E+000 +1 9 5.4491200E+001 6.1302600E+001 0.0000000E+000 5.4491200E+001 9.9439463E-002 1.9788453E+003 -7.6323009E+004 8.4277344E-001 1.1371173E+005 0.0000000E+000 +1 10 6.1302600E+001 6.8114000E+001 0.0000000E+000 6.1302600E+001 6.6306318E-002 1.3194957E+003 -1.9694015E+004 2.5097656E-001 1.0848220E+005 0.0000000E+000 +1 11 6.8114000E+001 7.4364000E+001 1.0000000E+000 7.4364000E+001 1.5170099E-002 3.0188497E+002 -1.4801340E+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.7551696E+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.2617960E+003 8.1835938E-001 1.4840435E+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.1717020E+003 1.7871094E-001 1.4840435E+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.8521141E+003 2.0410156E-001 1.1203157E+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.5624117E+002 2.1875000E-001 5.6026146E+003 0.0000000E+000 +1 17 1.0561400E+002 1.1186400E+002 1.0000000E+000 1.1186400E+002 2.3307388E-002 4.6381701E+002 1.2457797E+003 4.6093750E-001 1.1708573E+004 1.0000000E+000 +1 18 1.1186400E+002 1.1811400E+002 0.0000000E+000 1.1186400E+002 1.1222249E-002 2.2332276E+002 -9.8382023E+003 1.0000000E+000 1.1708573E+004 0.0000000E+000 +1 19 1.1811400E+002 1.2679750E+002 1.0000000E+000 1.2679750E+002 4.4130674E-002 8.7820042E+002 -1.2315388E+004 7.2558594E-001 7.9768083E+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.8806870E+004 1.5429688E-001 1.1457474E+005 1.0000000E+000 +1 21 1.3548100E+002 1.4416450E+002 0.0000000E+000 1.3548100E+002 1.3452235E-002 2.6769947E+002 -4.1413235E+004 2.8613281E-001 1.1457474E+005 0.0000000E+000 +1 22 1.4416450E+002 1.5284800E+002 0.0000000E+000 1.4416450E+002 6.3476430E-003 1.2631810E+002 -2.4066036E+004 9.8632812E-002 1.7972949E+004 7.3632812E-001 +1 23 1.5284800E+002 1.6153150E+002 0.0000000E+000 1.5284800E+002 4.9890086E-003 9.9281270E+001 -1.1639859E+004 1.4648438E-001 1.0669339E+004 7.2167969E-001 +1 24 1.6153150E+002 1.7021500E+002 0.0000000E+000 1.6153150E+002 2.5125789E-003 5.0000321E+001 -5.7642674E+003 0.0000000E+000 4.2315238E+003 6.5136719E-001 diff --git a/tests/data/cabledyn/lw24k.out b/tests/data/cabledyn/lw24k.out new file mode 100644 index 0000000..8fa9b0b --- /dev/null +++ b/tests/data/cabledyn/lw24k.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 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 0.0000000E+000 1.3200345E+003 2.9580965E-003 4.0150449E-003 5.4673736E-003 5.0087199E-002 9.7042048E-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.3896280E+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 -5.8891809E-005 -1.5629656E-006 -5.7572950E-005 -3.0214350E-006 -5.0987361E-005 -4.2068208E-006 -4.1593512E-005 -5.1782016E-006 -3.4987277E-005 -6.0210318E-006 -3.1513283E-005 -6.8122740E-006 -3.0773412E-005 -7.6167392E-006 -3.2105058E-005 -8.4770319E-006 -3.4008514E-005 -9.3801980E-006 -3.4202559E-005 -1.0250552E-005 -2.3022347E-005 -1.0541313E-005 -2.1215701E-006 -1.0349450E-005 1.0865464E-005 1.3192314E+003 2.9410065E-003 4.0246758E-003 5.4749687E-003 5.0106382E-002 9.7063724E-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.7754568E-003 1.6943156E+002 8.9569806E-004 1.6758921E+002 1.2366627E-004 1.6498325E+002 3.2079728E-005 1.6101239E+002 1.5749978E-005 1.5419495E+002 1.0072256E-005 1.4039754E+002 7.2293871E-006 1.1202841E+002 5.2723435E-006 7.4502148E+001 5.8285149E-006 4.9269623E+001 2.5223704E-005 5.3896282E+001 1.1956147E-005 6.9501881E+001 8.0739222E-006 8.9093718E+001 4.2192160E-006 + 2.0000000000000001E-001 9.3628278E+003 0.0000000E+000 -2.1550954E-004 -5.6372406E-006 -2.0619717E-004 -1.0750594E-005 -1.8632363E-004 -1.5314673E-005 -1.6893653E-004 -1.9523518E-005 -1.5775737E-004 -2.3505859E-005 -1.5119325E-004 -2.7373248E-005 -1.4859283E-004 -3.1220516E-005 -1.4865281E-004 -3.5091431E-005 -1.4812762E-004 -3.8912061E-005 -1.4240232E-004 -4.2486160E-005 -1.0559408E-004 -4.4211991E-005 -3.4954244E-005 -4.4119600E-005 1.9541593E-005 1.3185727E+003 3.0031930E-003 4.0399033E-003 5.4699221E-003 5.0105805E-002 9.7067100E-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.5415396E-002 1.6943243E+002 -7.2348356E-005 1.6758917E+002 -5.4501778E-005 1.6498319E+002 6.1287758E-005 1.6101239E+002 5.7359746E-005 1.5419494E+002 4.0306448E-005 1.4039763E+002 2.8989535E-005 1.1202889E+002 2.0184789E-005 7.4502579E+001 2.1080736E-005 4.9270255E+001 1.0801736E-004 5.3896270E+001 4.7409020E-005 6.9501834E+001 3.3518889E-005 8.9093616E+001 1.8363757E-005 + 3.0000000000000004E-001 9.3620876E+003 0.0000000E+000 -4.3833772E-004 -1.1432323E-005 -4.2377440E-004 -2.2066740E-005 -4.0386079E-004 -3.2421553E-005 -3.9640313E-004 -4.2665815E-005 -3.9219305E-004 -5.2800194E-005 -3.8814603E-004 -6.2833267E-005 -3.8440509E-004 -7.2773005E-005 -3.7994496E-004 -8.2574551E-005 -3.7107176E-004 -9.2053629E-005 -3.5310105E-004 -1.0092150E-004 -2.8186099E-004 -1.0616729E-004 -1.4272859E-004 -1.0763885E-004 -1.8223163E-005 1.3173645E+003 3.0924130E-003 4.0120417E-003 5.4507065E-003 5.0081522E-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.0353064E-003 1.6943302E+002 -3.3224100E-003 1.6758860E+002 1.1001786E-004 1.6498317E+002 2.8093876E-004 1.6101241E+002 1.6899400E-004 1.5419490E+002 1.0168043E-004 1.4039785E+002 6.9487079E-005 1.1202991E+002 4.6716209E-005 7.4503572E+001 4.5096904E-005 4.9271570E+001 2.6456893E-004 5.3896220E+001 1.0698411E-004 6.9501750E+001 8.0392250E-005 8.9093382E+001 4.6310251E-005 + 4.0000000000000002E-001 9.3831006E+003 0.0000000E+000 -7.7897304E-004 -2.0286344E-005 -7.5394553E-004 -3.9231501E-005 -7.3180754E-004 -5.8326558E-005 -7.3589101E-004 -7.7483805E-005 -7.3622639E-004 -9.6596492E-005 -7.3388661E-004 -1.1563211E-004 -7.3008098E-004 -1.3454674E-004 -7.2298635E-004 -1.5321322E-004 -7.0724471E-004 -1.7130915E-004 -6.7730259E-004 -1.8841861E-004 -5.6864726E-004 -1.9975396E-004 -3.5136147E-004 -2.0502896E-004 -1.3792570E-004 1.3161448E+003 3.1731732E-003 3.9703352E-003 5.4702815E-003 5.0093428E-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.3099127E-002 1.6943092E+002 -2.0652429E-003 1.6758801E+002 1.8318967E-003 1.6498337E+002 7.5248863E-004 1.6101232E+002 3.4451669E-004 1.5419484E+002 1.9824941E-004 1.4039823E+002 1.3416401E-004 1.1203162E+002 9.1045138E-005 7.4505339E+001 8.3017945E-005 4.9273740E+001 4.9997845E-004 5.3896151E+001 1.9069965E-004 6.9501610E+001 1.5325589E-004 8.9092971E+001 9.2275402E-005 + 5.0000000000000000E-001 9.3876360E+003 0.0000000E+000 -1.2895627E-003 -3.3559348E-005 -1.2543941E-003 -6.5251248E-005 -1.2227716E-003 -9.7128059E-005 -1.2197770E-003 -1.2866604E-004 -1.2069837E-003 -1.5987962E-004 -1.1960844E-003 -1.9085200E-004 -1.1867150E-003 -2.2157906E-004 -1.1742539E-003 -2.5190392E-004 -1.1502723E-003 -2.8138419E-004 -1.1068708E-003 -3.0945220E-004 -9.5876243E-004 -3.2932430E-004 -6.5804346E-004 -3.4064739E-004 -3.4649065E-004 1.3149054E+003 3.1970048E-003 3.9568281E-003 5.5006822E-003 5.0074589E-002 9.7053518E-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.6824613E-002 1.6942621E+002 8.9590666E-003 1.6758858E+002 3.6904282E-003 1.6498336E+002 1.0004818E-003 1.6101208E+002 5.4615378E-004 1.5419479E+002 3.4892376E-004 1.4039880E+002 2.3543276E-004 1.1203414E+002 1.6293205E-004 7.4508097E+001 1.4801312E-004 4.9276944E+001 8.1610433E-004 5.3896121E+001 3.0860399E-004 6.9501373E+001 2.6273304E-004 8.9092358E+001 1.6331771E-004 + 6.0000000000000009E-001 9.3955344E+003 0.0000000E+000 -1.9701261E-003 -5.1254583E-005 -1.9306616E-003 -1.0042122E-004 -1.8879807E-003 -1.4942121E-004 -1.8668261E-003 -1.9748881E-004 -1.8358585E-003 -2.4487898E-004 -1.8114125E-003 -2.9167589E-004 -1.7874404E-003 -3.3782059E-004 -1.7583513E-003 -3.8310622E-004 -1.7154245E-003 -4.2701983E-004 -1.6495307E-003 -4.6887953E-004 -1.4525524E-003 -4.9963627E-004 -1.0585963E-003 -5.1913969E-004 -6.4310717E-004 1.3133048E+003 3.1783604E-003 4.0146692E-003 5.4995787E-003 5.0073162E-002 9.7050778E-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.4085305E-002 1.6758999E+002 2.5696873E-003 1.6498251E+002 1.0753416E-003 1.6101195E+002 9.5904238E-004 1.5419467E+002 6.1467166E-004 1.4039962E+002 3.8892875E-004 1.1203756E+002 2.6688240E-004 7.4512061E+001 2.5274927E-004 4.9281273E+001 1.2091811E-003 5.3896206E+001 4.7893690E-004 6.9501003E+001 4.2320758E-004 8.9091522E+001 2.6863032E-004 + 7.0000000000000007E-001 9.4009250E+003 0.0000000E+000 -2.7898368E-003 -7.2570627E-005 -2.7514104E-003 -1.4311174E-004 -2.6982361E-003 -2.1288654E-004 -2.6627924E-003 -2.8158410E-004 -2.6276773E-003 -3.4953111E-004 -2.5950543E-003 -4.1653149E-004 -2.5540738E-003 -4.8234769E-004 -2.5028236E-003 -5.4668348E-004 -2.4347892E-003 -6.0896207E-004 -2.3398713E-003 -6.6836184E-004 -2.0828478E-003 -7.1306239E-004 -1.5790055E-003 -7.4338048E-004 -1.0455368E-003 1.3118616E+003 3.1341719E-003 4.1127734E-003 5.4392201E-003 5.0073373E-002 9.7051513E-002 3.5002597E-002 8.3324565E+003 7.2631592E+003 6.1999744E+003 2.1726902E+003 1.4731877E+003 1.4038813E+003 1.6783942E+003 1.7159399E+002 2.0317161E-002 1.7085449E+002 -1.9369967E-001 1.6942097E+002 3.0285029E-002 1.6759007E+002 -7.9146976E-004 1.6498116E+002 2.3973737E-003 1.6101218E+002 1.8459548E-003 1.5419423E+002 1.0139898E-003 1.4040084E+002 5.9655322E-004 1.1204187E+002 3.9939851E-004 7.4517464E+001 4.0515597E-004 4.9286738E+001 1.6660716E-003 5.3896481E+001 7.1968926E-004 6.9500473E+001 6.4697447E-004 8.9090443E+001 4.1753307E-004 + 8.0000000000000004E-001 9.4020369E+003 0.0000000E+000 -3.7246420E-003 -9.6880246E-005 -3.6902518E-003 -1.9194716E-004 -3.6287012E-003 -2.8560172E-004 -3.5882137E-003 -3.7856175E-004 -3.5601107E-003 -4.7075309E-004 -3.5206728E-003 -5.6166183E-004 -3.4658898E-003 -6.5100370E-004 -3.3989946E-003 -7.3843253E-004 -3.3123246E-003 -8.2326579E-004 -3.1921174E-003 -9.0444172E-004 -2.8756901E-003 -9.6695310E-004 -2.2536462E-003 -1.0115642E-003 -1.5832344E-003 1.3102681E+003 3.0796396E-003 4.2060609E-003 5.3615117E-003 5.0044111E-002 9.7039231E-002 3.4989709E-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.7321332E-006 1.6498051E+002 5.9476380E-003 1.6101232E+002 2.9402382E-003 1.5419352E+002 1.4584237E-003 1.4040249E+002 8.5718421E-004 1.1204710E+002 5.6096358E-004 7.4524480E+001 6.1374287E-004 4.9293312E+001 2.1661838E-003 5.3897030E+001 1.0433583E-003 6.9499764E+001 9.4171061E-004 8.9089111E+001 6.1913872E-004 + 9.0000000000000002E-001 9.4018352E+003 0.0000000E+000 -4.7676529E-003 -1.2400343E-004 -4.7385009E-003 -2.4647396E-004 -4.6721519E-003 -3.6700976E-004 -4.6311084E-003 -4.8734451E-004 -4.6053766E-003 -6.0654175E-004 -4.5524768E-003 -7.2412577E-004 -4.4882225E-003 -8.3998026E-004 -4.4137200E-003 -9.5368797E-004 -4.3148331E-003 -1.0643979E-003 -4.1735562E-003 -1.1707563E-003 -3.8048319E-003 -1.2544818E-003 -3.0711260E-003 -1.3168312E-003 -2.2571675E-003 1.3086300E+003 3.0237287E-003 4.2691471E-003 5.3287298E-003 5.0013708E-002 9.7030721E-002 3.4975910E-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.0943818E-002 1.6498112E+002 9.8587259E-003 1.6101156E+002 3.5898843E-003 1.5419304E+002 1.9535844E-003 1.4040431E+002 1.2124710E-003 1.1205339E+002 7.6530369E-004 7.4533173E+001 8.8932925E-004 4.9300979E+001 2.6849488E-003 5.3897948E+001 1.4574141E-003 6.9498861E+001 1.3127252E-003 8.9087520E+001 8.8381106E-004 + 1.0000000000000000E+000 9.3981855E+003 0.0000000E+000 -5.9087577E-003 -1.5367812E-004 -5.8860167E-003 -3.0616629E-004 -5.8194269E-003 -4.5637352E-004 -5.7743344E-003 -6.0651609E-004 -5.7391173E-003 -7.5489223E-004 -5.6717837E-003 -9.0153244E-004 -5.6035224E-003 -1.0463567E-003 -5.5201907E-003 -1.1886619E-003 -5.4032531E-003 -1.3274038E-003 -5.2358496E-003 -1.4610012E-003 -4.8135318E-003 -1.5678776E-003 -3.9722448E-003 -1.6500711E-003 -3.0190236E-003 1.3070579E+003 2.9698570E-003 4.2916475E-003 5.3670569E-003 5.0010582E-002 9.7026045E-002 3.4961434E-002 8.3304782E+003 7.2620596E+003 6.1996556E+003 2.1735689E+003 1.4738282E+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.0608466E-002 1.6498243E+002 1.0723526E-002 1.6100957E+002 4.0256592E-003 1.5419315E+002 2.7992743E-003 1.4040611E+002 1.7267709E-003 1.1206080E+002 1.0235198E-003 7.4543567E+001 1.2371275E-003 4.9309677E+001 3.1952248E-003 5.3899328E+001 1.9671868E-003 6.9497766E+001 1.7664643E-003 8.9085665E+001 1.2241498E-003 diff --git a/tests/data/cabledyn/lw24k.static.out b/tests/data/cabledyn/lw24k.static.out new file mode 100644 index 0000000..740cc4c --- /dev/null +++ b/tests/data/cabledyn/lw24k.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.8025102E-004 1.9506736E+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.8864958E+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.4278264E-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.7042048E-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.9084298E-002 3.7978951E+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.3896280E+001 -3.6103720E+001 0.0000000E+000 +1 13 8.0328061E+001 4.6873034E+001 0.0000000E+000 -5.3591906E+001 1.4197748E+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.0625856E-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.5304239E+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.4694429E-003 8.8943779E+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.6381673E-002 1.5197368E+003 1.2782747E+002 3.7827465E+001 0.0000000E+000 +1 21 1.3490766E+002 9.0268299E+001 0.0000000E+000 -8.0004660E+001 1.3071787E+003 6.9351507E-002 1.3797579E+003 9.2398084E+001 2.3980842E+000 0.0000000E+000 +1 22 1.4358973E+002 9.8950371E+001 0.0000000E+000 -8.0012880E+001 1.3215393E+003 2.7782661E-002 5.5289895E+002 8.8715051E+001 -1.2849486E+000 0.0000000E+000 +1 23 1.5227267E+002 1.0763331E+002 0.0000000E+000 -8.0008610E+001 1.3207091E+003 1.5626392E-002 3.1096900E+002 9.0906459E+001 9.0645936E-001 0.0000000E+000 +1 24 1.6095594E+002 1.1631657E+002 0.0000000E+000 -8.0010299E+001 1.3202448E+003 4.4719221E-003 8.8992344E+001 8.9461578E+001 -5.3842166E-001 0.0000000E+000 +1 25 1.6963937E+002 1.2500000E+002 0.0000000E+000 -8.0000000E+001 1.3200345E+003 6.8886693E-004 1.3708580E+001 9.0247961E+001 2.4796068E-001 0.0000000E+000 diff --git a/tests/test_cabledyn_inputs.py b/tests/test_cabledyn_inputs.py index 6887ab9..fc2eb94 100644 --- a/tests/test_cabledyn_inputs.py +++ b/tests/test_cabledyn_inputs.py @@ -92,12 +92,6 @@ def test_at_least_one_section(tmp_path): ("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"), - ( - "--------------------- OPTIONS ---\n", - "--------------------- SECTIONS ---\n1 cable 10.0 100\n" - "--------------------- OPTIONS ---\n", - "duplicate deck section", - ), ( "ID Type X Y Z\n(-) (-) (m) (m) (m)\n1 Coupled 0 0 -10\n2 Fixed 10 0 -12\n", "", @@ -740,7 +734,324 @@ def test_finite_ei_line_to_a_rod_end_is_swapped(tmp_path): def test_outputs_end_closes_the_channel_list(tmp_path): + """An unquoted ``END`` closes the list; CableDyn takes a quoted one as a name.""" path = _deck(tmp_path / "d.dat", channels=["FairTen1", "END", "AnchTen1"]) + assert read_cabledyn_deck(path).channels == ("FairTen1", "END", "AnchTen1") + _edit(path, '"END"\n', "end\n") assert read_cabledyn_deck(path).channels == ("FairTen1",) _edit(path, '"FairTen1"\n', '"FairTen1","Ten1N2" Curv1N2\n') assert read_cabledyn_deck(path).channels == ("FairTen1", "Ten1N2", "Curv1N2") + + +# --------------------------------------------------------------------------- # +# Records as CableDyn reads them # +# --------------------------------------------------------------------------- # +def test_comments_and_headers_as_cabledyn_reads_them(tmp_path): + """``scan_comment`` and ``is_section_header`` of the CableDyn deck reader. + + ``--`` starts a comment at the start of a record or after a separator, + unless the record holds a ``---`` rule; ``#`` and ``!`` start one + anywhere. A record holding ``---`` is a header named by its other + characters, a byte-order mark is dropped and a section met again goes on. + """ + path = _deck(tmp_path / "d.dat") + _edit(path, "1 1 2 pt\n", "1 1 2 pt -- the only line\n") + _edit(path, "--------------------- POINTS ---\n", "POINTS -------- # points\n") + _edit(path, "1 Coupled 0 0 -10\n", "1 Coupled 0 0 -10\t--hang-off\n") + _edit( + path, + "--------------------- OPTIONS ---\n", + "--- SECTIONS ---\n1 cable 2.0 20\n--------------------- OPTIONS ---\n", + ) + path.write_bytes(b"\xef\xbb\xbf" + path.read_bytes()) + deck = read_cabledyn_deck(path) + line = deck.line(1) + assert line.outputs == "pt" and deck.point_types["1"] == "coupled" + assert [sec.length_m for sec in line.sections] == [10.0, 2.0] + # Not a comment: '--' inside a token, after which the row has 5 columns. + _edit(path, "1 1 2 pt -- the only line\n", "1 1 2 pt a--b\n") + with pytest.raises(CableSchemaError, match="LINES row of line 1 has 5 columns"): + read_cabledyn_deck(path) + + +@pytest.mark.parametrize("mark", ["#", "!"]) +def test_comment_marks_cut_quoted_tokens_too(tmp_path, mark): + """CableDyn cuts a record at ``#`` or ``!`` even inside quotes + (``doc/options.rst``, file paths); the reader does the same.""" + path = _deck(tmp_path / "d.dat") + _edit(path, _ROW_10, _ROW_10.replace("cable", f'"armoured{mark}cable"')) + # The cut row holds no number: a header row to CableDyn, so no type is left. + with pytest.raises(CableSchemaError, match="LINE TYPES has no data rows"): + read_cabledyn_deck(path) + + +def test_quoted_token_runs_to_the_next_separator(tmp_path): + """A token opening with a quote runs past its closing quote to the next + separator (CableDyn ``token_bounds``), so ``"a b"c`` is one token.""" + path = _deck(tmp_path / "d.dat") + _edit(path, _ROW_10, _ROW_10.replace("cable", '"armoured cable"x')) + _edit(path, "1 cable 10.0 100\n", '1 "armoured cable"x 10.0 100\n') + deck = read_cabledyn_deck(path) + assert deck.line(1).sections[0].line_type == "armoured cablex" + + +# --------------------------------------------------------------------------- # +# LINE TYPES checks # +# --------------------------------------------------------------------------- # +@pytest.mark.parametrize( + "row", + [ + "cable 0.2 40.0 5e8 0.0 2e4 -1.2 0.1 1.0 0.0\n", + "cable 0.2 40.0 5e8 0.0 2e4 1.2 0.1 1.0 -0.1 0.8\n", + _row_14("1.5e4").replace(" 1.0 0.0\n", " -1.0 0.0\n"), + ], +) +def test_negative_drag_or_added_mass_is_refused(tmp_path, row): + with pytest.raises(CableSchemaError, match="must be non-negative"): + read_cabledyn_deck(_line_types(tmp_path, row)) + + +@pytest.mark.parametrize( + "row", + [ + "cable 0.2 40.0 5e8 0.0 2e4 0 1.5e4 0.1 0.2 1.2 0.1 1.0 0.0\n", + "cable 0.2 40.0 5e8 0.0 2e4 1.9e8 0 0.1 0.2 1.2 0.1 1.0 0.0\n", + "cable 0.2 40.0 5e8 0.0 2e4 1.9e8 1.5e4 -0.1 0.2 1.2 0.1 1.0 0.0\n", + "cable 0.2 40.0 5e8 0.0 2e4 1.9e8 1.5e4 0.1 0 1.2 0.1 1.0 0.0\n", + ], +) +def test_finite_ei_columns_are_all_positive_or_all_zero(tmp_path, row): + with pytest.raises(CableSchemaError, match="GAs/GJ/Irt/Irn must all be > 0"): + read_cabledyn_deck(_line_types(tmp_path, row)) + + +def test_finite_ei_columns_all_zero_give_no_gj(tmp_path): + row = "cable 0.2 40.0 5e8 0.0 2e4 0 0 0 0 1.2 0.1 1.0 0.0\n" + line_type = read_cabledyn_deck(_line_types(tmp_path, row)).line_type("cable") + assert line_type.gj_Nm2 == 0.0 and line_type.polar_inertia_kg_m == 0.0 + + +# --------------------------------------------------------------------------- # +# EQUIVALENT BUOYANCY # +# --------------------------------------------------------------------------- # +_EQUIVALENT = ( + "--------------------- EQUIVALENT BUOYANCY ---\n" + "LineType Diam SubmergedWeight\n(-) (m) (N/m)\n" +) + + +def _equivalent(tmp_path, rows): + path = _deck(tmp_path / "d.dat") + _edit( + path, + "--------------------- POINTS ---\n", + _EQUIVALENT + rows + "--------------------- POINTS ---\n", + ) + return path + + +def test_equivalent_buoyancy_replaces_diameter_and_mass(tmp_path): + """CableDyn's ``apply_equivalent_buoyancy``: ``Diam`` becomes the row's and + the mass ``rhoW pi D^2/4 + w/g``; the LINE TYPES values are kept apart. + + Checked against CableDyn 0.4.2: the ``lw24`` deck with the row + ``buoy 0.30 -100.0`` and the same deck with ``buoy`` written as + ``Diam 0.30`` and this mass give byte-identical ``.static.out``, + ``.out`` and line files. + """ + path = _equivalent(tmp_path, "cable 0.30 -100.0\n") + line_type = read_cabledyn_deck(path).line_type("cable") + mass = 1025.0 * math.pi / 4.0 * 0.30**2 - 100.0 / 9.81 + assert line_type.diameter_m == 0.30 + assert line_type.mass_kg_m == pytest.approx(mass, rel=1e-15) + assert (line_type.line_types_diameter_m, line_type.line_types_mass_kg_m) == ( + 0.2, + 40.0, + ) + assert line_type.equivalent_submerged_weight_N_m == -100.0 + plain = read_cabledyn_deck(_deck(tmp_path / "p.dat")).line_type("cable") + assert (plain.diameter_m, plain.line_types_diameter_m) == (0.2, 0.2) + assert plain.equivalent_submerged_weight_N_m is None + # Without g and rhoW in the deck, CableDyn's defaults resolve it. + _edit(path, "9.81 g - gravity\n1025.0 rhoW - density\n", "") + default = read_cabledyn_deck(path).line_type("cable") + assert default.mass_kg_m == pytest.approx( + 1025.0 * math.pi / 4.0 * 0.30**2 - 100.0 / 9.80665, rel=1e-15 + ) + + +@pytest.mark.parametrize( + ("rows", "match"), + [ + ("cable 0.30\n", "needs 3 columns"), + ("rope 0.30 -100.0\n", "unknown LineType 'rope'"), + ("cable 0.30 -100.0\nCABLE 0.31 -90.0\n", "duplicate EQUIVALENT BUOYANCY"), + ("cable 0.0 -100.0\n", "needs Diam > 0"), + ("cable 0.1 -1000.0\n", "negative dry mass"), + ("cable 0.3 x\n", "submerged weight of cable is not numeric"), + ], +) +def test_equivalent_buoyancy_errors(tmp_path, rows, match): + with pytest.raises(CableSchemaError, match=match): + read_cabledyn_deck(_equivalent(tmp_path, rows)) + + +# --------------------------------------------------------------------------- # +# Which lines CableDyn solves in torsion # +# --------------------------------------------------------------------------- # +def _one_end(tmp_path, *, row=None, end="A", extra=""): + """The synthetic line restrained in torsion at one end only.""" + tmp_path.mkdir(exist_ok=True) + path = _deck(tmp_path / "d.dat", torsion=True) + _edit(path, _ROW_10, row or _row_14("1.5e4")) + kept = f"1 {end} Rigid 1 0 0 Rigid 0 1 0 0\n" + _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", + kept, + ) + if extra: + _edit(path, "--------------------- OPTIONS ---\n", extra) + return path + + +def test_one_end_torsion_follows_cabledyns_rules(tmp_path): + """CableDyn ``resolve_one_end_torsion``: the line is solved in torsion + only when every section gives GJ, End B is Fixed and a dynamic run is + force-blended; otherwise it runs as without the columns and section + channels does not ask for Twist (CableDyn refuses Twist channels there).""" + line = read_cabledyn_deck(_one_end(tmp_path / "a")).line(1) + assert line.torsion_solved and line.torsion_note == "" + assert "Twist1N51" in section_channels(_one_end(tmp_path / "b"), {"mid": 5.05}) + no_gj = _one_end(tmp_path / "c", row=_ROW_10) + line = read_cabledyn_deck(no_gj).line(1) + assert not line.torsion_solved and "give no GJ" in line.torsion_note + assert not any(n.startswith("Twist") for n in section_channels(no_gj, {"m": 5.0})) + blend = _one_end( + tmp_path / "d", + extra="--------------------- OPTIONS ---\nFalse alpha_force_blend\n", + ) + assert "alpha_force_blend" in read_cabledyn_deck(blend).line(1).torsion_note + _edit(blend, "1.0 TMax - duration\n", "0.0 TMax - duration\n") + assert read_cabledyn_deck(blend).line(1).torsion_solved # a static run + moving = _one_end(tmp_path / "e") + _edit(moving, "2 Fixed 10 0 -12\n", "2 Coupled 10 0 -12\n") + line = read_cabledyn_deck(moving).line(1) + assert not line.torsion_solved and "not a Fixed point" in line.torsion_note + both = read_cabledyn_deck(_deck(tmp_path / "both.dat", torsion=True)).line(1) + assert both.torsion_solved and both.torsion_restrained + + +_RODS = ( + "--------------------- RODS ---\n" + "ID RodType Type XA YA ZA XB YB ZB NumSegs Outputs\n" + "1 tube {kind} 0 0 -12 0 0 -10 4 -\n" +) +_BODIES = ( + "--------------------- BODIES ---\n" + "ID Type X Y Z Rot1 Rot2 Rot3 Mass Vol C33 C44 C55 CdA Ca\n" + "1 {kind} 0 0 -10 0 0 0 1e5 0 0 0 0 0 0\n" +) + + +@pytest.mark.parametrize( + ("end_a", "block", "solved"), + [ + ("R1B", _RODS.format(kind="Fixed"), True), + ("R1B", _RODS.format(kind="Anchor"), True), + ("Rod1B", _RODS.format(kind="Pinned"), False), + ("R1B", _RODS.format(kind="Vessel"), False), + ("R1B", _RODS.format(kind="Body1") + _BODIES.format(kind="Rigid6"), True), + ("3", _BODIES.format(kind="Rigid6"), True), + ("3", _BODIES.format(kind="Coupled"), True), + ("3", _BODIES.format(kind="Point3"), False), + ], +) +def test_restrained_end_a_on_a_rod_or_body(tmp_path, end_a, block, solved): + """A restrained End A holds the torque on a Fixed rod's end or a Rigid6 + body only (a rod fixed to a body is a point of the body).""" + path = _one_end(tmp_path) + _edit(path, "1 1 2 pt\n", f"1 {end_a} 2 pt\n") + _edit(path, "2 Fixed 10 0 -12\n", "2 Fixed 10 0 -12\n3 Body1 0 0 -10\n") + _edit( + path, + "--------------------- LINES ---\n", + block + "--------------------- LINES ---\n", + ) + line = read_cabledyn_deck(path).line(1) + assert line.torsion_solved == solved, line.torsion_note + + +def test_free_point_below_a_fixed_node_a_is_not_swapped(tmp_path): + """CableDyn swaps a line from a Fixed NodeA to a Free/Connect NodeB only + when NodeA is not above it: a weight hung from an overhead point keeps + its written order.""" + path = _deck(tmp_path / "d.dat") + _edit( + path, + "1 Coupled 0 0 -10\n2 Fixed 10 0 -12\n", + "1 Fixed 0 0 -10\n2 Free 0 0 -20\n", + ) + assert not read_cabledyn_deck(path).line(1).reversed_by_parser + _edit(path, "2 Free 0 0 -20\n", "2 Connect 0 0 -5\n") + assert read_cabledyn_deck(path).line(1).reversed_by_parser + + +def test_line_restrained_at_one_end_needs_twist_in_a_dynamic_run(tmp_path): + positions = _bending_case(np.full(3, 0.02), np.zeros(3), 3) + root, deck = _write_case(tmp_path, positions, deck_kwargs={"torsion": True}) + _edit(deck, _ROW_10, _row_14("1.5e4")) + _edit(deck, "1 B Rigid 1 0 0 Rigid 0 1 0 0\n", "") + with pytest.raises(CableSchemaError, match="CableDyn solves its torsion"): + read_cabledyn_sections(root, deck, {"s": 3.95}, pressure="none") + # Without GJ CableDyn does not solve the torsion: read twist-free. + _edit(deck, _row_14("1.5e4"), _ROW_10) + read = read_cabledyn_sections(root, deck, {"s": 3.95}, pressure="none") + assert read.histories["s"].twist_rad is None + assert read.checks["torsion"]["solved"] is False + assert "give no GJ" in read.checks["torsion"]["not_solved_because"] + + +@pytest.mark.parametrize( + ("block", "match"), + [ + (_RODS.replace(" 4 -\n", "\n").replace(" -12 0", " -12"), "RODS row has 8"), + (_BODIES.format(kind="Rigid6").replace(" 0 0\n", "\n"), "BODIES row has 13"), + ], +) +def test_rod_and_body_rows_are_counted(tmp_path, block, match): + path = _one_end(tmp_path) + _edit( + path, + "--------------------- LINES ---\n", + block + "--------------------- LINES ---\n", + ) + with pytest.raises(CableSchemaError, match=match): + read_cabledyn_deck(path) + + +def test_zero_length_rod_is_the_point_it_collapses_to(tmp_path): + """A zero-length rod is a point (CableDyn ``collapse_zero_length_rods``): + a Fixed one holds a restrained End A like a Fixed point; a Free one + makes End A a Free point, from which a Fixed NodeB below is no swap.""" + path = _one_end(tmp_path) + _edit(path, "1 1 2 pt\n", "1 R1A 2 pt\n") + rods = _RODS.format(kind="Fix").replace(" 4 -\n", " 0 -\n") + _edit( + path, + "--------------------- LINES ---\n", + rods + "--------------------- LINES ---\n", + ) + line = read_cabledyn_deck(path).line(1) + assert line.torsion_solved and not line.reversed_by_parser + _edit(path, "1 tube Fix ", "1 tube Body2 ") + line = read_cabledyn_deck(path).line(1) + assert line.torsion_solved # a point of body 2, which the deck does not define + + +def test_alpha_force_blend_must_be_logical(tmp_path): + path = _one_end( + tmp_path, extra="--------------------- OPTIONS ---\nmaybe alpha_force_blend\n" + ) + with pytest.raises(CableSchemaError, match="alpha_force_blend 'maybe'"): + read_cabledyn_deck(path) diff --git a/tests/test_cabledyn_reader.py b/tests/test_cabledyn_reader.py index ef6f249..1c879cc 100644 --- a/tests/test_cabledyn_reader.py +++ b/tests/test_cabledyn_reader.py @@ -28,7 +28,11 @@ import pytest from cablexsec.exceptions import CableSchemaError -from cablexsec.io.cabledyn import read_cabledyn_deck, read_cabledyn_sections +from cablexsec.io.cabledyn import ( + read_cabledyn_deck, + read_cabledyn_sections, + section_channels, +) from cablexsec.io.time_history_csv import read_time_history_csv DATA = Path(__file__).parent / "data" / "cabledyn" @@ -1097,17 +1101,89 @@ def test_real_cabledyn_run_with_damped_coupled_line_types(tmp_path): 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. + assert read.checks["torsion"] == { + "restrained_ends": ["a"], + "solved": True, + "not_solved_because": "", + "material_twist": "Twist channels", + } + # Without the Twist channels the coupled line cannot be read, and with + # K = 0 neither can its dynamics (lw24k). (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, + with pytest.raises(CableSchemaError, match="in the dynamics the line twists"): + read_cabledyn_sections( + *_without_twist(tmp_path / "plain", coupling=False), + sections, + curvature_check_rtol=0.5, + ) + + +@pytest.mark.full_scale +def test_real_run_of_a_line_restrained_at_one_end_twists_dynamically(tmp_path): + """``lw24k``: ``lw24g`` without the coupling (``GJ|0|Bt``), CableDyn 0.4.2. + + End A, clamped and restrained in torsion on the vessel, rolls with it; + End B is free in torsion. The statics are twist-free (a free end carries + no torque), but in the dynamics the polar inertia carries torsional waves + and the line twists (``Twist1N`` up to -1.7e-3 deg in this 1 s run, + 0.18 deg in a 30 s run of the deck): without the channels it is refused, + with them read as written. The same deck read as a static run + (``TMax 0``) needs no channels. + """ + deck = read_cabledyn_deck(DATA / "lw24k.dat") + line = deck.line(1) + assert line.torsion_solved and line.torsion_restrained_ends == {"a"} + assert deck.line_type("bare").torque_tension_coupling_Nm == 0.0 + rows = (DATA / "lw24k.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:] + ] + ) + assert np.all(channel[0] == 0.0) and np.all(channel[1:] < 0.0) + sections = {"upper": 10.0, "sag": 58.4} + read = read_cabledyn_sections( + DATA / "lw24k", deck, sections, curvature_check_rtol=0.5 + ) + weight = (58.4 - 8 * 68.114 / 10) / (68.114 / 10) + np.testing.assert_allclose( + read.histories["sag"].twist_rad, + np.radians((1 - weight) * channel[:, 0] + weight * channel[:, 1]), + ) + assert set(section_channels(deck, sections)) >= {"Twist1N9", "Torq1N10"} + for suffix in ("Line1.p.out", "Line1.t.out", "static.out", "elements.out"): + name = f"lw24k.{suffix}" + (tmp_path / name).write_bytes((DATA / name).read_bytes()) + out = (DATA / "lw24k.out").read_text(encoding="utf-8").splitlines() + keep = [i for i, name in enumerate(out[1].split("\t")) if "Twist" not in name] + (tmp_path / "lw24k.out").write_text( + "\n".join( + [out[0], *("\t".join(r.split("\t")[i] for i in keep) for r in out[1:])] + ) + + "\n", + encoding="utf-8", + ) + text = (DATA / "lw24k.dat").read_text(encoding="utf-8") + (tmp_path / "lw24k.dat").write_text(text, encoding="utf-8") + with pytest.raises(CableSchemaError, match="CableDyn solves its torsion"): + read_cabledyn_sections( + tmp_path / "lw24k", + tmp_path / "lw24k.dat", + sections, + curvature_check_rtol=0.5, + ) + (tmp_path / "lw24k.dat").write_text( + text.replace("1.0 TMax", "0.0 TMax"), encoding="utf-8" + ) + static = read_cabledyn_sections( + tmp_path / "lw24k", tmp_path / "lw24k.dat", sections, curvature_check_rtol=0.5 ) - assert plain.histories["sag"].twist_rad is None + assert static.histories["sag"].twist_rad is None + assert static.checks["torsion"]["material_twist"] == "none (twist-free)" diff --git a/tests/test_sea_state_batch_inputs.py b/tests/test_sea_state_batch_inputs.py index 16016d1..68f8fd0 100644 --- a/tests/test_sea_state_batch_inputs.py +++ b/tests/test_sea_state_batch_inputs.py @@ -23,6 +23,7 @@ _json_default, _limit_threads, _portable, + _property_check, _restore, _termination_record, _thermal_record, @@ -82,6 +83,8 @@ def test_section_checks(args, match): ({"tension_basis": "wall"}, "tension_basis"), ({"external_diameter_m": 0.0}, "external_diameter_m"), ({"property_rtol": 0.0}, "property_rtol"), + ({"torsion_rtol": -0.1}, "torsion_rtol"), + ({"torsion_rtol": math.inf}, "torsion_rtol"), ], ) def test_option_checks(kwargs, match): @@ -282,3 +285,49 @@ def test_cable_source_is_checked_before_any_run_is_read(tmp_path, cable): [SectionRequest("a", 2.0)], cable_source=tmp_path / "missing.yaml", ) + + +def _with_torsion(run, stiffness, gj, k): + """The run's deck with a 14-column LINE TYPES row (GJ|K).""" + text = run.deck.read_text(encoding="utf-8") + old = next(line for line in text.splitlines() if line.startswith("cable ")) + head = old.split()[:6] + row = " ".join([*head, "1e8", f"{gj!r}|{k!r}", "0.1", "0.2", "1.2 0.1 1.0 0.0"]) + run.deck.write_text(text.replace(old, row), encoding="utf-8") + + +def test_property_check_compares_gj_and_coupling(tmp_path, cable, stiffness): + """GJ against K_tt and the coupling ratio K/sqrt(EA GJ) against + K_et/sqrt(EA_fixed K_tt), within ``torsion_rtol`` (default 25 %).""" + (run,) = _runs(tmp_path, stiffness, amplitudes=(0.01,), probabilities=(1.0,)) + sections = [SectionRequest("a", 2.0)] + options = SeaStateBatchOptions() + (record,) = _property_check(cable, [run], sections, options) + assert record["GJ_match"] is None and record["K_match"] is None # 10 columns + gj, k = stiffness.gj_Nm2, stiffness.axial_torsion_coupling_Nm + ratio = k / math.sqrt(stiffness.ea_fixed_N * gj) + _with_torsion(run, stiffness, gj, k) + (record,) = _property_check(cable, [run], sections, options) + assert record["GJ_match"] and record["K_match"] + assert record["global_coupling_ratio"] == pytest.approx(ratio, rel=1e-12) + assert record["local_coupling_ratio"] == pytest.approx(ratio, rel=1e-12) + # An uncoupled deck of this weakly coupled cable (ratio 0.1) passes. + _with_torsion(run, stiffness, 1.2 * gj, 0.0) + (record,) = _property_check(cable, [run], sections, options) + assert record["GJ_match"] and record["K_match"] + _with_torsion(run, stiffness, 1.5 * gj, k) + with pytest.raises(CableInputError, match=r"GJ .* N·m² against"): + _property_check(cable, [run], sections, options) + wrong = -0.2 * math.sqrt(stiffness.ea_fixed_N * gj) + _with_torsion(run, stiffness, gj, wrong) + with pytest.raises(CableInputError, match=r"K .* \(coupling ratio -0.2\)"): + _property_check(cable, [run], sections, options) + (record,) = _property_check( + cable, [run], sections, SeaStateBatchOptions(allow_property_mismatch=True) + ) + assert record["GJ_match"] and record["K_match"] is False + assert record["EA_match"] and record["EI_within_bounds"] + (record,) = _property_check( + cable, [run], sections, SeaStateBatchOptions(torsion_rtol=0.4) + ) + assert record["K_match"] diff --git a/validation/validation_report.md b/validation/validation_report.md index d1ed28d..037e716 100644 --- a/validation/validation_report.md +++ b/validation/validation_report.md @@ -73,7 +73,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: `34 passed` +- full_scale: `35 passed` Run `pytest -m ` to reproduce each group.