From 0a5d8426b606c1fe9f23a4205b7d2b00332dbe3d Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 29 Oct 2026 16:37:50 +0900 Subject: [PATCH 1/3] feat(syrope): composite lines, a Syrope section between chains A Syrope line had to be a single taut section. A LINE can now carry Syrope sections between plain EI = 0 sections, such as the chain-polyester-chain mooring of a floating platform. init_one_syrope_model builds each Syrope section's working curve and solves the static start through init_one_model with a secant EA per element. On a composite line the tension varies along a sagging Syrope section, so each Syrope element takes the secant of its rest curve at its own tension: every element starts on its curve, its slow strain at rest. One secant per section left the elements away from the mean off the curve, and their slow strains moved the fairlead tension by 1.4e-5 within 2 s; now a still run keeps it to the printed digits. The tension update stays a contraction where the chains' weight and the geometry set the tension. The line's sections split into runs of one secant for the model build (the mesh is unchanged), the chains keep their BA damping, and a tension above the OWC table or a slack Syrope element stops with a named error. A single-section line keeps its secant from the mean strain: all 52 example decks are bit-identical. SYROPE IC applies to every Syrope section of a line; the Python deck reader accepts it on any line with a Syrope section. New test syrope_composite (every polyester element on its OWC to 2e-11, the equilibrium start, the Tmax0 working curve, the named refusals) and example composite_chain_syrope_chain.dat on a moving vessel. The driver format, the rope guide and the tutorial no longer describe the current, waves and bathymetry the Syrope hydrodynamics now carry as refused. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 7 + CMakeLists.txt | 8 +- VALIDATION.md | 2 +- doc/capabilities.rst | 7 +- doc/driver_format.md | 18 +- doc/examples.rst | 5 + doc/modeling.rst | 2 +- doc/tutorial_ropes.rst | 4 +- examples/README.md | 4 +- examples/SYNTHETIC_ROPES.md | 7 +- examples/composite_chain_syrope_chain.dat | 59 +++ python/cabledyn/builder.py | 2 +- python/cabledyn/deck_file.py | 6 +- python/tests/test_deck_file.py | 8 +- src/CableDyn_DeckDriver.f90 | 490 ++++++++++++++++------ tests/test_deck_driver.f90 | 26 +- tests/test_syrope_composite.f90 | 303 +++++++++++++ 17 files changed, 809 insertions(+), 149 deletions(-) create mode 100644 examples/composite_chain_syrope_chain.dat create mode 100644 tests/test_syrope_composite.f90 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2622d9a1..5424649a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,13 @@ All notable changes to CableDyn are recorded in this file. The format follows chain 0.6 % and the polyester 2.9 times too stiff). Free/Connect points, a `Rigid` cable end connection, VIV lines, bodies, rods, buoys, torsion and `CONTROL` fail closed with named messages. This replaces the quasi-static linearisation without states. +- Composite Syrope lines: a Syrope polyester section between plain `EI = 0` sections, such as a + chain-polyester-chain mooring, in one LINE. The static start puts every Syrope element on the + rest curve of its load history with its own secant EA (the tension varies along a sagging + section), so the dynamics start in the static equilibrium; the chains keep their `BA` damping, + and `SYROPE IC` applies to every Syrope section of the line. On a 400 m polyester section + between chains every element starts on its OWC to 2e-11, and a still run keeps the fairlead + tension. Example `composite_chain_syrope_chain.dat`, on a moving vessel. - Section-frame curvature channels `CurvXN` and `CurvYN` on finite-EI lines: the curvature vector on the cable's cross-section axes, for the fatigue of an armour wire or conductor at a fixed point of the section. The axes start at End A from the end connection diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f9167d2..b5bd24c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2076,6 +2076,11 @@ target_link_libraries(test_section_curvature PRIVATE cabledyn_core) add_test(NAME section_curvature COMMAND test_section_curvature) set_tests_properties(section_curvature PROPERTIES LABELS "fortran;driver;integration;static") +add_executable(test_syrope_composite tests/test_syrope_composite.f90) +target_link_libraries(test_syrope_composite PRIVATE cabledyn_core) +add_test(NAME syrope_composite COMMAND test_syrope_composite) +set_tests_properties(syrope_composite PROPERTIES LABELS "fortran;driver;integration;static;dynamic") + add_executable(test_coupled_torsion tests/test_coupled_torsion.f90) target_link_libraries(test_coupled_torsion PRIVATE cabledyn_core) add_test(NAME coupled_torsion COMMAND test_coupled_torsion WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) @@ -2882,7 +2887,8 @@ foreach(_floor_case IN ITEMS held_start_gomex80_power_cable held_start_humboldt8 set_tests_properties(${_floor_case} PROPERTIES LABELS "fortran;driver;integration;dynamic") endforeach() foreach(_dyn_example IN ITEMS dynamic_chain_held dynamic_chain_current dynamic_chain_waves - ve_polyester_dynamic_waves syrope_polyester_mooring clump_weight_free_point connect_weighted_point) + ve_polyester_dynamic_waves syrope_polyester_mooring composite_chain_syrope_chain clump_weight_free_point + connect_weighted_point) add_test(NAME example_${_dyn_example} COMMAND cabledyn "${CMAKE_CURRENT_SOURCE_DIR}/examples/${_dyn_example}.dat" "${CMAKE_CURRENT_BINARY_DIR}/example_${_dyn_example}") diff --git a/VALIDATION.md b/VALIDATION.md index 6f4db7d2..10f1362e 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -812,7 +812,7 @@ stop with a named error. | Coupled pinned rods (`Pinned`, `CoupledPinned`/`VesselPinned`) | Pass verified | `openfast_pinned_rod` on the aggregate: a dry rod (10 m, 500 kg) released at 30° swings with the elliptic-integral compound-pendulum period to 1.6e-4 at `dt = T/100`, End A on the pin to 0 m; a held `CoupledPinned` node reproduces the `Pinned` rod to round-off (1e-12), returns zero moment, and its force equals the analytic pin reaction to 2.0e-13 of `mg`; a pin accelerating at 2 m/s² gives the mean angle `atan(a/g)` to 1e-6 rad and the period of `sqrt(g² + a²)` to 1.6e-4; a harmonic pin motion follows the linear base-excitation solution to 1.5e-3 / 3.7e-4 of the amplitude at `T0/100` / `T0/200` (ratio 4.03); a 0.1 s step sub-cycled 7 times reproduces a run at the sub-step size to 1e-14 rad and 4e-10 N for a drifting pin; a 1 m `Pinned` rod that carries no line (dry and hanging, or buoyant and upright under water) at a 0.6 s step (`omega0 dt` 2.29 / 3.42, beyond the explicit limit 2) sub-cycles it 6 / 9 times from its own swing stiffness `|W d_g - B d_b|`, equals the run at the sub-step size bit for bit, stays within its release angle and keeps the elliptic-integral period to 6.0e-3 / 5.9e-3 (taken whole, the step turns the rod over); a `CoupledPinned` pin crossing the free surface within one step at constant velocity (a 1 kg/m rod lifted from submerged to dry in 0.1 s, `omega dt` 2.13 wet; a 33 kg/m rod lowered from dry to submerged in 0.6 s, 2.29 dry) takes at least 6 sub-steps from its step-start wetting (more from the waterplane near the surface) and ends within 5e-5 / 3e-4 rad of a run at a sixtieth of the step, where the end-of-step wetting alone gives one sub-step and an angle error of 0.20 / 0.69 rad; on a stiff seabed (`kBot` 1e7 N/m³) a `Pinned` rod whose far end rests on the bed (0.1 s step) and a `Free` rod lying on it (0.05 s step) sub-cycle their contact mode (34–36 and 26 sub-steps), stay at rest on the bed over 5 s (angle change 3.8e-3 / 4e-15 rad, the undamped static settlement) and end within 1.9e-6 / 8e-8 of a run at a tenth of the step, where the sub-steps of the lines and swing alone (1 and 4) throw them off the bed (4.2 rad, 0.8 m); an output probe returns `-m (I_c/I_p) a_p` within 1e-10 of `mg` (not `-m a_p`), and its pin force moves by 2e-11 N when the held end acceleration of the attached tethers changes their end load by 8 N; snapshot/restore, probe restore and restart overlay are bit-identical, the restored state's loads before the next step included; a step without the staged rods (the step-start pin carried by the rod) is bit-identical to the staged one; a `Free` or `Coupled` rod with an end without a line is refused by name; with `PtfmInit` the static start leaves 1.4e-8 N·m about the pin. OpenFAST (IEA-15 UMaine, JONSWAP Hs 6 m, 60 s, `dtM = DT = 0.025 s`) with line 1 hung from a 4 m `CoupledPinned` rod at its fairlead: `openfast -restart` at 30 s reproduces every later OpenFAST output row bit for bit (`NumCrctn` 0 and 1), `NumCrctn = 1` equals `NumCrctn = 0` bit for bit, and surge/heave/pitch statistics stay within 0.2 % / 0.4 % / 1.7 % (mean) of the deck with line 1 on a `Coupled` point | | Coupled finite-EI touchdown/contact | Pass verified | flat `WtrDpth` and equivalent constant structured bathymetry initialise and step with matching loads; friction and checkpoint restore are tested. The IEA-15 mixed example (its power cable on 248 elements, each at most half the bending length) has 149 grounded nodes and completes a 20 s aggregate trajectory at `dtM=0.025 s` with 2 m surge, 1 m heave, and 0.5 m/s host current, without fallback or stall recovery, at most 12 Newton iterations. A full-turbine run of the same model (one hour after a 200 s transient; TurbSim normal turbulence, 10.6 m/s, 17 % TI; JONSWAP Hs 8 m, Tp 12 s, aligned with the wind and the cable; AeroDyn with the rotor held at 7.55 rpm, no controller, rigid blades and tower; SeaState grid covering the lines) completes without recoveries or non-finite values. The cable's hang-off tension is 11.5 ± 1.1 kN (static 11.9 kN, maximum 17.9 kN). The 149 nodes grounded at the static state stay grounded, joined by one more once the platform has drifted (the touchdown moves 2.5 m toward the platform). The peak curvature is 0.156 1/m at the sag bend, 72 m from the hang-off, and 0.109 1/m at the touchdown. On the former 87-element mesh (10 m elements along the laid section) the peak was 0.160 1/m and the touchdown curvature 0.075 1/m, under-resolved by about 30 %. These curvatures were recorded before the `Curv` channels took the curvature recovered from nodal equilibrium: they are the geometric curvature of the centreline (the larger one-sided trace at a node), which `OutputRecovery element` reproduces. The chain-only twin of the run matches stock MoorDyn over 1200 s to 0.3 % in platform motion and fairlead tension statistics. The anchor tension of the laid cable stays at its static 1.23 kN (maximum 1.24 kN): the seabed friction of the 370 m laid section holds the tension changes at the touchdown. On the former mesh it read 1.39 kN (median) with wave-frequency stick-slip peaks up to 4.1 kN lasting under 1 s, which the resolved mesh does not show, and before the anchor-end correction of this release it locked at about 2.75 kN for the whole run. The run takes 27.1 min of wall time (18.8 min on the former mesh) | | `WaterKin` from file | Pass verified | See [WaterKin and SeaState modes](#waterkin-and-seastate-modes) | -| Syrope polyester (`SYROPE:` syntax; [Falkenberg et al., 2017](https://cabledyn.readthedocs.io/en/latest/references.html#ref-falkenberg2017)) | Pass verified | MoorDyn-F/C `BA_s|BA_d` rate and force equations; analytic position/velocity tangents with finite-difference checks; projected, bracketed backward-Euler slow-state update with a strong-unloading boundary test; OWC running maximum; `SYROPE IC` `Tmax0/Tmean0` history with range/order checks; both states carried through every lifecycle stage and the coupled checkpoint. `BA_s` is kept separate from line axial damping (`BA`) and tested against double counting. The line takes the seabed, Morison loads, current, waves, host fluid and VIV of any `EI = 0` line: a taut 88.5 m polyester line in water whose fairlead sways 2 m matches MoorDyn-C v2.7.2 within 10.6 N over a 44.8 kN tension range (1.03 MN mean; t = 0 within 0.5 N), and its range grows 4.8 % without drag and added mass (`syrope_hydro`). Composite and finite-EI combinations stop with a named error | +| Syrope polyester (`SYROPE:` syntax; [Falkenberg et al., 2017](https://cabledyn.readthedocs.io/en/latest/references.html#ref-falkenberg2017)) | Pass verified | MoorDyn-F/C `BA_s|BA_d` rate and force equations; analytic position/velocity tangents with finite-difference checks; projected, bracketed backward-Euler slow-state update with a strong-unloading boundary test; OWC running maximum; `SYROPE IC` `Tmax0/Tmean0` history with range/order checks; both states carried through every lifecycle stage and the coupled checkpoint. `BA_s` is kept separate from line axial damping (`BA`) and tested against double counting. The line takes the seabed, Morison loads, current, waves, host fluid and VIV of any `EI = 0` line: a taut 88.5 m polyester line in water whose fairlead sways 2 m matches MoorDyn-C v2.7.2 within 10.6 N over a 44.8 kN tension range (1.03 MN mean; t = 0 within 0.5 N), and its range grows 4.8 % without drag and added mass (`syrope_hydro`). Composite lines (a 400 m Syrope polyester section between chains, `syrope_composite`): every polyester element starts on its OWC to 2e-11 across its 1.005–1.012 MN tension range, a still run keeps the fairlead tension to the printed digits (one secant per section moved it by 1.4e-5 within 2 s), the chains keep their `BA` damping, a `SYROPE IC` history puts the section on the `Tmax0` working curve, a line split into two Syrope sections reaches the single section's tensions to 1e-8, and a tension above the OWC table stops with a named error. Finite-EI combinations stop with a named error | | Cross-flow VIV (LINE TYPES `Cl`) | Pass verified | `EI = 0` lines and finite-EI cables on the aggregate with the host's fluid field: an `EI = 0` riser and a cable (EI 1 N m²) in a 0.15 m/s host current lock in at A/D 0.6645 / 0.6646 and 0.292 Hz (MoorDyn-F 0.662 at 0.293 Hz; standalone 0.665); the phases, running mean squares and averaging time ride in the checkpoint state and the correction rewind: a rebuild from the checkpoint continues bit for bit, one without the VIV reload does not (`viv_coupled`). OpenFAST (IEA-15 UMaine mixed deck, `Cl` 0.8 on the lazy-wave cable, SeaState 0.5 m/s current, 60 s): `openfast -restart` at 30 s reproduces every later CableDyn and OpenFAST output row bit for bit | **Standalone mixed aggregate.** `CableDyn_driver.exe` partitions and steps the diff --git a/doc/capabilities.rst b/doc/capabilities.rst index 902b8201..257140f9 100644 --- a/doc/capabilities.rst +++ b/doc/capabilities.rst @@ -77,9 +77,10 @@ Line and constitutive capability including load-dependent dynamic stiffness; ``EI = 0`` lines * - Syrope polyester - Supported with limits - - single-section taut dynamic line with OWC and two history states, with the seabed, - Morison loads, current, waves, host fluid fields and VIV of any ``EI = 0`` line; - composite and finite-EI combinations fail closed by name + - dynamic line with OWC and two history states, single-section and taut or between + linear-elastic ``EI = 0`` sections (chain–polyester–chain), with the seabed, Morison loads, + current, waves, host fluid fields and VIV of any ``EI = 0`` line; finite-EI combinations + fail closed by name * - Torsion of finite-EI lines - Supported with limits - condensed isotropic torsion (uniform torque, quasi-static: no torsional inertia) of a diff --git a/doc/driver_format.md b/doc/driver_format.md index 3e299aa8..550d19d1 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -286,9 +286,16 @@ and `BA = BA_s|BA_d`: or `EXP`), `k1`, and `k2` rows as `value name`. `OWC` names the original-working-curve table, resolved relative to the settings file: a `strain tension` table of at least two numeric rows. - `BA_d` enters the slow-state rate; the physical damping contribution is `BA_s*d(eps_slow)/dt`. -- A Syrope type requires `EI = 0`. A Syrope line must be a single section, taut at - initialisation, and run on a dynamic deck (`dtM`/`TMax`). It does not support `bathymetryFile`, - deck current or waves, or host-driven fluid loads. A flat `WtrDpth` seabed is accepted. +- A Syrope type requires `EI = 0`. A Syrope line is either a single section, taut at + initialisation, or a composite line whose other sections are linear-elastic `EI = 0` sections (a + chain–polyester–chain mooring), with every Syrope element in tension at initialisation. It runs + on a dynamic deck (`dtM`/`TMax`) and takes the seabed, `bathymetryFile`, Morison loads, current, + waves, host fluid fields and VIV of any `EI = 0` line. +- The static start solves each Syrope element on the rest curve of its load history (the OWC, or + the `Tmax0` working curve under `SYROPE IC`). A single-section line takes one secant EA from the + curve at its mean strain; on a composite line, where the tension varies along a sagging Syrope + section, every Syrope element takes its own secant at its own tension, so every element starts + on its curve and the dynamics start in the static equilibrium. The settings-file grammar is in [Auxiliary file formats](file_formats.rst). @@ -718,8 +725,9 @@ Line(s) Tmax0 Tmean0 The last two tokens are `Tmax0 Tmean0`; the tokens before them form the line list. Line ids are comma-separated (`1,2` or `1, 2`); ids separated only by spaces are rejected. Values must satisfy -`Tmax0 >= Tmean0 >= 0` and `Tmax0 > 0`, and be finite. Every referenced line must be a -single-section Syrope line, named in only one row. +`Tmax0 >= Tmean0 >= 0` and `Tmax0 > 0`, and be finite. Every referenced line must have a +Syrope section, and be named in only one row. On a composite line the history applies to every +Syrope section. `Tmax0` is the rope's running maximum tension. The static initial condition is solved on its rest curve, the working curve regenerated at `Tmax0` (the OWC beyond that curve's top strain). diff --git a/doc/examples.rst b/doc/examples.rst index 342e0d79..cb8abf50 100644 --- a/doc/examples.rst +++ b/doc/examples.rst @@ -158,6 +158,11 @@ for the equations, the viscoelastic (series-Kelvin) and Syrope sections of :doc: ``data/syrope/syrope_settings.dat`` and ``data/syrope/syrope_owc.dat`` - cable, dynamic - < 1 s + * - ``composite_chain_syrope_chain.dat`` + - chain–Syrope polyester–chain mooring on a vessel in a 12 s surge, heave and pitch record; + needs ``data/syrope/`` and ``data/vessel/vessel_surge_heave_pitch_12s_dt005.txt`` + - cable, dynamic + - < 1 s Dynamic environment ------------------- diff --git a/doc/modeling.rst b/doc/modeling.rst index b13561a9..0bf65947 100644 --- a/doc/modeling.rst +++ b/doc/modeling.rst @@ -308,7 +308,7 @@ Use-case map - ``ve_polyester_dynamic_waves.dat`` - slow/dynamic state, relaxation time, cyclic tension * - Syrope polyester - - ``syrope_polyester_mooring.dat`` + - ``syrope_polyester_mooring.dat`` / ``composite_chain_syrope_chain.dat`` - OWC/settings files, initial history, supported-combination limits * - Current/wave-loaded mooring - ``dynamic_chain_current.dat`` / ``dynamic_chain_waves.dat`` diff --git a/doc/tutorial_ropes.rst b/doc/tutorial_ropes.rst index f5e613ff..51527568 100644 --- a/doc/tutorial_ropes.rst +++ b/doc/tutorial_ropes.rst @@ -121,7 +121,9 @@ The static initial condition is solved on the ``Tmax0`` working curve, and the l that equilibrium: ``FairTen1`` is 972.8 kN at t = 0 and stays there over the 2 s run (the fairlead is held). With both ends fixed, the geometry and ``Tmax0`` set the mean tension, so ``Tmean0`` does not enter the state. The driver prints a note because this deck's 1.5 MN differs from the -972.8 kN equilibrium. Syrope lines are single-section and run dynamically (``dtM``/``TMax``). +972.8 kN equilibrium. Syrope lines run dynamically (``dtM``/``TMax``). A Syrope section can also +sit between chains: ``composite_chain_syrope_chain.dat`` is a chain–polyester–chain mooring on a +moving vessel, every polyester element starting on its working curve. .. important:: diff --git a/examples/README.md b/examples/README.md index 416de1b3..f2acc80e 100644 --- a/examples/README.md +++ b/examples/README.md @@ -43,9 +43,9 @@ Copy a deck under a new name and keep every file it references at the same relat | --- | --- | | `*.dat` | Standalone decks. `iea15mw_umaine_openfast_cabledyn.dat` is an OpenFAST-only `MooringFile`; `iea15mw_umaine_mixed_cabledyn.dat` runs both standalone and coupled. | | `openfast/` | IEA-15MW VolturnUS-S `.fst` pair (`CompMooring = 5` and `3`) with their mooring decks; see [openfast/README.md](openfast/README.md). | -| `data/syrope/` | Syrope settings and original working-curve table used by `syrope_polyester_mooring.dat`. | +| `data/syrope/` | Syrope settings and original working-curve table used by `syrope_polyester_mooring.dat` and `composite_chain_syrope_chain.dat`. | | `data/lozon/` | Prescribed hang-off heave history for `lozon_gomex80_power_cable_motion.dat` and the script that generates it. | -| `data/vessel/` | 6-DOF vessel-motion record for `lazy_wave_vessel_motion.dat`, the script that generates it, and the illustrative RAO table for `lazy_wave_vessel_rao.dat` and `lazy_wave_bend_stiffener.dat`. | +| `data/vessel/` | 6-DOF vessel-motion record for `lazy_wave_vessel_motion.dat` and `composite_chain_syrope_chain.dat`, the script that generates it, and the illustrative RAO table for `lazy_wave_vessel_rao.dat` and `lazy_wave_bend_stiffener.dat`. | | `data/torsion/` | Hang-off roll history (motionFile roll column) for `torsion_lazy_wave_hangoff_twist.dat` and the script that generates it. | | `data/range_tdp/` | Fairlead surge history for `chain_range_tdp.dat` and the script that generates it. | | `moordynC_wavekin/` | A deck with the MoorDyn-C `wave_frequencies.txt` and `current_profile.txt` files it reads from its own folder. | diff --git a/examples/SYNTHETIC_ROPES.md b/examples/SYNTHETIC_ROPES.md index 556e6fb5..d9dfcfb0 100644 --- a/examples/SYNTHETIC_ROPES.md +++ b/examples/SYNTHETIC_ROPES.md @@ -54,9 +54,10 @@ rope 0.1438 22.42 "SYROPE:data/syrope/syrope_settings.dat|1.53e8|23.12" initialisation with the offending tension and the next admissible `Tmax`. `EXP` requires `k2 > 0`. - Viscoelastic and Syrope line types require `EI = 0`; a finite-EI type is rejected. -- A Syrope line must be a single section and taut at initialisation, and the deck must set - `dtM` and `TMax` (there is no static-only output). Current, waves, bathymetry and host-driven - hydrodynamic loads on a Syrope line are rejected with an error naming the feature. +- A Syrope line is a single section, taut at initialisation, or a composite line whose other + sections are linear-elastic `EI = 0` sections (`composite_chain_syrope_chain.dat`), and the deck + must set `dtM` and `TMax` (there is no static-only output). It takes the seabed, bathymetry, + Morison loads, current, waves, host fluid fields and VIV of any `EI = 0` line. ## Run the Syrope example diff --git a/examples/composite_chain_syrope_chain.dat b/examples/composite_chain_syrope_chain.dat new file mode 100644 index 00000000..8aca158a --- /dev/null +++ b/examples/composite_chain_syrope_chain.dat @@ -0,0 +1,59 @@ +--------------------- CableDyn Input File ------------------------------------ +CableDyn driver deck -- composite chain + SYROPE polyester + chain mooring on a moving vessel +-- One LINE of three SECTIONS in End-A(fairlead)->End-B(anchor) order: a 100 m studless chain +-- at the fairlead, a 400 m polyester section with the Syrope working-curve model, and a 250 m +-- chain at the anchor, in 200 m of water. The line of composite_chain_poly_chain.dat with its +-- anchor 30 m further out, so the polyester carries about 1 MN. The polyester's EA and BA +-- columns, its settings and OWC files, are those of syrope_polyester_mooring.dat. The static +-- start puts every polyester element on its rest curve (here the OWC: the rope is virgin), so +-- the dynamics start in that equilibrium. The vessel then surges, heaves and pitches in the +-- 12 s record of lazy_wave_vessel_motion.dat, with its 12 s smooth start. +-- chain 155 mm R4 studless: volume-equivalent diam 0.2791 m, dry mass 480.93 kg/m, EA 2.058e9 N. +-- polyester 181.8 mm: diam 0.1438 m, dry mass 22.42 kg/m. +--------------------- LINE TYPES --------------------------------------- +TypeName Diam MassDenInAir EA BA EI Cd_n Cd_t Ca_n Ca_t +(-) (m) (kg/m) (-) (N-s|N-s) (N-m^2) (-) (-) (-) (-) +chain 0.2791 480.93 2.058e9 -1.0 0.0 1.37 0.64 1.0 0.0 +polyester 0.1438 22.42 "SYROPE:data/syrope/syrope_settings.dat|1.53e8|23.12" 5.0e10|1.0e5 0.0 1.2 0.2 1.0 0.0 +--------------------- POINTS ------------------------------------------- +ID Type X Y Z Mass Vol CdA Ca +(-) (-) (m) (m) (m) (kg) (m^3) (m^2) (-) +1 Fixed 780.0 0.0 -200.0 0 0 0 0 +2 Coupled 58.0 0.0 -14.0 0 0 0 0 +--------------------- LINES -------------------------------------------- +ID NodeA NodeB Outputs +(-) (-) (-) (-) +1 2 1 - +--------------------- SECTIONS ----------------------------------------- +LineID LineType Length NumSegs +(-) (-) (m) (-) +1 chain 100.0 12 +1 polyester 400.0 40 +1 chain 250.0 25 +--------------------- OPTIONS ------------------------------------------ +9.80665 g - Gravitational acceleration (m/s^2) [default: 9.80665] +1025.0 rhoW - Water density (kg/m^3) [default: 1025] +200.0 WtrDpth - Water depth (m) [default: absent standalone; host-owned OpenFAST] +3.0e6 kBot - Seabed penalty stiffness base (Pa/m) [default: 1.0e5] +1.0e4 cBot - Seabed normal damping base (Pa-s/m) [default: 1.0e4] +0.05 dtM - CableDyn internal time step (s) [default: omitted standalone; the glue DT in OpenFAST] +36.0 TMax - Standalone simulation duration (s), including the 12 s smooth start +data/vessel/vessel_surge_heave_pitch_12s_dt005.txt vesselMotion - 6-DOF vessel record moving every Coupled point rigidly +0.0|0.0|0.0 vesselRef - Vessel reference point, rotation centre and RAO origin (m) [default: 0|0|0] +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] +False adaptive_mesh - Automatic finite-EI refinement {False; True} [default: False] +dynamic_solver 1.0e-8 1.0e-14 30 12 - Relative tolerance, absolute tolerance, max iterations, backtracks [defaults shown] +none frictionMu - Seabed friction coefficient {none; value>=0} [default: none] +none current - Current model and velocity (m/s) {none; uniform; profile} [default: none] +none waves - Wave model, height, period, and direction (m, s, deg) {none; airy; jonswap} [default: none] +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" +"AnchTen1" +"FairIncl1" +"AnchIncl1" +"Point2px" +"Point2pz" +--------------------- need this line ----------------------------------- diff --git a/python/cabledyn/builder.py b/python/cabledyn/builder.py index 17d8e717..13f6cabc 100644 --- a/python/cabledyn/builder.py +++ b/python/cabledyn/builder.py @@ -669,7 +669,7 @@ class SyropeIC: Attributes ---------- lines : list[Line] - The single-section Syrope lines. + The lines with a Syrope section (alone or in a composite line). tmax0 : float Running maximum tension, in N. tmean0 : float diff --git a/python/cabledyn/deck_file.py b/python/cabledyn/deck_file.py index ef9bbb5f..2963c432 100644 --- a/python/cabledyn/deck_file.py +++ b/python/cabledyn/deck_file.py @@ -3896,12 +3896,10 @@ def is_body_kind(kind: str, pinned: bool) -> bool: f"{self._at(row)}: SYROPE IC must follow its referenced LINE definitions" ) if any( - len(section_types_by_line[value]) != 1 - or section_types_by_line[value][0] not in syrope_types - for value in ids + not any(t in syrope_types for t in section_types_by_line[value]) for value in ids ): raise DeckFormatError( - f"{self._at(row)}: SYROPE IC can reference only a single-section Syrope line" + f"{self._at(row)}: SYROPE IC can reference only a line with a Syrope section" ) if assigned_syrope.intersection(ids): raise DeckFormatError(f"{self._label}: duplicate SYROPE IC line assignment") diff --git a/python/tests/test_deck_file.py b/python/tests/test_deck_file.py index 0e93c791..37f0bec3 100644 --- a/python/tests/test_deck_file.py +++ b/python/tests/test_deck_file.py @@ -1362,7 +1362,7 @@ def test_syrope_ic_accepts_spaces_after_id_commas(tmp_path): assert deck.text() == path.read_bytes().decode("utf-8") -def test_syrope_ic_requires_a_single_syrope_section(tmp_path): +def test_syrope_ic_requires_a_syrope_section(tmp_path): chain = (ROOT / "examples/chain_catenary_r3_100m.dat").read_text(encoding="utf-8") chain = chain.replace( "--------------------- SECTIONS -----------------------------------------", @@ -1372,9 +1372,10 @@ def test_syrope_ic_requires_a_single_syrope_section(tmp_path): ) non_syrope = tmp_path / "non-syrope-ic.dat" non_syrope.write_text(chain, encoding="utf-8") - with pytest.raises(DeckFormatError, match="single-section Syrope line"): + with pytest.raises(DeckFormatError, match="line with a Syrope section"): DeckFile.read(non_syrope) + # a composite line with a Syrope section takes the history (every Syrope section's) syrope = (ROOT / "examples/syrope_polyester_mooring.dat").read_text(encoding="utf-8") syrope = syrope.replace( "1 rope 20.0 8", @@ -1382,8 +1383,7 @@ def test_syrope_ic_requires_a_single_syrope_section(tmp_path): ) composite = tmp_path / "composite-syrope-ic.dat" composite.write_text(syrope, encoding="utf-8") - with pytest.raises(DeckFormatError, match="single-section Syrope line"): - DeckFile.read(composite) + DeckFile.read(composite) DeckFile.read(ROOT / "examples/syrope_polyester_mooring.dat") diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 56d9903a..476faee3 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -50,7 +50,8 @@ MODULE CableDyn_DeckDriver USE CableDyn_Damping, ONLY: CD_Resolve_Legacy_BA, CD_DAMP_OK USE CableDyn_Syrope, ONLY: CD_SYROPE_WC_LINEAR, CD_SYROPE_WC_QUADRATIC, CD_SYROPE_WC_EXP, & CD_SyropeType, CD_Syrope_Init, CD_Syrope_End, & - CD_Syrope_Static_Tension, CD_Syrope_Slow_For_Tension, CD_SYROPE_OK + CD_Syrope_Static_Tension, CD_Syrope_Slow_For_Tension, CD_SYROPE_OK, & + CD_SYROPE_BADINPUT USE CableDyn_Dynamic, ONLY: GenAlphaConfig, CD_DYN_OK, CD_EI0_SUBSTEPS_OFF, CD_EI0_SUBSTEPS_AUTO USE CableDyn_Model, ONLY: CD_ModelType, CD_Init_Line_Model, CD_End_Model, CD_Model_NCoupledDOF, CD_Model_NDOF, & CD_Get_Model_CoupledDofs, CD_Get_Model_State, CD_Get_Model_Tension, & @@ -8756,10 +8757,11 @@ END SUBROUTINE line_static_friction RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry, & syrope_secant, syrope_is, syrope_type, syrope_slow0, syrope_tmax0) - !! Initialize one persistent model from a validated deck LINE. A Syrope line is built by - !! init_one_syrope_model, which calls back here with syrope_secant (the secant EA of its - !! static solve) and, for the final build, the per-element Syrope states: the line then - !! takes the same seabed, hydrodynamics and fluid fields as any EI = 0 line. + !! Initialize one persistent model from a validated deck LINE. A line with a Syrope section is + !! built by init_one_syrope_model, which calls back here with syrope_secant (per element, + !! anchor first: the static secant EA of each Syrope element; other elements ignored) and, for + !! the final build, the per-element Syrope states: the line then takes the same seabed, + !! hydrodynamics and fluid fields as any EI = 0 line. TYPE(DeckLine), INTENT(IN) :: ln TYPE(DeckSection), INTENT(IN) :: sections(:) TYPE(DeckLineType), INTENT(IN) :: types(:) @@ -8769,7 +8771,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg TYPE(CD_BathymetryType), INTENT(IN), OPTIONAL :: bathymetry - REAL(wp), INTENT(IN), OPTIONAL :: syrope_secant + REAL(wp), INTENT(IN), OPTIONAL :: syrope_secant(:) LOGICAL, INTENT(IN), OPTIONAL :: syrope_is(:) TYPE(CD_SyropeType), INTENT(IN), OPTIONAL :: syrope_type(:) REAL(wp), INTENT(IN), OPTIONAL :: syrope_slow0(:), syrope_tmax0(:) @@ -8784,6 +8786,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er REAL(wp), ALLOCATABLE :: hydro_diam(:), hydro_cdn(:), hydro_cdt(:), hydro_can(:), hydro_cat(:) REAL(wp), ALLOCATABLE :: ve_ead(:), ve_bas(:), ve_bad(:), ve_ambl(:), ve_vbet(:) REAL(wp), ALLOCATABLE :: viv_cl(:), viv_cf(:), viv_df(:) + LOGICAL, ALLOCATABLE :: syr_el(:) REAL(wp) :: anchor(3), fairlead(3) REAL(wp), PARAMETER :: factors(4) = [0.25_wp, 0.5_wp, 0.75_wp, CD_ONE] INTEGER :: j, i, e, es @@ -8821,7 +8824,7 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er ALLOCATE (ba(SIZE(l0)), hydro_diam(SIZE(l0)), hydro_cdn(SIZE(l0)), hydro_cdt(SIZE(l0)), & hydro_can(SIZE(l0)), hydro_cat(SIZE(l0)), ve_ead(SIZE(l0)), ve_bas(SIZE(l0)), & ve_bad(SIZE(l0)), ve_ambl(SIZE(l0)), ve_vbet(SIZE(l0)), viv_cl(SIZE(l0)), viv_cf(SIZE(l0)), & - viv_df(SIZE(l0))) + viv_df(SIZE(l0)), syr_el(SIZE(l0))) viv_cl = CD_ZERO viv_cf = CD_ZERO viv_df = CD_ZERO @@ -8864,8 +8867,10 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er viv_cl(e) = types(line_section_type(sections, ln%id, i))%cl viv_cf(e) = types(line_section_type(sections, ln%id, i))%viv_cf viv_df(e) = types(line_section_type(sections, ln%id, i))%viv_df + syr_el(e) = types(line_section_type(sections, ln%id, i))%is_syrope END DO END DO + syr_el = syr_el(SIZE(syr_el):1:-1) viv_cl = viv_cl(SIZE(viv_cl):1:-1) viv_cf = viv_cf(SIZE(viv_cf):1:-1) viv_df = viv_df(SIZE(viv_df):1:-1) @@ -8890,15 +8895,20 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er syt = line_section_type(sections, ln%id, i2) END DO IF (syt > 0 .AND. .NOT. PRESENT(syrope_secant)) THEN - CALL init_one_syrope_model(types, syt, ln, sections, points, l0, opts, model, ErrStat, ErrMsg, & + CALL init_one_syrope_model(types, ln, sections, points, l0, opts, model, ErrStat, ErrMsg, & bathymetry=bathymetry) RETURN END IF IF (PRESENT(syrope_secant)) THEN - ! the static solve's single secant EA; the working curve carries the rope's damping - ! (BA_s|BA_d), so the line takes no legacy BA on top of it - lts(secs(1)%line_type)%ea = syrope_secant - ba = CD_ZERO + ! each Syrope element's static secant EA; the working curve carries the rope's damping + ! (BA_s|BA_d), so its elements take no legacy BA on top of it (the other sections keep + ! theirs) + IF (SIZE(syrope_secant) /= SIZE(l0)) THEN + CALL fail(ErrStat, ErrMsg, 'internal: one Syrope secant per element expected'); RETURN + END IF + CALL syrope_secant_sections(syrope_secant, ErrStat, ErrMsg) + IF (ErrStat /= CD_DECKDRV_OK) RETURN + WHERE (syr_el) ba = CD_ZERO END IF END BLOCK ! external_fluid: the host prescribes per-node fluid kinematics each step, so the @@ -9164,22 +9174,96 @@ RECURSIVE SUBROUTINE init_one_model(ln, sections, types, points, opts, model, Er END IF END BLOCK END IF + + CONTAINS + + SUBROUTINE syrope_secant_sections(sec_el, es_out, em_out) + !! The line's sections and types with the Syrope elements' secant EAs: a Syrope section + !! splits into runs of elements of one secant, each its own section and type (the mesh is + !! unchanged); a section whose elements share one secant, and every other section, stays + !! whole. + REAL(wp), INTENT(IN) :: sec_el(:) + INTEGER, INTENT(OUT) :: es_out + CHARACTER(*), INTENT(OUT) :: em_out + TYPE(CD_LineType), ALLOCATABLE :: lts_n(:) + TYPE(CD_LineSection), ALLOCATABLE :: secs_n(:) + INTEGER :: is, je, d, n, ne_l, j0 + REAL(wp) :: seg + es_out = CD_DECKDRV_OK + em_out = '' + ne_l = SIZE(sec_el) + ALLOCATE (lts_n(ne_l + SIZE(secs)), secs_n(ne_l + SIZE(secs))) + n = 0 + d = 0 ! deck-order element index (End A first); internal index ne_l + 1 - d + DO is = 1, SIZE(secs) + IF (.NOT. types(line_section_type(sections, ln%id, is))%is_syrope) THEN + n = n + 1 + lts_n(n) = lts(secs(is)%line_type) + secs_n(n) = secs(is) + secs_n(n)%line_type = n + d = d + secs(is)%n_segments + CYCLE + END IF + seg = secs(is)%length/REAL(secs(is)%n_segments, wp) + j0 = 1 + DO je = 1, secs(is)%n_segments + IF (je < secs(is)%n_segments) THEN + IF (bits_same(sec_el(ne_l + 1 - (d + je)), sec_el(ne_l - (d + je)))) CYCLE + END IF + ! the run j0..je of this section, one secant + n = n + 1 + lts_n(n) = lts(secs(is)%line_type) + lts_n(n)%ea = sec_el(ne_l + 1 - (d + je)) + secs_n(n)%line_type = n + secs_n(n)%n_segments = je - j0 + 1 + IF (j0 == 1 .AND. je == secs(is)%n_segments) THEN + secs_n(n)%length = secs(is)%length + ELSE + secs_n(n)%length = seg*REAL(je - j0 + 1, wp) + END IF + j0 = je + 1 + END DO + d = d + secs(is)%n_segments + END DO + IF (d /= ne_l) THEN + es_out = CD_DECKDRV_BADINPUT + em_out = 'internal: the Syrope secants do not match the line mesh' + RETURN + END IF + CALL MOVE_ALLOC(lts_n, lts) + CALL MOVE_ALLOC(secs_n, secs) + lts = lts(1:n) + secs = secs(1:n) + END SUBROUTINE syrope_secant_sections + + PURE LOGICAL FUNCTION bits_same(a, b) + REAL(wp), INTENT(IN) :: a, b + bits_same = .NOT. (a < b .OR. a > b) + END FUNCTION bits_same END SUBROUTINE init_one_model - RECURSIVE SUBROUTINE init_one_syrope_model(types, syt, ln, sections, points, l0, opts, model, ErrStat, ErrMsg, & + RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts, model, ErrStat, ErrMsg, & bathymetry) - !! Build one Syrope line model: a single-section line, taut at init, with the seabed, - !! hydrodynamics and fluid fields of any EI = 0 line (init_one_model builds it). Builds the - !! working-curve constitutive from the parse-resolved OWC data and solves the static - !! equilibrium on the rest curve of the initial load history (the OWC for a virgin rope; - !! with SYROPE IC, the Tmax0 working curve below its top strain and the OWC above): the - !! secant EA of that curve at the solved mean strain, current drag included. Each element - !! then gets the running maximum of that history and the slow strain whose t = 0 kernel - !! force equals its static tension, so the dynamic state starts in the static - !! equilibrium. Tmean0 is not a state input (the fixed-end geometry and Tmax0 set the - !! mean tension); a disagreement beyond 1 % is reported on the console. + !! Build one Syrope line model: a line of one or more Syrope sections, alone (taut at init) or + !! between plain EI = 0 sections (a chain-polyester-chain mooring), with the seabed, + !! hydrodynamics and fluid fields of any EI = 0 line (init_one_model builds it). Builds each + !! Syrope section's working-curve constitutive from the parse-resolved OWC data and solves the + !! static equilibrium on the rest curve of the initial load history (the OWC for a virgin rope; + !! with SYROPE IC, the Tmax0 working curve below its top strain and the OWC above), current drag + !! included. Each Syrope element then gets the running maximum of that history and the slow + !! strain whose t = 0 kernel force equals its static tension, so the dynamic state starts in + !! the static equilibrium. Tmean0 is not a state input (the fixed-end geometry and Tmax0 set + !! the mean tension); a disagreement beyond 1 % is reported on the console. + !! The static solve uses secant EAs, iterated to the rest curve. A single-section line, taut + !! and of nearly uniform tension, takes one secant from the curve at its mean strain (the + !! strain the taut geometry fixes). On a composite line the tension varies along a sagging + !! Syrope section, so each Syrope element takes its own secant, from the curve's strain at the + !! element's tension: every element then starts on its rest curve, its slow strain at rest + !! (one secant per section would leave the elements away from the mean off the curve, and + !! their slow strains would settle the line after the start). The tension, which the chains' + !! weight and the geometry largely fix, keeps this update a contraction where a strain update + !! can overshoot. TYPE(DeckLineType), INTENT(IN) :: types(:) - INTEGER, INTENT(IN) :: syt TYPE(DeckLine), INTENT(IN) :: ln TYPE(DeckSection), INTENT(IN) :: sections(:) TYPE(DeckPoint), INTENT(IN) :: points(:) @@ -9190,88 +9274,143 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, syt, ln, sections, points, l0, CHARACTER(*), INTENT(OUT) :: ErrMsg TYPE(CD_BathymetryType), INTENT(IN), OPTIONAL :: bathymetry - TYPE(CD_SyropeType) :: td - TYPE(CD_SyropeType), ALLOCATABLE :: stype(:) - LOGICAL, ALLOCATABLE :: sis(:) - REAL(wp), ALLOCATABLE :: sslow(:), stmax(:), t_static(:) - REAL(wp) :: anchor(3), fairlead(3), eps0, t_ref, secant, total_l0, t_hist, eps_bar, t_mean_static - INTEGER :: ne, e, es, n_owc, iter, nsec + INTEGER, PARAMETER :: MAX_ITER_COMPOSITE = 50 + ! per section in deck order (End A first): its line type, element count and, for a Syrope + ! section, its constitutive data; per element (internal order, anchor first): its section, + ! whether it is a Syrope element and its static secant EA + TYPE(CD_SyropeType), ALLOCATABLE :: tds(:), stype(:) + INTEGER, ALLOCATABLE :: sec_type(:), sec_nseg(:), el_sec(:) + LOGICAL, ALLOCATABLE :: sec_syr(:), sis(:) + REAL(wp), ALLOCATABLE :: sec_el(:), cand_el(:), sslow(:), stmax(:), t_static(:) + REAL(wp) :: anchor(3), fairlead(3), eps0, t_ref, total_l0, t_hist, eps_bar, t_mean_static + REAL(wp) :: eps_e, change, secant, cand + INTEGER :: ne, e, es, n_owc, iter, nsec, j, k, isec, st + LOGICAL :: composite, converged CHARACTER(1024) :: em CHARACTER(24) :: s_eps, s_lo, s_hi ErrStat = CD_DECKDRV_OK ErrMsg = '' nsec = COUNT(sections%line_id == ln%id) - IF (nsec /= 1) THEN - CALL fail(ErrStat, ErrMsg, 'a Syrope line must be a single section (composite Syrope lines are '// & - 'not supported yet)'); RETURN - END IF - IF (types(syt)%ei > CD_ZERO) THEN - CALL fail(ErrStat, ErrMsg, 'a Syrope line does not support finite-EI bending'); RETURN + ALLOCATE (sec_type(nsec), sec_nseg(nsec), sec_syr(nsec), tds(nsec)) + k = 0 + DO j = 1, SIZE(sections) + IF (sections(j)%line_id /= ln%id) CYCLE + k = k + 1 + sec_type(k) = sections(j)%ltype + sec_nseg(k) = sections(j)%nsegs + sec_syr(k) = types(sections(j)%ltype)%is_syrope + END DO + composite = nsec > 1 + ne = SIZE(l0) + IF (SUM(sec_nseg) /= ne) THEN + CALL fail(ErrStat, ErrMsg, 'internal: the Syrope line''s section element counts do not match its mesh') + RETURN END IF - ! internal order anchor (End B) -> fairlead (End A), as gather_line_inputs + DO k = 1, nsec + st = sec_type(k) + IF (types(st)%ei > CD_ZERO) THEN + IF (sec_syr(k)) THEN + CALL fail(ErrStat, ErrMsg, 'a Syrope line does not support finite-EI bending') + ELSE + CALL fail(ErrStat, ErrMsg, 'a composite Syrope line''s other sections must have EI = 0 (section '// & + TRIM(int_to_str(k))//' of LINE '//TRIM(int_to_str(ln%id))//')') + END IF + RETURN + END IF + IF (.NOT. sec_syr(k) .AND. types(st)%elastic_mod > 1) THEN + CALL fail(ErrStat, ErrMsg, 'a composite Syrope line''s other sections must be linear-elastic '// & + '(ElasticMod 1; section '//TRIM(int_to_str(k))//' of LINE '//TRIM(int_to_str(ln%id))//')') + RETURN + END IF + END DO + ! internal element order anchor (End B) -> fairlead (End A), as gather_line_inputs: element e + ! belongs to deck section el_sec(e) + ALLOCATE (el_sec(ne)) + e = ne + DO k = 1, nsec + DO j = 1, sec_nseg(k) + el_sec(e) = k + e = e - 1 + END DO + END DO anchor = points(find_point(points, ln%nodeB))%pos fairlead = points(find_point(points, ln%nodeA))%pos - ! the working-curve constitutive from the parse-resolved OWC data - CALL CD_Syrope_Init(td, types(syt)%syrope_owc_strain, types(syt)%syrope_owc_tension, & - types(syt)%syrope_wc_mod, types(syt)%syrope_p1, types(syt)%syrope_p2, & - types(syt)%syrope_alpha, types(syt)%syrope_beta, & - types(syt)%syrope_c1, types(syt)%syrope_c2, es, em) - IF (es /= CD_SYROPE_OK) THEN - CALL fail(ErrStat, ErrMsg, TRIM(em)); RETURN - END IF - ! geometric strain of the taut line; the working-curve tension there and the - ! OWC secant EA that makes the static solve land at that strain - total_l0 = SUM(l0) - eps0 = NORM2(fairlead - anchor)/total_l0 - CD_ONE - IF (.NOT. (eps0 > CD_ZERO)) THEN - CALL CD_Syrope_End(td) - CALL fail(ErrStat, ErrMsg, 'a Syrope line must be taut at init (stretched length > unstretched)'); RETURN - END IF - ! the OWC table must cover the initial strain: the interpolation would clamp at - ! the end rows and the line would start silently mis-tensioned - n_owc = SIZE(types(syt)%syrope_owc_strain) - IF (eps0 < types(syt)%syrope_owc_strain(1) .OR. eps0 > types(syt)%syrope_owc_strain(n_owc)) THEN - WRITE (s_eps, '(ES10.3)') eps0 - WRITE (s_lo, '(ES10.3)') types(syt)%syrope_owc_strain(1) - WRITE (s_hi, '(ES10.3)') types(syt)%syrope_owc_strain(n_owc) - CALL CD_Syrope_End(td) - CALL fail(ErrStat, ErrMsg, 'the Syrope line''s initial strain '//TRIM(ADJUSTL(s_eps))// & - ' lies outside its OWC table strain range ['//TRIM(ADJUSTL(s_lo))//', '// & - TRIM(ADJUSTL(s_hi))//']; extend the table or reduce the pretension'); RETURN - END IF + ! each Syrope section's working-curve constitutive from the parse-resolved OWC data + DO k = 1, nsec + IF (.NOT. sec_syr(k)) CYCLE + st = sec_type(k) + CALL CD_Syrope_Init(tds(k), types(st)%syrope_owc_strain, types(st)%syrope_owc_tension, & + types(st)%syrope_wc_mod, types(st)%syrope_p1, types(st)%syrope_p2, & + types(st)%syrope_alpha, types(st)%syrope_beta, & + types(st)%syrope_c1, types(st)%syrope_c2, es, em) + IF (es /= CD_SYROPE_OK) THEN + CALL release_syrope(.FALSE.) + CALL fail(ErrStat, ErrMsg, TRIM(em)); RETURN + END IF + END DO ! The load history: SYROPE IC Tmax0, or (no IC) a virgin rope loaded along the OWC. ! The static solve uses that history's rest curve (CD_Syrope_Static_Tension: the ! Tmax0 working curve below its top strain, the OWC above), so the equilibrium it ! finds is the rest state of the SAME constitutive state the dynamics start from. t_hist = CD_ZERO IF (ln%has_syrope_ic) t_hist = ln%syrope_tmax0 - CALL rest_tension(eps0, t_ref, es, em) - IF (es /= CD_SYROPE_OK) THEN - CALL CD_Syrope_End(td) - CALL fail(ErrStat, ErrMsg, 'SYROPE IC working curve: '//TRIM(em)); RETURN - END IF - IF (.NOT. (t_ref > CD_ZERO)) THEN - WRITE (s_eps, '(ES10.3)') eps0 - CALL CD_Syrope_End(td) - CALL fail(ErrStat, ErrMsg, 'the Syrope line is slack on its SYROPE IC working curve: the initial '// & - 'strain '//TRIM(ADJUSTL(s_eps))//' is below the zero-tension strain of the Tmax0 curve; '// & - 'lower Tmax0 or shorten the line'); RETURN - END IF - secant = t_ref/eps0 - ne = SIZE(l0) - ALLOCATE (stype(ne), sis(ne), sslow(ne), stmax(ne), t_static(ne)) - sis = .TRUE. + ALLOCATE (sec_el(ne), cand_el(ne), stype(ne), sis(ne), sslow(ne), stmax(ne), t_static(ne)) + sis = .FALSE. + sslow = CD_ZERO + stmax = CD_ZERO + sec_el = CD_ZERO DO e = 1, ne - stype(e) = td - END DO - ! Static solve with a single secant EA, the line otherwise built as any EI = 0 line (seabed, - ! drag in the deck current, buoyancy). The secant is iterated to the rest curve at the solved - ! mean strain, so the static line carries the curve tension on average (a chord-strain - ! secant misses it by the sag and the current's deflection). - DO iter = 1, 6 + IF (.NOT. sec_syr(el_sec(e))) CYCLE + sis(e) = .TRUE. + stype(e) = tds(el_sec(e)) + END DO + secant = CD_ZERO + IF (.NOT. composite) THEN + ! geometric strain of the taut line; the working-curve tension there and the + ! OWC secant EA that makes the static solve land at that strain + total_l0 = SUM(l0) + eps0 = NORM2(fairlead - anchor)/total_l0 - CD_ONE + IF (.NOT. (eps0 > CD_ZERO)) THEN + CALL release_syrope(.TRUE.) + CALL fail(ErrStat, ErrMsg, 'a Syrope line must be taut at init (stretched length > unstretched)'); RETURN + END IF + ! the OWC table must cover the initial strain: the interpolation would clamp at + ! the end rows and the line would start silently mis-tensioned + IF (.NOT. strain_in_table(1, eps0)) THEN + CALL release_syrope(.TRUE.) + RETURN + END IF + CALL rest_tension(1, eps0, t_ref, es, em) + IF (es /= CD_SYROPE_OK) THEN + CALL release_syrope(.TRUE.) + CALL fail(ErrStat, ErrMsg, 'SYROPE IC working curve: '//TRIM(em)); RETURN + END IF + IF (.NOT. (t_ref > CD_ZERO)) THEN + WRITE (s_eps, '(ES10.3)') eps0 + CALL release_syrope(.TRUE.) + CALL fail(ErrStat, ErrMsg, 'the Syrope line is slack on its SYROPE IC working curve: the initial '// & + 'strain '//TRIM(ADJUSTL(s_eps))//' is below the zero-tension strain of the Tmax0 curve; '// & + 'lower Tmax0 or shorten the line'); RETURN + END IF + secant = t_ref/eps0 + sec_el = secant + ELSE + ! a first solve with each Syrope element at its placeholder stiffness (the working curve's + ! alpha); the tension update below takes it to the curve + DO e = 1, ne + IF (sis(e)) sec_el(e) = types(sec_type(el_sec(e)))%syrope_alpha + END DO + END IF + ! Static solve with the secant EAs, the line otherwise built as any EI = 0 line (seabed, drag + ! in the deck current, buoyancy). The secants are iterated to the rest curves, so the Syrope + ! elements carry their curve tensions (a chord-strain secant misses them by the sag and the + ! current's deflection). The solve just made belongs to the current secants, which are kept + ! once the candidates agree with them. + converged = .FALSE. + DO iter = 1, MERGE(MAX_ITER_COMPOSITE, 6, composite) CALL init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry=bathymetry, & - syrope_secant=secant) + syrope_secant=sec_el) IF (ErrStat /= CD_DECKDRV_OK) EXIT CALL CD_Get_Model_Tension(model, t_static, es, em) CALL CD_End_Model(model, ErrStat, ErrMsg) @@ -9280,35 +9419,87 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, syt, ln, sections, points, l0, ErrMsg = em END IF IF (ErrStat /= CD_MODEL_OK) EXIT - eps_bar = SUM(l0*t_static)/(secant*SUM(l0)) - CALL rest_tension(eps_bar, t_ref, es, em) - IF (es /= CD_SYROPE_OK .OR. .NOT. (t_ref > CD_ZERO .AND. eps_bar > CD_ZERO)) EXIT - IF (ABS(t_ref/eps_bar - secant) <= 1.0e-10_wp*secant) EXIT - secant = t_ref/eps_bar + IF (composite) THEN + ! each Syrope element: the curve's strain at its tension + change = CD_ZERO + cand_el = sec_el + DO e = 1, ne + IF (.NOT. sis(e)) CYCLE + isec = el_sec(e) + IF (.NOT. (t_static(e) > CD_ZERO)) THEN + CALL release_syrope(.TRUE.) + CALL fail(ErrStat, ErrMsg, 'Syrope section '//TRIM(int_to_str(isec))//' of LINE '// & + TRIM(int_to_str(ln%id))//' is slack at init; shorten the line or raise the pretension') + RETURN + END IF + CALL rest_strain(isec, t_static(e), eps_e, es, em) + IF (es /= CD_SYROPE_OK) THEN + CALL release_syrope(.TRUE.) + CALL fail(ErrStat, ErrMsg, 'Syrope section '//TRIM(int_to_str(isec))//' of LINE '// & + TRIM(int_to_str(ln%id))//': '//TRIM(em)); RETURN + END IF + cand_el(e) = t_static(e)/eps_e + change = MAX(change, ABS(cand_el(e) - sec_el(e))/sec_el(e)) + END DO + IF (change <= 1.0e-10_wp) THEN + converged = .TRUE. + EXIT + END IF + sec_el = cand_el + ELSE + eps_bar = SUM(l0*t_static)/(secant*SUM(l0)) + CALL rest_tension(1, eps_bar, t_ref, es, em) + IF (es /= CD_SYROPE_OK .OR. .NOT. (t_ref > CD_ZERO .AND. eps_bar > CD_ZERO)) EXIT + cand = t_ref/eps_bar + IF (ABS(cand - secant) <= 1.0e-10_wp*secant) EXIT + secant = cand + sec_el = secant + END IF END DO IF (ErrStat /= CD_MODEL_OK) THEN - CALL release_syrope() + CALL release_syrope(.TRUE.) ErrMsg = 'CableDyn_DeckDriver: Syrope static solve failed: '//TRIM(ErrMsg) IF (ErrStat /= CD_DECKDRV_BADINPUT) ErrStat = CD_DECKDRV_SOLVEFAIL RETURN END IF - ! Per element: the running maximum is the history's (raised to the element's static + IF (composite) THEN + ! a composite line starts only from converged secants, every Syrope element on its + ! curve's table + IF (.NOT. converged) THEN + CALL release_syrope(.TRUE.) + CALL fail(ErrStat, ErrMsg, 'the static secant EA of the Syrope elements of LINE '// & + TRIM(int_to_str(ln%id))//' did not converge in '//TRIM(int_to_str(MAX_ITER_COMPOSITE))// & + ' iterations') + RETURN + END IF + DO e = 1, ne + IF (.NOT. sis(e)) CYCLE + IF (.NOT. strain_in_table(el_sec(e), t_static(e)/sec_el(e))) THEN + CALL release_syrope(.TRUE.) + RETURN + END IF + END DO + END IF + ! Per Syrope element: the running maximum is the history's (raised to the element's static ! tension where that exceeds it, i.e. the element sits on the OWC; without SYROPE IC ! every element is a virgin rope at its own static tension), and the slow strain ! is the state whose t = 0 kernel force at the static strain equals the static element ! tension exactly, so t = 0 is the static equilibrium (zero initial transient). DO e = 1, ne + IF (.NOT. sis(e)) CYCLE + isec = el_sec(e) stmax(e) = MAX(t_hist, t_static(e)) - CALL CD_Syrope_Slow_For_Tension(td, stmax(e), t_static(e)/secant, t_static(e), sslow(e), es, em) + CALL CD_Syrope_Slow_For_Tension(tds(isec), stmax(e), t_static(e)/sec_el(e), t_static(e), sslow(e), & + es, em) IF (es /= CD_SYROPE_OK) THEN - CALL release_syrope() + CALL release_syrope(.TRUE.) CALL fail(ErrStat, ErrMsg, 'Syrope initial state: '//TRIM(em)); RETURN END IF END DO IF (ln%has_syrope_ic) THEN ! Tmean0 does not enter the state: with fixed ends the mean tension follows from the ! geometry and the Tmax0 history. Name a disagreement rather than ignore it silently. - t_mean_static = SUM(l0*t_static)/SUM(l0) + t_mean_static = SUM(l0*t_static, MASK=sis)/SUM(l0, MASK=sis) IF (ABS(t_mean_static - ln%syrope_tmean0) > 0.01_wp*MAX(t_mean_static, ln%syrope_tmean0)) THEN WRITE (*, '(A,I0,A,ES11.4,A,ES11.4,A)') 'CableDyn: SYROPE IC line ', ln%id, & ': static equilibrium mean tension ', t_mean_static, ' N on the Tmax0 working curve; Tmean0 ', & @@ -9316,18 +9507,20 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, syt, ln, sections, points, l0, END IF END IF CALL init_one_model(ln, sections, types, points, opts, model, ErrStat, ErrMsg, bathymetry=bathymetry, & - syrope_secant=secant, syrope_is=sis, syrope_type=stype, syrope_slow0=sslow, & + syrope_secant=sec_el, syrope_is=sis, syrope_type=stype, syrope_slow0=sslow, & syrope_tmax0=stmax) - CALL release_syrope() + CALL release_syrope(.TRUE.) IF (ErrStat /= CD_DECKDRV_OK) THEN ErrMsg = 'CableDyn_DeckDriver: Syrope model init failed: '//TRIM(ErrMsg) IF (ErrStat /= CD_DECKDRV_BADINPUT) ErrStat = CD_DECKDRV_SOLVEFAIL END IF CONTAINS - SUBROUTINE rest_tension(eps, tension, es_out, em_out) - !! The static curve of the initial load history at strain eps: the OWC for a virgin - !! rope (no SYROPE IC), the Tmax0 working curve / OWC (CD_Syrope_Static_Tension) with it. + SUBROUTINE rest_tension(isec_, eps, tension, es_out, em_out) + !! The static curve of the initial load history of Syrope section isec_ at strain eps: the + !! OWC for a virgin rope (no SYROPE IC), the Tmax0 working curve / OWC + !! (CD_Syrope_Static_Tension) with it. + INTEGER, INTENT(IN) :: isec_ REAL(wp), INTENT(IN) :: eps REAL(wp), INTENT(OUT) :: tension INTEGER, INTENT(OUT) :: es_out @@ -9335,18 +9528,82 @@ SUBROUTINE rest_tension(eps, tension, es_out, em_out) es_out = CD_SYROPE_OK em_out = '' IF (ln%has_syrope_ic) THEN - CALL CD_Syrope_Static_Tension(td, t_hist, eps, tension, es_out, em_out) + CALL CD_Syrope_Static_Tension(tds(isec_), t_hist, eps, tension, es_out, em_out) ELSE - tension = owc_table_interp(types(syt)%syrope_owc_strain, types(syt)%syrope_owc_tension, eps) + tension = owc_table_interp(types(sec_type(isec_))%syrope_owc_strain, & + types(sec_type(isec_))%syrope_owc_tension, eps) END IF END SUBROUTINE rest_tension - SUBROUTINE release_syrope() + SUBROUTINE rest_strain(isec_, tension, eps, es_out, em_out) + !! The strain of section isec_'s rest curve at a tension, by bisection over its OWC table + !! (the curve rises monotonically with strain). + INTEGER, INTENT(IN) :: isec_ + REAL(wp), INTENT(IN) :: tension + REAL(wp), INTENT(OUT) :: eps + INTEGER, INTENT(OUT) :: es_out + CHARACTER(*), INTENT(OUT) :: em_out + REAL(wp) :: lo, hi, t_lo, t_hi, t_mid + INTEGER :: it, n + CHARACTER(24) :: s_t, s_top + n = SIZE(types(sec_type(isec_))%syrope_owc_strain) + lo = types(sec_type(isec_))%syrope_owc_strain(1) + hi = types(sec_type(isec_))%syrope_owc_strain(n) + eps = lo + CALL rest_tension(isec_, lo, t_lo, es_out, em_out) + IF (es_out /= CD_SYROPE_OK) RETURN + CALL rest_tension(isec_, hi, t_hi, es_out, em_out) + IF (es_out /= CD_SYROPE_OK) RETURN + IF (tension > t_hi) THEN + WRITE (s_t, '(ES10.3)') tension + WRITE (s_top, '(ES10.3)') t_hi + es_out = CD_SYROPE_BADINPUT + em_out = 'a tension of '//TRIM(ADJUSTL(s_t))//' N lies above the top of its OWC table ('// & + TRIM(ADJUSTL(s_top))//' N); extend the table or reduce the pretension' + RETURN + END IF + IF (.NOT. (tension > t_lo)) RETURN + DO it = 1, 200 + eps = 0.5_wp*(lo + hi) + CALL rest_tension(isec_, eps, t_mid, es_out, em_out) + IF (es_out /= CD_SYROPE_OK) RETURN + IF (t_mid < tension) THEN + lo = eps + ELSE + hi = eps + END IF + IF (hi - lo <= 4.0_wp*EPSILON(hi)*hi) EXIT + END DO + eps = 0.5_wp*(lo + hi) + END SUBROUTINE rest_strain + + LOGICAL FUNCTION strain_in_table(isec_, eps) RESULT(ok) + !! Whether strain eps lies in section isec_'s OWC table (the interpolation clamps at its end + !! rows, so a strain outside would start the line silently mis-tensioned); fails otherwise. + INTEGER, INTENT(IN) :: isec_ + REAL(wp), INTENT(IN) :: eps + n_owc = SIZE(types(sec_type(isec_))%syrope_owc_strain) + ok = .NOT. (eps < types(sec_type(isec_))%syrope_owc_strain(1) .OR. & + eps > types(sec_type(isec_))%syrope_owc_strain(n_owc)) + IF (ok) RETURN + WRITE (s_eps, '(ES10.3)') eps + WRITE (s_lo, '(ES10.3)') types(sec_type(isec_))%syrope_owc_strain(1) + WRITE (s_hi, '(ES10.3)') types(sec_type(isec_))%syrope_owc_strain(n_owc) + CALL fail(ErrStat, ErrMsg, 'the Syrope line''s initial strain '//TRIM(ADJUSTL(s_eps))// & + ' lies outside its OWC table strain range ['//TRIM(ADJUSTL(s_lo))//', '// & + TRIM(ADJUSTL(s_hi))//']; extend the table or reduce the pretension') + END FUNCTION strain_in_table + + SUBROUTINE release_syrope(with_elements) !! Free the constitutive copies (the model deep-copies what it keeps). - INTEGER :: k - CALL CD_Syrope_End(td) - DO k = 1, ne - CALL CD_Syrope_End(stype(k)) + LOGICAL, INTENT(IN) :: with_elements + INTEGER :: kk + DO kk = 1, nsec + IF (sec_syr(kk)) CALL CD_Syrope_End(tds(kk)) + END DO + IF (.NOT. with_elements) RETURN + DO kk = 1, ne + IF (sis(kk)) CALL CD_Syrope_End(stype(kk)) END DO END SUBROUTINE release_syrope END SUBROUTINE init_one_syrope_model @@ -16783,21 +17040,18 @@ SUBROUTINE finalize_checks(types, bodies, rod_types, rods, points, lines, sectio END IF END DO - ! A history row is meaningful only for a line whose constitutive type is - ! Syrope. The current production surface is single-section, so this also - ! prevents an IC from being silently attached to a plain/composite line. + ! A history row is meaningful only for a line with a Syrope section (alone or in a + ! composite line); it sets the load history of every Syrope section of the line. DO i = 1, SIZE(lines) at_line = lines(i)%deck_line IF (.NOT. lines(i)%has_syrope_ic) CYCLE - nsec_for_line = 0 idx = 0 DO j = 1, SIZE(sections) IF (sections(j)%line_id /= lines(i)%id) CYCLE - nsec_for_line = nsec_for_line + 1 IF (types(sections(j)%ltype)%is_syrope) idx = idx + 1 END DO - IF (nsec_for_line /= 1 .OR. idx /= 1) THEN - CALL fail(ErrStat, ErrMsg, 'SYROPE IC can reference only a single-section Syrope LINE') + IF (idx < 1) THEN + CALL fail(ErrStat, ErrMsg, 'SYROPE IC can reference only a LINE with a Syrope section') RETURN END IF END DO diff --git a/tests/test_deck_driver.f90 b/tests/test_deck_driver.f90 index c2081107..25787d3c 100644 --- a/tests/test_deck_driver.f90 +++ b/tests/test_deck_driver.f90 @@ -1182,11 +1182,27 @@ PROGRAM test_deck_driver ! the placeholder linear EA or to a load path that carries no Syrope state. BLOCK TYPE(CD_ModelType), ALLOCATABLE :: smodels(:) - CALL write_syrope_deck('deck_syrope_composite.dat', 'SYROPE:syrope.dat|1.53e8|23.12', & - '5.0e10|1.0e5', nsections=2) - CALL CD_Init_Deck_Models('deck_syrope_composite.dat', smodels, es, em) - CALL require(es /= CD_DECKDRV_OK .AND. INDEX(em, 'composite Syrope') > 0, & - 'composite Syrope fails closed by name') + ! a Syrope line split into two Syrope sections (the same mesh) is the same line: the + ! composite build's mean-tension secant iteration lands on the single section's equilibrium + BLOCK + TYPE(CD_ModelType), ALLOCATABLE :: one(:) + REAL(wp) :: t1(4), t2(4) + CALL write_syrope_deck('deck_syrope_one.dat', 'SYROPE:syrope.dat|1.53e8|23.12', '5.0e10|1.0e5') + CALL CD_Init_Deck_Models('deck_syrope_one.dat', one, es, em) + CALL require(es == CD_DECKDRV_OK, 'single-section Syrope line builds: '//TRIM(em)) + CALL write_syrope_deck('deck_syrope_composite.dat', 'SYROPE:syrope.dat|1.53e8|23.12', & + '5.0e10|1.0e5', nsections=2) + CALL CD_Init_Deck_Models('deck_syrope_composite.dat', smodels, es, em) + CALL require(es == CD_DECKDRV_OK, 'a Syrope line of two Syrope sections builds: '//TRIM(em)) + IF (ALLOCATED(one) .AND. ALLOCATED(smodels)) THEN + CALL CD_Get_Model_Tension(one(1), t1, es, em) + CALL CD_Get_Model_Tension(smodels(1), t2, es, em) + CALL require(MAXVAL(ABS(t2 - t1)) <= 1.0e-8_wp*MAXVAL(t1), & + 'two Syrope sections reach the single section''s static tensions') + CALL CD_End_Model(one(1), es, em) + CALL CD_End_Model(smodels(1), es, em) + END IF + END BLOCK CALL write_syrope_deck('deck_syrope_finite_ei.dat', 'SYROPE:syrope.dat|1.53e8|23.12', & '5.0e10|1.0e5', ei=5.0e3_wp) diff --git a/tests/test_syrope_composite.f90 b/tests/test_syrope_composite.f90 new file mode 100644 index 00000000..848952cd --- /dev/null +++ b/tests/test_syrope_composite.f90 @@ -0,0 +1,303 @@ +! File: tests/test_syrope_composite.f90 +! SPDX-License-Identifier: Apache-2.0 +! Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +PROGRAM test_syrope_composite + !! Composite Syrope lines: a chain-polyester-chain mooring whose polyester section follows the + !! Syrope working-curve model, in 200 m of water (the line of + !! examples/composite_chain_poly_chain.dat with its anchor 30 m further out, so the polyester + !! carries about 1 MN, where the working curve of these constants is admissible for a virgin + !! rope). + !! 1. The line builds; the Syrope flags sit on the 40 polyester elements only, the chains keep + !! their BA damping and the polyester takes none (its working curve carries the rope's). + !! 2. The static polyester sits on its rest curve: every element's geometric strain gives its + !! tension on the OWC (each element takes its own secant EA), and so does the section's mean. + !! 3. The same line with a linear-EA polyester of the mean secant EA has the static tensions to + !! the spread of the elements' own secants: the chains are built as any EI = 0 line. + !! 4. The dynamics start in the static equilibrium: a still run keeps the fairlead tension + !! (one secant per section left the elements away from the mean off the curve, and their + !! slow strains moved the fairlead tension by 1.4e-5 within 2 s). + !! 5. A SYROPE IC history (Tmax0 above the static tension) puts the section on the Tmax0 + !! working curve instead. + !! 6. A pretension above the top of the OWC table fails closed by name. + USE CableDyn_Precision, ONLY: wp + USE CableDyn_DeckDriver, ONLY: CD_Init_Deck_Models, CD_Run_Deck_Driver, CD_DECKDRV_OK + USE CableDyn_Model, ONLY: CD_ModelType, CD_End_Model, CD_Get_Model_Tension + USE CableDyn_Syrope, ONLY: CD_SyropeType, CD_Syrope_Init, CD_Syrope_End, CD_Syrope_Static_Tension, & + CD_SYROPE_WC_EXP, CD_SYROPE_OK + IMPLICIT NONE + + INTEGER, PARAMETER :: NOWC = 30, NE_A = 25, NE_P = 40, NE_F = 12 + ! the shipped data/syrope/syrope_owc.dat table + REAL(wp), PARAMETER :: OWC_EPS(NOWC) = [ & + 0.00000e+00_wp, 2.06897e-03_wp, 4.13793e-03_wp, 6.20690e-03_wp, 8.27586e-03_wp, & + 1.03448e-02_wp, 1.24138e-02_wp, 1.44828e-02_wp, 1.65517e-02_wp, 1.86207e-02_wp, & + 2.06897e-02_wp, 2.27586e-02_wp, 2.48276e-02_wp, 2.68966e-02_wp, 2.89655e-02_wp, & + 3.10345e-02_wp, 3.31034e-02_wp, 3.51724e-02_wp, 3.72414e-02_wp, 3.93103e-02_wp, & + 4.13793e-02_wp, 4.34483e-02_wp, 4.55172e-02_wp, 4.75862e-02_wp, 4.96552e-02_wp, & + 5.17241e-02_wp, 5.37931e-02_wp, 5.58621e-02_wp, 5.79310e-02_wp, 6.00000e-02_wp] + REAL(wp), PARAMETER :: OWC_TEN(NOWC) = [ & + 0.00000e+00_wp, 1.71768e+05_wp, 3.30952e+05_wp, 4.78788e+05_wp, 6.16510e+05_wp, & + 7.45355e+05_wp, 8.66556e+05_wp, 9.81351e+05_wp, 1.09097e+06_wp, 1.19666e+06_wp, & + 1.29964e+06_wp, 1.40116e+06_wp, 1.50245e+06_wp, 1.60474e+06_wp, 1.70927e+06_wp, & + 1.81728e+06_wp, 1.93000e+06_wp, 2.04866e+06_wp, 2.17450e+06_wp, 2.30876e+06_wp, & + 2.45267e+06_wp, 2.60747e+06_wp, 2.77439e+06_wp, 2.95467e+06_wp, 3.14954e+06_wp, & + 3.36024e+06_wp, 3.58800e+06_wp, 3.83406e+06_wp, 4.09965e+06_wp, 4.38601e+06_wp] + INTEGER :: nfail = 0, es, e + CHARACTER(1024) :: em + TYPE(CD_ModelType), ALLOCATABLE :: models(:), lin(:) + REAL(wp) :: t_syr(NE_A + NE_P + NE_F), t_lin(NE_A + NE_P + NE_F), eps_bar, t_bar, secant, eps_e, worst + CHARACTER(32) :: ea_text + + CALL write_owc('csyr_owc.dat', NOWC) + CALL write_settings('csyr_settings.dat', 'csyr_owc.dat') + + ! 1. the composite line builds, with its Syrope elements and damping where they belong + CALL write_deck('csyr.dat', '"SYROPE:csyr_settings.dat|1.53e8|23.12"', '5.0e10|1.0e5') + CALL CD_Init_Deck_Models('csyr.dat', models, es, em) + CALL require(es == CD_DECKDRV_OK, 'chain-Syrope-chain line builds: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) CALL finish() + ASSOCIATE (md => models(1)) + ! internal element order anchor -> fairlead: the anchor chain, the polyester, the fairlead chain + CALL require(md%n_elem == NE_A + NE_P + NE_F, 'the composite mesh has the three sections'' elements') + CALL require(COUNT(md%syrope_is) == NE_P .AND. ALL(md%syrope_is(NE_A + 1:NE_A + NE_P)), & + 'the Syrope flags sit on the polyester elements only') + CALL require(ALL(md%ba_dyn(1:NE_A) > 0.0_wp) .AND. ALL(md%ba_dyn(NE_A + NE_P + 1:) > 0.0_wp), & + 'the chain sections keep their BA damping') + CALL require(ALL(.NOT. (md%ba_dyn(NE_A + 1:NE_A + NE_P) > 0.0_wp)), & + 'the polyester takes no legacy BA (its working curve carries the damping)') + CALL CD_Get_Model_Tension(md, t_syr, es, em) + ! 2. on the rest curve (a virgin rope: the OWC) at the section's mean strain + eps_bar = 0.0_wp + DO e = NE_A + 1, NE_A + NE_P + eps_bar = eps_bar + (NORM2(md%q(3*md%elem_conn(2, e) - 2:3*md%elem_conn(2, e)) - & + md%q(3*md%elem_conn(1, e) - 2:3*md%elem_conn(1, e))) - md%l0(e)) + END DO + eps_bar = eps_bar/SUM(md%l0(NE_A + 1:NE_A + NE_P)) + t_bar = SUM(md%l0(NE_A + 1:NE_A + NE_P)*t_syr(NE_A + 1:NE_A + NE_P))/SUM(md%l0(NE_A + 1:NE_A + NE_P)) + PRINT '(A,ES12.5,A,ES12.5,A,ES12.5,A,ES12.5)', ' polyester mean strain ', eps_bar, ', mean tension ', & + t_bar, ' N, OWC there ', owc(eps_bar), ' N; fairlead tension ', t_syr(NE_A + NE_P + NE_F) + CALL require(ABS(owc(eps_bar) - t_bar) <= 1.0e-6_wp*t_bar, & + 'the static polyester section sits on its OWC at its mean strain') + ! and every polyester element on its own OWC (each takes its own secant) + worst = 0.0_wp + DO e = NE_A + 1, NE_A + NE_P + eps_e = NORM2(md%q(3*md%elem_conn(2, e) - 2:3*md%elem_conn(2, e)) - & + md%q(3*md%elem_conn(1, e) - 2:3*md%elem_conn(1, e)))/md%l0(e) - 1.0_wp + worst = MAX(worst, ABS(owc(eps_e) - t_syr(e))/t_syr(e)) + END DO + PRINT '(A,ES10.3,A,ES12.5,A,ES12.5,A)', ' polyester elements off their OWC by at most ', worst, & + ' (tensions ', MINVAL(t_syr(NE_A + 1:NE_A + NE_P)), ' to ', MAXVAL(t_syr(NE_A + 1:NE_A + NE_P)), ' N)' + CALL require(worst <= 1.0e-8_wp, 'every static polyester element sits on its OWC') + secant = t_bar/eps_bar + END ASSOCIATE + CALL CD_End_Model(models(1), es, em) + + ! 3. the same line with a linear-EA polyester of the converged secant EA + WRITE (ea_text, '(ES23.16)') secant + CALL write_deck('csyr_lin.dat', TRIM(ADJUSTL(ea_text)), '0.0') + CALL CD_Init_Deck_Models('csyr_lin.dat', lin, es, em) + CALL require(es == CD_DECKDRV_OK, 'the linear-EA twin builds: '//TRIM(em)) + IF (es == CD_DECKDRV_OK) THEN + CALL CD_Get_Model_Tension(lin(1), t_lin, es, em) + PRINT '(A,ES10.3)', ' Syrope vs linear-EA twin: max element-tension difference / max tension ', & + MAXVAL(ABS(t_syr - t_lin))/MAXVAL(t_lin) + CALL require(MAXVAL(ABS(t_syr - t_lin)) <= 1.0e-6_wp*MAXVAL(t_lin), & + 'the linear-EA twin of the mean secant EA has the static tensions (to the spread of '// & + 'the elements'' own secants)') + CALL CD_End_Model(lin(1), es, em) + END IF + + ! 4. the dynamics start in the static equilibrium + CALL still_run() + + ! 5. a SYROPE IC history above the static tension: the Tmax0 working curve + CALL tmax0_curve() + + ! 6. a pretension above the top of the OWC table + CALL write_owc('csyr_owc_short.dat', 6) + CALL write_settings('csyr_settings_short.dat', 'csyr_owc_short.dat') + CALL write_deck('csyr_short.dat', '"SYROPE:csyr_settings_short.dat|1.53e8|23.12"', '5.0e10|1.0e5') + CALL CD_Init_Deck_Models('csyr_short.dat', models, es, em) + CALL require(es /= CD_DECKDRV_OK .AND. INDEX(em, 'above the top of its OWC table') > 0, & + 'a pretension above the OWC table fails closed by name: '//TRIM(em)) + + CALL finish() + +CONTAINS + + SUBROUTINE still_run() + !! The composite line run still for 2 s: the fairlead tension stays at its static value. + INTEGER :: u, ios, n + CHARACTER(4096) :: row + REAL(wp) :: t, ft, ft0, dev + LOGICAL :: conv + CALL write_deck('csyr_dyn.dat', '"SYROPE:csyr_settings.dat|1.53e8|23.12"', '5.0e10|1.0e5', dynamic=.TRUE.) + CALL CD_Run_Deck_Driver('csyr_dyn.dat', 'csyr_dyn', conv, es, em) + CALL require(es == CD_DECKDRV_OK, 'the composite line runs: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + OPEN (NEWUNIT=u, FILE='csyr_dyn.out', STATUS='OLD', ACTION='READ', IOSTAT=ios) + n = 0 + dev = 0.0_wp + ft0 = 0.0_wp + DO + READ (u, '(A)', IOSTAT=ios) row + IF (ios /= 0) EXIT + IF (row(1:1) == '#' .OR. INDEX(row, 'Time') > 0) CYCLE + READ (row, *, IOSTAT=ios) t, ft + IF (ios /= 0) CYCLE + n = n + 1 + IF (n == 1) ft0 = ft + dev = MAX(dev, ABS(ft - ft0)) + END DO + CLOSE (u) + PRINT '(A,I0,A,ES10.3)', ' still run: ', n, ' rows, max |FairTen - FairTen(0)| / FairTen(0) ', dev/ft0 + CALL require(n > 100 .AND. dev <= 1.0e-7_wp*ft0, 'the dynamics start in the static equilibrium') + END SUBROUTINE still_run + + SUBROUTINE tmax0_curve() + !! SYROPE IC Tmax0 = 2.5 MN: the polyester's mean tension is the Tmax0 working curve's at its + !! mean strain. + TYPE(CD_ModelType), ALLOCATABLE :: mic(:) + TYPE(CD_SyropeType) :: td + REAL(wp) :: ten(NE_A + NE_P + NE_F), eb, tb, tcurve + INTEGER :: k + CALL write_deck('csyr_ic.dat', '"SYROPE:csyr_settings.dat|1.53e8|23.12"', '5.0e10|1.0e5', & + ic_row='1 2.5e6 1.0e6') + CALL CD_Init_Deck_Models('csyr_ic.dat', mic, es, em) + CALL require(es == CD_DECKDRV_OK, 'the composite line with SYROPE IC builds: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + CALL CD_Syrope_Init(td, OWC_EPS, OWC_TEN, CD_SYROPE_WC_EXP, 0.20_wp, 1.50_wp, 1.53e8_wp, 23.12_wp, & + 5.0e10_wp, 1.0e5_wp, es, em) + CALL require(es == CD_SYROPE_OK, 'reference working curve: '//TRIM(em)) + ASSOCIATE (md => mic(1)) + CALL CD_Get_Model_Tension(md, ten, es, em) + eb = 0.0_wp + DO k = NE_A + 1, NE_A + NE_P + eb = eb + (NORM2(md%q(3*md%elem_conn(2, k) - 2:3*md%elem_conn(2, k)) - & + md%q(3*md%elem_conn(1, k) - 2:3*md%elem_conn(1, k))) - md%l0(k)) + END DO + eb = eb/SUM(md%l0(NE_A + 1:NE_A + NE_P)) + tb = SUM(md%l0(NE_A + 1:NE_A + NE_P)*ten(NE_A + 1:NE_A + NE_P))/SUM(md%l0(NE_A + 1:NE_A + NE_P)) + CALL CD_Syrope_Static_Tension(td, 2.5e6_wp, eb, tcurve, es, em) + PRINT '(A,ES12.5,A,ES12.5,A,ES12.5,A)', ' SYROPE IC: polyester mean strain ', eb, ', mean tension ', tb, & + ' N, Tmax0 working curve there ', tcurve, ' N' + CALL require(es == CD_SYROPE_OK .AND. ABS(tcurve - tb) <= 1.0e-6_wp*tb, & + 'with SYROPE IC the polyester sits on the Tmax0 working curve') + CALL require(ALL(md%syrope_tmax(NE_A + 1:NE_A + NE_P) >= 2.5e6_wp), & + 'every polyester element carries the Tmax0 history') + END ASSOCIATE + CALL CD_End_Model(mic(1), es, em) + CALL CD_Syrope_End(td) + END SUBROUTINE tmax0_curve + + REAL(wp) FUNCTION owc(eps) RESULT(t) + !! The OWC table, interpolated linearly. + REAL(wp), INTENT(IN) :: eps + INTEGER :: k + t = OWC_TEN(NOWC) + DO k = 2, NOWC + IF (eps <= OWC_EPS(k)) THEN + t = OWC_TEN(k - 1) + (OWC_TEN(k) - OWC_TEN(k - 1))*(eps - OWC_EPS(k - 1))/(OWC_EPS(k) - OWC_EPS(k - 1)) + RETURN + END IF + END DO + END FUNCTION owc + + SUBROUTINE write_owc(path, nrow) + CHARACTER(*), INTENT(IN) :: path + INTEGER, INTENT(IN) :: nrow + INTEGER :: u, k + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'Strain Tension' + WRITE (u, '(A)') '(-) (N)' + DO k = 1, nrow + WRITE (u, '(ES14.6,1X,ES14.6)') OWC_EPS(k), OWC_TEN(k) + END DO + CLOSE (u) + END SUBROUTINE write_owc + + SUBROUTINE write_settings(path, owc_path) + CHARACTER(*), INTENT(IN) :: path, owc_path + INTEGER :: u + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') owc_path//' OWC - Original working-curve table file' + WRITE (u, '(A)') 'EXP WCType - Working-curve formulation' + WRITE (u, '(A)') '0.20 k1 - First working-curve shape parameter' + WRITE (u, '(A)') '1.50 k2 - Second working-curve shape parameter' + CLOSE (u) + END SUBROUTINE write_settings + + SUBROUTINE write_deck(path, poly_ea, poly_ba, dynamic, ic_row) + !! The chain-polyester-chain line (anchor at 780 m), the polyester with the given EA and BA + !! columns. + CHARACTER(*), INTENT(IN) :: path, poly_ea, poly_ba + LOGICAL, INTENT(IN), OPTIONAL :: dynamic + CHARACTER(*), INTENT(IN), OPTIONAL :: ic_row + INTEGER :: u + LOGICAL :: dyn + dyn = .FALSE. + IF (PRESENT(dynamic)) dyn = dynamic + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'composite Syrope test deck' + 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)') 'chain 0.2791 480.93 2.058e9 -1.0 0.0 1.37 0.64 1.0 0.0' + WRITE (u, '(A)') 'poly 0.1438 22.42 '//poly_ea//' '//poly_ba//' 0.0 1.2 0.2 1.0 0.0' + 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 Fixed 780.0 0.0 -200.0 0 0 0 0' + WRITE (u, '(A)') '2 Vessel 58.0 0.0 -14.0 0 0 0 0' + WRITE (u, '(A)') '--- LINES ---' + WRITE (u, '(A)') 'ID NodeA NodeB Outputs' + WRITE (u, '(A)') '(-) (-) (-) (-)' + WRITE (u, '(A)') '1 2 1 -' + IF (PRESENT(ic_row)) THEN + WRITE (u, '(A)') '--- SYROPE IC ---' + WRITE (u, '(A)') 'Line(s) Tmax0 Tmean0' + WRITE (u, '(A)') '(-) (N) (N)' + WRITE (u, '(A)') ic_row + END IF + WRITE (u, '(A)') '--- SECTIONS ---' + WRITE (u, '(A)') 'LineID LineType Length NumSegs' + WRITE (u, '(A)') '(-) (-) (m) (-)' + WRITE (u, '(A)') '1 chain 100.0 12' + WRITE (u, '(A)') '1 poly 400.0 40' + WRITE (u, '(A)') '1 chain 250.0 25' + WRITE (u, '(A)') '--- OPTIONS ---' + WRITE (u, '(A)') '9.80665 g' + WRITE (u, '(A)') '1025.0 rhoW' + WRITE (u, '(A)') '200.0 WtrDpth' + WRITE (u, '(A)') '3.0e6 kBot' + WRITE (u, '(A)') '1.0e4 cBot' + IF (dyn) THEN + WRITE (u, '(A)') '0.01 dtM' + WRITE (u, '(A)') '2.0 TMax' + END IF + WRITE (u, '(A)') '--- OUTPUTS ---' + WRITE (u, '(A)') 'FairTen1' + WRITE (u, '(A)') '--- end ---' + CLOSE (u) + END SUBROUTINE write_deck + + SUBROUTINE require(ok, what) + LOGICAL, INTENT(IN) :: ok + CHARACTER(*), INTENT(IN) :: what + IF (ok) THEN + PRINT '(A)', 'PASS: '//what + ELSE + PRINT '(A)', 'FAIL: '//what + nfail = nfail + 1 + END IF + END SUBROUTINE require + + SUBROUTINE finish() + IF (nfail > 0) THEN + PRINT '(I0,A)', nfail, ' assertion(s) failed' + ERROR STOP 1 + END IF + PRINT '(A)', 'all composite Syrope checks passed' + STOP + END SUBROUTINE finish +END PROGRAM test_syrope_composite From 52c4a783465cf1864c1b7c67847defbe695b0c0c Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 29 Oct 2026 22:37:27 +0900 Subject: [PATCH 2/3] fix(syrope): an overshooting trial tension no longer refuses a composite line The composite static solve starts its Syrope elements at the working curve's alpha, so on a taut line the first trial tension can lie above the top of the OWC table although the equilibrium is well inside it (20 m of rope stretched to 20.7 m: 5.36 MN at alpha against the table's 4.39 MN top, 2.04 MN on the curve). Such an iterate now takes the curve's secant at the table's top row and the update continues; only a converged tension above the table is refused, by the same message. New gate in syrope_composite: that taut two-section rope builds with every element on its OWC to 5e-11 (the unfixed code refuses it at 5.355 MN). Signed-off-by: Jae Hoon Seo --- src/CableDyn_DeckDriver.f90 | 23 +++++++++++-- tests/test_syrope_composite.f90 | 60 +++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 476faee3..5be28522 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -9432,13 +9432,24 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts TRIM(int_to_str(ln%id))//' is slack at init; shorten the line or raise the pretension') RETURN END IF - CALL rest_strain(isec, t_static(e), eps_e, es, em) + ! an iterate's tension above the top of the table (the placeholder alpha can overshoot + ! the curve) takes the curve's secant at the table's top row, where the curve's secant + ! is continuous, so the update goes on; the converged tensions are checked against the + ! table below + eps_e = types(sec_type(isec))%syrope_owc_strain(SIZE(types(sec_type(isec))%syrope_owc_strain)) + CALL rest_tension(isec, eps_e, t_ref, es, em) + IF (es == CD_SYROPE_OK .AND. .NOT. (t_static(e) > t_ref)) & + CALL rest_strain(isec, t_static(e), eps_e, es, em) IF (es /= CD_SYROPE_OK) THEN CALL release_syrope(.TRUE.) CALL fail(ErrStat, ErrMsg, 'Syrope section '//TRIM(int_to_str(isec))//' of LINE '// & TRIM(int_to_str(ln%id))//': '//TRIM(em)); RETURN END IF - cand_el(e) = t_static(e)/eps_e + IF (t_static(e) > t_ref) THEN + cand_el(e) = t_ref/eps_e + ELSE + cand_el(e) = t_static(e)/eps_e + END IF change = MAX(change, ABS(cand_el(e) - sec_el(e))/sec_el(e)) END DO IF (change <= 1.0e-10_wp) THEN @@ -9474,6 +9485,14 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts END IF DO e = 1, ne IF (.NOT. sis(e)) CYCLE + ! a converged tension above the table's top (the secant held at the top row's) is refused + ! by name + CALL rest_strain(el_sec(e), t_static(e), eps_e, es, em) + IF (es /= CD_SYROPE_OK) THEN + CALL release_syrope(.TRUE.) + CALL fail(ErrStat, ErrMsg, 'Syrope section '//TRIM(int_to_str(el_sec(e)))//' of LINE '// & + TRIM(int_to_str(ln%id))//': '//TRIM(em)); RETURN + END IF IF (.NOT. strain_in_table(el_sec(e), t_static(e)/sec_el(e))) THEN CALL release_syrope(.TRUE.) RETURN diff --git a/tests/test_syrope_composite.f90 b/tests/test_syrope_composite.f90 index 848952cd..29c06f78 100644 --- a/tests/test_syrope_composite.f90 +++ b/tests/test_syrope_composite.f90 @@ -19,6 +19,9 @@ PROGRAM test_syrope_composite !! 5. A SYROPE IC history (Tmax0 above the static tension) puts the section on the Tmax0 !! working curve instead. !! 6. A pretension above the top of the OWC table fails closed by name. + !! 7. A taut line of two Syrope sections whose first solve, at the placeholder alpha, overshoots + !! the top of the table: the update continues from the table's top secant and every + !! element lands on its OWC. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Init_Deck_Models, CD_Run_Deck_Driver, CD_DECKDRV_OK USE CableDyn_Model, ONLY: CD_ModelType, CD_End_Model, CD_Get_Model_Tension @@ -121,6 +124,9 @@ PROGRAM test_syrope_composite CALL require(es /= CD_DECKDRV_OK .AND. INDEX(em, 'above the top of its OWC table') > 0, & 'a pretension above the OWC table fails closed by name: '//TRIM(em)) + ! 7. an overshooting first solve on a taut two-section rope + CALL taut_overshoot() + CALL finish() CONTAINS @@ -154,6 +160,60 @@ SUBROUTINE still_run() CALL require(n > 100 .AND. dev <= 1.0e-7_wp*ft0, 'the dynamics start in the static equilibrium') END SUBROUTINE still_run + SUBROUTINE taut_overshoot() + !! 20 m of virgin rope in two 10 m Syrope sections between fixed points 20.7 m apart: alpha + !! (1.53e8 N) at the 3.5 % chord strain gives 5.4 MN, above the table's 4.4 MN top, while the + !! OWC there is about 2 MN. + TYPE(CD_ModelType), ALLOCATABLE :: mt(:) + REAL(wp) :: ten(10), eps_k, wst + INTEGER :: u, k + OPEN (NEWUNIT=u, FILE='csyr_taut.dat', STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'taut two-section Syrope test deck' + 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.1438 22.42 "SYROPE:csyr_settings.dat|1.53e8|23.12" 5.0e10|1.0e5 0.0 1.2 0.2 1.0 0.0' + 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 Fixed 20.7 0.0 -100.0 0 0 0 0' + WRITE (u, '(A)') '2 Vessel 0.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 2 1 -' + WRITE (u, '(A)') '--- SECTIONS ---' + WRITE (u, '(A)') 'LineID LineType Length NumSegs' + WRITE (u, '(A)') '(-) (-) (m) (-)' + WRITE (u, '(A)') '1 poly 10.0 5' + WRITE (u, '(A)') '1 poly 10.0 5' + WRITE (u, '(A)') '--- OPTIONS ---' + WRITE (u, '(A)') '9.80665 g' + WRITE (u, '(A)') '1025.0 rhoW' + WRITE (u, '(A)') '200.0 WtrDpth' + WRITE (u, '(A)') '--- OUTPUTS ---' + WRITE (u, '(A)') 'FairTen1' + WRITE (u, '(A)') '--- end ---' + CLOSE (u) + CALL CD_Init_Deck_Models('csyr_taut.dat', mt, es, em) + CALL require(es == CD_DECKDRV_OK, 'a taut rope whose first solve overshoots the OWC table builds: '//TRIM(em)) + IF (es /= CD_DECKDRV_OK) RETURN + ASSOCIATE (md => mt(1)) + CALL CD_Get_Model_Tension(md, ten, es, em) + wst = 0.0_wp + DO k = 1, md%n_elem + eps_k = NORM2(md%q(3*md%elem_conn(2, k) - 2:3*md%elem_conn(2, k)) - & + md%q(3*md%elem_conn(1, k) - 2:3*md%elem_conn(1, k)))/md%l0(k) - 1.0_wp + wst = MAX(wst, ABS(owc(eps_k) - ten(k))/ten(k)) + END DO + PRINT '(A,ES12.5,A,ES12.5,A,ES10.3)', ' taut rope: tensions ', MINVAL(ten), ' to ', MAXVAL(ten), & + ' N, elements off their OWC by at most ', wst + CALL require(wst <= 1.0e-8_wp .AND. MAXVAL(ten) < OWC_TEN(NOWC), & + 'every element of the taut rope sits on its OWC, inside the table') + END ASSOCIATE + CALL CD_End_Model(mt(1), es, em) + END SUBROUTINE taut_overshoot + SUBROUTINE tmax0_curve() !! SYROPE IC Tmax0 = 2.5 MN: the polyester's mean tension is the Tmax0 working curve's at its !! mean strain. From 005df8597e3d3900d18d691c55b8d0c84fb073ff Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Fri, 30 Oct 2026 00:20:23 +0900 Subject: [PATCH 3/3] fix(syrope): a secant step on the composite static secants The tension update of a composite line's Syrope secants contracts by 1 - secant/tangent of the rest curve, slowly near a working curve's zero-tension strain: a lightly loaded SYROPE IC rope (Tmax0 2.5 MN, about 53 kN of tension) still moved its secants by 5e-5 after the 50 iterations and was refused. The last two solves now give the line's response at each element, a falling line in (strain, tension); its crossing with the rising rest curve (bisection over the table) is the next secant. The step is taken only beyond the tension update in the same direction and at most 100 times as far, else the tension update stands; the convergence test still measures how far each element sits off its curve. That rope now converges in 18 solves, every element on the Tmax0 working curve to 6e-10 (new gate in syrope_composite); the chain-polyester-chain lines converge in 13. Full suite passes; both Syrope examples are bit-identical. Signed-off-by: Jae Hoon Seo --- src/CableDyn_DeckDriver.f90 | 76 +++++++++++++++++++++++++++++++-- tests/test_syrope_composite.f90 | 59 +++++++++++++++++++------ 2 files changed, 118 insertions(+), 17 deletions(-) diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 5be28522..f4cf1b08 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -9281,9 +9281,9 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts TYPE(CD_SyropeType), ALLOCATABLE :: tds(:), stype(:) INTEGER, ALLOCATABLE :: sec_type(:), sec_nseg(:), el_sec(:) LOGICAL, ALLOCATABLE :: sec_syr(:), sis(:) - REAL(wp), ALLOCATABLE :: sec_el(:), cand_el(:), sslow(:), stmax(:), t_static(:) + REAL(wp), ALLOCATABLE :: sec_el(:), cand_el(:), sslow(:), stmax(:), t_static(:), eps_prev(:), t_prev(:) REAL(wp) :: anchor(3), fairlead(3), eps0, t_ref, total_l0, t_hist, eps_bar, t_mean_static - REAL(wp) :: eps_e, change, secant, cand + REAL(wp) :: eps_e, change, secant, cand, eps_now, d_eps, d_t, eps_r, t_r, acc INTEGER :: ne, e, es, n_owc, iter, nsec, j, k, isec, st LOGICAL :: composite, converged CHARACTER(1024) :: em @@ -9355,7 +9355,8 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts ! finds is the rest state of the SAME constitutive state the dynamics start from. t_hist = CD_ZERO IF (ln%has_syrope_ic) t_hist = ln%syrope_tmax0 - ALLOCATE (sec_el(ne), cand_el(ne), stype(ne), sis(ne), sslow(ne), stmax(ne), t_static(ne)) + ALLOCATE (sec_el(ne), cand_el(ne), stype(ne), sis(ne), sslow(ne), stmax(ne), t_static(ne), eps_prev(ne), & + t_prev(ne)) sis = .FALSE. sslow = CD_ZERO stmax = CD_ZERO @@ -9450,7 +9451,31 @@ RECURSIVE SUBROUTINE init_one_syrope_model(types, ln, sections, points, l0, opts ELSE cand_el(e) = t_static(e)/eps_e END IF + ! the residual: how far the element's (strain, tension) sits off its curve change = MAX(change, ABS(cand_el(e) - sec_el(e))/sec_el(e)) + ! The tension update contracts by 1 - (secant / tangent) of the curve, slowly where the + ! secant is far below the tangent (near a working curve's zero-tension strain). The + ! last two solves give the line's response at the element, a straight line in + ! (strain, tension) that falls as the secant stiffens (the tension rises, the strain + ! drops); its crossing with the rising curve is the next secant, a secant step on the + ! equilibrium. It is taken only beyond the tension update in the same direction and + ! at most 100 times as far, else the tension update stands. + eps_now = t_static(e)/sec_el(e) + IF (iter > 1) THEN + d_eps = eps_now - eps_prev(e) + d_t = t_static(e) - t_prev(e) + IF (d_eps*d_t < CD_ZERO) THEN + CALL response_root(isec, eps_now, t_static(e), d_eps, d_t, eps_r, t_r) + IF (eps_r > CD_ZERO .AND. t_r > CD_ZERO) THEN + acc = t_r/eps_r + IF ((acc - sec_el(e))*(cand_el(e) - sec_el(e)) > CD_ZERO .AND. & + ABS(acc - sec_el(e)) >= ABS(cand_el(e) - sec_el(e)) .AND. & + ABS(acc - sec_el(e)) <= 100.0_wp*ABS(cand_el(e) - sec_el(e))) cand_el(e) = acc + END IF + END IF + END IF + eps_prev(e) = eps_now + t_prev(e) = t_static(e) END DO IF (change <= 1.0e-10_wp) THEN converged = .TRUE. @@ -9596,6 +9621,51 @@ SUBROUTINE rest_strain(isec_, tension, eps, es_out, em_out) eps = 0.5_wp*(lo + hi) END SUBROUTINE rest_strain + SUBROUTINE response_root(isec_, eps_k, t_k, d_eps_, d_t_, eps_out, t_out) + !! The crossing of section isec_'s rest curve with the response line through (eps_k, t_k) + !! of direction (d_eps_, d_t_), d_eps_*d_t_ < 0: h(eps) = (T(eps) - t_k) d_eps_ - + !! (eps - eps_k) d_t_ is monotone over the table (the curve rises, the line falls), so + !! bisection over the table finds it. eps_out = -1 where the crossing lies outside the + !! table or the curve fails. + INTEGER, INTENT(IN) :: isec_ + REAL(wp), INTENT(IN) :: eps_k, t_k, d_eps_, d_t_ + REAL(wp), INTENT(OUT) :: eps_out, t_out + REAL(wp) :: lo, hi, h_lo, h_hi, h_mid, t_c + INTEGER :: it, n, es_c + CHARACTER(256) :: em_c + eps_out = -CD_ONE + t_out = CD_ZERO + n = SIZE(types(sec_type(isec_))%syrope_owc_strain) + lo = types(sec_type(isec_))%syrope_owc_strain(1) + hi = types(sec_type(isec_))%syrope_owc_strain(n) + CALL rest_tension(isec_, lo, t_c, es_c, em_c) + IF (es_c /= CD_SYROPE_OK) RETURN + h_lo = (t_c - t_k)*d_eps_ - (lo - eps_k)*d_t_ + CALL rest_tension(isec_, hi, t_c, es_c, em_c) + IF (es_c /= CD_SYROPE_OK) RETURN + h_hi = (t_c - t_k)*d_eps_ - (hi - eps_k)*d_t_ + IF (.NOT. (h_lo*h_hi <= CD_ZERO)) RETURN + DO it = 1, 200 + eps_out = 0.5_wp*(lo + hi) + CALL rest_tension(isec_, eps_out, t_c, es_c, em_c) + IF (es_c /= CD_SYROPE_OK) THEN + eps_out = -CD_ONE + RETURN + END IF + h_mid = (t_c - t_k)*d_eps_ - (eps_out - eps_k)*d_t_ + IF (h_mid*h_lo > CD_ZERO) THEN + lo = eps_out + h_lo = h_mid + ELSE + hi = eps_out + END IF + IF (hi - lo <= 4.0_wp*EPSILON(hi)*hi) EXIT + END DO + eps_out = 0.5_wp*(lo + hi) + CALL rest_tension(isec_, eps_out, t_out, es_c, em_c) + IF (es_c /= CD_SYROPE_OK) eps_out = -CD_ONE + END SUBROUTINE response_root + LOGICAL FUNCTION strain_in_table(isec_, eps) RESULT(ok) !! Whether strain eps lies in section isec_'s OWC table (the interpolation clamps at its end !! rows, so a strain outside would start the line silently mis-tensioned); fails otherwise. diff --git a/tests/test_syrope_composite.f90 b/tests/test_syrope_composite.f90 index 29c06f78..92ded4e3 100644 --- a/tests/test_syrope_composite.f90 +++ b/tests/test_syrope_composite.f90 @@ -22,6 +22,9 @@ PROGRAM test_syrope_composite !! 7. A taut line of two Syrope sections whose first solve, at the placeholder alpha, overshoots !! the top of the table: the update continues from the table's top secant and every !! element lands on its OWC. + !! 8. A lightly loaded SYROPE IC rope near its working curve's zero-tension strain, where the + !! plain secant update contracts slowly: the accelerated update lands every element on the + !! Tmax0 working curve. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Init_Deck_Models, CD_Run_Deck_Driver, CD_DECKDRV_OK USE CableDyn_Model, ONLY: CD_ModelType, CD_End_Model, CD_Get_Model_Tension @@ -124,8 +127,12 @@ PROGRAM test_syrope_composite CALL require(es /= CD_DECKDRV_OK .AND. INDEX(em, 'above the top of its OWC table') > 0, & 'a pretension above the OWC table fails closed by name: '//TRIM(em)) - ! 7. an overshooting first solve on a taut two-section rope - CALL taut_overshoot() + ! 7. an overshooting first solve on a taut two-section rope: alpha (1.53e8 N) at the 3.5 % chord + ! strain gives 5.4 MN, above the table's 4.4 MN top, while the OWC there is about 2 MN + CALL taut_rope(20.7_wp, '22.42', 'a taut rope whose first solve overshoots the OWC table') + ! 8. a lightly loaded, nearly neutrally buoyant rope on the Tmax0 = 2.5 MN working curve, near its + ! zero-tension strain (about 53 kN), where the plain secant update contracts slowly + CALL taut_rope(20.2_wp, '16.70', 'a lightly loaded preconditioned rope', tmax0=2.5e6_wp) CALL finish() @@ -160,28 +167,41 @@ SUBROUTINE still_run() CALL require(n > 100 .AND. dev <= 1.0e-7_wp*ft0, 'the dynamics start in the static equilibrium') END SUBROUTINE still_run - SUBROUTINE taut_overshoot() - !! 20 m of virgin rope in two 10 m Syrope sections between fixed points 20.7 m apart: alpha - !! (1.53e8 N) at the 3.5 % chord strain gives 5.4 MN, above the table's 4.4 MN top, while the - !! OWC there is about 2 MN. + SUBROUTINE taut_rope(span, mass, what, tmax0) + !! 20 m of rope in two 10 m Syrope sections between fixed points span apart, of the given mass + !! per length, a virgin rope or (tmax0 present) a SYROPE IC history: every element must land on + !! its rest curve (the OWC, or the Tmax0 working curve), inside the table. + REAL(wp), INTENT(IN) :: span + CHARACTER(*), INTENT(IN) :: mass, what + REAL(wp), INTENT(IN), OPTIONAL :: tmax0 TYPE(CD_ModelType), ALLOCATABLE :: mt(:) - REAL(wp) :: ten(10), eps_k, wst + TYPE(CD_SyropeType) :: td + REAL(wp) :: ten(10), eps_k, wst, tcurve INTEGER :: u, k + CHARACTER(32) :: s_span, s_tmax0 + WRITE (s_span, '(F8.3)') span OPEN (NEWUNIT=u, FILE='csyr_taut.dat', STATUS='REPLACE', ACTION='WRITE') WRITE (u, '(A)') 'taut two-section Syrope test deck' 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.1438 22.42 "SYROPE:csyr_settings.dat|1.53e8|23.12" 5.0e10|1.0e5 0.0 1.2 0.2 1.0 0.0' + WRITE (u, '(A)') 'poly 0.1438 '//mass//' "SYROPE:csyr_settings.dat|1.53e8|23.12" 5.0e10|1.0e5 0.0 1.2 0.2 1.0 0.0' 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 Fixed 20.7 0.0 -100.0 0 0 0 0' + WRITE (u, '(A)') '1 Fixed '//TRIM(ADJUSTL(s_span))//' 0.0 -100.0 0 0 0 0' WRITE (u, '(A)') '2 Vessel 0.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 2 1 -' + IF (PRESENT(tmax0)) THEN + WRITE (s_tmax0, '(ES23.16)') tmax0 + WRITE (u, '(A)') '--- SYROPE IC ---' + WRITE (u, '(A)') 'Line(s) Tmax0 Tmean0' + WRITE (u, '(A)') '(-) (N) (N)' + WRITE (u, '(A)') '1 '//TRIM(ADJUSTL(s_tmax0))//' 1.0e5' + END IF WRITE (u, '(A)') '--- SECTIONS ---' WRITE (u, '(A)') 'LineID LineType Length NumSegs' WRITE (u, '(A)') '(-) (-) (m) (-)' @@ -196,23 +216,34 @@ SUBROUTINE taut_overshoot() WRITE (u, '(A)') '--- end ---' CLOSE (u) CALL CD_Init_Deck_Models('csyr_taut.dat', mt, es, em) - CALL require(es == CD_DECKDRV_OK, 'a taut rope whose first solve overshoots the OWC table builds: '//TRIM(em)) + CALL require(es == CD_DECKDRV_OK, what//' builds: '//TRIM(em)) IF (es /= CD_DECKDRV_OK) RETURN + IF (PRESENT(tmax0)) THEN + CALL CD_Syrope_Init(td, OWC_EPS, OWC_TEN, CD_SYROPE_WC_EXP, 0.20_wp, 1.50_wp, 1.53e8_wp, 23.12_wp, & + 5.0e10_wp, 1.0e5_wp, es, em) + CALL require(es == CD_SYROPE_OK, 'reference working curve: '//TRIM(em)) + END IF ASSOCIATE (md => mt(1)) CALL CD_Get_Model_Tension(md, ten, es, em) wst = 0.0_wp DO k = 1, md%n_elem eps_k = NORM2(md%q(3*md%elem_conn(2, k) - 2:3*md%elem_conn(2, k)) - & md%q(3*md%elem_conn(1, k) - 2:3*md%elem_conn(1, k)))/md%l0(k) - 1.0_wp - wst = MAX(wst, ABS(owc(eps_k) - ten(k))/ten(k)) + IF (PRESENT(tmax0)) THEN + CALL CD_Syrope_Static_Tension(td, tmax0, eps_k, tcurve, es, em) + ELSE + tcurve = owc(eps_k) + END IF + wst = MAX(wst, ABS(tcurve - ten(k))/ten(k)) END DO PRINT '(A,ES12.5,A,ES12.5,A,ES10.3)', ' taut rope: tensions ', MINVAL(ten), ' to ', MAXVAL(ten), & - ' N, elements off their OWC by at most ', wst + ' N, elements off their rest curve by at most ', wst CALL require(wst <= 1.0e-8_wp .AND. MAXVAL(ten) < OWC_TEN(NOWC), & - 'every element of the taut rope sits on its OWC, inside the table') + 'every element of '//what//' sits on its rest curve, inside the table') END ASSOCIATE CALL CD_End_Model(mt(1), es, em) - END SUBROUTINE taut_overshoot + IF (PRESENT(tmax0)) CALL CD_Syrope_End(td) + END SUBROUTINE taut_rope SUBROUTINE tmax0_curve() !! SYROPE IC Tmax0 = 2.5 MN: the polyester's mean tension is the Tmax0 working curve's at its