diff --git a/CHANGELOG.md b/CHANGELOG.md index 83ac53d1..08fa1f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,9 +31,8 @@ All notable changes to CableDyn are recorded in this file. The format follows re-steps such a cable at every outer iteration and couples the junction coordinates of its two objects through its finite-difference end-to-end stiffness in one Newton matrix (on a stiff taut cable between light bodies, dropping that coupling took 9.2 mean outer iterations and 300 step - halvings over 100 steps, against 3.9 and none); a pinned cable with one moving end is coupled at - the predictor whichever end that is, and an end on a fixed rod's end is the `Fixed` end there - (byte for byte). `bodyIC static` balances both objects on the cubic-Hermite cable, its passes + halvings over 100 steps, against 3.9 and none); an end on a fixed rod's end is the `Fixed` end + there (byte for byte). `bodyIC static` balances both objects on the cubic-Hermite cable, its passes accelerated by Anderson mixing: a stiff (EI 1e6 N m^2) clamped cable between two unequal moored bodies, out of their plane, converges in 8 passes, written in either direction, to the same equilibrium. Two identical bodies stay mirror images to the output precision, a body joined to @@ -354,6 +353,33 @@ All notable changes to CableDyn are recorded in this file. The format follows ### Fixed +- A finite-EI cable pinned to a light moving object no longer throws it off its static start in + the monolithic multibody step. Such a cable (pinned at a Rigid6 body point or a free or pinned + rod end, the other end held) was stepped once per step with the predicted motion of its + attachment and its end force held through the iterations, an explicit coupling that diverges + once the cable's dynamic end stiffness times `dtM^2` exceeds about 0.85 of the object's mass + along the cable. It is now re-stepped at every outer iteration with its end stiffness in the + Newton matrix, as a clamped cable already was. A 3 t free rod spar with a 55 m cable (EA 5e8 N) + pinned at either rod end, at `dtM` 0.01 s: the cable tension rose from 11 kN past 1 MN in + 0.7 s and the rod end moved 6.3 to 6.5 m in 2 s (5.4 m in a current, 6.1 m with the cable from + a fixed rod's end); it now holds to 2e-10 m and 3e-8 of the tension (6e-4 m in the current, + as on the staggered scheme), and the monolithic and staggered schemes agree to 2e-10 m. With a + 1500 kg clump on that cable the rod moved 15 m in 3 s; it holds to 1.1e-6 m (`line_attachments` + 11 and 12 march at `dtM` 0.01 s again). A 4 t buoy with a pinned keel cable moved 0.22 m and + its cable tension reached 38 times its start; it now holds to 1e-9 m. Decks with a pinned cable + on a heavy body change at the accuracy of the old coupling: on the `mixed_body_rods_points` + example (150 t buoy) the body motion changes by 3.5e-5 m, its error against a run at `dtM` / 4 + falling from 3.7e-5 m to 1.6e-6 m, and the cable top tension by 0.6 N of 8.1 kN; that deck runs + about 45 % longer. +- A finite-EI cable whose End A rests on the seabed below its End B (a cable written from a seabed + termination, such as a fixed rod's end, up to a floater) takes the catenary-continuation static + route again. Its catenary seed refused the line (the fairlead, End A, must sit above the bed), + so the mesh-sequenced route alone solved it, and its branch depended on platform round-off: a + 55 m cable from a fixed rod's end on the seabed to a free spar rod solved on Windows and + reached a kinked state (max h kappa 1.96) on Linux gfortran, which failed the deck. The seed + is now laid from End A, the line seen from its other end, and its nodes put back in order. The + deck starts at the same equilibrium as before on Windows (1e-7 m, 6e-4 N), and moving the fixed + rod by 1 ulp either way or 1e-12 m up leaves the rod's start unchanged (0 m). - A rod numbered as a body no longer joins the body's attachment points. A `RodA/B` end point keeps its rod's id where a `Body` point keeps its body's, and the body's point list took every point with its id: a rod end POINT row listed before the body's points became the body's diff --git a/CMakeLists.txt b/CMakeLists.txt index 87526527..869b3af8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2214,6 +2214,11 @@ target_link_libraries(test_cable_between_bodies PRIVATE cabledyn_core) add_test(NAME cable_between_bodies COMMAND test_cable_between_bodies) set_tests_properties(cable_between_bodies PROPERTIES LABELS "fortran;driver;integration;dynamic;static") +add_executable(test_pinned_cable_light_object tests/test_pinned_cable_light_object.f90) +target_link_libraries(test_pinned_cable_light_object PRIVATE cabledyn_core) +add_test(NAME pinned_cable_light_object COMMAND test_pinned_cable_light_object) +set_tests_properties(pinned_cable_light_object PROPERTIES LABELS "fortran;driver;integration;dynamic") + add_executable(test_section_curvature tests/test_section_curvature.f90) target_link_libraries(test_section_curvature PRIVATE cabledyn_core) add_test(NAME section_curvature COMMAND test_section_curvature) diff --git a/doc/driver_format.md b/doc/driver_format.md index ed01706b..fba25861 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -412,10 +412,10 @@ connection moment at every connected end, and at both ends of a cable between tw spring to its own object, so a stiff cable with both ends on one body (or between two light objects) is resolved there only as far as `dtM` allows; the monolithic scheme couples it in its Newton matrix; -- a cable re-stepped at every outer iteration of the monolithic step is one connected at an end - on a moving object or one between two moving objects (Rigid6 bodies, free or pinned rods); - a pinned cable with one moving end is coupled at the predictor, whichever end that is, and an - end on a fixed rod's end is the `Fixed` end there; +- the monolithic step re-steps at every outer iteration every cable with an end, pinned or + connected, on a moving object (a Rigid6 body, a free or pinned rod), with its end stiffness in + the Newton matrix, so a light object on a stiff cable is as stable as a heavy one; an end on a + fixed rod's end is the `Fixed` end there; - every `Free`/`Connect` point carries at least one EI = 0 line; - `motionFile` and `Coupled`/`Vessel` rods are rejected by name. diff --git a/doc/theory.rst b/doc/theory.rst index 9be55fbb..12380951 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1623,7 +1623,9 @@ mesh-sequenced route described below first and this route as its fallback): declared seabed plane (flat ``WtrDpth``, or the least-squares plane of a structured bathymetry along the chord) or hung in mid-water when there is no seabed. The solve runs in the vertical plane of the chord, translated to the anchor, so a translated or rotated deck gives the same - numbers to round-off. Over a bathymetry that is not a plane along the chord (a surveyed + numbers to round-off. A line whose End A (the fairlead) rests on the seabed below its End B, + such as a cable written from a seabed termination up to a floater, is seeded from End A, the + same catenary seen from its other end, with its nodes put back in order. Over a bathymetry that is not a plane along the chord (a surveyed seabed with roughness, bumps or dips), the seed laid on the fitted plane meets the actual bed wherever the bed rises above that plane: every seed node deeper below the actual bed than its static penalty penetration (nodal submerged weight over the nodal contact stiffness @@ -2571,10 +2573,14 @@ linear spring-mass body conserved to :math:`5\times10^{-10}` at :math:`\Delta t` :math:`\rho_\infty`; observed order 2 in positions and fairlead tensions on the moored buoy and in surge, heave and pitch on the V-SP spar; gyroscopic precession of a torque-free symmetric top at second order; and an error no larger than the staggered scheme's at :math:`\Delta t` = 0.1 s and -0.05 s on the moored buoy and rod spar. A finite-EI cable pinned to its object is stepped once -per step with the attachment motion of the Newmark predictor, and its end force is held -through the iterations; a cable clamped to its object is re-stepped at every outer iteration -(*Cables clamped to bodies and rods*, below). Standalone decks with a ``motionFile``, a +0.05 s on the moored buoy and rod spar. A finite-EI cable with an end on a moving object, pinned +or clamped, is re-stepped at every outer iteration (*Cables clamped to bodies and rods*, below; +a pinned end returns no moment). Coupling a pinned cable at the predictor instead (stepped once +with the predicted end motion, its end force held through the iterations) is explicit: with +:math:`K_e` the cable's condensed dynamic end stiffness and :math:`m_e` the object's effective mass +along it at the attachment, the error grows from step to step once :math:`K_e\Delta t^2/m_e` +exceeds about 0.85, so a light rod or buoy on a stiff cable diverges from a balanced start. +Standalone decks with a ``motionFile``, a ``FAILURE`` section, or Coupled/Vessel rods, and the OpenFAST and C-API coupled routes, use the staggered scheme. @@ -2764,7 +2770,8 @@ stretch) stays free. The cable returns to the object its end force at the attach connection moment :math:`\mathbf{M}_e = \mathbf{m}\times\mathbf{g}_m`, with :math:`\mathbf{g}_m` the constraint (or spring) force on the tangent coordinates. In the monolithic step the cable is re-stepped from the step entry at every outer iteration with the -iterate's end-of-step motion, orientation, angular velocity and angular acceleration, and its +iterate's end-of-step motion, orientation, angular velocity and angular acceleration (a pinned +end, which the monolithic step couples the same way, takes the motion only), and its end force and moment load the object at the force level :math:`(1-\alpha_f)\,\mathbf{f}_{n+1} + \alpha_f\,\mathbf{f}_n`. Its condensed dynamic end stiffness with respect to the object's translation and rotation enters the Newton matrix by diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 2141712b..ec80fc40 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -988,7 +988,8 @@ MODULE CableDyn_DeckDriver ! End A (cab_kind_b 0: a Fixed End B, held), cab_clamp_b its connection or torsion frame on its ! object, and the *_b loads those of End B on its object. cab_imp: the cable is re-stepped at ! every outer iteration of the monolithic step with its end stiffness in the Newton matrix - ! (cab_clamp, or an End B on an object: the cable then couples the groups of its two objects). + ! (an end, pinned or connected, on an object the march moves; with both ends on objects the + ! cable couples the groups of its two objects). INTEGER, ALLOCATABLE :: cab_kind_b(:), cab_obj_b(:) REAL(wp), ALLOCATABLE :: cab_off_b(:, :) LOGICAL, ALLOCATABLE :: cab_clamp_b(:), cab_imp(:) @@ -5595,7 +5596,7 @@ RECURSIVE SUBROUTINE hermite_static_primary(anchor, fairlead, l0, ea, ei, w, dia INTEGER :: nnode, ne, i, es, cont_iters, polish_iters, budget_cont, cmode, k_walk ! Anchor retreats tried for a line too long for its span (see seed_walk). INTEGER, PARAMETER :: WALK_MAX_TRIES = 6 - LOGICAL :: walk_ok, fold + LOGICAL :: walk_ok, fold, rev_seed CHARACTER(1024) :: walk_msg_c REAL(wp) :: walk_d, a_seed(3) CHARACTER(1024) :: walk_msg @@ -5606,6 +5607,7 @@ RECURSIVE SUBROUTINE hermite_static_primary(anchor, fairlead, l0, ea, ei, w, dia REAL(wp) :: lambda0, ratio, span(2), span_len, t, xg, yg, zf, sx, sz, sxx, sxz, xl, yl REAL(wp) :: res_cont, cont_tol, phi, penetration, zfit(NFIT), fit_misfit, fine_limit, seed_bed, anchor_bed REAL(wp), ALLOCATABLE :: pos(:), q_seed(:), q_cont(:), curv_cont(:), knnode(:), tdir(:, :), stretch(:) + REAL(wp), ALLOCATABLE :: pos_r(:), l0_r(:), ea_r(:), w_r(:) CHARACTER(1024) :: em ErrStat = CD_HCSTAT_OK @@ -5733,6 +5735,7 @@ RECURSIVE SUBROUTINE hermite_static_primary(anchor, fairlead, l0, ea, ei, w, dia walk_d = CD_ZERO a_seed = a_l walk_msg = '' + rev_seed = .FALSE. seed_walk: DO k_walk = 0, WALK_MAX_TRIES IF (laid) THEN ErrStat = CD_HCSTAT_OK @@ -5780,7 +5783,33 @@ RECURSIVE SUBROUTINE hermite_static_primary(anchor, fairlead, l0, ea, ei, w, dia seed_bed = zf END IF END IF - IF (contact_enabled) THEN + ! A fairlead (End A) on or below the seabed plane under a raised anchor (End B): a cable + ! from a seabed termination up to a floater, written from the seabed end. The catenary is + ! the same line seen from its other end, so it is seeded with the ends exchanged (End A + ! the anchor on the bed, the bed plane and its slope seen from there) and its nodes put + ! back in order. Without it the route refused the seed (the fairlead must be above the + ! bed) and left the line to the mesh-sequenced route, whose branch on such a line + ! depended on platform round-off (a kinked equilibrium on one, the cable's own on + ! another). No anchor walk follows a reversed seed. + rev_seed = contact_enabled .AND. k_walk == 0 .AND. .NOT. fold .AND. & + f_l(3) <= seed_bed + seabed_slope*span_len .AND. a_l(3) > seed_bed + IF (rev_seed) THEN + ALLOCATE (pos_r(3*nnode)) + l0_r = l0(ne:1:-1) + ea_r = ea(ne:1:-1) + w_r = w(ne:1:-1) + CALL CD_Catenary_Seed(f_l, a_seed, l0_r, ea_r, w_r, pos_r, horizontal_tension, grounded_length, es, em, & + seabed_z=seed_bed + seabed_slope*span_len, seabed_slope=-seabed_slope) + IF (es == CD_CAT_OK) THEN + DO i = 1, nnode + pos(3*(i - 1) + 1:3*i) = pos_r(3*(nnode - i) + 1:3*(nnode - i + 1)) + END DO + ELSE + ErrStat = CD_HCSTAT_NOCONVERGE + ErrMsg = 'catenary seed unavailable (the line seeded from its End A on the seabed): '//TRIM(em) + RETURN + END IF + ELSE IF (contact_enabled) THEN CALL CD_Catenary_Seed(a_seed, f_l, l0, ea, w, pos, horizontal_tension, grounded_length, es, em, & seabed_z=seed_bed, seabed_slope=seabed_slope) ELSE @@ -21530,9 +21559,7 @@ SUBROUTINE write_multibody_dynamic_out(deck_path, out_root, channels, types, bod pc(pb)%ptype = 'coupled' mb%cab_clamp_b(c) = cab_lines(c)%endconn_mode(2) /= CD_ENDCONN_PINNED .OR. line_torsion_at_b(cab_lines(c)) ! re-stepped inside the outer Newton when End A is connected, otherwise set with the - ! attachments below: when End B is connected on an object that moves, or both ends' objects - ! move; a cable with one moving end on an object is coupled at the predictor (pinned) or - ! implicitly (connected) whichever end that is + ! attachments below: whenever either end's object moves (implicit coupling, see there) mb%cab_imp(c) = mb%cab_clamp(c) BLOCK TYPE(DeckLine) :: lnc @@ -21692,11 +21719,23 @@ SUBROUTINE write_multibody_dynamic_out(deck_path, out_root, channels, types, bod 'unresolved rod end'); GOTO 900 END IF END IF - ! a cable connected at End B on a moving object, or between two moving objects, couples - ! them implicitly - IF (mb%cab_kind_b(c) > 0 .AND. .NOT. mb%cab_imp(c)) THEN - mb%cab_imp(c) = attachment_moves(mb%cab_kind_b(c), mb%cab_obj_b(c)) .AND. & - (mb%cab_clamp_b(c) .OR. attachment_moves(mb%cab_kind(c), mb%cab_obj(c))) + ! A cable with an end on an object that the march moves couples it implicitly, pinned or + ! connected, at either end: it is re-stepped at every outer iteration with the iterate's + ! motion, its end stiffness in the Newton matrix. A pinned cable coupled at the predictor + ! instead (stepped once with the predicted attachment motion, its end force held through + ! the iterations) is a partitioned explicit coupling: the object sees the end force of the + ! predicted end position, F = -K_e x_pred, K_e the cable's condensed dynamic end stiffness + ! (the end element's EA/l_e condensed onto the inertia of the nodes behind it). On a mass + ! m_e (the object's effective mass along the cable at the attachment) that recurrence, with + ! the trapezoidal object update, has a step amplification above 1 once K_e dt^2/m_e exceeds + ! about 0.85 (1.5 at 1.3, 2.5 at 2): a light object on a stiff cable diverges whatever its + ! static balance (a 3 t free rod spar on a cable of EA 5e8 N in 1.4 m elements, dtM 0.01 s: + ! the step change of the cable tension alternated in sign and grew 2.3 times per step, the + ! tension rose from 11 kN past 1 MN and the rod top moved 6 m in 2 s). + IF (.NOT. mb%cab_imp(c)) THEN + mb%cab_imp(c) = attachment_moves(mb%cab_kind(c), mb%cab_obj(c)) + IF (mb%cab_kind_b(c) > 0) & + mb%cab_imp(c) = mb%cab_imp(c) .OR. attachment_moves(mb%cab_kind_b(c), mb%cab_obj_b(c)) IF (mb%cab_imp(c)) mb%cables(c)%tol = MIN(mb%cables(c)%tol, CLAMPED_CABLE_TOL) END IF END DO @@ -23665,12 +23704,11 @@ RECURSIVE SUBROUTINE mb_step_implicit(mb, points, opts, time, dt, converged, sta IF (.NOT. lconv) EXIT mb%loads = mb%floads END IF - ! finite-EI cables with a pinned End A and a Fixed End B: stepped once, with the attachment - ! motion of the Newmark predictor; their end force is held through the outer iterations - ! (explicit coupling at the predictor). A cable clamped (or elastically connected) to its - ! object, or one between two objects, is re-stepped from the step entry at every outer - ! iteration with the iterate's motion and orientation of its objects, and loads the - ! junction at both ends at the alpha level (implicit coupling) + ! finite-EI cables: a cable with an end on a moving object (cab_imp: pinned or connected, + ! at either end) is re-stepped from the step entry at every outer iteration with the + ! iterate's motion and orientation of its objects, and loads the junction at both ends at + ! the alpha level (implicit coupling). A cable with no moving end (both ends held: on Fixed + ! points or rods fixed in place) is stepped once, its end force held DO c = 1, SIZE(mb%cables) IF (.NOT. (first .OR. mb%cab_imp(c))) CYCLE IF (.NOT. first) THEN diff --git a/tests/test_line_attachments.f90 b/tests/test_line_attachments.f90 index c69dcfe7..0d5a20dd 100644 --- a/tests/test_line_attachments.f90 +++ b/tests/test_line_attachments.f90 @@ -49,12 +49,12 @@ PROGRAM test_line_attachments !! 11. A free buoyant spar rod (10 m, 1 m diameter) on four taut legs with a finite-EI cable !! pinned at its upper end carrying a 1500 kg clump 25 m along it; bodyIC static: the body !! static passes converge (6, on the core cable that carries the clump smeared) and the rod - !! holds its static pose over 0.3 s of the march (dtM 0.002 s) to 1e-6 m (measured 0) and - !! the leg tensions to 1e-5 (measured 3e-7). Before, the plain passes diverged (end-load + !! holds its static pose over 1 s of the march (dtM 0.01 s) to 1e-6 m (measured 1e-7) and + !! the leg tensions to 1e-5 (measured 2.9e-7). Before, the plain passes diverged (end-load !! change 2.9 of the force scale after 60 passes) and the deck stopped. !! 12. The spar rod of case 11 with the cable and no clump: the bending share of the pinned !! cable's end force is in the rod's static balance too, so the rod holds its pose over - !! 0.3 s to 1e-6 m (measured 0) and its leg tensions to 1e-5 (measured 0). Before, the + !! 1 s to 1e-6 m (measured 0) and its leg tensions to 1e-5 (measured 3.8e-8). Before, the !! body passes left a pinned line without ATTACHMENTS to the core's cable without bending !! stiffness: the rod started 5.7e-2 m off its equilibrium and its top moved 1.8e-4 m in 0.1 s !! (dtM 0.01 s; 7e-2 m and a 2.3 % leg tension change in 3 s with the implicit object @@ -514,8 +514,8 @@ SUBROUTINE case_pinned_point3_clump() END SUBROUTINE case_pinned_point3_clump SUBROUTINE case_pinned_rod_clump(clump) - !! 11 (clump) and 12: 0.3 s of the march of pinned_rod_deck (dtM 0.002 s, which the explicit - !! coupling of the cable to the rod on this route needs to stay stable). + !! 11 (clump) and 12: 1 s of the march of pinned_rod_deck (dtM 0.01 s; the pinned cable is + !! coupled to the free rod implicitly, test_pinned_cable_light_object). LOGICAL, INTENT(IN) :: clump INTEGER :: nrow REAL(wp), ALLOCATABLE :: d(:, :) @@ -525,13 +525,13 @@ SUBROUTINE case_pinned_rod_clump(clump) CHARACTER(16) :: root, gate root = MERGE('att_rod_pin ', 'att_rod_pin_no', clump) gate = MERGE('11 with a clump', '12 alone ', clump) - CALL pinned_rod_deck(TRIM(root), clump, '25.0', '0.002', '0.3') + CALL pinned_rod_deck(TRIM(root), clump, '25.0', '0.01', '1.0') CALL run(TRIM(root)//'.dat', TRIM(root), ok, msg) CALL require(ok, TRIM(gate)//', a pinned cable on a free rod: runs: '//TRIM(msg)) IF (.NOT. ok) RETURN CALL read_out(TRIM(root)//'.out', d, nrow, 6) - CALL require(nrow >= 151, TRIM(gate)//', a pinned cable on a free rod: the run written') - IF (nrow < 151) RETURN + CALL require(nrow >= 101, TRIM(gate)//', a pinned cable on a free rod: the run written') + IF (nrow < 101) RETURN dpos = MAXVAL(ABS(d(2:3, 1:nrow) - SPREAD(d(2:3, 1), 2, nrow))) dten = MAXVAL(ABS(d(4:6, 1:nrow) - SPREAD(d(4:6, 1), 2, nrow))/SPREAD(ABS(d(4:6, 1)), 2, nrow)) WRITE (*, '(A,A,A,ES10.3,A,ES10.3)') ' ', TRIM(gate), ', a pinned cable on a free rod: rod top drift ', dpos, & diff --git a/tests/test_pinned_cable_light_object.f90 b/tests/test_pinned_cable_light_object.f90 new file mode 100644 index 00000000..b92c96bb --- /dev/null +++ b/tests/test_pinned_cable_light_object.f90 @@ -0,0 +1,448 @@ +! File: tests/test_pinned_cable_light_object.f90 +! SPDX-License-Identifier: Apache-2.0 +! Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +!> Gates of a finite-EI (cubic-Hermite) cable pinned to a light object on the standalone +!> monolithic multibody march. The deck: a 10 m, 1 m diameter buoyant free rod spar (3 t dry, +!> 8 t displaced) on four taut EI = 0 legs in 50 m of water, and a finite-EI cable (EA 5e8 N, +!> EI 2e4 N m^2, 40 elements over 55 m) pinned at a rod end and run to an anchor. The static +!> passes balance the rod on the cubic-Hermite cable, so the start is the march's equilibrium, +!> and a stable one. The monolithic step coupled such a pinned cable at the Newmark predictor +!> (stepped once with the predicted end motion, its end force held): the cable's dynamic end +!> stiffness against the rod's few tonnes made that explicit coupling unstable (K_e dt^2 / m_e +!> above about 0.85), the step change of the cable tension alternated in sign and grew 2.3 +!> times per step, and the rod fell over. A pinned cable on a moving object is now re-stepped +!> at every outer iteration with its end stiffness in the Newton matrix, as a clamped one is. +!> Positions are written to 8 digits (1e-6 m at the rod's 20 to 30 m depths). +!> H hold: the static start stays at rest over 2 s with the cable pinned at the upper and at +!> the lower rod end: rod end move at most 1e-5 m and the cable end tensions within 1e-5 of +!> the larger (measured 1e-10 and 1.8e-10 m, 2.7e-8 and 3.4e-8); in a 0.5 m/s current at +!> most 2e-3 m and 1e-3 (measured 6.3e-4 m and 1.2e-4: a slow swing of the start in the +!> current, the same on the staggered scheme). The old coupling: rod end moves of 6.3, 5.4 +!> and 6.5 m, tension changes of 161, 472 and 5596 times the start tension; +!> D the cable written from its anchor is turned around to start at the rod end and writes +!> the same output (byte for byte); a cable from a fixed rod's end to the free rod's end +!> (an End B on the moving object) holds to 1e-5 m and its tension to 1e-4 (measured 2e-7 +!> m and 9e-8; old: 6.1 m, 1190 times). That cable's End A (the fixed rod's end) lies on +!> the seabed below its End B: its catenary seed is laid from End A, the line seen from +!> its other end. Before, the catenary route refused it (fairlead on the bed) and the +!> mesh-sequenced route took over, whose branch depended on platform round-off: Linux +!> gfortran reached a kinked state (max h kappa 1.96) and failed the deck, Windows the +!> cable's equilibrium; +!> R the static start of that deck with the fixed rod moved by 1 ulp in x either way or by +!> 1e-12 m up is the same rod pose to 1e-9 m; +!> B a light Rigid6 buoy (4 t) with a pinned keel cable holds over 4 s (move at most 1e-5 m, +!> tension within 1e-5; measured 1e-9 m and 3.3e-8; old: 0.22 m, 38 times); +!> S second route: the staggered scheme, whose sub-stepped central difference resolves the +!> same coupling, gives the same rod motion (within 1e-5 m) and cable tensions (within 1e-5 +!> of the larger) as the monolithic step, the cable at the upper and at the lower rod end +!> (measured 1e-10 and 1.7e-10 m; old: 6.0 and 6.5 m apart); +!> E controls of the routes coupled implicitly before: the same deck with an EI = 0 cable +!> holds its static start to 1e-6 m, and the cable clamped (Rigid) at the upper or lower +!> rod end to 1e-5 m. +PROGRAM test_pinned_cable_light_object + USE CableDyn_Precision, ONLY: wp + USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_DECKDRV_OK + USE, INTRINSIC :: IEEE_ARITHMETIC, ONLY: IEEE_IS_FINITE + IMPLICIT NONE + + INTEGER :: n_fail = 0 + REAL(wp) :: mv_m, ten_m + + CALL check_hold('upper', 'pcl_upper', .FALSE., 1.0e-5_wp, 1.0e-5_wp) + CALL check_hold('upper', 'pcl_current', .TRUE., 2.0e-3_wp, 1.0e-3_wp) + CALL check_hold('lower', 'pcl_lower', .FALSE., 1.0e-5_wp, 1.0e-5_wp) + CALL check_reversed() + CALL check_hold('fixrod', 'pcl_fixrod', .FALSE., 1.0e-5_wp, 1.0e-4_wp) + CALL check_fixrod_roundoff() + CALL check_buoy() + CALL check_staggered('upper', 'pcl_upper') + CALL check_staggered('lower', 'pcl_lower') + CALL check_hold('upper', 'pcl_ei0', .FALSE., 1.0e-6_wp, 1.0e-6_wp, ei0=.TRUE.) + CALL check_hold('upper', 'pcl_clamp_up', .FALSE., 1.0e-5_wp, 1.0e-4_wp, clamp='1.0') + CALL check_hold('lower', 'pcl_clamp_lo', .FALSE., 1.0e-5_wp, 1.0e-4_wp, clamp='-1.0') + IF (n_fail > 0) THEN + WRITE (*, '(A,I0,A)') 'FAIL: ', n_fail, ' gate(s) of a pinned cable on a light object failed' + ERROR STOP 1 + END IF + WRITE (*, '(A)') 'PASS: a finite-EI cable pinned to a light object (hold, direction, buoy, staggered '// & + 'route, EI = 0 and clamped controls)' + +CONTAINS + + INCLUDE 'nan_max_abs.inc' + + SUBROUTINE require(cond, msg) + LOGICAL, INTENT(IN) :: cond + CHARACTER(*), INTENT(IN) :: msg + IF (.NOT. cond) THEN + n_fail = n_fail + 1 + WRITE (*, '(A,A)') 'FAILED: ', msg + END IF + END SUBROUTINE require + + SUBROUTINE run_deck(path, root, ok, em) + CHARACTER(*), INTENT(IN) :: path, root + LOGICAL, INTENT(OUT) :: ok + CHARACTER(*), INTENT(OUT) :: em + LOGICAL :: conv + INTEGER :: es + CALL CD_Run_Deck_Driver(path, root, conv, es, em) + ok = es == CD_DECKDRV_OK .AND. conv + END SUBROUTINE run_deck + + SUBROUTINE read_rows(path, vals, nrow, ok) + !! Every data row of a driver .out file (two header lines) into vals(:, 1:nrow). + CHARACTER(*), INTENT(IN) :: path + REAL(wp), INTENT(OUT) :: vals(:, :) + INTEGER, INTENT(OUT) :: nrow + LOGICAL, INTENT(OUT) :: ok + INTEGER :: u, ios + CHARACTER(512) :: buf + nrow = 0 + vals = 0.0_wp + ok = .FALSE. + OPEN (NEWUNIT=u, FILE=path, STATUS='OLD', ACTION='READ', IOSTAT=ios) + IF (ios /= 0) RETURN + READ (u, '(A)', IOSTAT=ios) buf + READ (u, '(A)', IOSTAT=ios) buf + DO WHILE (nrow < SIZE(vals, 2)) + READ (u, *, IOSTAT=ios) vals(:, nrow + 1) + IF (ios /= 0) EXIT + nrow = nrow + 1 + END DO + CLOSE (u) + ok = nrow > 0 .AND. ALL(IEEE_IS_FINITE(vals(:, 1:nrow))) + END SUBROUTINE read_rows + + LOGICAL FUNCTION same_text(p1, p2) RESULT(same) + !! The two files have the same lines. + CHARACTER(*), INTENT(IN) :: p1, p2 + INTEGER :: u1, u2, i1, i2 + CHARACTER(1024) :: b1, b2 + same = .FALSE. + OPEN (NEWUNIT=u1, FILE=p1, STATUS='OLD', ACTION='READ', IOSTAT=i1) + IF (i1 /= 0) RETURN + OPEN (NEWUNIT=u2, FILE=p2, STATUS='OLD', ACTION='READ', IOSTAT=i2) + IF (i2 /= 0) THEN + CLOSE (u1) + RETURN + END IF + DO + READ (u1, '(A)', IOSTAT=i1) b1 + READ (u2, '(A)', IOSTAT=i2) b2 + IF (i1 /= 0 .OR. i2 /= 0) EXIT + IF (b1 /= b2) EXIT + END DO + same = i1 < 0 .AND. i2 < 0 + CLOSE (u1) + CLOSE (u2) + END FUNCTION same_text + + ! ------------------------------------------------------------------------------------------ + SUBROUTINE write_spar_deck(path, cable_at, current, scheme, ei0, clamp, from_anchor, rod2_a, tmax) + !! The free rod spar between z = -30 m (End A) and -20 m (End B) on four taut EI = 0 legs + !! (from End A to anchors 25 m up- and downstream, from End B to anchors 30 m to either side) + !! and the finite-EI cable (line 5, 55 m) to the anchor (-40, 0, -50): from the rod's upper + !! end (cable_at 'upper'), its lower end ('lower'), or from the end of a fixed rod at that + !! anchor to the upper end ('fixrod', End B on the free rod). current: 0.5 m/s in +X; + !! scheme: bodyScheme; ei0: the cable without bending stiffness; clamp: a Rigid End A + !! connection along the rod axis (EzZ given); from_anchor: line 5 written from the anchor; + !! rod2_a: the fixed rod's End A (default the anchor; its End B 1 m above); tmax: TMax + !! (default 2 s). + CHARACTER(*), INTENT(IN) :: path, cable_at, scheme, clamp + LOGICAL, INTENT(IN) :: current, ei0, from_anchor + REAL(wp), INTENT(IN), OPTIONAL :: rod2_a(3) + CHARACTER(*), INTENT(IN), OPTIONAL :: tmax + INTEGER :: u + CHARACTER(8) :: rod_end + REAL(wp) :: r2(3) + r2 = [-40.0_wp, 0.0_wp, -50.0_wp] + IF (PRESENT(rod2_a)) r2 = rod2_a + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'free rod spar with a finite-EI cable pinned at a rod end' + WRITE (u, '(A)') '--- LINE TYPES ---' + WRITE (u, '(A)') 'Name Diam Mass EA BA EI Cdn Cdt Can Cat' + WRITE (u, '(A)') '(-) (m) (kg/m) (N) (-) (Nm2) (-) (-) (-) (-)' + WRITE (u, '(A)') 'poly 0.10 10.0 2.0e7 -1.0 0.0 1.2 0.2 1.0 0.0' + IF (ei0) THEN + WRITE (u, '(A)') 'cab 0.20 60.0 5.0e8 -1.0 0.0 1.2 0.0 1.0 0.0' + ELSE + WRITE (u, '(A)') 'cab 0.20 60.0 5.0e8 -1.0 2.0e4 1.2 0.0 1.0 0.0' + END IF + WRITE (u, '(A)') '--- ROD TYPES ---' + WRITE (u, '(A)') 'Name Diam Mass Cd Ca CdEnd CaEnd CdAx CaAx' + WRITE (u, '(A)') '(-) (m) (kg/m) (-) (-) (-) (-) (-) (-)' + WRITE (u, '(A)') 'spar 1.0 300.0 0.8 1.0 0.0 0.0 0.2 0.0' + WRITE (u, '(A)') '--- RODS ---' + WRITE (u, '(A)') 'ID RodType Type XA YA ZA XB YB ZB NumSegs Outputs' + WRITE (u, '(A)') '(-) (-) (-) (m) (m) (m) (m) (m) (m) (-) (-)' + WRITE (u, '(A)') '1 spar Free 0.0 0.0 -30.0 0.0 0.0 -20.0 1 -' + IF (cable_at == 'fixrod') WRITE (u, '(A,6(ES24.16,1X),A)') '2 spar Fixed ', r2, r2 + [0.0_wp, 0.0_wp, 1.0_wp], & + ' 1 -' + WRITE (u, '(A)') '--- POINTS ---' + WRITE (u, '(A)') 'ID Type X Y Z Mass Vol CdA Ca' + WRITE (u, '(A)') '(-) (-) (m) (m) (m) (kg) (m3) (m2) (-)' + WRITE (u, '(A)') '1 Rod1A 0.0 0.0 -30.0 0 0 0 0' + WRITE (u, '(A)') '2 Rod1B 0.0 0.0 -20.0 0 0 0 0' + WRITE (u, '(A)') '3 Fixed 25.0 0.0 -50.0 0 0 0 0' + WRITE (u, '(A)') '4 Fixed -25.0 0.0 -50.0 0 0 0 0' + WRITE (u, '(A)') '5 Fixed 0.0 30.0 -50.0 0 0 0 0' + WRITE (u, '(A)') '6 Fixed 0.0 -30.0 -50.0 0 0 0 0' + IF (cable_at == 'fixrod') THEN + WRITE (u, '(A,3(ES24.16,1X),A)') '7 Rod2A ', r2, ' 0 0 0 0' + ELSE + WRITE (u, '(A)') '7 Fixed -40.0 0.0 -50.0 0 0 0 0' + END IF + WRITE (u, '(A)') '--- LINES ---' + WRITE (u, '(A)') 'ID NodeA NodeB Outputs' + WRITE (u, '(A)') '(-) (-) (-) (-)' + WRITE (u, '(A)') '1 1 3 -' + WRITE (u, '(A)') '2 1 4 -' + WRITE (u, '(A)') '3 2 5 -' + WRITE (u, '(A)') '4 2 6 -' + rod_end = MERGE('1', '2', cable_at == 'lower') + IF (from_anchor .OR. cable_at == 'fixrod') THEN + WRITE (u, '(A)') '5 7 '//TRIM(rod_end)//' -' + ELSE + WRITE (u, '(A)') '5 '//TRIM(rod_end)//' 7 -' + END IF + WRITE (u, '(A)') '--- SECTIONS ---' + WRITE (u, '(A)') 'LineID LineType Length NumSegs' + WRITE (u, '(A)') '(-) (-) (m) (-)' + WRITE (u, '(A)') '1 poly 31.95 16' + WRITE (u, '(A)') '2 poly 31.95 16' + WRITE (u, '(A)') '3 poly 42.40 20' + WRITE (u, '(A)') '4 poly 42.40 20' + WRITE (u, '(A)') '5 cab 55.0 40' + IF (LEN_TRIM(clamp) > 0) THEN + WRITE (u, '(A)') '--- END CONNECTIONS ---' + WRITE (u, '(A)') 'LineID End Stiffness EzX EzY EzZ' + WRITE (u, '(A)') '(-) (-) (N-m/rad) (-) (-) (-)' + WRITE (u, '(A)') '5 A Rigid 0.0 0.0 '//TRIM(clamp) + END IF + WRITE (u, '(A)') '--- OPTIONS ---' + WRITE (u, '(A)') '9.80665 g' + WRITE (u, '(A)') '1025.0 rhoW' + WRITE (u, '(A)') '50.0 WtrDpth' + WRITE (u, '(A)') '0.01 dtM' + IF (PRESENT(tmax)) THEN + WRITE (u, '(A)') tmax//' TMax' + ELSE + WRITE (u, '(A)') '2.0 TMax' + END IF + WRITE (u, '(A)') 'static bodyIC' + WRITE (u, '(A)') scheme//' bodyScheme' + WRITE (u, '(A)') '0.4 rhoInf' + IF (current) WRITE (u, '(A)') 'uniform 0.5 0.0 0.0 current' + WRITE (u, '(A)') '--- OUTPUTS ---' + WRITE (u, '(A)') 'Point1px Point1pz Point2px Point2pz FairTen5 AnchTen5' + WRITE (u, '(A)') '--- END ---' + CLOSE (u) + END SUBROUTINE write_spar_deck + + SUBROUTINE spar_measures(root, mv, ten, ok) + !! The largest rod end move from the start and the largest change of the cable's end + !! tensions from their start over the run, relative to the larger start tension. + CHARACTER(*), INTENT(IN) :: root + REAL(wp), INTENT(OUT) :: mv, ten + LOGICAL, INTENT(OUT) :: ok + REAL(wp) :: rows(7, 400) + INTEGER :: n, k + CALL read_rows(TRIM(root)//'.out', rows, n, ok) + mv = HUGE(1.0_wp) + ten = HUGE(1.0_wp) + IF (.NOT. ok) RETURN + mv = 0.0_wp + ten = 0.0_wp + DO k = 1, n + mv = nan_max_abs([mv, NORM2(rows(2:3, k) - rows(2:3, 1)), NORM2(rows(4:5, k) - rows(4:5, 1))]) + ten = nan_max_abs([ten, (rows(6:7, k) - rows(6:7, 1))/MAXVAL(rows(6:7, 1))]) + END DO + END SUBROUTINE spar_measures + + SUBROUTINE check_hold(cable_at, root, current, mv_tol, ten_tol, ei0, clamp) + !! H / D / E. The spar deck (cable_at, current, ei0, clamp as in write_spar_deck) holds its + !! static start: rod end move at most mv_tol, cable tension change at most ten_tol relative. + CHARACTER(*), INTENT(IN) :: cable_at, root + LOGICAL, INTENT(IN) :: current + REAL(wp), INTENT(IN) :: mv_tol, ten_tol + LOGICAL, INTENT(IN), OPTIONAL :: ei0 + CHARACTER(*), INTENT(IN), OPTIONAL :: clamp + LOGICAL :: ok, e0 + CHARACTER(1024) :: em + CHARACTER(8) :: cl + e0 = .FALSE. + IF (PRESENT(ei0)) e0 = ei0 + cl = '' + IF (PRESENT(clamp)) cl = clamp + CALL write_spar_deck(root//'.dat', cable_at, current, 'monolithic', e0, cl, .FALSE.) + CALL run_deck(root//'.dat', root, ok, em) + CALL require(ok, root//': the spar deck runs: '//TRIM(em)) + IF (.NOT. ok) RETURN + CALL spar_measures(root, mv_m, ten_m, ok) + CALL require(ok, root//': output readable') + IF (.NOT. ok) RETURN + WRITE (*, '(A,A,ES10.3,A,ES10.3,A,ES10.3,A,ES10.3,A)') root, ': rod end move ', mv_m, ' m (tol ', mv_tol, & + '), cable tension change ', ten_m, ' (tol ', ten_tol, ')' + CALL require(mv_m <= mv_tol, root//': the rod holds its static start') + CALL require(ten_m <= ten_tol, root//': the cable tension holds') + END SUBROUTINE check_hold + + SUBROUTINE check_reversed() + !! D. Line 5 written from its anchor to the upper rod end runs as the deck written from the + !! rod end (the line is turned around): the same output, byte for byte. + LOGICAL :: ok + CHARACTER(1024) :: em + CALL write_spar_deck('pcl_reversed.dat', 'upper', .FALSE., 'monolithic', .FALSE., '', .TRUE.) + CALL run_deck('pcl_reversed.dat', 'pcl_reversed', ok, em) + CALL require(ok, 'D: the reversed spar deck runs: '//TRIM(em)) + IF (.NOT. ok) RETURN + ok = same_text('pcl_reversed.out', 'pcl_upper.out') + WRITE (*, '(A,L1)') 'D: cable written from its anchor writes the same output: ', ok + CALL require(ok, 'D: the cable written from its anchor writes the same output as from the rod end') + END SUBROUTINE check_reversed + + SUBROUTINE check_fixrod_roundoff() + !! R. The fixed-rod-to-free-rod cable of D, its End A on the seabed below End B: its static + !! start with the fixed rod moved by 1 ulp in x either way and by 1e-12 m up is the + !! same rod pose to 1e-9 m. + REAL(wp), PARAMETER :: X0 = -40.0_wp, Z0 = -50.0_wp + REAL(wp) :: r2(3, 3), rows(7, 4), p0(4), dmax + INTEGER :: k, n + LOGICAL :: ok + CHARACTER(1024) :: em + CHARACTER(24) :: root + r2(:, 1) = [NEAREST(X0, 1.0_wp), 0.0_wp, Z0] + r2(:, 2) = [NEAREST(X0, -1.0_wp), 0.0_wp, Z0] + r2(:, 3) = [X0, 0.0_wp, Z0 + 1.0e-12_wp] + CALL write_spar_deck('pcl_fixrod_r0.dat', 'fixrod', .FALSE., 'monolithic', .FALSE., '', .FALSE., tmax='0.0') + CALL run_deck('pcl_fixrod_r0.dat', 'pcl_fixrod_r0', ok, em) + CALL require(ok, 'R: the fixed-rod deck static start runs: '//TRIM(em)) + IF (.NOT. ok) RETURN + CALL read_rows('pcl_fixrod_r0.out', rows, n, ok) + CALL require(ok, 'R: static row written') + IF (.NOT. ok) RETURN + p0 = rows(2:5, 1) + dmax = 0.0_wp + DO k = 1, 3 + WRITE (root, '(A,I0)') 'pcl_fixrod_r', k + CALL write_spar_deck(TRIM(root)//'.dat', 'fixrod', .FALSE., 'monolithic', .FALSE., '', .FALSE., & + rod2_a=r2(:, k), tmax='0.0') + CALL run_deck(TRIM(root)//'.dat', TRIM(root), ok, em) + CALL require(ok, 'R: '//TRIM(root)//' (the fixed rod moved by round-off) runs: '//TRIM(em)) + IF (.NOT. ok) RETURN + CALL read_rows(TRIM(root)//'.out', rows, n, ok) + CALL require(ok, 'R: '//TRIM(root)//' static row written') + IF (.NOT. ok) RETURN + dmax = MAX(dmax, MAXVAL(ABS(rows(2:5, 1) - p0))) + END DO + WRITE (*, '(A,ES10.3,A)') 'R: fixed rod moved by 1 ulp or 1e-12 m: rod pose change ', dmax, ' m' + CALL require(dmax <= 1.0e-9_wp, 'R: the fixed rod moved by round-off gives the same static start') + END SUBROUTINE check_fixrod_roundoff + + SUBROUTINE check_staggered(cable_at, mono_root) + !! S. The spar deck (cable_at) on the staggered scheme: rod end positions within 1e-5 m and + !! the cable end tensions within 1e-5 of the larger start tension of the monolithic + !! step's (run mono_root) at every output step. + CHARACTER(*), INTENT(IN) :: cable_at, mono_root + REAL(wp) :: rm(7, 400), rs(7, 400), dp, dt_rel + INTEGER :: nm, ns, k + LOGICAL :: ok, ok2 + CHARACTER(1024) :: em + CALL write_spar_deck('pcl_stag_'//cable_at//'.dat', cable_at, .FALSE., 'staggered', .FALSE., '', .FALSE.) + CALL run_deck('pcl_stag_'//cable_at//'.dat', 'pcl_stag_'//cable_at, ok, em) + CALL require(ok, 'S: the staggered spar deck runs ('//cable_at//'): '//TRIM(em)) + IF (.NOT. ok) RETURN + CALL read_rows(mono_root//'.out', rm, nm, ok) + CALL read_rows('pcl_stag_'//cable_at//'.out', rs, ns, ok2) + CALL require(ok .AND. ok2 .AND. nm == ns, 'S: both outputs readable with the same rows ('//cable_at//')') + IF (.NOT. (ok .AND. ok2 .AND. nm == ns)) RETURN + dp = 0.0_wp + dt_rel = 0.0_wp + DO k = 1, nm + dp = nan_max_abs([dp, rm(2:5, k) - rs(2:5, k)]) + dt_rel = nan_max_abs([dt_rel, (rm(6:7, k) - rs(6:7, k))/MAXVAL(rs(6:7, 1))]) + END DO + WRITE (*, '(A,A,A,ES10.3,A,ES10.3)') 'S (', cable_at, '): monolithic vs staggered: rod end position ', dp, & + ' m, cable tension (relative) ', dt_rel + CALL require(dp <= 1.0e-5_wp, 'S: the monolithic and staggered rod motions agree ('//cable_at//')') + CALL require(dt_rel <= 1.0e-5_wp, 'S: the monolithic and staggered cable tensions agree ('//cable_at//')') + END SUBROUTINE check_staggered + + ! ------------------------------------------------------------------------------------------ + SUBROUTINE check_buoy() + !! B. A 4 t Rigid6 buoy (12 m^3) on three taut legs with a finite-EI cable pinned at its keel + !! point to a seabed anchor holds its static start over 4 s: body move at most 1e-5 m + !! and the cable tension within 1e-5. + INTEGER :: u, n, k + REAL(wp) :: rows(4, 500), mv, ten + LOGICAL :: ok + CHARACTER(1024) :: em + OPEN (NEWUNIT=u, FILE='pcl_buoy.dat', STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'light buoy with a finite-EI cable pinned at its keel' + WRITE (u, '(A)') '--- LINE TYPES ---' + WRITE (u, '(A)') 'Name Diam Mass EA BA EI Cdn Cdt Can Cat' + WRITE (u, '(A)') '(-) (m) (kg/m) (N) (-) (Nm2) (-) (-) (-) (-)' + WRITE (u, '(A)') 'poly 0.12 15.0 5.0e7 -1.0 0.0 1.2 0.2 1.0 0.0' + WRITE (u, '(A)') 'cable 0.20 60.0 5.0e8 -1.0 2.0e4 1.2 0.0 1.0 0.0' + WRITE (u, '(A)') '--- BODIES ---' + WRITE (u, '(A)') 'ID Type X Y Z Roll Pitch Yaw Mass Vol C33 C44 C55 CdA Ca Ixx Iyy Izz' + WRITE (u, '(A)') '(-) (-) (m) (m) (m) (deg) (deg) (deg) (kg) (m3) (N/m) (Nm) (Nm) (m2) (-) (kgm2) (kgm2) (kgm2)' + WRITE (u, '(A)') '1 Rigid6 0.0 0.0 0.0 0.0 0.0 0.0 4.0e3 12.0 2.84e5 2.0e6 2.0e6 24.0 0.1 2.0e4 2.0e4 1.8e4' + WRITE (u, '(A)') '--- POINTS ---' + WRITE (u, '(A)') 'ID Type X Y Z Mass Vol CdA Ca' + WRITE (u, '(A)') '(-) (-) (m) (m) (m) (kg) (m3) (m2) (-)' + WRITE (u, '(A)') '1 Body1 3.0 0.0 -4.0 0 0 0 0' + WRITE (u, '(A)') '2 Body1 -1.5 2.598 -4.0 0 0 0 0' + WRITE (u, '(A)') '3 Body1 -1.5 -2.598 -4.0 0 0 0 0' + WRITE (u, '(A)') '4 Body1 0.0 0.0 -4.0 0 0 0 0' + WRITE (u, '(A)') '5 Fixed 60.0 0.0 -100.0 0 0 0 0' + WRITE (u, '(A)') '6 Fixed -30.0 51.962 -100.0 0 0 0 0' + WRITE (u, '(A)') '7 Fixed -30.0 -51.962 -100.0 0 0 0 0' + WRITE (u, '(A)') '8 Fixed -60.0 0.0 -100.0 0 0 0 0' + WRITE (u, '(A)') '--- LINES ---' + WRITE (u, '(A)') 'ID NodeA NodeB Outputs' + WRITE (u, '(A)') '(-) (-) (-) (-)' + WRITE (u, '(A)') '1 1 5 -' + WRITE (u, '(A)') '2 2 6 -' + WRITE (u, '(A)') '3 3 7 -' + WRITE (u, '(A)') '4 4 8 -' + WRITE (u, '(A)') '--- SECTIONS ---' + WRITE (u, '(A)') 'LineID LineType Length NumSegs' + WRITE (u, '(A)') '(-) (-) (m) (-)' + WRITE (u, '(A)') '1 poly 111.4 20' + WRITE (u, '(A)') '2 poly 111.4 20' + WRITE (u, '(A)') '3 poly 111.4 20' + WRITE (u, '(A)') '4 cable 10.0 40' + WRITE (u, '(A)') '4 cable 120.0 60' + WRITE (u, '(A)') '--- OPTIONS ---' + WRITE (u, '(A)') '9.80665 g' + WRITE (u, '(A)') '1025.0 rhoW' + WRITE (u, '(A)') '100.0 WtrDpth' + WRITE (u, '(A)') '0.01 dtM' + WRITE (u, '(A)') '4.0 TMax' + WRITE (u, '(A)') 'static bodyIC' + WRITE (u, '(A)') 'monolithic bodyScheme' + WRITE (u, '(A)') '0.4 rhoInf' + WRITE (u, '(A)') '--- OUTPUTS ---' + WRITE (u, '(A)') 'Body1Px Body1Pz FairTen4' + WRITE (u, '(A)') '--- END ---' + CLOSE (u) + CALL run_deck('pcl_buoy.dat', 'pcl_buoy', ok, em) + CALL require(ok, 'B: the buoy deck runs: '//TRIM(em)) + IF (.NOT. ok) RETURN + CALL read_rows('pcl_buoy.out', rows, n, ok) + CALL require(ok, 'B: buoy output readable') + IF (.NOT. ok) RETURN + mv = 0.0_wp + ten = 0.0_wp + DO k = 1, n + mv = nan_max_abs([mv, NORM2(rows(2:3, k) - rows(2:3, 1))]) + ten = nan_max_abs([ten, (rows(4, k) - rows(4, 1))/rows(4, 1)]) + END DO + WRITE (*, '(A,ES10.3,A,ES10.3)') 'B: light buoy, pinned keel cable: body move ', mv, & + ' m, cable tension change ', ten + CALL require(mv <= 1.0e-5_wp, 'B: the light buoy holds its static start') + CALL require(ten <= 1.0e-5_wp, 'B: the keel cable tension holds') + END SUBROUTINE check_buoy +END PROGRAM test_pinned_cable_light_object