diff --git a/CHANGELOG.md b/CHANGELOG.md index 29c376c6..264bf097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -190,6 +190,18 @@ All notable changes to CableDyn are recorded in this file. The format follows ### Fixed +- The side a finite-EI line leaves its vertical plane to in an in-plane current past the + pitchfork (the grounded run turned sideways on the seabed) followed the line's heading, not + the line. The symmetry-breaking cross-flow was taken from the line's local frame, which is + the identity for any chord without a y component, so a chord along -x took it at +y (to its + right) and a chord a round-off away from -x at -y (to its left), and a deck rotated by 180 + degrees about the vertical left to the same global side as the original. The cross-flow now + points to the left of the horizontal chord from the anchor (End B) to the fairlead (End A) + whatever its heading (+y for a vertical chord, as before), so the rotated deck reaches the + rotated equilibrium. A deck whose chord points exactly along -x and that reaches this branch + now leaves to the other side: the mirror image, with the same end forces. The statics matrix + checks the side of the deck and of its 180-degree rotation, and that a cross current of the + deck's own picks the side (mirror twins to 1e-6). The theory page states the rule. - The statics of a finite-EI line through the free surface could fail at isolated currents: each Gauss point's hydrodynamic load switched on and off at the surface, so the residual jumped and an equilibrium with a point at the waterline had no root (a light lazy-wave cable, diff --git a/doc/theory.rst b/doc/theory.rst index 0f8b3914..8ce9d1be 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -2609,7 +2609,12 @@ pitchfork: the equilibrium beyond it turns the grounded run sideways on the seab anchor and back (a lazy wave in a 0.7 to 1.2 m/s current along its plane, for example). Newton cannot leave the plane of a symmetric problem, so the line is then solved in 3D under the current with a cross-flow of 1 % of its horizontal speed, and that state is polished at -the exact current and audited like any other. A planar equilibrium in such a current is also +the exact current and audited like any other. The cross-flow points to the left of the +horizontal chord from the anchor (End B) to the fairlead (End A), along :math:`+y` for a +vertical chord, so the side the line leaves its plane to turns with the line: the same deck +rotated about the vertical reaches the rotated equilibrium. Both sides are equilibria of the +symmetric problem; a deck that needs one gives its current a small cross component of its own, +and the static solve then follows that side. A planar equilibrium in such a current is also checked with the line free to leave its plane; one that is a saddle there (the grounded run held in the plane only by the symmetry) is replaced by this 3D solve; when the 3D solve finds no equilibrium, the planar one is kept and a note says that it is held in the plane of the line diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index d0e7d5b5..4899abe6 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -4696,7 +4696,16 @@ LOGICAL FUNCTION symmetric_current_retry() RESULT(retry) ALLOCATE (fixed_dofs(6)) fixed_dofs = [1, 2, 3, ndof - 5, ndof - 4, ndof - 3] sym_broken = .TRUE. - nrm = [-frame_cs(2), frame_cs(1)] + ! The cross-flow points to the left of the horizontal chord from the anchor (End B) to the + ! fairlead (End A), +y for a vertical chord, so the side the line leaves its plane to + ! follows the line, not its heading: frame_cs is the identity for any chord without a y + ! component, which put the cross-flow at +y for a chord along -x (to its right) and at -y + ! for one a round-off away from it (to its left). + IF (hspan > 1.0e-9_wp*MAX(1.0_wp, ABS(dxh) + ABS(dyh))) THEN + nrm = [-dyh, dxh]/hspan + ELSE + nrm = [CD_ZERO, CD_ONE] + END IF uh = NORM2(cur_obj%velocity(1:2)) cur_obj%velocity(1:2) = cur_obj%velocity(1:2) + SYM_BREAK*uh*nrm IF (ALLOCATED(cur_obj%profile_velocity)) THEN diff --git a/tests/data/cable_statics_matrix.json b/tests/data/cable_statics_matrix.json index c1b3541c..029b444c 100644 --- a/tests/data/cable_statics_matrix.json +++ b/tests/data/cable_statics_matrix.json @@ -1486,7 +1486,49 @@ "lambda_over_length": 0.0 } }, - "note": "past its anchor, where it folds back" + "note": "past its anchor, where it folds back", + "side": "+y" + }, + { + "id": "CUR_1013__rot180", + "expect": "admissible", + "why": "The parent rotated by 180 degrees about z. Past the pitchfork of the in-plane current the symmetry-breaking pass adds a cross-flow to the left of the horizontal chord from the anchor (End B) to the fairlead (End A), so the rotated deck reaches the rotated equilibrium and leaves its plane to -y. Before, a chord without a y component always took the cross-flow at +y, so the parent (its chord from the anchor along -x) and this deck left to the same global side.", + "deck": "--------------------- CableDyn Input File ---------------------------\nCUR_1013__rot180\n--------------------- LINE TYPES ------------------------------------\nTypeName Diam MassDenInAir EA BA EI Cd_n Cd_t Ca_n Ca_t\n(-) (m) (kg/m) (N) (-) (N-m2) (-) (-) (-) (-)\nbare 0.1784650716 82.63060908 255233842 0 25945.91551 1.2 0.1 1 0\nbuoy 0.4710966462 88.94142595 255233842 0 40205.41756 1.2 0.1 1 0\n--------------------- POINTS ----------------------------------------\nID Type X Y Z\n(-) (-) (m) (m) (m)\n1 Coupled 0 0 -13.08348484\n2 Fixed -41.77649681 0 -42.543\n--------------------- LINES -----------------------------------------\nID NodeA NodeB Outputs\n(-) (-) (-) (-)\n1 1 2 -\n--------------------- SECTIONS --------------------------------------\nLineID LineType Length NumSegs\n(-) (-) (m) (-)\n1 bare 20.5504 2\n1 buoy 7.3589 1\n1 bare 35.1167 4\n--------------------- OPTIONS ---------------------------------------\n9.80665 g\n1025.0 rhoW\n42.543 WtrDpth\n3e+06 kBot\n1.0e4 cBot\n0.05 dtM\n0.0 TMax\nFalse adaptive_mesh\nTrue tensile_safety\nuniform -1.906 0.0 0.0 current\n--------------------- OUTPUTS ---------------------------------------\n\"FairTen1\"\n\"AnchTen1\"\n--------------------- need this line --------------------------------\n", + "lines": { + "1": { + "oracle_tfair": [], + "lambda_over_length": 0.0 + } + }, + "side": "-y", + "twin_of": "CUR_1013" + }, + { + "id": "CUR_1013__xp", + "expect": "admissible", + "why": "A cross current toward +y of 2 % of the in-plane current picks the side: the grounded run, folded back past its anchor, lies at -y.", + "deck": "--------------------- CableDyn Input File ---------------------------\nCUR_1013__xp\n--------------------- LINE TYPES ------------------------------------\nTypeName Diam MassDenInAir EA BA EI Cd_n Cd_t Ca_n Ca_t\n(-) (m) (kg/m) (N) (-) (N-m2) (-) (-) (-) (-)\nbare 0.1784650716 82.63060908 255233842 0 25945.91551 1.2 0.1 1 0\nbuoy 0.4710966462 88.94142595 255233842 0 40205.41756 1.2 0.1 1 0\n--------------------- POINTS ----------------------------------------\nID Type X Y Z\n(-) (-) (m) (m) (m)\n1 Coupled 0 0 -13.08348484\n2 Fixed 41.77649681 0 -42.543\n--------------------- LINES -----------------------------------------\nID NodeA NodeB Outputs\n(-) (-) (-) (-)\n1 1 2 -\n--------------------- SECTIONS --------------------------------------\nLineID LineType Length NumSegs\n(-) (-) (m) (-)\n1 bare 20.5504 2\n1 buoy 7.3589 1\n1 bare 35.1167 4\n--------------------- OPTIONS ---------------------------------------\n9.80665 g\n1025.0 rhoW\n42.543 WtrDpth\n3e+06 kBot\n1.0e4 cBot\n0.05 dtM\n0.0 TMax\nFalse adaptive_mesh\nTrue tensile_safety\nuniform 1.906 0.03812 0.0 current\n--------------------- OUTPUTS ---------------------------------------\n\"FairTen1\"\n\"AnchTen1\"\n--------------------- need this line --------------------------------\n", + "lines": { + "1": { + "oracle_tfair": [], + "lambda_over_length": 0.0 + } + }, + "side": "-y" + }, + { + "id": "CUR_1013__xm", + "expect": "admissible", + "why": "CUR_1013__xp with the cross current toward -y: the mirror image of its equilibrium.", + "deck": "--------------------- CableDyn Input File ---------------------------\nCUR_1013__xm\n--------------------- LINE TYPES ------------------------------------\nTypeName Diam MassDenInAir EA BA EI Cd_n Cd_t Ca_n Ca_t\n(-) (m) (kg/m) (N) (-) (N-m2) (-) (-) (-) (-)\nbare 0.1784650716 82.63060908 255233842 0 25945.91551 1.2 0.1 1 0\nbuoy 0.4710966462 88.94142595 255233842 0 40205.41756 1.2 0.1 1 0\n--------------------- POINTS ----------------------------------------\nID Type X Y Z\n(-) (-) (m) (m) (m)\n1 Coupled 0 0 -13.08348484\n2 Fixed 41.77649681 0 -42.543\n--------------------- LINES -----------------------------------------\nID NodeA NodeB Outputs\n(-) (-) (-) (-)\n1 1 2 -\n--------------------- SECTIONS --------------------------------------\nLineID LineType Length NumSegs\n(-) (-) (m) (-)\n1 bare 20.5504 2\n1 buoy 7.3589 1\n1 bare 35.1167 4\n--------------------- OPTIONS ---------------------------------------\n9.80665 g\n1025.0 rhoW\n42.543 WtrDpth\n3e+06 kBot\n1.0e4 cBot\n0.05 dtM\n0.0 TMax\nFalse adaptive_mesh\nTrue tensile_safety\nuniform 1.906 -0.03812 0.0 current\n--------------------- OUTPUTS ---------------------------------------\n\"FairTen1\"\n\"AnchTen1\"\n--------------------- need this line --------------------------------\n", + "lines": { + "1": { + "oracle_tfair": [], + "lambda_over_length": 0.0 + } + }, + "side": "+y", + "mirror_of": "CUR_1013__xp" }, { "id": "LWM_1002", diff --git a/tests/test_cable_statics_matrix.py b/tests/test_cable_statics_matrix.py index ad2b0f5f..64d5a9fa 100644 --- a/tests/test_cable_statics_matrix.py +++ b/tests/test_cable_statics_matrix.py @@ -40,7 +40,14 @@ parent profile at the same unstretched arc length; * at-rest twins (the parent deck marched in time with nothing moving) must report the line-end forces of the static solution at every output step: FairTen/AnchTen are the - end forces of the committed state, identical for the static and the dynamic run. + end forces of the committed state, identical for the static and the dynamic run; +* a deck with a ``side`` must leave its vertical plane to that side (``+y`` or ``-y``, its + recorded equilibrium): past the pitchfork of an in-plane current the symmetry-breaking pass + adds a cross-flow to the left of the horizontal chord from the anchor (End B) to the + fairlead (End A), so the deck rotated by 180 degrees about z leaves to the opposite global + side, and a small cross current of the deck's own picks the side; +* mirror twins (``mirror_of``: the parent deck reflected in y) must reach the mirror image of + the parent's equilibrium: end forces within 1e-6, nodes within 1e-6 of the line length. usage: test_cable_statics_matrix.py --exe --cases --output """ @@ -285,6 +292,38 @@ def check_case(case: dict, res: dict) -> list: return errs +def side_errors(res: dict, side: str) -> list: + """The side a line turned to out of its vertical plane: the node farthest from y = 0 lies at + +y or -y (``side``) by more than 1e-3 of the line length.""" + errs = [] + for lid, rows in res["static"].items(): + length = rows[-1][0] - rows[0][0] + y = max((r[2] for r in rows), key=abs) + if abs(y) <= 1e-3 * length or (y > 0.0) != (side == "+y"): + errs.append("line %s turned to y = %.4g m, expected the %s side" % (lid, y, side)) + return errs + + +def mirror_errors(res: dict, pr: dict, parent: str) -> list: + """The mirror image in y of the parent's equilibrium: end forces within 1e-6, every node's x + and z equal and y opposite within 1e-6 of the line length.""" + errs = [] + for name, v in res["forces"].items(): + vp = pr["forces"].get(name) + if vp is None or abs(v - vp) > 1e-6 * max(abs(vp), 1.0): + errs.append("%s %.9g differs from its mirror %s (%s)" % (name, v, parent, vp)) + for lid, rows in res["static"].items(): + prow = pr["static"].get(lid) + if not prow or len(prow) != len(rows): + errs.append("line %s has no matching profile in %s" % (lid, parent)) + continue + length = rows[-1][0] - rows[0][0] + dev = max(max(abs(r[1] - p[1]), abs(r[2] + p[2]), abs(r[3] - p[3])) for r, p in zip(rows, prow)) + if dev > 1e-6 * length: + errs.append("line %s departs %.3g m from the mirror of %s" % (lid, dev, parent)) + return errs + + def mesh_twin_errors(res: dict, pr: dict, parent: str) -> list: """The same equilibrium on a refined mesh: FairTen within 0.5 %, every node within 1e-3 of the line length of the parent profile interpolated at its unstretched arc length.""" @@ -376,6 +415,15 @@ def main() -> int: errs.append("mesh parent %s did not converge" % mesh) else: errs += mesh_twin_errors(res, pr, mesh) + if case.get("side") and not errs: + errs += side_errors(res, case["side"]) + mirror = case.get("mirror_of") + if mirror and not errs: + pr = byid.get(mirror) + if pr is None or pr["rc"] != 0 or "forces" not in pr: + errs.append("mirror parent %s did not converge" % mirror) + else: + errs += mirror_errors(res, pr, mirror) status = "FAIL" if errs else "ok" print("%-4s %-18s %-14s rc=%-7s %6.2fs wall %6.2fs cpu %s" % ( status, case["id"], case["expect"], res["rc"], res["time"], res["cpu"], "; ".join(errs)[:400]))