From dd33d63763764cd4d362513218f2a4452267c8a3 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 15 Oct 2026 17:41:46 +0900 Subject: [PATCH 01/11] fix(dynamics): stop EI=0 tension spikes at slack/taut switching EI=0 lines produced silent tension spikes of 5x to 360x when parts of a line went slack, at the default rhoInf = 0.4 and every dtM: a light, axially stiff cable under a 3 m, 10 s heave reached 4.2 MN at the fairlead against about 0.13 MN, and in a JONSWAP Hs 8 m sea its anchor read 0.41 MN against 0.043 MN. Two mechanisms, both confirmed: - The tension-only force was evaluated at the blended state q_alpha, so the end-of-step state extrapolated past it and a segment slack at the start of a coarse step ended it over-stretched. - At fine steps, a segment released from taut to slack within a step returned alpha_f T_n (e_n - e_{n+1}) of work while it had stored only T_n e_n / 2, so any release deeper than 0.75 e_n created energy and fed a rattle of one-step spikes. The EI=0 residual now blends forces, (1 - alpha_f) r(q_{n+1}) + alpha_f r(q_n), for the axial force and every dynamic load (added mass stays at q_alpha), with the step-start force recomputed at the committed state so restarts stay exact; and an element going taut to slack within a step carries at most the force that returns its stored strain energy. A linear element reduces to the old scheme. False alpha_force_blend restores the old scheme byte for byte. modified_newton now refreshes the tangent when the residual contracts by less than a factor 4, as the manual states. All reproducers now agree with their small-dt, rhoInf = 0 or finite-EI references (light cable at dt 0.1 s: anchor 20 MN -> 0.096 MN; JONSWAP anchor 0.41 MN -> 0.0431 MN against 0.0429 MN; viscoelastic polyester under 15 m surge: 2.69 MN -> 1.795 MN against 1.797 MN). New notes: a time-step advisory for taut EI=0 segments turning more than 1 degree in a step, a snap note when the step does not resolve the axial wave, a once-per-line warning for non-physical tension spikes (no warning in 704 completed campaign runs; flags 37 of 49 old spiking runs), and a note for rhoInf > 0.95, whose loss of dissipation lets a loose Newton tolerance accumulate. EI=0 dynamic outputs change: example tension means by at most 0.23 %, maxima by at most 0.9 %, except the anchor snap of the als_volturnus decks (10 % lower, failure time unchanged). Local validation records change within their gates (L3-2 swing 8.405 -> 8.411 %, snap-load error 2.76 -> 1.62 %, Bergdahl RMSE 1.580 -> 1.587 N). Cost 1-6 % wall time. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 50 ++++ CMakeLists.txt | 6 + VALIDATION.md | 16 +- doc/driver_format.md | 2 +- doc/options.rst | 26 +- doc/theory.rst | 86 ++++++- doc/troubleshooting.rst | 24 ++ examples/cabledyn_options_reference.dat | 2 +- src/CableDyn_DeckDriver.f90 | 131 +++++++++- src/CableDyn_Dynamic.f90 | 283 ++++++++++++++++++-- src/CableDyn_Model.f90 | 186 +++++++++++++- tests/test_cable_dynamic.f90 | 56 ++-- tests/test_core_release_regressions.f90 | 7 +- tests/test_ei0_slack_dynamics.f90 | 327 ++++++++++++++++++++++++ 14 files changed, 1128 insertions(+), 74 deletions(-) create mode 100644 tests/test_ei0_slack_dynamics.f90 diff --git a/CHANGELOG.md b/CHANGELOG.md index d2006685..39d61320 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,18 @@ All notable changes to CableDyn are recorded in this file. The format follows Coupling a host (CFD) solver, that compares the call sequence step by step with MoorDyn's C API: initialisation, vector layout, end-of-step motion, outer correctors, load summation, the fixed step of the aggregate route, and units. +- Run audit of tension-only (`EI = 0`) lines in the standalone driver. At every output step it + tracks the largest turn of a taut segment's chord, the segments that snap from slack to + taut, and non-physical tension spikes: a segment whose elastic tension at one step exceeds + four times its own one step before and after, ten times the largest tension anywhere on the + line one step before and after, and the largest tension of the initial state. The first spike + of a line is reported as a warning, once per line, and the run summary counts them. The run + ends with a note when a taut segment turned by more than 1° in one step (the mean and + standard deviation of the tension err by about 1 % and more above it; 1.3 % at 2.9° on a + heaving chain), and when segments snapped taut while the axial wave crosses a segment more + than once per step, so the snap peaks are not resolved in time. A dynamic deck with `rhoInf` + above 0.95 prints a note on the missing numerical dissipation. See the manual's troubleshooting + page. ### Changed @@ -153,6 +165,44 @@ All notable changes to CableDyn are recorded in this file. The format follows ### Fixed +- Tension spikes of tension-only (`EI = 0`) lines that go slack. The generalised-α step + evaluated the axial force and the dynamic loads at the blended configuration + `q_α = (1 − α_f) q_{n+1} + α_f q_n`. A segment that was slack at the start of a step and + carries tension at `q_α` then ends the step stretched beyond it, + `q_{n+1} = (q_α − α_f q_n)/(1 − α_f)`, and a segment going slack within a step returned more + work to the motion than its strain energy. Both happened silently at the default + `rhoInf = 0.4`, at every `dtM` from 0.002 to 0.2 s, on realistic input: a light, axially stiff + cable (80 kg/m, EA 8e8 N) under 3 m heave reported 4.2 MN at the fairlead and 3.4 MN at the + anchor (`dtM` 0.0025 s) and 20 MN at the anchor (`dtM` 0.1 s), against 0.1 to 0.18 MN at + `rhoInf = 0`, at `dtM` down to 0.25 ms and with a finite-EI model; the same cable in an + `Hs` 8 m JONSWAP sea 0.41 MN at the anchor against 0.043 MN; the shipped viscoelastic + polyester in 15 m surge 2.69 MN against 1.80 MN; a semi-taut chain–polyester leg 9.5 MN at + the anchor against 4.6 MN; and a line on a stiff seabed failed the plausibility guard. The + step now blends forces, `(1 − α_f) r(q_{n+1}, v_{n+1}) + α_f r(q_n, v_n)`, as the finite-EI + path does, for the axial force and every dynamic load (damping, viscoelastic and Syrope laws, + seabed, drag, Froude–Krylov, buoyancy; added mass stays at `q_α`). The step-start force is + evaluated afresh at the committed state, so no state is added and restarts stay exact. An + element going from taut to slack within a step carries at most its discrete energy gradient + (the strain energy it releases over the shortening), so a release can no longer create + energy. At the default `rhoInf` the reproducers now give 0.14 / 0.08 MN, 0.092 / 0.096 MN, + 0.075 / 0.043 MN and 1.80 MN, as their references, and the stiff-seabed line runs to + completion; the chain–polyester anchor snap peaks at 5.8 MN at `dtM` 0.05 s, a single-step + peak (4.6 MN at 0.0025 s) that the new snap note reports. On a linear element the scheme + is unchanged, so taut lines keep their accuracy: every MoorDyn-C, OrcaFlex, analytic and + experimental comparison that runs locally still passes, and its reported error moves by at + most 0.35 percentage points (the minimum fairlead tension of the one-hour VolturnUS-S + record, 0.15 % to 0.50 %; the snap-load peak at 20 ms improves from 2.8 % to 1.6 %; see + VALIDATION.md). Every `EI = 0` dynamic output changes. Over the shipped examples the + statistics of the tensions change by at most 0.23 % (mean) and 0.9 % (maximum), except the + two `als_volturnus` decks, whose pre-failure anchor snap at 250 s is resolved by one or two + samples and peaks 10 % lower. Static runs and finite-EI lines are unchanged. The step costs + up to 6 % more wall time on `EI = 0` dynamic decks (one more force evaluation per step and + about 4 % more Newton iterations). `False alpha_force_blend`, which until now + applied to finite-EI lines only, selects the former scheme for `EI = 0` lines as well. +- `modified_newton` on tension-only lines rebuilds the tangent when an iterate reduces the + residual by less than a factor four, as the manual states; it had kept the first tangent for + the whole step, which a slow linear contraction could exhaust (30 iterations at the start of + the 5 m heave cells of the L2-2 parity test with the force blend). - The development environment (`environment.yml`) excludes OpenBLAS 0.3.34, which caused the access violation in the modal analysis tests listed under Known issues for 0.1.1. On AMD Zen 4 and Zen 5 CPUs that expose AVX-512, OpenBLAS 0.3.34 enlarges the GEMM blocking, diff --git a/CMakeLists.txt b/CMakeLists.txt index e0006d2e..a6dbf325 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1781,6 +1781,12 @@ add_executable(test_dynamics_regressions tests/test_dynamics_regressions.f90) target_link_libraries(test_dynamics_regressions PRIVATE cabledyn_core) add_test(NAME dynamics_regressions COMMAND test_dynamics_regressions) set_tests_properties(dynamics_regressions PROPERTIES LABELS "fortran;driver;integration;dynamic") +# Tension-only lines going slack and snapping taut at the default rhoInf: force blend, release +# cap and the driver's run audit (the driver executable is passed for its stdout). +add_executable(test_ei0_slack_dynamics tests/test_ei0_slack_dynamics.f90) +target_link_libraries(test_ei0_slack_dynamics PRIVATE cabledyn_core) +add_test(NAME ei0_slack_dynamics COMMAND test_ei0_slack_dynamics $) +set_tests_properties(ei0_slack_dynamics PROPERTIES LABELS "fortran;driver;integration;dynamic") add_executable(test_deck_reader_io tests/test_deck_reader_io.f90) target_link_libraries(test_deck_reader_io PRIVATE cabledyn_core) diff --git a/VALIDATION.md b/VALIDATION.md index 6349554c..f448be17 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -74,7 +74,7 @@ article's methods, are compared in | **L3-6c** | Irregular-sea (JONSWAP) dynamic lazy-wave | OrcaFlex 11.6d (same 80-component sea) | curv 0.21%; tension 0.20/0.19/0.23%; wave-driven curv rise 1.0%, tension range 2.1% | curv <2%, tension <1%; rise <15%, range <10% | Pass | | **L3-6d** | Moving-touchdown dynamic contact | OrcaFlex 11.6d installed | curv 0.48/0.58%, tension 0.74/0.90/0.80%, TDP 0.08 m, migration 2–3 m/cycle | curv <3–5%, tension <2–3%, TDP excursion bounds <1.5 m | Pass | | **L3-6e** | Out-of-plane / 3D whirl response | OrcaFlex 11.6d | 3D curv 0.52%, interior Y env ≤1.0 mm, sag ≤22 mm, tension 0.14/0.17/0.12% | curv <3%, env <5 cm, tension <2–3% | Pass | -| **L3-7** | 1-hour VolturnUS-S mooring dynamic | OrcaFlex 11.6d | `FairTen` mean 0.28%, std 0.25%, min/max 0.15/0.43%, Fourier 0.27/1.13% | ≤5% | Pass | +| **L3-7** | 1-hour VolturnUS-S mooring dynamic | OrcaFlex 11.6d | `FairTen` mean 0.27%, std 0.26%, min/max 0.50/0.43%, Fourier 0.27/1.14% | ≤5% | Pass | | **L3-H** | Holcombe static lazy-wave experiment | measured marker geometry | position RMSE 1.07–1.89% of suspended length; peak marker-curvature error 0.34–5.54% | end-restraint bracket | Pass | | **L3-B** | Bergdahl chain experiment, 30 orbit conditions | measured upper-end force | RMSE 1.58 N; MAPE 3.11%; Pearson 0.993; Lin concordance 0.989 | full published matrix | Pass | | **L-fig** | Along-arc curvature overlay (CableDyn / OrcaFlex / MoorDyn-F ±4×) | 3-code committed record | CableDyn peak 0.11% from OrcaFlex | <0.5% | Pass | @@ -82,7 +82,7 @@ article's methods, are compared in | **L4-1b** | VolturnUS-S coupled platform + power cable | OpenFAST v5.0.0 (CompMooring 5 vs 3) | platform DOFs <0.6% (3-seed DLC-1.1); fairlead and anchor <0.001% static | <3% platform | Pass | | **L4-1c** | Lozon lazy-wave cable under coupled FOWT motion, 3 depths | OrcaFlex 11.6d | curv amplification 0.05/0.09/0.01%; dyn curv 0.24/0.35/1.01%; tension <0.7% | ampl <2%, curv <2–3%, tension <1.5–2% | Pass | | **L4-rot** | Coupled mooring rotational stiffness | held 1° pitch geometry | upwind −16.0 kN, downwind +7.8 kN each; first-order restoring moment | signs + first-order | Pass | -| **L5-stab** | Snap-load Δt-stability | sub-CFL fine-dt (0.5 ms) self-ref | peak 2.7% at dt = 20 ms (explicit limit 3.2 ms) | — | Pass | +| **L5-stab** | Snap-load Δt-stability | sub-CFL fine-dt (0.5 ms) self-ref | peak 1.6% at dt = 20 ms (explicit limit 3.2 ms) | — | Pass | | **L5-stab** | Snap-load Δt-stability, implicit and explicit steps | MoorDyn-C explicit step limit | 20 ms implicit; ~1 ms explicit | — | Pass | | **L5-V** | VolturnUS-S 1-hr mooring wall-clock | measured, matched protocol | CableDyn 18.1–32 s across repeated runs (full Newton) vs OrcaFlex 14.5 s; heave-only config 10.3 s | — | Pass (response at L3-7) | | **L5-wc** | Wall-clock vs explicit C solver | external-C RK2 (WD chain) | L2 0.967 s vs external-C 0.541 s; traces validated | matched comparison reported | Pass measured | @@ -178,7 +178,7 @@ initialisation. - **L3-1 WD0050 static** (`l3_orcaflex_static`): fairlead/anchor **0.154% / 0.848%**. The OrcaFlex reference is within 0.657/0.731% of MoorDyn-C. - **L3-2 regular-wave dynamic** (`l3_orcaflex_wave_dynamic`): mean fairlead - tension **0.298%** (2% acceptance), swing **8.405%** (15% acceptance) against an + tension **0.298%** (2% acceptance), swing **8.411%** (15% acceptance) against an OrcaFlex reference with implicit dt 0.005 s. Wave stretching changes the OrcaFlex swing by only 0.18%, and the unpinned OrcaFlex dt=0.1 s is not converged (refinement moves it toward CableDyn). The residual comes from surface-piercing @@ -255,10 +255,11 @@ initialisation. **0.14 / 0.17 / 0.12%**. - **L3-7 1-hour mooring dynamic** (`l3_longduration_mooring`): VolturnUS-S all-chain line driven for one hour by 5 m/90 s surge + 2 m/12 s heave. Over the - steady 3400 s window the `FairTen` channel differs from OrcaFlex by **0.28% in - mean, 0.25% in std, 0.15 / 0.43% in minimum / maximum, and 0.27% (90 s) / 1.13% + steady 3400 s window the `FairTen` channel differs from OrcaFlex by **0.27% in + mean, 0.26% in std, 0.50 / 0.43% in minimum / maximum, and 0.27% (90 s) / 1.14% (12 s) in Fourier amplitude**. The end-element tension carries the 1.28% static - offset of L2-V in its mean and extremes. + offset of L2-V in its mean and extremes. The force-blended `EI = 0` step moved the + minimum by +7 kN (0.15% before) and the other statistics by at most 0.01%. - **L-fig curvature overlay**: `l3_lazywave_dynamic` writes each site's along-arc curvature profile. [`validation/scripts/curvature_profile_overlay.py`](https://github.com/SMI-Lab-Inha/CableDyn/blob/main/validation/scripts/curvature_profile_overlay.py) @@ -373,7 +374,8 @@ scripts, results, and source provenance are in - **Snap load** (`snap_load`): a grounded tension-only line goes slack, then snaps to ~10 MN. Implicit generalised-α integrates it at **dt = 20 ms, above the explicit CFL limit of about 3.2 ms**, with every step converged (stable up to about - 30 ms in a sweep); the peak is within **2.7%** of the 0.5 ms sub-CFL reference. + 30 ms in a sweep); the peak is within **1.6%** of the 0.5 ms sub-CFL reference + (1.1% at 10 ms, 0.05% at 5 ms; 2.8 / 0.6 / 0.16% before the force-blended `EI = 0` step). - **Implicit and explicit steps**: on the matched near-taut snap, MoorDyn-C's explicit RK2 needs `dtM ≲ 1 ms`, as expected of an explicit scheme at this line stiffness; CableDyn's implicit step remains stable at **20 ms**. diff --git a/doc/driver_format.md b/doc/driver_format.md index 5b39e369..944eb78f 100644 --- a/doc/driver_format.md +++ b/doc/driver_format.md @@ -1006,7 +1006,7 @@ syntax form. The most frequently edited keywords are: | `cable_load_feedback` | coupled finite-EI cable reaction switch. `True` returns cable force and moment to the host. `False` marches the cable with the same moving boundary and host fluid field and keeps its output channels, but returns zero force and moment; use it for a one-way comparison, not as a physical model | `True` | | `adaptive_mesh` | `True`/`False`; allow finite-EI mesh refinement when the static resolution check is fragile | `False` | | `cable_statics` | `continuation` or `sequenced`: which finite-EI static route runs first (the other is its fallback); both results are audited | `continuation` | -| `alpha_force_blend` | `True`/`False`; generalised-α blend of the finite-EI dynamics: forces (`True`) or the configuration `q_αf` (`False`), which biases the mean tension of a rotating line at large `dtM` | `True` | +| `alpha_force_blend` | `True`/`False`; generalised-α blend of the finite-EI and `EI = 0` dynamics: forces (`True`) or the configuration `q_αf` (`False`), which biases the mean tension of a rotating finite-EI line at large `dtM` and lets `EI = 0` segments that go slack report spurious tension spikes | `True` | | `tensile_safety` | `False`, `warn`, or `True`; audits the element-mean axial force (three-point Gauss mean of the signed axial resultant, averaged over an element and its two neighbours). `True` rejects. `warn` commits the state, counts accepted-step events, and reports the worst force, threshold, element and time (the printed `xi` is always 0.5, the element centre) | `False` | | `tensile_strain_tolerance` | non-negative strain band for the dynamic tensile audit | `2e-6` | | `recovery_max_substeps` | integer from 4 to 65536; maximum step subdivision for dynamic-step recovery on tension-only and bending lines. Internal prescribed states lie on one C2 quintic trajectory and land on the nominal coupling endpoint. The standalone summary reports recovered intervals and the largest subdivision used | `1024` | diff --git a/doc/options.rst b/doc/options.rst index ac834613..635a5720 100644 --- a/doc/options.rst +++ b/doc/options.rst @@ -294,7 +294,16 @@ rejected as unknown. The dynamic Newton controls are set with ``dynamic_solver`` * - ``rhoInf`` / ``rho_inf`` - real, – - ``0.4`` - - finite, in ``[0, 1]``; generalised-alpha high-frequency spectral radius + - finite, in ``[0, 1]``; generalised-alpha high-frequency spectral radius. Smaller values + damp the modes ``dtM`` does not resolve (axial waves, slack-taut transitions) faster; + ``0`` annihilates them in one step. Above ``0.95`` the march has almost no numerical + dissipation: those modes then keep the residual each Newton step leaves and the energy + of under-resolved snaps, and a run prints a note. In an irregular sea a finite-EI lazy + wave at ``1 rhoInf`` with a ``1e-4`` relative Newton tolerance peaked at 2.0e5 N against + 1.02e4 N (3.1e4 N at ``0.99``) and was exact with ``1e-6``; ``EI = 0`` lines at ``1`` and + ``1e-4`` failed the ``maxStrain`` guard, and at the default tolerance their peaks rose + 2 to 5 times at ``0.95`` to ``1``. Keep ``rhoInf`` at or below ``0.95``, or tighten the + ``dynamic_solver`` relative tolerance to ``1e-6`` and resolve the snaps with ``dtM`` - both - ``0.4 rhoInf`` * - ``maxStrain`` / ``max_strain`` @@ -371,16 +380,21 @@ Finite-EI cable controls * - ``alpha_force_blend`` / ``alphaforceblend`` - logical - ``True`` - - Generalised-α blend of the finite-EI dynamics. ``True`` blends the forces of the - two step ends; ``False`` evaluates the forces at the blended configuration - :math:`q_{\alpha_f}` (Chung and Hulbert), whose blended tangent vectors are shortened - while the line rotates and raise the mean tension at large ``dtM``: on the Lozon Gulf of + - Generalised-α blend of the dynamics of finite-EI and ``EI = 0`` lines. ``True`` blends + the forces of the two step ends; ``False`` evaluates the forces at the blended + configuration :math:`q_{\alpha_f}` (Chung and Hulbert), the ``EI = 0`` scheme of 0.1.1 and + earlier. On ``EI = 0`` lines ``False`` lets a segment that turns taut within a step carry + the stretch extrapolated past the blended state, and lets a release create energy: on a + light, axially stiff cable (80 kg/m, EA 8e8 N) under 3 m heave the fairlead peaks at + 4.2 MN against 0.14 MN with ``True`` (see :doc:`theory`). On finite-EI lines the blended + tangent vectors are shortened while the line rotates and raise the mean tension at large + ``dtM``: on the Lozon Gulf of Mexico 80 m cable in 3 m surge the mean hang-off tension is 12511 / 10097 / 9507 / 9360 N at ``dtM`` 0.1 / 0.05 / 0.025 / 0.0125 s with ``False`` and 9424 / 9322 / 9314 / 9311 N with ``True``. A run prints a note when a nodal tangent turns by more than 0.25 deg (``True``) or 0.1 deg (``False``) in one step. A dynamic run with a torsional line (``END CONNECTIONS`` ``TorsStiffness`` at both ends) needs ``True`` - - standalone and coupled (finite-EI lines) + - standalone and coupled (finite-EI and ``EI = 0`` lines) - ``False alpha_force_blend`` * - ``cable_statics`` / ``cablestatics`` - mode diff --git a/doc/theory.rst b/doc/theory.rst index 46fbf879..5cf23c7f 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1280,7 +1280,7 @@ and the residual is evaluated at the intermediate states - \mathbf{f}_\text{ext}(\mathbf{q}_\alpha, \mathbf{v}_\alpha, t_\alpha), \qquad (\cdot)_\alpha = (1 - \alpha_f)(\cdot)_{n+1} + \alpha_f(\cdot)_n . -Time-dependent loads (waves) are evaluated at :math:`t_\alpha`. The Hermite path blends the +Time-dependent loads (waves) are evaluated at :math:`t_\alpha`. By default both paths blend the *forces* instead (``alpha_force_blend``, default ``True``; ``False`` selects the form above), .. math:: @@ -1290,15 +1290,52 @@ Time-dependent loads (waves) are evaluated at :math:`t_\alpha`. The Hermite path + \alpha_f\,\mathbf{r}(\mathbf{q}_n, \mathbf{v}_n, t_n), \qquad \mathbf{r} = \mathbf{f}_\text{int} - \mathbf{f}_\text{ext}, -with the same accuracy and tangent. Its position and tangent-vector DOFs rotate with the line, -and a blended configuration :math:`\mathbf{q}_\alpha` would shorten the tangents of a rotating -element, a spurious stretch of order :math:`\alpha_f(1 - \alpha_f)(\omega\Delta t)^2 EA` that -raises the mean tension at large time steps. :math:`\mathbf{r}_n` is the previous step's -converged force, reused unless the state or the load configuration changed in between. Since it -enters every later step, the accepted state is taken one Newton correction beyond the tolerance -(the last factorisation reused), so a loose Newton tolerance does not bias the response. Both -forms converge to the same response; the force blend removes the rotation-driven bias (see -``alpha_force_blend`` in :doc:`options`). The effective tangent is +with the same accuracy and tangent. On the Hermite path the position and tangent-vector DOFs +rotate with the line, and a blended configuration :math:`\mathbf{q}_\alpha` would shorten the +tangents of a rotating element, a spurious stretch of order +:math:`\alpha_f(1 - \alpha_f)(\omega\Delta t)^2 EA` that raises the mean tension at large time +steps. There :math:`\mathbf{r}_n` is the previous step's converged force, reused unless the state +or the load configuration changed in between. Since it enters every later step, the accepted +state is taken one Newton correction beyond the tolerance (the last factorisation reused), so a +loose Newton tolerance does not bias the response. Both forms converge to the same response; the +force blend removes the rotation-driven bias (see ``alpha_force_blend`` in :doc:`options`). + +On the ``EI = 0`` path the force blend covers the axial force of the elements and every +dynamic load: axial damping, the viscoelastic and Syrope laws, seabed contact, damping and +friction, Morison drag, Froude–Krylov and buoyancy loads. Added mass stays at +:math:`(\mathbf{q}_\alpha, \mathbf{a}_{\alpha_m})`. :math:`\mathbf{r}_n` is evaluated afresh at +the committed state of every step, with the viscoelastic and Syrope elements at their committed +internal state, and with the fluid fields of the step, so the scheme carries no extra state and +a restart is exact; a re-solve of the same step from the same state (the junction coupling) +reuses it. The configuration blend fails at slack–taut transitions. A tension-only element is a +one-sided spring, and the residual sets its force at :math:`\mathbf{q}_\alpha`; the end state +:math:`\mathbf{q}_{n+1} = (\mathbf{q}_\alpha - \alpha_f\mathbf{q}_n)/(1 - \alpha_f)` extrapolates +past it. A segment slack at :math:`t_n` that carries a tension at :math:`t_\alpha` thus ends the +step stretched by :math:`\alpha_f/(1 - \alpha_f)` of its former slack on top: with +:math:`\rho_\infty = 0.4` a 2 m segment of a light, axially stiff cable (80 kg/m, EA 8e8 N) that +was 0.2 m slack reports about 30 MN. A mass dropped 1 m onto a tension-only spring +(:math:`\omega = 1000` rad/s) peaks at 6.9 MN at :math:`\Delta t` = 0.1 s with the configuration +blend, against the resolved 0.35 MN; the force blend gives 5.7 kN, the under-resolved impact +dissipated as at :math:`\rho_\infty = 0`. + +**Release cap.** The force blend alone still creates energy when a taut element goes slack +within one step. An element with tension :math:`T_n` and stretch :math:`e_n = l_n - l_0 > 0` at +:math:`t_n` and :math:`e_{n+1} < 0` at :math:`t_{n+1}` carries :math:`\alpha_f T_n` along its +step-start chord while it shortens by :math:`e_n - e_{n+1}`. That force returns the work +:math:`\alpha_f T_n (e_n - e_{n+1})` to the motion, but the element released only its strain +energy :math:`W_n = \tfrac{1}{2} T_n e_n`: a release deeper than +:math:`e_n (1/(2\alpha_f) - 1)` (0.75 :math:`e_n` at :math:`\rho_\infty = 0.4`) creates energy. +On a slack light cable this feeds a sustained rattle of single-step tension spikes. Such an +element carries instead the discrete energy gradient :math:`W_n/(e_n - e_{n+1})`, which returns +exactly :math:`W_n`; the smaller of the two is kept, so the blend is continuous in +:math:`e_{n+1}`, and the residual and the tangent take the difference. Every taut element, every +element going taut (where the force blend dissipates), and every line that allows compression +keep the force blend. In the slack-cable case above the internal forces created 2.7e8 J over +20 s with the configuration blend and 6.7e7 J with the force blend alone, and 0.2 J (round-off) +with the cap; the fairlead peak is 0.14 MN, against 0.13 to 0.19 MN at +:math:`\rho_\infty = 0` and at :math:`\Delta t` down to 0.25 ms. For a linear element the force +blend and the cap reduce to the configuration blend, so the linear spectral properties and the +second-order accuracy are unchanged. The effective tangent is .. math:: @@ -1393,9 +1430,32 @@ partly subdivided state is ever committed. **Step size.** Being implicit, the scheme is not bound by the explicit axial-wave limit. In the snap-load verification a slack line snapping to about 10 MN integrates stably at :math:`\Delta t = 20\,\mathrm{ms}`, well above the explicit limit of 3.2 ms, with the peak -within 2.7% of a 2 ms reference (:doc:`validation`). The time step must still resolve the +within 1.6% of a 0.5 ms reference (:doc:`validation`). The time step must still resolve the response of interest and, for explicitly integrated points and bodies (below), their own -stability limit. +stability limit. The standalone driver audits every ``EI = 0`` line at each output step and +reports at the end of the run: + +- the largest turn of the chord of a taut segment in one step. Above 1 deg it prints a note: + against a 3.125 ms reference on chain catenaries under 5 m heave, 10 m surge and 15 m sway + and on a light laid cable under 10 m sway, the mean and standard deviation of the fairlead + tension err by 0.9 % at 1.2 deg per step (sway, standard deviation), and by 0.6 % at + 1.4 deg and 1.3 % at 2.9 deg (heave, mean), in proportion with the turn; +- segments that go from slack to taut above the initial tension in one step while the axial + wave crosses a segment more than once per step (:math:`\Delta t\,c/l_0 > 1`, + :math:`c = \sqrt{EA/m}`): the snap peaks are then not resolved in time, and the note asks for a + confirmation at a smaller ``dtM``; +- non-physical tension spikes. The elastic tension of a segment at one step is a spike when it + exceeds four times its own tension one step before and one step after, ten times the largest + tension anywhere on the line one step before and one step after, and the largest tension of + the initial state. A physical snap or tension wave persists over the axial transit time and is + shared by the neighbouring segments, so no line carries such an isolated single-step peak. + The first spike of a line is reported as a warning with its segment, tension and time, at most + once per line, and the run summary gives the count. Over the 746 decks of a dynamics + robustness campaign it warns in none of the 704 runs that complete. Applied to the same + decks' configuration-blend results it flags 37 of the 49 runs whose segment tensions were 3 + to 370 times those of the force blend, and 1 of the 158 runs within 25 % of them. Spikes + that persist over several steps (a rattle at :math:`\rho_\infty` near 1) are left to the + ``maxStrain`` guard and the ``rhoInf`` note. Attached objects and line ends ------------------------------ @@ -1566,7 +1626,7 @@ added mass, gyroscopic terms, hydrostatics, drag and seabed contact, and the lin The iteration is a multilevel Newton. For a trial :math:`\mathbf{x}` every attached line is stepped from its committed state with the resulting end motion prescribed, and returns its reaction at the alpha level, :math:`\mathbf{f}_e = -\mathbf{R}_E` (the end rows of its own -residual :math:`\mathbf{M}\mathbf{a}_{\alpha_m} + \mathbf{f}_\text{int}(\mathbf{q}_{\alpha_f}) - \mathbf{f}_\text{ext}`), +residual :math:`\mathbf{M}\mathbf{a}_{\alpha_m} + (1 - \alpha_f)\,\mathbf{r}_{n+1} + \alpha_f\,\mathbf{r}_n`), so the end-node inertia, drag and added mass enter exactly, and its condensed dynamic end stiffness :math:`\mathbf{K}_e = \mathbf{S}_{EE} - \mathbf{S}_{EF}\mathbf{S}_{FF}^{-1}\mathbf{S}_{FE}` of the step's effective tangent :math:`\mathbf{S}`, the exact implicit-function derivative of diff --git a/doc/troubleshooting.rst b/doc/troubleshooting.rst index c2f34a07..487b6d4a 100644 --- a/doc/troubleshooting.rst +++ b/doc/troubleshooting.rst @@ -561,6 +561,30 @@ Warnings and notes that do not stop a run * - ``Note: line ...: a nodal tangent turned up to ... deg in one step`` - the time-step audit of a finite-EI line: above 0.25° per step (0.1° with ``False alpha_force_blend``) the mean tension can err by about 1 %. Reduce ``dtM``. + * - ``Note: line ...: a taut segment turned up to ... deg in one step`` + - the time-step audit of an ``EI = 0`` line: above 1° per step the mean and standard + deviation of the tension can err by about 1 % (1.3 % at 2.9° on a heaving chain). Reduce + ``dtM`` if that matters for the result. + * - ``Note: line ...: ... segment step(s) went from slack to taut above the initial tension`` + - snap loads on an ``EI = 0`` line at a ``dtM`` that does not resolve the axial wave over a + segment: the peak is set by a single step (a 15 m surge of a semi-taut chain–polyester + line peaks at 5.8 MN at ``dtM`` 0.05 s against 4.6 MN at 0.0025 s). The run is valid; + confirm design peaks with a smaller ``dtM``. + * - ``Warning: line ...: segment ... carried ... N at t = ... s for a single step, ... times + the largest tension on the line one step before and after`` + - a non-physical tension spike: the elastic tension of one segment rose and fell within one + step to ten times anything the line carried one step before and after, which no physical + snap or tension wave does. It is the signature of an under-resolved slack–taut + transition integrated without energy control, for example with + ``False alpha_force_blend`` (the ``EI = 0`` scheme of 0.1.1 and earlier) or with + ``rhoInf`` near 1. Remove ``False alpha_force_blend``, keep ``rhoInf`` at or below + 0.95, or reduce ``dtM``; the run summary counts the spikes of the line. + * - ``Note: rhoInf = ... leaves almost no numerical dissipation`` + - ``rhoInf`` above 0.95: the modes ``dtM`` does not resolve keep the residual of each + Newton step and the energy of under-resolved snaps. In an irregular sea this can raise the + tensions several times (a lazy wave at ``1 rhoInf`` with a ``1e-4`` Newton tolerance + peaked at twenty times the converged value). Use ``rhoInf`` ≤ 0.95 (default 0.4), or a + ``dynamic_solver`` relative tolerance of ``1e-6`` or tighter and a smaller ``dtM``. * - ``Note: line ...: elements as short as ... are below sqrt(EI/EA)`` - the finite-EI deck mesh is finer than the axial-bending length :math:`\sqrt{EI/EA}`: the axial stiffness of each element swamps its bending stiffness and the static diff --git a/examples/cabledyn_options_reference.dat b/examples/cabledyn_options_reference.dat index a4223f66..79ae9cbf 100644 --- a/examples/cabledyn_options_reference.dat +++ b/examples/cabledyn_options_reference.dat @@ -40,7 +40,7 @@ False modified_newton - Tangent-reuse mode {False=full Newton; True=guarded True cable_load_feedback - Return finite-EI cable reactions to OpenFAST {False; True} [default: True] False adaptive_mesh - Automatic finite-EI refinement {False; True} [default: False] continuation cable_statics - Finite-EI static route order {continuation; sequenced} [default: continuation] -True alpha_force_blend - Finite-EI generalised-alpha force blend {True; False=configuration blend} [default: True] +True alpha_force_blend - Generalised-alpha force blend, finite-EI and EI=0 lines {True; False=configuration blend} [default: True] False tensile_safety - Element-mean axial-force audit {False; warn; True=reject} [default: False] 2.0e-6 tensile_strain_tolerance - Dynamic audit strain band [default: 2.0e-6] 1024 recovery_max_substeps - Internal dynamic-step recovery ceiling {4..65536} [default: 1024] diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index ce5edfed..506b070d 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -55,7 +55,8 @@ MODULE CableDyn_DeckDriver CD_Get_Model_CoupledDofs, CD_Get_Model_State, CD_Get_Model_Tension, & CD_Get_Model_EndForces, & CD_Update_Model_CoupledMotion, CD_Update_Model_Hydro_Fields, & - CD_Recompute_Model_Acceleration, CD_Step_Model, CD_Step_Model_Recovering, CD_MODEL_OK + CD_Recompute_Model_Acceleration, CD_Step_Model, CD_Step_Model_Recovering, CD_MODEL_OK, & + CD_Audit_Model_Step USE CableDyn_System, ONLY: CD_SystemType, CD_SystemPointType, CD_LineEndpointBinding, & CD_Init_System_From_Points, CD_End_System, CD_System_Line_NDOF, & CD_System_Line_NElem, CD_Get_System_Point_State, CD_Get_System_Line_State, & @@ -242,6 +243,8 @@ MODULE CableDyn_DeckDriver CHARACTER(*), PARAMETER :: TORSION_NEEDS_FORCE_BLEND = 'torsion in a dynamic run needs the force-blended '// & 'generalised-alpha (OPTION alpha_force_blend True)' REAL(wp), PARAMETER :: QUARTER_PI = 0.785398163397448309616_wp ! pi/4 (displaced-area factor) + ! rhoInf above which a dynamic run notes the missing numerical dissipation (run_deck_driver) + REAL(wp), PARAMETER :: RHO_INF_NOTE = 0.95_wp REAL(wp), PARAMETER :: CD_RAD2DEG = 57.29577951308232087680_wp ! 180/pi (declination/azimuth output) INTEGER, PARAMETER :: WAVE_NONE = 0, WAVE_AIRY = 1, WAVE_JONSWAP = 2, WAVE_COMPONENTS = 3 ! WAVE_SEA: spectral/multi-train/spread seas of CableDyn_WaveSpectra @@ -7089,6 +7092,18 @@ SUBROUTINE run_deck_driver(deck_path, out_root, converged, ErrStat, ErrMsg) TRIM(int_to_str(lines(li)%id))//' is torsionally restrained at one end only; with the other end free '// & 'to twist it carries no torque, so no torsion is solved.' END DO + ! rhoInf near 1 leaves the march without numerical dissipation of the modes dtM does not + ! resolve (axial waves, slack-taut transitions). In an irregular sea a finite-EI lazy wave + ! at rhoInf = 1 with a 1e-4 Newton tolerance peaked at 2e5 N against 1.02e4 N (3e4 N at + ! 0.99), and was exact at 1e-6; EI=0 lines at rhoInf = 1 and 1e-4 failed the plausibility + ! guard, and at the default tolerance their peaks rose by factors of 2 to 5 at rhoInf >= 0.95. + IF (opts%has_dtm .AND. opts%has_tmax .AND. opts%tmax > CD_ZERO .AND. opts%rho_inf > RHO_INF_NOTE) THEN + WRITE (output_unit, '(A,F5.3,A)') ' Note: rhoInf = ', opts%rho_inf, ' leaves almost no numerical '// & + 'dissipation: modes dtM does not resolve (axial waves, slack-taut transitions) keep the residual a '// & + 'Newton step leaves and the energy of under-resolved snaps, which can raise tensions several times. '// & + 'Use rhoInf <= 0.95 (default 0.4), or a relative dynamic_solver tolerance of 1e-6 or tighter and a '// & + 'dtM that resolves the snaps.' + END IF IF (ANY([(line_torsion_active(lines(li)), li=1, SIZE(lines))])) THEN IF (opts%has_tmax .AND. opts%tmax > CD_ZERO .AND. .NOT. opts%alpha_force_blend) THEN CALL fail(ErrStat, ErrMsg, TORSION_NEEDS_FORCE_BLEND); RETURN @@ -7581,6 +7596,7 @@ SUBROUTINE init_one_model(ln, sections, types, points, opts, model, ErrStat, Err dynamic_cfg%max_iter = opts%dynamic_max_iter dynamic_cfg%armijo_max_backtracks = opts%dynamic_backtracks dynamic_cfg%modified_newton = opts%dynamic_modified_newton + dynamic_cfg%force_blend = opts%alpha_force_blend CALL CD_Build_Line_Mesh(secs, lts, .TRUE., conn, l0, ea, mpl, diam, es, em) IF (es /= CD_LINE_OK) THEN CALL fail(ErrStat, ErrMsg, 'line mesh for model init: '//TRIM(em)); RETURN @@ -15523,6 +15539,7 @@ SUBROUTINE write_dynamic_out(out_root, channels, lines, points, opts, models, co ErrMsg = TRIM(ErrMsg)//INSPECTION_NOTE RETURN END IF + CALL audit_line_models(models, lines, t, opts%dtM) CALL CD_Profile_Step() CALL CD_Profile_Enter(CD_PROF_OUTPUT) IF (opts%has_motion_file) THEN @@ -15552,6 +15569,7 @@ SUBROUTINE write_dynamic_out(out_root, channels, lines, points, opts, models, co WRITE (output_unit, '(A,I0,A,I0,A)') ' Recovery audit: dynamic run subdivided ', & recovery_event_count, ' nominal interval(s); maximum substeps used=', recovery_max_substeps_used, '.' END IF + IF (ErrStat == CD_DECKDRV_OK) CALL report_line_model_audits(models, lines, opts%dtM) IF (ErrStat == CD_DECKDRV_OK .AND. converged) CALL range_write(output_work%rset, out_root, ErrStat, ErrMsg) END SUBROUTINE write_dynamic_out @@ -15679,6 +15697,7 @@ SUBROUTINE write_system_dynamic_out(out_root, channels, lines, points, opts, sys converged = .FALSE. RETURN END IF + CALL audit_system_lines(system, lines, t, opts%dtM) IF (PRESENT(failures)) THEN CALL check_and_fire_failures(system, lines, points, failures, t, es, em) IF (es /= CD_DECKDRV_OK) THEN @@ -15710,6 +15729,7 @@ SUBROUTINE write_system_dynamic_out(out_root, channels, lines, points, opts, sys CALL close_dynamic_line_outputs(pos_units, ten_units) CALL CD_Classify_Dynamic_Completion('dynamic point-system run', nstep, miss_count, max_consecutive_miss, & first_miss_time, last_miss_time, converged, ErrStat, ErrMsg) + IF (ErrStat == CD_DECKDRV_OK) CALL report_system_line_audits(system, lines, opts%dtM) IF (ErrStat == CD_DECKDRV_OK .AND. converged) CALL range_write(output_work%rset, out_root, ErrStat, ErrMsg) END SUBROUTINE write_system_dynamic_out @@ -16057,6 +16077,7 @@ SUBROUTINE write_rigid6_dynamic_out(out_root, channels, bodies, lines, points, o converged = .FALSE. RETURN END IF + CALL audit_system_lines(system, lines, t, opts%dtM) IF (PRESENT(failures)) THEN CALL check_and_fire_failures(system, lines, points, failures, t, es, em) IF (es /= CD_DECKDRV_OK) THEN @@ -16089,6 +16110,7 @@ SUBROUTINE write_rigid6_dynamic_out(out_root, channels, bodies, lines, points, o CALL close_dynamic_line_outputs(pos_units, ten_units) CALL CD_Classify_Dynamic_Completion('Rigid6 dynamic run', nstep, miss_count, max_consecutive_miss, & first_miss_time, last_miss_time, converged, ErrStat, ErrMsg) + IF (ErrStat == CD_DECKDRV_OK) CALL report_system_line_audits(system, lines, opts%dtM) IF (ErrStat == CD_DECKDRV_OK .AND. converged) CALL range_write(output_work%rset, out_root, ErrStat, ErrMsg) END SUBROUTINE write_rigid6_dynamic_out @@ -16247,6 +16269,7 @@ SUBROUTINE write_rod_dynamic_out(out_root, channels, rod_types, rods, lines, poi converged = .FALSE. RETURN END IF + CALL audit_system_lines(system, lines, t, opts%dtM) CALL CD_Profile_Step() CALL CD_Profile_Enter(CD_PROF_OUTPUT) CALL write_system_model_row(unit, t, channels, lines, points, system, output_work, ErrStat, ErrMsg, & @@ -16279,6 +16302,7 @@ SUBROUTINE write_rod_dynamic_out(out_root, channels, rod_types, rods, lines, poi CALL close_dynamic_rod_outputs(rod_pos_units) CALL CD_Classify_Dynamic_Completion('rod dynamic run', nstep, miss_count, max_consecutive_miss, & first_miss_time, last_miss_time, converged, ErrStat, ErrMsg) + IF (ErrStat == CD_DECKDRV_OK) CALL report_system_line_audits(system, lines, opts%dtM) IF (ErrStat == CD_DECKDRV_OK .AND. converged) CALL range_write(output_work%rset, out_root, ErrStat, ErrMsg) END SUBROUTINE write_rod_dynamic_out @@ -17753,6 +17777,7 @@ SUBROUTINE write_multibody_dynamic_out(deck_path, out_root, channels, types, bod ErrMsg = TRIM(ErrMsg)//INSPECTION_NOTE GOTO 800 END IF + CALL audit_system_lines(mb%system, sys_lines, t, opts%dtM) END IF CALL CD_Profile_Step() CALL CD_Profile_Enter(CD_PROF_OUTPUT) @@ -17768,6 +17793,7 @@ SUBROUTINE write_multibody_dynamic_out(deck_path, out_root, channels, types, bod END IF CALL CD_Classify_Dynamic_Completion('multibody dynamic run', nstep, miss_count, max_consecutive_miss, & first_miss_time, last_miss_time, converged, ErrStat, ErrMsg) + IF (ErrStat == CD_DECKDRV_OK .AND. mb%has_sys) CALL report_system_line_audits(mb%system, sys_lines, opts%dtM) IF (ErrStat == CD_DECKDRV_OK .AND. converged) CALL range_write(mb_ranges, out_root, ErrStat, ErrMsg) 800 CONTINUE CLOSE (unit) @@ -26394,6 +26420,109 @@ SUBROUTINE update_wave_models(models, opts, time, work, ErrStat, ErrMsg, initial END DO END SUBROUTINE update_wave_models + SUBROUTINE audit_line_models(models, lines, time, dt) + !! Run audit of one committed host step over the standalone EI=0 line models (models(i) + !! is deck line i): see CD_Audit_Model_Step. Warns once per line, at the line's first + !! implausible tension spike. + TYPE(CD_ModelType), INTENT(INOUT) :: models(:) + TYPE(DeckLine), INTENT(IN) :: lines(:) + REAL(wp), INTENT(IN) :: time, dt + INTEGER :: i + LOGICAL :: spike + DO i = 1, SIZE(models) + CALL CD_Audit_Model_Step(models(i), time, dt, spike) + IF (spike) CALL warn_line_spike(models(i), audited_line_id(lines, i)) + END DO + END SUBROUTINE audit_line_models + + SUBROUTINE audit_system_lines(system, lines, time, dt) + !! audit_line_models over the EI=0 lines of a point-connected system. + TYPE(CD_SystemType), INTENT(INOUT) :: system + TYPE(DeckLine), INTENT(IN) :: lines(:) + REAL(wp), INTENT(IN) :: time, dt + INTEGER :: i + LOGICAL :: spike + IF (.NOT. ALLOCATED(system%lines)) RETURN + DO i = 1, SIZE(system%lines) + CALL CD_Audit_Model_Step(system%lines(i), time, dt, spike) + IF (spike) CALL warn_line_spike(system%lines(i), audited_line_id(lines, i)) + END DO + END SUBROUTINE audit_system_lines + + INTEGER FUNCTION audited_line_id(lines, i) RESULT(id) + !! Deck id of line i (i itself past the deck lines). + TYPE(DeckLine), INTENT(IN) :: lines(:) + INTEGER, INTENT(IN) :: i + id = i + IF (i <= SIZE(lines)) id = lines(i)%id + END FUNCTION audited_line_id + + SUBROUTINE warn_line_spike(model, line_id) + !! The once-per-line warning of the run audit's first implausible tension spike. + TYPE(CD_ModelType), INTENT(IN) :: model + INTEGER, INTENT(IN) :: line_id + INTEGER :: ios + WRITE (output_unit, '(A,I0,A,I0,A,ES10.3,A,F10.3,A,F0.1,A)', IOSTAT=ios) ' Warning: line ', line_id, & + ': segment ', model%audit_spike_elem, ' carried ', model%audit_spike_tension, ' N at t =', & + model%audit_spike_time, ' s for a single step, ', model%audit_spike_ratio, & + ' times the largest tension on the line one step before and after: a non-physical tension spike '// & + '(an under-resolved slack-taut transition). Check the result with a smaller dtM (doc: troubleshooting).' + END SUBROUTINE warn_line_spike + + SUBROUTINE report_model_audit(model, line_id, dt) + !! End-of-run notes of the run audit of one EI=0 line: the time-step advisory (largest + !! chord turn of a taut segment in one step; calibrated against dtM 3.125 ms on chain + !! catenaries under 5 m heave, 10 m surge and 15 m sway and on a light laid cable under + !! 10 m sway: the mean and standard deviation of the fairlead tension err by 0.9 % at + !! 1.2 deg per step (sway, standard deviation), 0.6 % at 1.4 deg and 1.3 % at 2.9 deg + !! (heave, mean), in proportion with the turn), the unresolved slack-to-taut snaps, and + !! the number of implausible tension spikes after the warned first one. + TYPE(CD_ModelType), INTENT(IN) :: model + INTEGER, INTENT(IN) :: line_id + REAL(wp), INTENT(IN) :: dt + REAL(wp), PARAMETER :: EI0_TURN_NOTE = 1.0_wp + INTEGER :: ios + IF (model%audit_max_turn > EI0_TURN_NOTE) THEN + WRITE (output_unit, '(A,I0,A,F7.3,A)', IOSTAT=ios) ' Note: line ', line_id, ': a taut segment turned up to ', & + model%audit_max_turn, ' deg in one step; a smaller dtM would resolve the line''s rotation (tension '// & + 'mean and standard-deviation errors of about 1 % and more above 1 deg per step).' + END IF + IF (model%audit_snaps > 0 .AND. model%audit_snap_courant > CD_ONE) THEN + WRITE (output_unit, '(A,I0,A,I0,A,ES9.2,A,F0.1,A)', IOSTAT=ios) ' Note: line ', line_id, ': ', & + model%audit_snaps, ' segment step(s) went from slack to taut above the initial tension; at dtM =', & + dt, ' s the axial wave crosses a segment up to ', model%audit_snap_courant, & + ' times per step, so the snap-load peaks are not resolved in time: confirm peak tensions with a '// & + 'smaller dtM.' + END IF + IF (model%audit_spikes > 1) THEN + WRITE (output_unit, '(A,I0,A,I0,A)', IOSTAT=ios) ' Warning: line ', line_id, ': ', model%audit_spikes, & + ' non-physical single-step tension spikes in all (the first is reported above).' + END IF + END SUBROUTINE report_model_audit + + SUBROUTINE report_line_model_audits(models, lines, dt) + !! report_model_audit over the standalone EI=0 line models. + TYPE(CD_ModelType), INTENT(IN) :: models(:) + TYPE(DeckLine), INTENT(IN) :: lines(:) + REAL(wp), INTENT(IN) :: dt + INTEGER :: i + DO i = 1, SIZE(models) + CALL report_model_audit(models(i), audited_line_id(lines, i), dt) + END DO + END SUBROUTINE report_line_model_audits + + SUBROUTINE report_system_line_audits(system, lines, dt) + !! report_model_audit over the EI=0 lines of a point-connected system. + TYPE(CD_SystemType), INTENT(IN) :: system + TYPE(DeckLine), INTENT(IN) :: lines(:) + REAL(wp), INTENT(IN) :: dt + INTEGER :: i + IF (.NOT. ALLOCATED(system%lines)) RETURN + DO i = 1, SIZE(system%lines) + CALL report_model_audit(system%lines(i), audited_line_id(lines, i), dt) + END DO + END SUBROUTINE report_system_line_audits + SUBROUTINE check_model_plausibility(model, max_strain, line_id, time, ErrStat, ErrMsg) !! Per-step plausibility guard on one committed EI=0 line state. A generalized-alpha !! step can converge on a numerically unstable (exploding) trajectory; its residual diff --git a/src/CableDyn_Dynamic.f90 b/src/CableDyn_Dynamic.f90 index 5509fd86..a5e5785d 100644 --- a/src/CableDyn_Dynamic.f90 +++ b/src/CableDyn_Dynamic.f90 @@ -10,12 +10,16 @@ MODULE CableDyn_Dynamic !! and C-facing lifecycle layers. !! !! One consistent-mass step advances (q_n, v_n, a_n) -> (q_{n+1}, v_{n+1}, a_{n+1}) - !! over dt by solving, at the alpha-blended configuration q_alpha, - !! R(q) = M a_alpha + f_int(q_alpha) - f_ext = 0 + !! over dt by solving the force-blended residual (GenAlphaConfig%force_blend, default) + !! R(q) = M a_alpha + (1 - alpha_f) r(q_{n+1}, v_{n+1}) + alpha_f r(q_n, v_n) = 0, + !! r = f_int - f_ext - f_load, + !! with a release cap on tension-only elements that go slack within the step (see + !! apply_release_cap), or the configuration-blended R(q) = M a_alpha + f_int(q_alpha) - ..., !! for the Newton variable q = q_{n+1} with a Newton + Armijo line search on the !! 1/2||R||^2 merit. Optional callbacks add dynamic loads, force-only residual - !! evaluations, added mass, and prescribed support motion. The effective tangent is - !! (1 - alpha_m)/(beta dt^2) M + (1 - alpha_f) K_t(q_alpha), + !! evaluations, added mass (at q_alpha either way), and prescribed support motion. The + !! effective tangent is + !! (1 - alpha_m)/(beta dt^2) M + (1 - alpha_f) K_t(q_{n+1} or q_alpha), !! and the free-DOF block is assembled and solved directly in banded DGBSV !! storage when no arbitrary dense callback Jacobian is active. !! @@ -73,6 +77,11 @@ MODULE CableDyn_Dynamic !! (CD_Cosserat_Gen_Alpha_Step) reads it; the EI=0 cable !! path has no rotation DOFs. With .TRUE. the step fails !! closed on moving supports and dynamic load callbacks. + LOGICAL :: force_blend = .TRUE. !! EI=0 cable step only: .TRUE. blends the internal force + !! and the dynamic loads, (1 - alpha_f) r(q_{n+1}, v_{n+1}) + !! + alpha_f r(q_n, v_n); .FALSE. evaluates them at the + !! blended configuration (q_alpha, v_alpha). The finite-EI + !! paths have their own setting. END TYPE GenAlphaConfig TYPE :: CD_CableGenAlphaWorkspace @@ -114,6 +123,18 @@ MODULE CableDyn_Dynamic REAL(wp), ALLOCATABLE :: fint_eval(:) REAL(wp), ALLOCATABLE :: tension_eval(:) REAL(wp), ALLOCATABLE :: load_eval(:) + ! force blend (GenAlphaConfig%force_blend): the configuration the internal force and the + ! dynamic loads are evaluated at (q_{n+1}), and the step-start internal force and dynamic + ! load (at q_n, v_n) that enter the blend with weight alpha_f + REAL(wp), ALLOCATABLE :: q_force(:) + REAL(wp), ALLOCATABLE :: fint_n(:) + REAL(wp), ALLOCATABLE :: load_n(:) + ! release cap of the force blend (tension-only elements): the step-start tension, stretch + ! l - l0 and unit chord of every element + REAL(wp), ALLOCATABLE :: tension_n(:), stretch_n(:), chord_n(:, :) + ! fint_n, load_n and the release-cap data hold the step-start values of the last call: a + ! warm re-solve of the same step (guess_armed, from the same committed state) reuses them + LOGICAL :: start_valid = .FALSE. REAL(wp), ALLOCATABLE :: eff(:, :) REAL(wp), ALLOCATABLE :: eff_free(:, :) REAL(wp), ALLOCATABLE :: Kt_eval(:, :) @@ -294,6 +315,13 @@ SUBROUTINE CD_Clear_GenAlpha_Workspace(work) IF (ALLOCATED(work%fint_eval)) DEALLOCATE (work%fint_eval) IF (ALLOCATED(work%tension_eval)) DEALLOCATE (work%tension_eval) IF (ALLOCATED(work%load_eval)) DEALLOCATE (work%load_eval) + IF (ALLOCATED(work%q_force)) DEALLOCATE (work%q_force) + IF (ALLOCATED(work%fint_n)) DEALLOCATE (work%fint_n) + IF (ALLOCATED(work%load_n)) DEALLOCATE (work%load_n) + IF (ALLOCATED(work%tension_n)) DEALLOCATE (work%tension_n) + IF (ALLOCATED(work%stretch_n)) DEALLOCATE (work%stretch_n) + IF (ALLOCATED(work%chord_n)) DEALLOCATE (work%chord_n) + work%start_valid = .FALSE. IF (ALLOCATED(work%eff)) DEALLOCATE (work%eff) IF (ALLOCATED(work%eff_free)) DEALLOCATE (work%eff_free) IF (ALLOCATED(work%Kt_eval)) DEALLOCATE (work%Kt_eval) @@ -577,7 +605,7 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on converged, stalled, n_iter, ErrStat, ErrMsg, & load_proc, added_mass_proc, load_force_proc, & load_band_proc, prescribed_q, prescribed_v, prescribed_a, structural_mass, & - workspace, added_mass_band_proc) + workspace, added_mass_band_proc, start_load) !! One generalized-alpha step: the constant load f_ext plus the optional load, !! banded-load, force-only and added-mass callbacks (hydrodynamics, damping, contact). !! On a singular effective tangent returns CD_DYN_SINGULAR; on a line-search @@ -622,6 +650,12 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on REAL(wp), INTENT(IN), OPTIONAL :: prescribed_q(:), prescribed_v(:), prescribed_a(:) REAL(wp), INTENT(IN), OPTIONAL :: structural_mass(:, :) TYPE(CD_CableGenAlphaWorkspace), INTENT(INOUT), TARGET, OPTIONAL :: workspace + !! Force blend (cfg%force_blend) with a load callback: the dynamic load at the step-start + !! state (q, v) as the callbacks return it for the committed state (a constitutive law + !! with internal state, such as the viscoelastic and Syrope contributors, gives its + !! committed force there, not one advanced over the step). Absent: the step evaluates the + !! force-only callback (or load_proc) at (q, v). Full (3 n_nodes) array. + REAL(wp), INTENT(IN), OPTIONAL :: start_load(:) INTEGER :: n_dof, n_elem, n_free, bt, kl, ku, ldab INTEGER, POINTER :: free(:), fixed(:), ipiv(:) @@ -631,6 +665,14 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on REAL(wp), POINTER :: a_eval(:), a_alpha(:), q_alpha(:), v_eval(:), v_alpha(:), fint_eval(:) ! q_alpha viewed as (3, n_nodes) nodal coordinates, without a copy REAL(wp), POINTER :: q_alpha_nodes(:, :) + ! force blend: q_force holds q_{n+1} for the force evaluation, fint_n and load_n the + ! step-start internal force and dynamic load; qf, vf (qf_nodes) are the state the internal + ! force and the dynamic loads are evaluated at (q_{n+1}, v_{n+1} with the force blend, + ! q_alpha, v_alpha without) + REAL(wp), POINTER :: q_force(:), q_n_nodes(:, :), fint_n(:), load_n(:) + REAL(wp), POINTER :: qf(:), vf(:), qf_nodes(:, :) + REAL(wp), POINTER :: tension_n(:), stretch_n(:), chord_n(:, :) + LOGICAL :: force_blend, release_cap LOGICAL :: topo_ok, bw_hit, mb_hit INTEGER :: il, jl REAL(wp), POINTER :: Kt_eval(:, :), tension_eval(:), load_eval(:), jac_q_eval(:, :), jac_v_eval(:, :) @@ -865,6 +907,28 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on END DO END IF + ! --- force blend: the step-start internal force and dynamic load, the alpha_f share of + ! the blended residual (1 - alpha_f) r(q_{n+1}, v_{n+1}) + alpha_f r(q_n, v_n) --- + ! A warm re-solve of the same step (the junction coupling re-steps the line from the + ! same committed state with moved ends) reuses those of the previous call. + force_blend = cfg%force_blend + release_cap = .FALSE. + IF (force_blend) THEN + IF (work%guess_armed .AND. work%start_valid) THEN + release_cap = tension_only .AND. alpha_f > CD_ZERO + ELSE + work%start_valid = .FALSE. + CALL start_forces(es, em) + IF (es /= 0) THEN + CALL fail_callback(ErrStat, ErrMsg, em, es) + RETURN + END IF + work%start_valid = .TRUE. + END IF + ELSE + work%start_valid = .FALSE. + END IF + DO il = 1, n_dof qk(il) = q_pred(il) END DO @@ -1199,7 +1263,10 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on EXIT END IF END IF - IF (.NOT. cfg%modified_newton) have_eff = .FALSE. + ! modified Newton keeps the factorised tangent only while each iterate reduces the + ! residual to at most a quarter of the previous one (a frozen tangent converges + ! linearly, and a slow contraction would spend the iteration budget) + IF (.NOT. cfg%modified_newton .OR. norm > 0.25_wp*norm_before) have_eff = .FALSE. END DO work%resid_first = converged .AND. n_iter == 0 .AND. .NOT. guess_used @@ -1377,6 +1444,71 @@ SUBROUTINE end_junction_data() work%end_valid = CD_All_Finite(work%end_k) .AND. CD_All_Finite(work%end_r) END SUBROUTINE end_junction_data + SUBROUTINE start_forces(es_s, em_s) + !! fint_n = f_int(q_n) and load_n = the dynamic load at (q_n, v_n): start_load when the + !! caller supplies it, else the force-only callback (or load_proc) evaluated there. + INTEGER, INTENT(OUT) :: es_s + CHARACTER(*), INTENT(OUT) :: em_s + INTEGER :: i + es_s = 0 + em_s = '' + CALL CD_Assemble_Cable_Internal_Force(q_n_nodes, elem_conn, l0, ea, tension_only, fint_n, es_s, em_s, & + topology_validated=topo_ok) + IF (es_s /= 0) THEN + es_s = CD_DYN_BADINPUT + em_s = 'step-start internal-force assembly failed: '//TRIM(em_s) + RETURN + END IF + ! release cap: the step-start tension, stretch and chord of every taut element (the + ! assembly above has validated the connectivity and the element lengths) + release_cap = tension_only .AND. alpha_f > CD_ZERO + IF (release_cap) THEN + DO i = 1, n_elem + BLOCK + REAL(wp) :: d(3), ell + d = q_n_nodes(:, elem_conn(2, i)) - q_n_nodes(:, elem_conn(1, i)) + ell = NORM2(d) + chord_n(:, i) = d/ell + stretch_n(i) = ell - l0(i) + tension_n(i) = CD_ZERO + IF (stretch_n(i) > CD_ZERO) tension_n(i) = ea(i)*(ell/l0(i) - CD_ONE) + END BLOCK + END DO + END IF + DO i = 1, n_dof + load_n(i) = CD_ZERO + END DO + IF (.NOT. (has_load_proc .OR. has_load_band_proc)) RETURN + IF (PRESENT(start_load)) THEN + IF (SIZE(start_load) /= n_dof) THEN + es_s = CD_DYN_BADINPUT + em_s = 'start_load must have shape (3 n_nodes)' + RETURN + END IF + DO i = 1, n_dof + load_n(i) = start_load(i) + END DO + ELSE IF (has_load_force_proc) THEN + CALL load_force_proc_cb(q_n, v_n, load_n, es_s, em_s) + IF (es_s /= 0) THEN + em_s = 'step-start dynamic force load failed: '//TRIM(em_s) + RETURN + END IF + ELSE + jac_q_eval = CD_ZERO + jac_v_eval = CD_ZERO + CALL load_proc_cb(q_n, v_n, load_n, jac_q_eval, jac_v_eval, es_s, em_s) + IF (es_s /= 0) THEN + em_s = 'step-start dynamic load failed: '//TRIM(em_s) + RETURN + END IF + END IF + IF (.NOT. CD_All_Finite(load_n)) THEN + es_s = CD_DYN_BADINPUT + em_s = 'step-start dynamic load is non-finite' + END IF + END SUBROUTINE start_forces + SUBROUTINE refresh_band_scales() !! Diagonal scale and max absolute row sum of the current (unfactored) effective band. IF (.NOT. scales_stale) RETURN @@ -1428,8 +1560,24 @@ SUBROUTINE bind_step_workspace(workspace_ref) a_alpha => workspace_ref%a_alpha(1:n_dof) q_alpha => workspace_ref%q_alpha(1:n_dof) q_alpha_nodes(1:3, 1:n_dof/3) => workspace_ref%q_alpha(1:n_dof) + q_force => workspace_ref%q_force(1:n_dof) + q_n_nodes(1:3, 1:n_dof/3) => workspace_ref%q_n(1:n_dof) + fint_n => workspace_ref%fint_n(1:n_dof) + load_n => workspace_ref%load_n(1:n_dof) + tension_n => workspace_ref%tension_n(1:n_elem) + stretch_n => workspace_ref%stretch_n(1:n_elem) + chord_n => workspace_ref%chord_n(1:3, 1:n_elem) v_eval => workspace_ref%v_eval(1:n_dof) v_alpha => workspace_ref%v_alpha(1:n_dof) + IF (cfg%force_blend) THEN + qf => workspace_ref%q_force(1:n_dof) + qf_nodes(1:3, 1:n_dof/3) => workspace_ref%q_force(1:n_dof) + vf => workspace_ref%v_eval(1:n_dof) + ELSE + qf => workspace_ref%q_alpha(1:n_dof) + qf_nodes(1:3, 1:n_dof/3) => workspace_ref%q_alpha(1:n_dof) + vf => workspace_ref%v_alpha(1:n_dof) + END IF fint_eval => workspace_ref%fint_eval(1:n_dof) tension_eval => workspace_ref%tension_eval(1:n_elem) load_eval => workspace_ref%load_eval(1:n_dof) @@ -1506,9 +1654,10 @@ SUBROUTINE form_trial(stp) END SUBROUTINE form_trial SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) - !! R = M a_alpha + f_int(q_alpha) - f_ext (f_ext_alpha = f_ext, constant). When + !! R = M a_alpha + (1-af) r(q_eval, v_eval) + af r(q_n, v_n) with the force blend, else + !! M a_alpha + f_int(q_alpha) - f_ext - load(q_alpha, v_alpha) (f_ext constant). When !! the OPTIONAL effout is present it also returns the effective tangent - !! (1-am)/(beta dt^2) M + (1-af) K_t(q_alpha); when absent only the internal + !! (1-am)/(beta dt^2) M + (1-af) K_t(q_eval or q_alpha); when absent only the internal !! force is assembled (the residual-only path the line search uses). Host- !! associates M, q_pred, q_n, a_n, f_ext, the Chung-Hulbert params, and the mesh. REAL(wp), INTENT(IN) :: q_eval(:) @@ -1531,6 +1680,11 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) q_alpha(iv) = (CD_ONE - alpha_f)*q_eval(iv) + alpha_f*q_n(iv) v_alpha(iv) = (CD_ONE - alpha_f)*v_eval(iv) + alpha_f*v_n(iv) END DO + IF (force_blend) THEN + DO iv = 1, n_dof + q_force(iv) = q_eval(iv) + END DO + END IF IF (obj_levels) THEN DO il2 = 1, SIZE(fixed) IF (.NOT. object_level(il2)) CYCLE @@ -1543,7 +1697,7 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) END IF load_eval = CD_ZERO IF (PRESENT(effbandout)) THEN - CALL CD_Assemble_Cable_Tangent_Force_Banded_Free(q_alpha_nodes, elem_conn, l0, ea, & + CALL CD_Assemble_Cable_Tangent_Force_Banded_Free(qf_nodes, elem_conn, l0, ea, & tension_only, free, kl, ku, Kt_band, fint_eval, & tension_eval, es_e, em_e, topology_validated=topo_ok, & free_map=work%dof_marker(1:n_dof)) @@ -1555,7 +1709,7 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) END IF IF (has_load_band_proc) THEN ! the callback defines every INTENT(OUT) band entry itself - CALL load_band_proc_cb(q_alpha, v_alpha, free, kl, ku, load_eval, jq_band, jv_band, es_e, em_e) + CALL load_band_proc_cb(qf, vf, free, kl, ku, load_eval, jq_band, jv_band, es_e, em_e) IF (es_e /= 0) THEN em_e = 'dynamic banded load failed: '//TRIM(em_e) Rout = CD_ZERO @@ -1572,7 +1726,7 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) END IF END IF ELSE IF (PRESENT(effout)) THEN - CALL CD_Assemble_Cable_Tangent_Force(q_alpha_nodes, elem_conn, l0, ea, & + CALL CD_Assemble_Cable_Tangent_Force(qf_nodes, elem_conn, l0, ea, & tension_only, Kt_eval, fint_eval, tension_eval, es_e, em_e, & topology_validated=topo_ok) IF (es_e /= 0) THEN @@ -1582,7 +1736,7 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) RETURN END IF ELSE - CALL CD_Assemble_Cable_Internal_Force(q_alpha_nodes, elem_conn, l0, ea, & + CALL CD_Assemble_Cable_Internal_Force(qf_nodes, elem_conn, l0, ea, & tension_only, fint_eval, es_e, em_e, topology_validated=topo_ok) IF (es_e /= 0) THEN em_e = 'internal-force assembly failed: '//TRIM(em_e) @@ -1594,7 +1748,7 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) IF (tangent_requested .AND. has_load_proc) THEN jac_q_eval = CD_ZERO jac_v_eval = CD_ZERO - CALL load_proc_cb(q_alpha, v_alpha, load_eval, jac_q_eval, jac_v_eval, es_e, em_e) + CALL load_proc_cb(qf, vf, load_eval, jac_q_eval, jac_v_eval, es_e, em_e) IF (es_e /= 0) THEN em_e = 'dynamic load failed: '//TRIM(em_e) Rout = CD_ZERO @@ -1612,7 +1766,7 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) RETURN END IF ELSE IF (has_load_force_proc .AND. .NOT. tangent_requested) THEN - CALL load_force_proc_cb(q_alpha, v_alpha, load_eval, es_e, em_e) + CALL load_force_proc_cb(qf, vf, load_eval, es_e, em_e) IF (es_e /= 0) THEN em_e = 'dynamic force load failed: '//TRIM(em_e) Rout = CD_ZERO @@ -1629,7 +1783,7 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) ELSE IF (has_load_proc) THEN jac_q_eval = CD_ZERO jac_v_eval = CD_ZERO - CALL load_proc_cb(q_alpha, v_alpha, load_eval, jac_q_eval, jac_v_eval, es_e, em_e) + CALL load_proc_cb(qf, vf, load_eval, jac_q_eval, jac_v_eval, es_e, em_e) IF (es_e /= 0) THEN em_e = 'dynamic load failed: '//TRIM(em_e) Rout = CD_ZERO @@ -1678,6 +1832,18 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) RETURN END IF END IF + IF (force_blend) THEN + ! (1 - alpha_f) r(q_{n+1}, v_{n+1}) + alpha_f r(q_n, v_n); the tangent below takes the + ! (1 - alpha_f) share of the derivatives at q_{n+1} + DO iv = 1, n_dof + fint_eval(iv) = (CD_ONE - alpha_f)*fint_eval(iv) + alpha_f*fint_n(iv) + END DO + IF (has_load_proc .OR. has_load_band_proc) THEN + DO iv = 1, n_dof + load_eval(iv) = (CD_ONE - alpha_f)*load_eval(iv) + alpha_f*load_n(iv) + END DO + END IF + END IF IF (has_added_mass_proc) THEN Rout = MATMUL(M_eff_eval, a_alpha) + fint_eval - f_ext - load_eval ELSE IF (has_added_mass_band_proc) THEN @@ -1717,8 +1883,83 @@ SUBROUTINE eval_dynamic(q_eval, Rout, es_e, em_e, effout, effbandout) RETURN END IF END IF + IF (force_blend .AND. release_cap) THEN + IF (PRESENT(effbandout)) THEN + CALL apply_release_cap(q_eval, Rout, effbandout=effbandout) + ELSE IF (PRESENT(effout)) THEN + CALL apply_release_cap(q_eval, Rout, effout=effout) + ELSE + CALL apply_release_cap(q_eval, Rout) + END IF + END IF END SUBROUTINE eval_dynamic + SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) + !! Release cap of the force blend. A tension-only element taut at t_n (tension T_0, + !! stretch e_0 = l_n - l0 > 0) and slack at t_{n+1} (e_1 < 0) carries alpha_f T_0 along + !! its step-start chord in the blended residual. While the element shortens by + !! e_0 - e_1 that force returns the work alpha_f T_0 (e_0 - e_1) to the motion, but the + !! element only released its strain energy W_0 = T_0 e_0/2: a release deeper than + !! e_0 (1/(2 alpha_f) - 1) within one step would create energy. Such an element instead + !! carries the discrete energy gradient W_0/(e_0 - e_1), which returns exactly W_0 (the + !! smaller of the two is kept, so the blend is continuous in e_1). Every other element, + !! and every taut one, keeps the force blend. The residual and the tangent are corrected + !! by the difference. + REAL(wp), INTENT(IN) :: q_eval(:) + REAL(wp), INTENT(INOUT) :: Rout(:) + REAL(wp), INTENT(INOUT), OPTIONAL :: effout(:, :), effbandout(:, :) + INTEGER :: e, na, nb, i, j, gi(6), fi, fj + REAL(wp) :: d1(3), l1, e1, e0, t0, den, dg, delta, ddg, t1(3), blk(3, 3), sgn + DO e = 1, n_elem + t0 = tension_n(e) + IF (.NOT. t0 > CD_ZERO) CYCLE + na = elem_conn(1, e) + nb = elem_conn(2, e) + d1 = q_eval(3*nb - 2:3*nb) - q_eval(3*na - 2:3*na) + ! a taut end state (the common case) is decided on the squared length, without a root + IF (d1(1)*d1(1) + d1(2)*d1(2) + d1(3)*d1(3) >= l0(e)*l0(e)) CYCLE + l1 = NORM2(d1) + e1 = l1 - l0(e) + IF (e1 >= CD_ZERO) CYCLE + e0 = stretch_n(e) + den = e0 - e1 + dg = 0.5_wp*t0*e0/den + IF (dg >= alpha_f*t0) CYCLE + delta = dg - alpha_f*t0 + Rout(3*na - 2:3*na) = Rout(3*na - 2:3*na) - delta*chord_n(:, e) + Rout(3*nb - 2:3*nb) = Rout(3*nb - 2:3*nb) + delta*chord_n(:, e) + IF (.NOT. (PRESENT(effout) .OR. PRESENT(effbandout))) CYCLE + ! d(delta)/d(x_b) = ddg t1, d(delta)/d(x_a) = -ddg t1 + IF (.NOT. l1 > CD_ZERO) CYCLE + t1 = d1/l1 + ddg = 0.5_wp*t0*e0/(den*den) + DO j = 1, 3 + DO i = 1, 3 + blk(i, j) = ddg*chord_n(i, e)*t1(j) + END DO + END DO + DO i = 1, 3 + gi(i) = 3*na - 3 + i + gi(3 + i) = 3*nb - 3 + i + END DO + DO j = 1, 6 + DO i = 1, 6 + ! rows of node a carry -delta t0, columns of node a d(delta)/d(x_a) = -ddg t1 + sgn = MERGE(-CD_ONE, CD_ONE, i <= 3)*MERGE(-CD_ONE, CD_ONE, j <= 3) + IF (PRESENT(effout)) THEN + effout(gi(i), gi(j)) = effout(gi(i), gi(j)) + sgn*blk(MOD(i - 1, 3) + 1, MOD(j - 1, 3) + 1) + ELSE + fi = work%dof_marker(gi(i)) + fj = work%dof_marker(gi(j)) + IF (fi <= 0 .OR. fj <= 0) CYCLE + effbandout(kl + ku + 1 + fi - fj, fj) = effbandout(kl + ku + 1 + fi - fj, fj) + & + sgn*blk(MOD(i - 1, 3) + 1, MOD(j - 1, 3) + 1) + END IF + END DO + END DO + END DO + END SUBROUTINE apply_release_cap + END SUBROUTINE CD_Cable_Gen_Alpha_Step ! --------------------------------------------------------------------------- ! @@ -1800,6 +2041,18 @@ SUBROUTINE ensure_step_workspace(work, n_dof, n_elem, n_free, ldab, need_band, n IF (ErrStat /= CD_DYN_OK) RETURN CALL ensure_real_vector(work%load_eval, n_dof, ErrStat, ErrMsg) IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%q_force, n_dof, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%fint_n, n_dof, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%load_n, n_dof, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%tension_n, n_elem, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%stretch_n, n_elem, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_matrix(work%chord_n, 3, n_elem, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN IF (need_band) THEN ! a reallocated mass band no longer holds the remembered one IF (ALLOCATED(work%M_band)) THEN diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index be545525..8e1972b6 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -103,6 +103,7 @@ MODULE CableDyn_Model PUBLIC :: CD_Recompute_Model_Acceleration PUBLIC :: CD_Model_Is_Initialized PUBLIC :: CD_Copy_Model + PUBLIC :: CD_Audit_Model_Step INTEGER, PARAMETER, PUBLIC :: CD_MODEL_OK = 0 INTEGER, PARAMETER, PUBLIC :: CD_MODEL_BADINPUT = 1 @@ -168,6 +169,12 @@ MODULE CableDyn_Model INTEGER, ALLOCATABLE :: free_map_work(:) TYPE(CD_CableGenAlphaWorkspace) :: dynamic_workspace REAL(wp), ALLOCATABLE :: load_force_work(:) + ! the load contributors at the committed state, the step-start share of the force-blended + ! generalised-alpha residual (scratch, rebuilt every step) + REAL(wp), ALLOCATABLE :: load_start_work(:) + ! load_start_work holds the committed-state load of the last step: a warm re-solve of the + ! same step (the junction coupling, dynamic_workspace%guess_armed) reuses it + LOGICAL :: load_start_valid = .FALSE. REAL(wp), ALLOCATABLE :: load_jq_work(:, :) REAL(wp), ALLOCATABLE :: load_jv_work(:, :) LOGICAL :: has_seabed = .FALSE. @@ -277,6 +284,22 @@ MODULE CableDyn_Model REAL(wp), ALLOCATABLE :: added_mass_can_elem(:) REAL(wp), ALLOCATABLE :: added_mass_cat_elem(:) TYPE(GenAlphaConfig) :: cfg + ! Run audit of the committed host steps (CD_Audit_Model_Step), diagnostics only: never part + ! of the state, of a copy, or of a result. audit_t holds the elastic segment tensions of the + ! last two audited states (column 1 the latest; -1 marks a segment whose tension the + ! viscoelastic or Syrope law carries), audit_u the unit chords of the latest one, audit_n + ! how many states are held (0 to 2). audit_floor is the largest tension of the first audited + ! state. audit_max_turn is the largest turn of a taut segment's chord in one step (deg), + ! audit_snaps the segments that went from slack to taut above audit_floor in one step and + ! audit_snap_courant the largest dt*c/l0 (c the axial wave speed) among them. audit_spikes + ! counts the implausible tension spikes, the first one recorded with its time, segment, + ! tension and ratio to the largest tension of the line one step before and after. + INTEGER :: audit_n = 0 + REAL(wp), ALLOCATABLE :: audit_t(:, :), audit_u(:, :), audit_now(:) + REAL(wp) :: audit_time = CD_ZERO, audit_floor = CD_ZERO, audit_max_turn = CD_ZERO + REAL(wp) :: audit_snap_courant = CD_ZERO + INTEGER :: audit_snaps = 0, audit_spikes = 0, audit_spike_elem = 0 + REAL(wp) :: audit_spike_time = CD_ZERO, audit_spike_tension = CD_ZERO, audit_spike_ratio = CD_ZERO END TYPE CD_ModelType CONTAINS @@ -373,6 +396,7 @@ SUBROUTINE CD_Init_Model(model, q0, v0, elem_conn, l0, ea, rho_a, tension_only, ! under memory pressure before any checked allocation runs). CALL clear_model_load_contributor_workspace(model) CALL CD_Clear_GenAlpha_Workspace(model%dynamic_workspace) + CALL clear_model_audit(model) old_model = model n_dof = SIZE(q0) @@ -1852,6 +1876,35 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, has_load = model%has_seabed .OR. model%has_seabed_damping .OR. model%has_seabed_friction .OR. & model%has_damping .OR. model%has_viscoelastic .OR. model%has_syrope .OR. model%has_morison_drag .OR. & model%has_froude_krylov .OR. model%has_buoyancy_recovery + ! Force-blended generalised alpha: the load contributors at the committed state (q_n, v_n) + ! carry the alpha_f share of the residual. They are evaluated here, in the instantaneous + ! limit (ve_dt = 0), so the viscoelastic and Syrope elements give their committed force. + ! A warm re-solve of the same step (the junction coupling re-steps the line from the same + ! committed state with moved ends) reuses the load of the previous call. + IF (.NOT. (has_load .AND. model%cfg%force_blend)) THEN + model%load_start_valid = .FALSE. + ELSE IF (.NOT. (model%dynamic_workspace%guess_armed .AND. model%load_start_valid)) THEN + model%load_start_valid = .FALSE. + IF (ALLOCATED(model%load_start_work)) THEN + IF (SIZE(model%load_start_work) /= model%n_dof) DEALLOCATE (model%load_start_work) + END IF + IF (.NOT. ALLOCATED(model%load_start_work)) THEN + ALLOCATE (model%load_start_work(model%n_dof), STAT=es) + IF (es /= 0) THEN + ErrStat = CD_MODEL_ALLOCFAIL + ErrMsg = 'CableDyn_Model: step-start load workspace allocation failed' + RETURN + END IF + END IF + model%ve_dt = CD_ZERO + CALL model_contributor_force(model, model%q, model%v, model%load_start_work, es, em) + IF (es /= CD_MODEL_OK) THEN + ErrStat = es + ErrMsg = 'CableDyn_Model: step-start load failed: '//TRIM(em) + RETURN + END IF + model%load_start_valid = .TRUE. + END IF ! arm the viscoelastic contributors with the step size: in-step load ! evaluations use the backward-Euler-eliminated dl_1(q, v); it is reset to ! the instantaneous limit (0) on EVERY exit below so committed-state queries @@ -1865,7 +1918,7 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, es, em, load_force_proc=model_force, load_band_proc=model_load_band, & added_mass_band_proc=model_added_mass_band, prescribed_q=prescribed_q, & prescribed_v=prescribed_v, prescribed_a=prescribed_a, & - workspace=model%dynamic_workspace) + workspace=model%dynamic_workspace, start_load=model%load_start_work) ELSE IF (PRESENT(prescribed_q) .AND. has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1873,7 +1926,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, n_iter, & es, em, load_force_proc=model_force, load_band_proc=model_load_band, & prescribed_q=prescribed_q, prescribed_v=prescribed_v, & - prescribed_a=prescribed_a, workspace=model%dynamic_workspace) + prescribed_a=prescribed_a, workspace=model%dynamic_workspace, & + start_load=model%load_start_work) ELSE IF (PRESENT(prescribed_q) .AND. model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1895,14 +1949,15 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, dt, model%cfg, model%q_step, model%v_step, model%a_step, converged, stalled, & n_iter, es, em, & load_force_proc=model_force, load_band_proc=model_load_band, & - added_mass_band_proc=model_added_mass_band, workspace=model%dynamic_workspace) + added_mass_band_proc=model_added_mass_band, workspace=model%dynamic_workspace, & + start_load=model%load_start_work) ELSE IF (has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & dt, model%cfg, model%q_step, model%v_step, model%a_step, converged, stalled, & n_iter, es, em, & load_force_proc=model_force, load_band_proc=model_load_band, & - workspace=model%dynamic_workspace) + workspace=model%dynamic_workspace, start_load=model%load_start_work) ELSE IF (model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -4601,6 +4656,126 @@ SUBROUTINE model_added_mass_band(q, accel, free, kl, ku, M_add_a, M_add_band, dM END SUBROUTINE model_added_mass_band END SUBROUTINE CD_Recompute_Model_Acceleration + SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) + !! Audit one committed host step of an EI=0 line (called once per output step by the + !! standalone driver, after the step's plausibility guard). Cheap, O(n_elem), and + !! diagnostic only. It tracks + !! + !! * the largest turn of a taut segment's chord over one step, the measure of how well + !! dtM resolves the rotation of the line (time-step advisory); + !! * slack-to-taut snaps above the initial tension scale, with the largest dt*c/l0 among + !! them (c = sqrt(EA/m) the axial wave speed): dt*c/l0 > 1 leaves the snap peak + !! unresolved in time; + !! * implausible tension spikes. A segment's elastic tension T_n at the previous audited + !! step is a spike when it exceeds four times its own tension one step before and one + !! step after, ten times the largest tension anywhere on the line one step before and + !! one step after, and the largest tension of the initial state. A physical snap or + !! tension wave persists over the axial transit time and is shared by the neighbouring + !! segments, so no line, resolved or not, carries such an isolated single-step peak; an + !! integrator artefact (an under-resolved slack-taut transition) does. + !! + !! new_spike reports the line's first spike (so the caller warns once per line). The + !! elastic tension is EA*max(strain, 0) of the plain elements; viscoelastic and Syrope + !! elements, whose tension comes from their own laws, are skipped. + TYPE(CD_ModelType), INTENT(INOUT) :: model + REAL(wp), INTENT(IN) :: time, dt + LOGICAL, INTENT(OUT) :: new_spike + REAL(wp), PARAMETER :: SPIKE_ISOLATION = 4.0_wp, SPIKE_LINE_FACTOR = 10.0_wp + INTEGER :: e, na, nb, istat + REAL(wp) :: d(3), ell, strain, u(3), c, line_max, tn + LOGICAL :: fresh + + new_spike = .FALSE. + IF (.NOT. model%initialized .OR. model%n_elem < 1) RETURN + fresh = .NOT. (ALLOCATED(model%audit_t) .AND. ALLOCATED(model%audit_u) .AND. ALLOCATED(model%audit_now)) + IF (.NOT. fresh) fresh = SIZE(model%audit_t, 1) /= model%n_elem + IF (fresh) THEN + IF (ALLOCATED(model%audit_t)) DEALLOCATE (model%audit_t) + IF (ALLOCATED(model%audit_u)) DEALLOCATE (model%audit_u) + IF (ALLOCATED(model%audit_now)) DEALLOCATE (model%audit_now) + ALLOCATE (model%audit_t(model%n_elem, 2), model%audit_u(3, model%n_elem), model%audit_now(model%n_elem), & + STAT=istat) + IF (istat /= 0) RETURN + model%audit_n = 0 + END IF + ! current elastic tensions, chords and the chord turn against the previous audited state + DO e = 1, model%n_elem + na = model%elem_conn(1, e) + nb = model%elem_conn(2, e) + d = model%q(3*nb - 2:3*nb) - model%q(3*na - 2:3*na) + ell = NORM2(d) + IF (.NOT. ell > CD_ZERO) THEN + u = CD_ZERO + ELSE + u = d/ell + END IF + IF (model%ea_dyn(e) > CD_ZERO) THEN + strain = ell/model%l0(e) - CD_ONE + IF (model%tension_only .AND. strain < CD_ZERO) strain = CD_ZERO + model%audit_now(e) = model%ea_dyn(e)*strain + ELSE + model%audit_now(e) = -CD_ONE + END IF + IF (model%audit_n >= 1) THEN + ! the turn of a segment taut at both states (a slack segment turns freely and carries + ! no tension whose accuracy the turn would measure) + IF (model%audit_now(e) > CD_ZERO .AND. model%audit_t(e, 1) > CD_ZERO) & + model%audit_max_turn = MAX(model%audit_max_turn, & + ACOS(MAX(-CD_ONE, MIN(CD_ONE, DOT_PRODUCT(u, model%audit_u(:, e)))))* & + (180.0_wp/ACOS(-CD_ONE))) + ! slack at the previous state, taut above the initial tension scale now + IF (model%audit_t(e, 1) == CD_ZERO .AND. model%audit_now(e) > model%audit_floor) THEN + model%audit_snaps = model%audit_snaps + 1 + c = SQRT(model%ea_dyn(e)/model%rho_a(e)) + model%audit_snap_courant = MAX(model%audit_snap_courant, dt*c/model%l0(e)) + END IF + END IF + model%audit_u(:, e) = u + END DO + IF (model%audit_n == 0) model%audit_floor = MAX(CD_ZERO, MAXVAL(model%audit_now)) + ! spike test on the previous state, between its two neighbours + IF (model%audit_n >= 2) THEN + line_max = MAX(MAXVAL(model%audit_t(:, 2)), MAXVAL(model%audit_now)) + DO e = 1, model%n_elem + tn = model%audit_t(e, 1) + IF (.NOT. (tn > model%audit_floor)) CYCLE + IF (tn <= SPIKE_ISOLATION*MAX(model%audit_t(e, 2), model%audit_now(e))) CYCLE + IF (tn <= SPIKE_LINE_FACTOR*line_max) CYCLE + model%audit_spikes = model%audit_spikes + 1 + IF (model%audit_spikes == 1) THEN + model%audit_spike_time = model%audit_time + model%audit_spike_elem = e + model%audit_spike_tension = tn + model%audit_spike_ratio = tn/MAX(line_max, TINY(CD_ONE)) + new_spike = .TRUE. + END IF + END DO + END IF + model%audit_t(:, 2) = model%audit_t(:, 1) + model%audit_t(:, 1) = model%audit_now + model%audit_time = time + model%audit_n = MIN(model%audit_n + 1, 2) + END SUBROUTINE CD_Audit_Model_Step + + SUBROUTINE clear_model_audit(model) + !! Reset the run audit (CD_Audit_Model_Step). + TYPE(CD_ModelType), INTENT(INOUT) :: model + IF (ALLOCATED(model%audit_t)) DEALLOCATE (model%audit_t) + IF (ALLOCATED(model%audit_u)) DEALLOCATE (model%audit_u) + IF (ALLOCATED(model%audit_now)) DEALLOCATE (model%audit_now) + model%audit_n = 0 + model%audit_time = CD_ZERO + model%audit_floor = CD_ZERO + model%audit_max_turn = CD_ZERO + model%audit_snap_courant = CD_ZERO + model%audit_snaps = 0 + model%audit_spikes = 0 + model%audit_spike_elem = 0 + model%audit_spike_time = CD_ZERO + model%audit_spike_tension = CD_ZERO + model%audit_spike_ratio = CD_ZERO + END SUBROUTINE clear_model_audit + SUBROUTINE CD_End_Model(model, ErrStat, ErrMsg) !! Release all allocatable model storage. Safe to call on an uninitialised model. TYPE(CD_ModelType), INTENT(INOUT) :: model @@ -4642,6 +4817,7 @@ SUBROUTINE CD_End_Model(model, ErrStat, ErrMsg) IF (ALLOCATED(model%free_map_work)) DEALLOCATE (model%free_map_work) CALL CD_Clear_GenAlpha_Workspace(model%dynamic_workspace) CALL clear_model_load_contributor_workspace(model) + CALL clear_model_audit(model) IF (ALLOCATED(model%seabed_kn)) DEALLOCATE (model%seabed_kn) IF (ALLOCATED(model%seabed_cn)) DEALLOCATE (model%seabed_cn) CALL CD_End_Bathymetry(model%bathymetry) @@ -5397,6 +5573,8 @@ SUBROUTINE clear_model_load_contributor_workspace(model) IF (ALLOCATED(model%load_force_work)) DEALLOCATE (model%load_force_work) IF (ALLOCATED(model%load_jq_work)) DEALLOCATE (model%load_jq_work) IF (ALLOCATED(model%load_jv_work)) DEALLOCATE (model%load_jv_work) + IF (ALLOCATED(model%load_start_work)) DEALLOCATE (model%load_start_work) + model%load_start_valid = .FALSE. END SUBROUTINE clear_model_load_contributor_workspace PURE LOGICAL FUNCTION mode3_marked(alpha_mbl, e) RESULT(marked) diff --git a/tests/test_cable_dynamic.f90 b/tests/test_cable_dynamic.f90 index b38de153..28f3f2ed 100644 --- a/tests/test_cable_dynamic.f90 +++ b/tests/test_cable_dynamic.f90 @@ -184,39 +184,46 @@ END SUBROUTINE case_axial_period SUBROUTINE case_reference_one_step() !! One generalized-alpha step of a taut 3-node chain under gravity (node 2 free, - !! ends fixed) reproduces the reference q/v/a to the float64 floor. - INTEGER :: conn(2, 2), fixed(6), es, n_iter, i + !! ends fixed) reproduces the reference q/v/a to the float64 floor, for the force blend + !! (the default) and the configuration blend. The references solve the same step for + !! the middle node's z in 40-digit decimal arithmetic: G(z) = M a_alpha + f(z) - F with + !! f the force blend (1 - af) f_z(q_{n+1}) + af f_z(q_n) or the configuration blend + !! f_z((1 - af) q_{n+1} + af q_n), rho_inf = 0.8, dt = 0.01, from rest with a0 = -15. + !! The tight tolerance keeps the Newton error below the reference precision. + INTEGER :: conn(2, 2), fixed(6), es, n_iter, i, k REAL(wp) :: l0(2), ea(2), rho_a(2), q0(9), f_ext(9), load(3, 2) REAL(wp) :: q(9), v(9), a(9), q_new(9), v_new(9), a_new(9) LOGICAL :: converged, stalled TYPE(GenAlphaConfig) :: cfg CHARACTER(120) :: em - REAL(wp), PARAMETER :: want_q(9) = [0.0_wp, 0.0_wp, 0.0_wp, & - 1.0_wp, 0.0_wp, -7.485738187584846e-4_wp, & - 2.0_wp, 0.0_wp, 0.0_wp] - REAL(wp), PARAMETER :: want_v(9) = [0.0_wp, 0.0_wp, 0.0_wp, & - 0.0_wp, 0.0_wp, -0.14971761611417994_wp, & - 0.0_wp, 0.0_wp, 0.0_wp] - REAL(wp), PARAMETER :: want_a(9) = [0.0_wp, 0.0_wp, 0.0_wp, & - 0.0_wp, 0.0_wp, -14.9537917277749_wp, & - 0.0_wp, 0.0_wp, 0.0_wp] + REAL(wp), PARAMETER :: want_z(2) = [-7.4857381553276945e-4_wp, -7.4857381801437368e-4_wp] + REAL(wp), PARAMETER :: want_vz(2) = [-0.149717615475488341_wp, -0.149717615966845990_wp] + REAL(wp), PARAMETER :: want_az(2) = [-14.95379162326173_wp, -14.95379170366571_wp] CALL three_node_chain(conn, l0, ea, rho_a, q0) load = SPREAD([0.0_wp, 0.0_wp, -50.0_wp], 2, 2) CALL CD_Assemble_Distributed_Load(conn, l0, load, f_ext, es, em) CALL expect_es(es, 0, 'reference:fext-ErrStat') - q = q0; v = 0.0_wp fixed = [1, 2, 3, 7, 8, 9] - CALL CD_Cable_Initial_Acceleration(q, v, conn, l0, ea, rho_a, .FALSE., f_ext, fixed, a, es, em) - CALL expect_es(es, CD_DYN_OK, 'reference:a0-ErrStat') - CALL expect(a(6), -15.0_wp, 'reference:a0-z') - CALL CD_Cable_Gen_Alpha_Step(q, v, a, conn, l0, ea, rho_a, .FALSE., f_ext, fixed, & - 0.01_wp, cfg, q_new, v_new, a_new, converged, stalled, n_iter, es, em) - CALL expect_es(es, CD_DYN_OK, 'reference:step-ErrStat') - CALL require(converged, 'reference:converged') - DO i = 1, 9 - CALL expect(q_new(i), want_q(i), 'reference:q') - CALL expect(v_new(i), want_v(i), 'reference:v') - CALL expect(a_new(i), want_a(i), 'reference:a') + cfg%rel_tol = 1.0e-14_wp + DO k = 1, 2 + cfg%force_blend = k == 1 + q = q0; v = 0.0_wp + CALL CD_Cable_Initial_Acceleration(q, v, conn, l0, ea, rho_a, .FALSE., f_ext, fixed, a, es, em) + CALL expect_es(es, CD_DYN_OK, 'reference:a0-ErrStat') + CALL expect(a(6), -15.0_wp, 'reference:a0-z') + CALL CD_Cable_Gen_Alpha_Step(q, v, a, conn, l0, ea, rho_a, .FALSE., f_ext, fixed, & + 0.01_wp, cfg, q_new, v_new, a_new, converged, stalled, n_iter, es, em) + CALL expect_es(es, CD_DYN_OK, 'reference:step-ErrStat') + CALL require(converged, 'reference:converged') + DO i = 1, 9 + IF (i == 6) CYCLE + CALL expect(q_new(i), q0(i), 'reference:q-held') + CALL expect(v_new(i), 0.0_wp, 'reference:v-held') + CALL expect(a_new(i), 0.0_wp, 'reference:a-held') + END DO + CALL expect(q_new(6), want_z(k), 'reference:q') + CALL expect(v_new(6), want_vz(k), 'reference:v') + CALL expect(a_new(6), want_az(k), 'reference:a') END DO END SUBROUTINE case_reference_one_step @@ -549,6 +556,9 @@ SUBROUTINE case_line_search_fallback_handles_bad_tangent() a_bad = a_ref cfg%max_iter = 80 cfg%armijo_max_backtracks = 14 + ! both steps converged far below the comparison tolerance (a = (q - q_pred)/(beta dt^2) + ! magnifies the Newton error in q by 4e4 at this step) + cfg%rel_tol = 1.0e-12_wp CALL CD_Cable_Gen_Alpha_Step(q_ref, v_ref, a_ref, conn, l0, ea, rho_a, .FALSE., f_ext, fixed, & 0.01_wp, cfg, q_clean_out, v_clean_out, a_clean_out, & diff --git a/tests/test_core_release_regressions.f90 b/tests/test_core_release_regressions.f90 index 0a569e38..a692c8f1 100644 --- a/tests/test_core_release_regressions.f90 +++ b/tests/test_core_release_regressions.f90 @@ -159,12 +159,13 @@ SUBROUTINE case_fallback_restores_constitutive_state() ALLOCATE (qc(nc), vc(nc), ac(nc)) CALL CD_Get_System_CoupledMotion(system, qc, vc, ac, es, em) CALL require(es == CD_SYSTEM_OK, 'fallback:coupled-motion') - ! pull both ends of both lines outward + ! pull both ends of both lines outward, unevenly so the free middle node must move (a + ! symmetric pull leaves it balanced at its predictor up to round-off) DO i = 0, 1 qc(6*i + 1) = qc(6*i + 1) - 0.004_wp vc(6*i + 1) = -0.2_wp - qc(6*i + 4) = qc(6*i + 4) + 0.004_wp - vc(6*i + 4) = 0.2_wp + qc(6*i + 4) = qc(6*i + 4) + 0.010_wp + vc(6*i + 4) = 0.5_wp END DO ac = 0.0_wp diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 new file mode 100644 index 00000000..07b3119f --- /dev/null +++ b/tests/test_ei0_slack_dynamics.f90 @@ -0,0 +1,327 @@ +! File: tests/test_ei0_slack_dynamics.f90 +! SPDX-License-Identifier: Apache-2.0 +! Copyright (c) 2026 Jae Hoon Seo, SMI Lab, Inha University +PROGRAM test_ei0_slack_dynamics + !! Tension-only (EI = 0) lines that go slack and snap taut, at the default rhoInf = 0.4: + !! 1. A light, axially stiff cable (80 kg/m, EA 8e8 N, 115 x 2 m segments) under 3 m / 10 s + !! heave at dtM 0.1 s. The configuration-blended step reported 0.61 MN at the fairlead and + !! 20 MN at the anchor against about 0.1 MN (rhoInf 0 and small-step references); the + !! force blend stays below 0.2 MN. + !! 2. The same cable at dtM 0.01 s, where the force blend alone still fed a rattle of + !! single-step segment spikes (2.3 MN by 24 s) through the energy a release creates; + !! with the release cap every segment stays below 0.2 MN. + !! 3. The shipped viscoelastic polyester (Es|Ed, Bs|Bd) under 15 m surge at dtM 0.1 s: + !! 1.80 MN at the fairlead (2.69 MN configuration-blended), as at dtM 0.0025 s. + !! 4. The run audit of the driver (stdout of the executable given as the first argument): + !! the configuration blend (False alpha_force_blend) of case 1 warns of a non-physical + !! tension spike, the force blend does not; rhoInf above 0.95 prints its note; a 10 m + !! sway at dtM 0.2 s prints the segment-turn advisory. + USE CableDyn_Precision, ONLY: wp + USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_DECKDRV_OK + IMPLICIT NONE + + REAL(wp), PARAMETER :: PI = 3.141592653589793238462643383279502884197_wp + CHARACTER(*), PARAMETER :: CABLE = 'cable 0.2 80.0 8.0e8 0.0 0.0 1.2 0.1 1.0 0.0' + CHARACTER(*), PARAMETER :: POLY_VE = 'poly_ve 0.1438 22.42 1.424e8|2.50e8 4.0e9|1.1e7 0.0 1.2 0.2 1.0 0.0' + INTEGER :: nfail + CHARACTER(1024) :: driver + + nfail = 0 + driver = '' + IF (COMMAND_ARGUMENT_COUNT() >= 1) CALL GET_COMMAND_ARGUMENT(1, driver) + CALL case_light_cable_coarse_step() + CALL case_light_cable_release_cap() + CALL case_viscoelastic_surge() + IF (LEN_TRIM(driver) > 0) THEN + CALL case_run_audit() + ELSE + WRITE (*, '(A)') 'MISMATCH [audit: the driver executable is the first argument]' + nfail = nfail + 1 + END IF + + IF (nfail > 0) THEN + WRITE (*, '(A,I0,A)') 'FAIL: ', nfail, ' assertion(s) failed' + ERROR STOP 1 + END IF + WRITE (*, '(A)') 'PASS: EI = 0 slack-taut dynamics (force blend, release cap, run audit)' + +CONTAINS + + SUBROUTINE require(cond, label) + LOGICAL, INTENT(IN) :: cond + CHARACTER(*), INTENT(IN) :: label + IF (.NOT. cond) THEN + WRITE (*, '(A)') 'MISMATCH ['//label//']' + nfail = nfail + 1 + END IF + END SUBROUTINE require + + SUBROUTINE write_motion(path, pid, x0, axis, amp, period, ramp, dt, tmax) + !! Harmonic translation of one point, amp*r(t)*sin(w t), with the C2 quintic start-up + !! ramp r over `ramp` seconds and its exact velocity and acceleration. + CHARACTER(*), INTENT(IN) :: path + INTEGER, INTENT(IN) :: pid, axis + REAL(wp), INTENT(IN) :: x0(3), amp, period, ramp, dt, tmax + INTEGER :: u, i, n + REAL(wp) :: t, s, r, rd, rdd, w, p(3), v(3), a(3) + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') '# time id x y z vx vy vz ax ay az' + n = NINT(tmax/dt) + w = 2.0_wp*PI/period + DO i = 0, n + t = REAL(i, wp)*dt + s = MIN(t/ramp, 1.0_wp) + r = 10.0_wp*s**3 - 15.0_wp*s**4 + 6.0_wp*s**5 + rd = 0.0_wp + rdd = 0.0_wp + IF (t < ramp) THEN + rd = (30.0_wp*s**2 - 60.0_wp*s**3 + 30.0_wp*s**4)/ramp + rdd = (60.0_wp*s - 180.0_wp*s**2 + 120.0_wp*s**3)/ramp**2 + END IF + p = x0 + v = 0.0_wp + a = 0.0_wp + p(axis) = p(axis) + amp*r*SIN(w*t) + v(axis) = amp*(rd*SIN(w*t) + r*w*COS(w*t)) + a(axis) = amp*(rdd*SIN(w*t) + 2.0_wp*rd*w*COS(w*t) - r*w*w*SIN(w*t)) + WRITE (u, '(ES17.10,1X,I0,9(1X,ES17.10))') t, pid, p, v, a + END DO + CLOSE (u) + END SUBROUTINE write_motion + + SUBROUTINE write_deck(path, linetype, anchor, fairlead, length, nseg, depth, outputs, options) + !! One line from a Coupled fairlead (point 1, End A) to a Fixed anchor (point 2). + CHARACTER(*), INTENT(IN) :: path, linetype, outputs, options(:) + REAL(wp), INTENT(IN) :: anchor(3), fairlead(3), length, depth + INTEGER, INTENT(IN) :: nseg + INTEGER :: u, i + CHARACTER(32) :: name + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'EI = 0 slack-taut dynamics regression 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)') TRIM(linetype) + READ (linetype, *) name + WRITE (u, '(A)') '--- POINTS ---' + WRITE (u, '(A)') 'ID Type X Y Z Mass Vol CdA Ca' + WRITE (u, '(A)') '(-) (-) (m) (m) (m) (kg) (m^3) (m^2) (-)' + WRITE (u, '(A,3(1X,ES16.9),A)') '1 Coupled', fairlead, ' 0 0 0 0' + WRITE (u, '(A,3(1X,ES16.9),A)') '2 Fixed', anchor, ' 0 0 0 0' + WRITE (u, '(A)') '--- LINES ---' + WRITE (u, '(A)') 'ID NodeA NodeB Outputs' + WRITE (u, '(A)') '(-) (-) (-) (-)' + WRITE (u, '(A,A)') '1 1 2 ', outputs + WRITE (u, '(A)') '--- SECTIONS ---' + WRITE (u, '(A)') 'LineID LineType Length NumSegs' + WRITE (u, '(A)') '(-) (-) (m) (-)' + WRITE (u, '(A,A,1X,ES16.9,1X,I0)') '1 ', TRIM(name), length, nseg + WRITE (u, '(A)') '--- OPTIONS ---' + WRITE (u, '(ES16.9,A)') depth, ' WtrDpth' + DO i = 1, SIZE(options) + IF (LEN_TRIM(options(i)) > 0) WRITE (u, '(A)') TRIM(options(i)) + END DO + WRITE (u, '(A)') '--- OUTPUTS ---' + WRITE (u, '(A)') 'FairTen1 AnchTen1' + WRITE (u, '(A)') '--- end ---' + CLOSE (u) + END SUBROUTINE write_deck + + SUBROUTINE light_cable_deck(path, dt, tmax, extra, outputs) + !! The light, axially stiff cable from the fairlead (5, 0, -14) to the anchor (205, 0, -80), + !! 230 m in 115 segments, heaving 3 m at 10 s after a 10 s ramp. + CHARACTER(*), INTENT(IN) :: path, extra, outputs + REAL(wp), INTENT(IN) :: dt, tmax + CHARACTER(64) :: opts(4) + CALL write_motion('ei0slack_heave.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 3, 3.0_wp, 10.0_wp, 10.0_wp, dt, tmax) + WRITE (opts(1), '(ES14.7,A)') dt, ' dtM' + WRITE (opts(2), '(ES14.7,A)') tmax, ' TMax' + opts(3) = 'ei0slack_heave.txt motionFile' + opts(4) = extra + CALL write_deck(path, CABLE, [205.0_wp, 0.0_wp, -80.0_wp], [5.0_wp, 0.0_wp, -14.0_wp], 230.0_wp, 115, 80.0_wp, & + outputs, opts) + END SUBROUTINE light_cable_deck + + SUBROUTINE read_out(path, data, nrow) + !! Numeric rows of a driver output file (comment and header lines skipped). + CHARACTER(*), INTENT(IN) :: path + REAL(wp), ALLOCATABLE, INTENT(OUT) :: data(:, :) + INTEGER, INTENT(OUT) :: nrow + INTEGER :: u, ios, ncol, k + CHARACTER(8192) :: line + LOGICAL :: header_seen + REAL(wp), ALLOCATABLE :: grow(:, :) + nrow = 0 + ncol = 0 + header_seen = .FALSE. + ALLOCATE (data(0, 0)) + OPEN (NEWUNIT=u, FILE=path, STATUS='OLD', ACTION='READ', IOSTAT=ios) + IF (ios /= 0) RETURN + DO + READ (u, '(A)', IOSTAT=ios) line + IF (ios /= 0) EXIT + IF (line(1:1) == '#' .OR. LEN_TRIM(line) == 0) CYCLE + IF (.NOT. header_seen) THEN + header_seen = .TRUE. + ncol = count_tokens(line) + DEALLOCATE (data) + ALLOCATE (data(ncol, 64)) + CYCLE + END IF + IF (nrow == SIZE(data, 2)) THEN + ALLOCATE (grow(ncol, 2*SIZE(data, 2))) + grow(:, 1:nrow) = data(:, 1:nrow) + CALL MOVE_ALLOC(grow, data) + END IF + nrow = nrow + 1 + READ (line, *) (data(k, nrow), k=1, ncol) + END DO + CLOSE (u) + END SUBROUTINE read_out + + INTEGER FUNCTION count_tokens(line) RESULT(n) + CHARACTER(*), INTENT(IN) :: line + INTEGER :: i + LOGICAL :: inside + n = 0 + inside = .FALSE. + DO i = 1, LEN_TRIM(line) + IF (line(i:i) == ' ' .OR. line(i:i) == CHAR(9)) THEN + inside = .FALSE. + ELSE IF (.NOT. inside) THEN + inside = .TRUE. + n = n + 1 + END IF + END DO + END FUNCTION count_tokens + + REAL(wp) FUNCTION column_max(path, first_col, last_col) RESULT(mx) + !! Largest value of the columns first_col..last_col (last_col 0: through the last column). + CHARACTER(*), INTENT(IN) :: path + INTEGER, INTENT(IN) :: first_col, last_col + REAL(wp), ALLOCATABLE :: d(:, :) + INTEGER :: nrow, lc + mx = -HUGE(1.0_wp) + CALL read_out(path, d, nrow) + IF (nrow < 1) RETURN + lc = last_col + IF (lc == 0) lc = SIZE(d, 1) + mx = MAXVAL(d(first_col:lc, 1:nrow)) + END FUNCTION column_max + + LOGICAL FUNCTION file_contains(path, needle) RESULT(found) + CHARACTER(*), INTENT(IN) :: path, needle + INTEGER :: u, ios + CHARACTER(4096) :: line + found = .FALSE. + OPEN (NEWUNIT=u, FILE=path, STATUS='OLD', ACTION='READ', IOSTAT=ios) + IF (ios /= 0) RETURN + DO + READ (u, '(A)', IOSTAT=ios) line + IF (ios /= 0) EXIT + IF (INDEX(line, needle) > 0) THEN + found = .TRUE. + EXIT + END IF + END DO + CLOSE (u) + END FUNCTION file_contains + + SUBROUTINE run_driver_logged(deck, root, log, ok) + !! Run the driver executable on a deck, its stdout and stderr to log. + CHARACTER(*), INTENT(IN) :: deck, root, log + LOGICAL, INTENT(OUT) :: ok + INTEGER :: ex, cs + CALL EXECUTE_COMMAND_LINE('"'//TRIM(driver)//'" '//deck//' '//root//' > '//log//' 2>&1', & + WAIT=.TRUE., EXITSTAT=ex, CMDSTAT=cs) + ok = cs == 0 .AND. ex == 0 + END SUBROUTINE run_driver_logged + + SUBROUTINE case_light_cable_coarse_step() + LOGICAL :: conv + INTEGER :: es + CHARACTER(512) :: em + REAL(wp) :: fair, anch + CALL light_cable_deck('ei0slack_coarse.dat', 0.1_wp, 40.0_wp, '', '-') + CALL CD_Run_Deck_Driver('ei0slack_coarse.dat', 'ei0slack_coarse', conv, es, em) + CALL require(es == CD_DECKDRV_OK .AND. conv, 'coarse:run '//TRIM(em)) + fair = column_max('ei0slack_coarse.out', 2, 2) + anch = column_max('ei0slack_coarse.out', 3, 3) + WRITE (*, '(A,ES10.3,A,ES10.3,A)') ' light cable, dtM 0.1 s: FairTen1 max ', fair, ' N, AnchTen1 max ', anch, ' N' + CALL require(fair > 5.0e4_wp .AND. fair < 2.0e5_wp, 'coarse:fairlead-peak') + CALL require(anch > 2.0e4_wp .AND. anch < 2.0e5_wp, 'coarse:anchor-peak') + END SUBROUTINE case_light_cable_coarse_step + + SUBROUTINE case_light_cable_release_cap() + LOGICAL :: conv + INTEGER :: es + CHARACTER(512) :: em + REAL(wp) :: seg + CALL light_cable_deck('ei0slack_release.dat', 0.01_wp, 24.0_wp, '', 't') + CALL CD_Run_Deck_Driver('ei0slack_release.dat', 'ei0slack_release', conv, es, em) + CALL require(es == CD_DECKDRV_OK .AND. conv, 'release:run '//TRIM(em)) + seg = column_max('ei0slack_release.Line1.t.out', 2, 0) + WRITE (*, '(A,ES10.3,A)') ' light cable, dtM 0.01 s: largest segment tension ', seg, ' N' + CALL require(seg > 5.0e4_wp .AND. seg < 2.0e5_wp, 'release:segment-peak') + END SUBROUTINE case_light_cable_release_cap + + SUBROUTINE case_viscoelastic_surge() + LOGICAL :: conv + INTEGER :: es + CHARACTER(512) :: em + CHARACTER(64) :: opts(4) + REAL(wp) :: fair + CALL write_motion('ei0slack_surge.txt', 1, [58.0_wp, 0.0_wp, -14.0_wp], 1, 15.0_wp, 12.0_wp, 12.0_wp, & + 0.1_wp, 48.0_wp) + opts(1) = '0.1 dtM' + opts(2) = '48.0 TMax' + opts(3) = 'ei0slack_surge.txt motionFile' + opts(4) = '3.0e6 kBot' + CALL write_deck('ei0slack_ve.dat', POLY_VE, [700.0_wp, 0.0_wp, -200.0_wp], [58.0_wp, 0.0_wp, -14.0_wp], & + 690.0_wp, 50, 200.0_wp, '-', opts) + CALL CD_Run_Deck_Driver('ei0slack_ve.dat', 'ei0slack_ve', conv, es, em) + CALL require(es == CD_DECKDRV_OK .AND. conv, 've:run '//TRIM(em)) + fair = column_max('ei0slack_ve.out', 2, 2) + WRITE (*, '(A,ES10.3,A)') ' viscoelastic polyester, 15 m surge, dtM 0.1 s: FairTen1 max ', fair, ' N' + CALL require(fair > 1.6e6_wp .AND. fair < 1.9e6_wp, 've:fairlead-peak') + END SUBROUTINE case_viscoelastic_surge + + SUBROUTINE case_run_audit() + LOGICAL :: ok + CHARACTER(64) :: opts(4) + ! the configuration blend of case 1: its spikes are reported once, as a warning + CALL light_cable_deck('ei0slack_audit_cfg.dat', 0.1_wp, 40.0_wp, 'False alpha_force_blend', '-') + CALL run_driver_logged('ei0slack_audit_cfg.dat', 'ei0slack_audit_cfg', 'ei0slack_audit_cfg.log', ok) + CALL require(ok, 'audit:configuration-blend-run') + CALL require(file_contains('ei0slack_audit_cfg.log', 'Warning: line 1: segment '), & + 'audit:configuration-blend-spike-warned') + CALL require(file_contains('ei0slack_audit_cfg.log', 'for a single step'), 'audit:spike-message') + ! the default force blend: no spike warning + CALL light_cable_deck('ei0slack_audit_fb.dat', 0.1_wp, 40.0_wp, '', '-') + CALL run_driver_logged('ei0slack_audit_fb.dat', 'ei0slack_audit_fb', 'ei0slack_audit_fb.log', ok) + CALL require(ok, 'audit:force-blend-run') + CALL require(.NOT. file_contains('ei0slack_audit_fb.log', 'Warning: line'), 'audit:force-blend-no-warning') + CALL require(.NOT. file_contains('ei0slack_audit_fb.log', 'Note: rhoInf'), 'audit:default-rhoinf-no-note') + ! rhoInf above 0.95 + CALL light_cable_deck('ei0slack_audit_rho.dat', 0.1_wp, 12.0_wp, '0.99 rhoInf', '-') + CALL run_driver_logged('ei0slack_audit_rho.dat', 'ei0slack_audit_rho', 'ei0slack_audit_rho.log', ok) + CALL require(ok, 'audit:rhoinf-run') + CALL require(file_contains('ei0slack_audit_rho.log', 'Note: rhoInf = 0.990 leaves almost no numerical'), & + 'audit:rhoinf-note') + ! a 10 m sway at dtM 0.2 s turns the segments by several degrees per step + CALL write_motion('ei0slack_sway.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 2, 10.0_wp, 10.0_wp, 10.0_wp, & + 0.2_wp, 20.0_wp) + opts(1) = '0.2 dtM' + opts(2) = '20.0 TMax' + opts(3) = 'ei0slack_sway.txt motionFile' + opts(4) = '' + CALL write_deck('ei0slack_audit_sway.dat', CABLE, [205.0_wp, 0.0_wp, -80.0_wp], [5.0_wp, 0.0_wp, -14.0_wp], & + 230.0_wp, 115, 80.0_wp, '-', opts) + CALL run_driver_logged('ei0slack_audit_sway.dat', 'ei0slack_audit_sway', 'ei0slack_audit_sway.log', ok) + CALL require(ok, 'audit:sway-run') + CALL require(file_contains('ei0slack_audit_sway.log', 'Note: line 1: a taut segment turned up to'), & + 'audit:segment-turn-note') + CALL require(.NOT. file_contains('ei0slack_audit_sway.log', 'Warning: line'), 'audit:sway-no-warning') + END SUBROUTINE case_run_audit + +END PROGRAM test_ei0_slack_dynamics From 973062eb0a926c497d042a398428795f40c735f8 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 15 Oct 2026 21:11:14 +0900 Subject: [PATCH 02/11] test(dynamics): check the release-cap tangent; tighten the run audit - A probe of CD_Cable_Gen_Alpha_Step (optional probe_q/probe_R/probe_K, used by tests only) returns the residual and free tangent of the force-blended step at a given state without iterating. The new test compares the tangent with a central difference on a three-segment tension-only chain, banded and dense, with all segments taut, with the release cap active and with a segment slack at both states (1.5e-10 relative); removing or flipping the cap's derivative fails it. It also asserts the snap note. - The turn advisory counts a segment as taut only above 1e-3 of the initial line tension, so a nearly slack segment turning freely no longer triggers it; the spike warning needs at least three segments. - The CHANGELOG states that the modified_newton tangent refresh applies to every EI = 0 line, also under False alpha_force_blend, and the junction query documents that a warm re-solve must start from the same committed state. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 9 +- src/CableDyn_Dynamic.f90 | 53 +++++++++- src/CableDyn_Model.f90 | 16 ++- tests/test_ei0_slack_dynamics.f90 | 164 +++++++++++++++++++++++++++++- 4 files changed, 233 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39d61320..460cd4dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -199,10 +199,11 @@ All notable changes to CableDyn are recorded in this file. The format follows up to 6 % more wall time on `EI = 0` dynamic decks (one more force evaluation per step and about 4 % more Newton iterations). `False alpha_force_blend`, which until now applied to finite-EI lines only, selects the former scheme for `EI = 0` lines as well. -- `modified_newton` on tension-only lines rebuilds the tangent when an iterate reduces the - residual by less than a factor four, as the manual states; it had kept the first tangent for - the whole step, which a slow linear contraction could exhaust (30 iterations at the start of - the 5 m heave cells of the L2-2 parity test with the force blend). +- `modified_newton` on `EI = 0` lines (with or without the force blend, so also under + `False alpha_force_blend`) rebuilds the tangent when an iterate reduces the residual by less + than a factor four, as the manual states; it had kept the first tangent for the whole step, + which a slow linear contraction could exhaust (30 iterations at the start of the 5 m heave + cells of the L2-2 parity test with the force blend). - The development environment (`environment.yml`) excludes OpenBLAS 0.3.34, which caused the access violation in the modal analysis tests listed under Known issues for 0.1.1. On AMD Zen 4 and Zen 5 CPUs that expose AVX-512, OpenBLAS 0.3.34 enlarges the GEMM blocking, diff --git a/src/CableDyn_Dynamic.f90 b/src/CableDyn_Dynamic.f90 index a5e5785d..f7324129 100644 --- a/src/CableDyn_Dynamic.f90 +++ b/src/CableDyn_Dynamic.f90 @@ -605,7 +605,7 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on converged, stalled, n_iter, ErrStat, ErrMsg, & load_proc, added_mass_proc, load_force_proc, & load_band_proc, prescribed_q, prescribed_v, prescribed_a, structural_mass, & - workspace, added_mass_band_proc, start_load) + workspace, added_mass_band_proc, start_load, probe_q, probe_R, probe_K) !! One generalized-alpha step: the constant load f_ext plus the optional load, !! banded-load, force-only and added-mass callbacks (hydrodynamics, damping, contact). !! On a singular effective tangent returns CD_DYN_SINGULAR; on a line-search @@ -656,6 +656,14 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on !! committed force there, not one advanced over the step). Absent: the step evaluates the !! force-only callback (or load_proc) at (q, v). Full (3 n_nodes) array. REAL(wp), INTENT(IN), OPTIONAL :: start_load(:) + !! TEST HOOK (unit tests of the tangent; production callers omit it). With probe_q (full + !! 3 n_nodes array, the fixed DOFs at their t_{n+1} values) present, the step returns after + !! its setup without iterating: probe_R is the residual (3 n_nodes) and probe_K the free-free + !! effective tangent (n_free x n_free, free DOFs in ascending order) of the Newton iteration + !! at probe_q, exactly as the iteration assembles them (banded or dense path). All three + !! are passed together; the state outputs are the t_n state, converged = .FALSE. + REAL(wp), INTENT(IN), OPTIONAL :: probe_q(:) + REAL(wp), INTENT(OUT), OPTIONAL :: probe_R(:), probe_K(:, :) INTEGER :: n_dof, n_elem, n_free, bt, kl, ku, ldab INTEGER, POINTER :: free(:), fixed(:), ipiv(:) @@ -1013,6 +1021,11 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on END IF END IF + IF (PRESENT(probe_q)) THEN + CALL probe_tangent() + RETURN + END IF + r0 = CD_ZERO scale = CD_ONE tension_scale = CD_ZERO @@ -1641,6 +1654,44 @@ REAL(wp) FUNCTION free_dot(x) RESULT(r) END DO END FUNCTION free_dot + SUBROUTINE probe_tangent() + !! The residual and free-free effective tangent at probe_q (see probe_q). + INTEGER :: i, j + IF (.NOT. (PRESENT(probe_R) .AND. PRESENT(probe_K))) THEN + CALL fail(ErrStat, ErrMsg, 'probe_q needs probe_R and probe_K') + RETURN + END IF + IF (SIZE(probe_q) /= n_dof .OR. SIZE(probe_R) /= n_dof .OR. SIZE(probe_K, 1) /= n_free .OR. & + SIZE(probe_K, 2) /= n_free) THEN + CALL fail(ErrStat, ErrMsg, 'probe_q, probe_R must have shape (3 n_nodes), probe_K (n_free, n_free)') + RETURN + END IF + IF (direct_banded) THEN + CALL eval_dynamic(probe_q, R, es, em, effbandout=eff_band) + ELSE + CALL eval_dynamic(probe_q, R, es, em, effout=eff) + END IF + IF (es /= 0) THEN + CALL fail_callback(ErrStat, ErrMsg, em, es) + RETURN + END IF + DO i = 1, n_dof + probe_R(i) = R(i) + END DO + probe_K = CD_ZERO + DO j = 1, n_free + IF (direct_banded) THEN + DO i = MAX(1, j - ku), MIN(n_free, j + kl) + probe_K(i, j) = eff_band(kl + ku + 1 + i - j, j) + END DO + ELSE + DO i = 1, n_free + probe_K(i, j) = eff(free(i), free(j)) + END DO + END IF + END DO + END SUBROUTINE probe_tangent + SUBROUTINE form_trial(stp) !! q_trial = qk, then q_trial(free) += stp*dq. REAL(wp), INTENT(IN) :: stp diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index 8e1972b6..2de03dbc 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -3680,7 +3680,10 @@ SUBROUTINE CD_Set_Model_EndQuery(model, request, active, arm_guess, refresh, lev !! converged step then leaves the alpha-level reaction rows of its fixed DOFs and the !! condensed dynamic end tangent (CD_Get_Model_EndQuery). active (one flag per fixed DOF, !! in model%fixed_dofs order) limits the tangent columns to the junction DOFs; arm_guess - !! warm-starts the step from the previous converged solve of the same step. + !! warm-starts the step from the previous converged solve of the same step. arm_guess + !! must be set only for a re-solve of that step from the same committed state (the + !! line rolled back to it): the warm re-solve also reuses the step-start force and load + !! of the force blend computed by the previous call. TYPE(CD_ModelType), INTENT(INOUT) :: model LOGICAL, INTENT(IN) :: request LOGICAL, INTENT(IN), OPTIONAL :: active(:) @@ -4681,6 +4684,11 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) REAL(wp), INTENT(IN) :: time, dt LOGICAL, INTENT(OUT) :: new_spike REAL(wp), PARAMETER :: SPIKE_ISOLATION = 4.0_wp, SPIKE_LINE_FACTOR = 10.0_wp + ! A segment counts as taut for the turn advisory above this fraction of the initial + ! line tension (a nearly slack segment turns freely, its tension error is irrelevant); + ! the spike test needs this many segments (the neighbours share the axial wave). + REAL(wp), PARAMETER :: TURN_TAUT_FRACTION = 1.0e-3_wp + INTEGER, PARAMETER :: SPIKE_MIN_ELEMS = 3 INTEGER :: e, na, nb, istat REAL(wp) :: d(3), ell, strain, u(3), c, line_max, tn LOGICAL :: fresh @@ -4719,7 +4727,9 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) IF (model%audit_n >= 1) THEN ! the turn of a segment taut at both states (a slack segment turns freely and carries ! no tension whose accuracy the turn would measure) - IF (model%audit_now(e) > CD_ZERO .AND. model%audit_t(e, 1) > CD_ZERO) & + IF (model%audit_now(e) > TURN_TAUT_FRACTION*model%audit_floor .AND. & + model%audit_now(e) > CD_ZERO .AND. & + model%audit_t(e, 1) > TURN_TAUT_FRACTION*model%audit_floor .AND. model%audit_t(e, 1) > CD_ZERO) & model%audit_max_turn = MAX(model%audit_max_turn, & ACOS(MAX(-CD_ONE, MIN(CD_ONE, DOT_PRODUCT(u, model%audit_u(:, e)))))* & (180.0_wp/ACOS(-CD_ONE))) @@ -4734,7 +4744,7 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) END DO IF (model%audit_n == 0) model%audit_floor = MAX(CD_ZERO, MAXVAL(model%audit_now)) ! spike test on the previous state, between its two neighbours - IF (model%audit_n >= 2) THEN + IF (model%audit_n >= 2 .AND. model%n_elem >= SPIKE_MIN_ELEMS) THEN line_max = MAX(MAXVAL(model%audit_t(:, 2)), MAXVAL(model%audit_now)) DO e = 1, model%n_elem tn = model%audit_t(e, 1) diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index 07b3119f..3a5edc01 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -15,9 +15,17 @@ PROGRAM test_ei0_slack_dynamics !! 4. The run audit of the driver (stdout of the executable given as the first argument): !! the configuration blend (False alpha_force_blend) of case 1 warns of a non-physical !! tension spike, the force blend does not; rhoInf above 0.95 prints its note; a 10 m - !! sway at dtM 0.2 s prints the segment-turn advisory. + !! sway at dtM 0.2 s prints the segment-turn advisory; the unresolved slack-to-taut + !! snaps of case 1 print the snap note. + !! 5. The Newton tangent of the force-blended step against a central finite difference of its + !! residual (the step's probe_q hook), on a three-segment tension-only chain with one fixed + !! node: all segments taut at t_n and at the trial state (release cap inactive), a segment + !! taut at t_n and deeply slack at the trial state (cap active, its energy-gradient force + !! W_n/(e_n - e_{n+1}) and tangent), and a segment slack at both states; each on the + !! banded and the dense path. The cap's residual is also checked against the closed form. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_DECKDRV_OK + USE CableDyn_Dynamic, ONLY: GenAlphaConfig, CD_CableGenAlphaWorkspace, CD_Cable_Gen_Alpha_Step, CD_DYN_OK IMPLICIT NONE REAL(wp), PARAMETER :: PI = 3.141592653589793238462643383279502884197_wp @@ -29,6 +37,7 @@ PROGRAM test_ei0_slack_dynamics nfail = 0 driver = '' IF (COMMAND_ARGUMENT_COUNT() >= 1) CALL GET_COMMAND_ARGUMENT(1, driver) + CALL case_tangent_consistency() CALL case_light_cable_coarse_step() CALL case_light_cable_release_cap() CALL case_viscoelastic_surge() @@ -237,6 +246,154 @@ SUBROUTINE run_driver_logged(deck, root, log, ok) ok = cs == 0 .AND. ex == 0 END SUBROUTINE run_driver_logged + SUBROUTINE zero_load(q, v, force, jac_q, jac_v, ErrStat, ErrMsg) + !! No dynamic load; selects the dense (load_proc) path of the step. + REAL(wp), INTENT(IN) :: q(:), v(:) + REAL(wp), INTENT(OUT) :: force(:), jac_q(:, :), jac_v(:, :) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + force = 0.0_wp + jac_q = 0.0_wp + jac_v = 0.0_wp + ErrStat = 0 + ErrMsg = '' + END SUBROUTINE zero_load + + SUBROUTINE chain_nodes(dirs, strain, l0, q) + !! Nodes of the chain from the fixed node at the origin: segment e runs along dirs(:, e) + !! with the length l0(e)*(1 + strain(e)). + REAL(wp), INTENT(IN) :: dirs(3, 3), strain(3), l0(3) + REAL(wp), INTENT(OUT) :: q(12) + INTEGER :: e + q(1:3) = 0.0_wp + DO e = 1, 3 + q(3*e + 1:3*e + 3) = q(3*e - 2:3*e) + dirs(:, e)/NORM2(dirs(:, e))*l0(e)*(1.0_wp + strain(e)) + END DO + END SUBROUTINE chain_nodes + + SUBROUTINE blended_force(qn, q1, l0, ea, alpha_f, capped, f) + !! Closed form of the blended internal force (1 - alpha_f) f(q1) + alpha_f f(qn) of the + !! tension-only chain, with the release cap (capped) or without it. + REAL(wp), INTENT(IN) :: qn(12), q1(12), l0(3), ea(3), alpha_f + LOGICAL, INTENT(IN) :: capped + REAL(wp), INTENT(OUT) :: f(12) + INTEGER :: e + REAL(wp) :: dn(3), d1(3), ln, l1, t0, t1, e0, e1, dg, share(3) + f = 0.0_wp + DO e = 1, 3 + dn = qn(3*e + 1:3*e + 3) - qn(3*e - 2:3*e) + d1 = q1(3*e + 1:3*e + 3) - q1(3*e - 2:3*e) + ln = NORM2(dn) + l1 = NORM2(d1) + t0 = MAX(0.0_wp, ea(e)*(ln/l0(e) - 1.0_wp)) + t1 = MAX(0.0_wp, ea(e)*(l1/l0(e) - 1.0_wp)) + e0 = ln - l0(e) + e1 = l1 - l0(e) + dg = alpha_f*t0 + IF (capped .AND. t0 > 0.0_wp .AND. e1 < 0.0_wp) dg = MIN(dg, 0.5_wp*t0*e0/(e0 - e1)) + share = (1.0_wp - alpha_f)*t1*d1/l1 + dg*dn/ln + f(3*e - 2:3*e) = f(3*e - 2:3*e) - share + f(3*e + 1:3*e + 3) = f(3*e + 1:3*e + 3) + share + END DO + END SUBROUTINE blended_force + + SUBROUTINE probe_step(qn, vn, an, q1, l0, ea, rho_a, dense, R, K) + !! Residual and effective tangent of the force-blended step at q1 (the probe_q hook). + REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), q1(12), l0(3), ea(3), rho_a(3) + LOGICAL, INTENT(IN) :: dense + REAL(wp), INTENT(OUT) :: R(12), K(9, 9) + INTEGER :: conn(2, 3), n_iter, es + REAL(wp) :: qo(12), vo(12), ao(12) + LOGICAL :: converged, stalled + TYPE(GenAlphaConfig) :: cfg + TYPE(CD_CableGenAlphaWorkspace) :: work + CHARACTER(120) :: em + conn = RESHAPE([1, 2, 2, 3, 3, 4], [2, 3]) + cfg%rho_inf = 0.4_wp + IF (dense) THEN + CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & + qo, vo, ao, converged, stalled, n_iter, es, em, load_proc=zero_load, & + workspace=work, probe_q=q1, probe_R=R, probe_K=K) + ELSE + CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & + qo, vo, ao, converged, stalled, n_iter, es, em, & + workspace=work, probe_q=q1, probe_R=R, probe_K=K) + END IF + IF (es /= CD_DYN_OK) THEN + WRITE (*, '(A)') 'MISMATCH [tangent:probe '//TRIM(em)//']' + nfail = nfail + 1 + R = 0.0_wp + K = 0.0_wp + END IF + END SUBROUTINE probe_step + + SUBROUTINE tangent_config(label, strain_n, strain_1, expect_cap) + !! One configuration of the three-segment chain (node 1 fixed): segment strains at t_n and + !! at the trial state of the step, t_n at rest but for a small velocity and acceleration. + CHARACTER(*), INTENT(IN) :: label + REAL(wp), INTENT(IN) :: strain_n(3), strain_1(3) + LOGICAL, INTENT(IN) :: expect_cap + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.8e6_wp] + REAL(wp), PARAMETER :: DIRS_N(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & + -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) + REAL(wp), PARAMETER :: DIRS_1(3, 3) = RESHAPE([1.0_wp, 0.27_wp, 0.04_wp, 0.36_wp, 1.0_wp, -0.12_wp, & + -0.12_wp, 0.46_wp, 1.0_wp], [3, 3]) + REAL(wp), PARAMETER :: H = 1.0e-6_wp, ALPHA_F = 0.4_wp/1.4_wp + INTEGER :: p, j, free(9), i + REAL(wp) :: qn(12), vn(12), an(12), q1(12), qp(12), rho_a(3), R(12), Rp(12), Rm(12), K(9, 9), Kfd(9, 9) + REAL(wp) :: Kdump(9, 9), f_cap(12), f_raw(12), scale, err + LOGICAL :: dense + free = [(i + 3, i=1, 9)] + CALL chain_nodes(DIRS_N, strain_n, L0, qn) + CALL chain_nodes(DIRS_1, strain_1, L0, q1) + vn = 0.0_wp + an = 0.0_wp + DO i = 4, 12 + vn(i) = 0.01_wp*SIN(1.7_wp*REAL(i, wp)) + an(i) = 0.02_wp*COS(2.3_wp*REAL(i, wp)) + END DO + ! the closed-form blended force: the residual of a nearly massless chain is the force + rho_a = 1.0e-9_wp + CALL probe_step(qn, 0.0_wp*vn, 0.0_wp*an, q1, L0, EA, rho_a, .FALSE., R, Kdump) + CALL blended_force(qn, q1, L0, EA, ALPHA_F, .TRUE., f_cap) + CALL blended_force(qn, q1, L0, EA, ALPHA_F, .FALSE., f_raw) + scale = MAXVAL(ABS(f_raw)) + CALL require(MAXVAL(ABS(R(4:12) - f_cap(4:12))) < 1.0e-6_wp*scale, 'tangent:'//label//':residual-closed-form') + IF (expect_cap) THEN + CALL require(MAXVAL(ABS(f_cap - f_raw)) > 1.0e-2_wp*scale, 'tangent:'//label//':cap-active') + ELSE + CALL require(MAXVAL(ABS(f_cap - f_raw)) < 1.0e-12_wp*scale, 'tangent:'//label//':cap-inactive') + END IF + ! the tangent against the central difference of the residual, with inertia + rho_a = [2.0_wp, 3.0_wp, 1.5_wp] + DO p = 1, 2 + dense = p == 2 + CALL probe_step(qn, vn, an, q1, L0, EA, rho_a, dense, R, K) + DO j = 1, 9 + qp = q1 + qp(free(j)) = q1(free(j)) + H + CALL probe_step(qn, vn, an, qp, L0, EA, rho_a, dense, Rp, Kdump) + qp(free(j)) = q1(free(j)) - H + CALL probe_step(qn, vn, an, qp, L0, EA, rho_a, dense, Rm, Kdump) + Kfd(:, j) = (Rp(4:12) - Rm(4:12))/(2.0_wp*H) + END DO + scale = MAXVAL(ABS(K)) + err = MAXVAL(ABS(K - Kfd))/scale + WRITE (*, '(A,A,A,L1,A,ES9.2)') ' tangent ', label, ' dense=', dense, ': max |K - K_fd|/max|K| = ', err + CALL require(err < 1.0e-6_wp, 'tangent:'//label//TRIM(MERGE(':dense ', ':banded', dense))//':fd-tangent') + END DO + END SUBROUTINE tangent_config + + SUBROUTINE case_tangent_consistency() + ! (a) all segments taut at t_n and at the trial state: the cap is inactive + CALL tangent_config('taut-taut', [0.010_wp, 0.020_wp, 0.010_wp], [0.020_wp, 0.015_wp, 0.020_wp], .FALSE.) + ! (b) segment 1 taut at t_n and deeply slack at the trial state (release deeper than + ! 0.75 e_n): it carries the energy gradient W_n/(e_n - e_{n+1}) instead of alpha_f T_n + CALL tangent_config('release-cap', [0.010_wp, 0.020_wp, 0.010_wp], [-0.050_wp, 0.015_wp, 0.020_wp], .TRUE.) + ! (c) segment 2 slack at both states + CALL tangent_config('slack-slack', [0.010_wp, -0.020_wp, 0.010_wp], [0.020_wp, -0.030_wp, 0.015_wp], .FALSE.) + END SUBROUTINE case_tangent_consistency + SUBROUTINE case_light_cable_coarse_step() LOGICAL :: conv INTEGER :: es @@ -296,6 +453,11 @@ SUBROUTINE case_run_audit() CALL require(file_contains('ei0slack_audit_cfg.log', 'Warning: line 1: segment '), & 'audit:configuration-blend-spike-warned') CALL require(file_contains('ei0slack_audit_cfg.log', 'for a single step'), 'audit:spike-message') + ! the snaps of the light cable (axial wave crossing a segment ~160 times per step) are noted + CALL require(file_contains('ei0slack_audit_cfg.log', 'went from slack to taut above the initial tension'), & + 'audit:snap-note') + CALL require(file_contains('ei0slack_audit_cfg.log', 'snap-load peaks are not resolved in time'), & + 'audit:snap-note-text') ! the default force blend: no spike warning CALL light_cable_deck('ei0slack_audit_fb.dat', 0.1_wp, 40.0_wp, '', '-') CALL run_driver_logged('ei0slack_audit_fb.dat', 'ei0slack_audit_fb', 'ei0slack_audit_fb.log', ok) From eeb59466b6bb4b54485554a0d71541be0a0d31b4 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Fri, 16 Oct 2026 05:31:33 +0900 Subject: [PATCH 03/11] docs(validation): Bergdahl record on the force-blended EI = 0 step The 30-condition Bergdahl chain record and its refinement study are rerun with the force-blended step: RMSE 1.58 -> 1.59 N, MAPE 3.11 -> 3.12 %, mean bias +0.46 -> +0.45 N, Pearson and Lin unchanged; the spatial and temporal refinement differences fall from 0.49 % and 0.28 % to 0.34 % and 0.22 %, and the T 1.25 s maxima at 0.625 ms and 0.15625 ms move to 71.7 N and 67.9 N. The comparison and refinement summaries, aggregate metrics and provenance hashes are regenerated. The waveform metrics need the article's expData.dat, which was not available, and stay those of the previous executable, as provenance and the README now state. The OpenFAST and FAST.Farm records that use EI = 0 dynamics were rerun with this branch and are unchanged within their recorded figures: linearisation A/B, the FAST.Farm shared-mooring 600 s A/B, the active tension A/B, the settled statics, the coupled chain A/B (1200 s, controller-free), coupled torsion with restart, the Lozon coupled test and the one-hour coupled touchdown run. Signed-off-by: Jae Hoon Seo --- VALIDATION.md | 6 +- validation/experiments/bergdahl/README.md | 13 ++-- .../bergdahl/aggregate_metrics.json | 18 +++--- .../bergdahl/comparison_summary.csv | 60 +++++++++---------- .../experiments/bergdahl/provenance.json | 18 +++--- .../bergdahl/refinement_summary.csv | 4 +- .../bergdahl/refinement_summary.json | 40 ++++++------- 7 files changed, 80 insertions(+), 79 deletions(-) diff --git a/VALIDATION.md b/VALIDATION.md index f448be17..fd48e38c 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -76,7 +76,7 @@ article's methods, are compared in | **L3-6e** | Out-of-plane / 3D whirl response | OrcaFlex 11.6d | 3D curv 0.52%, interior Y env ≤1.0 mm, sag ≤22 mm, tension 0.14/0.17/0.12% | curv <3%, env <5 cm, tension <2–3% | Pass | | **L3-7** | 1-hour VolturnUS-S mooring dynamic | OrcaFlex 11.6d | `FairTen` mean 0.27%, std 0.26%, min/max 0.50/0.43%, Fourier 0.27/1.14% | ≤5% | Pass | | **L3-H** | Holcombe static lazy-wave experiment | measured marker geometry | position RMSE 1.07–1.89% of suspended length; peak marker-curvature error 0.34–5.54% | end-restraint bracket | Pass | -| **L3-B** | Bergdahl chain experiment, 30 orbit conditions | measured upper-end force | RMSE 1.58 N; MAPE 3.11%; Pearson 0.993; Lin concordance 0.989 | full published matrix | Pass | +| **L3-B** | Bergdahl chain experiment, 30 orbit conditions | measured upper-end force | RMSE 1.59 N; MAPE 3.12%; Pearson 0.993; Lin concordance 0.989 | full published matrix | Pass | | **L-fig** | Along-arc curvature overlay (CableDyn / OrcaFlex / MoorDyn-F ±4×) | 3-code committed record | CableDyn peak 0.11% from OrcaFlex | <0.5% | Pass | | **L4-1** | Coupled platform + mooring | synthetic reference | bit-for-bit | — | Pass | | **L4-1b** | VolturnUS-S coupled platform + power cable | OpenFAST v5.0.0 (CompMooring 5 vs 3) | platform DOFs <0.6% (3-seed DLC-1.1); fairlead and anchor <0.001% static | <3% platform | Pass | @@ -288,10 +288,10 @@ scripts, results, and source provenance are in - **L3-B Bergdahl dynamic chain test** ([Bergdahl et al., 2016](https://cabledyn.readthedocs.io/en/latest/references.html#ref-bergdahl2016)): over the full 30-condition period-radius matrix, cycle-maximum upper-end force - has RMSE 1.58 N, mean absolute percentage error 3.11%, Pearson correlation + has RMSE 1.59 N, mean absolute percentage error 3.12%, Pearson correlation 0.993, and Lin concordance 0.989. Two phase-averaged measured histories have waveform RMSEs of 5.95% and 2.54% of their force ranges. Halving the mesh length - and the time step changes the mean cycle maximum by at most 0.49% and 0.28%. The + and the time step changes the mean cycle maximum by at most 0.34% and 0.22%. The 0.3125 ms step resolves the segment axial modes that the snap loads excite; at 1.25 ms the maxima are 2–15% higher and vary from cycle to cycle. diff --git a/validation/experiments/bergdahl/README.md b/validation/experiments/bergdahl/README.md index 0354bdf4..dd657eb7 100644 --- a/validation/experiments/bergdahl/README.md +++ b/validation/experiments/bergdahl/README.md @@ -70,12 +70,13 @@ committed summary file (`sha256sum`, or `Get-FileHash` in PowerShell). `comparison_summary.csv`, `aggregate_metrics.json` and `provenance.json` hold the compact results and the checksum of the executable used. The calculated force is `FairTen1`, the force -at the upper line end. Across the 30 conditions, the cycle maxima have an RMSE of 1.58 N, a -mean absolute percentage error of 3.11%, a mean bias of +0.46 N, a Pearson correlation of 0.993 +at the upper line end. Across the 30 conditions, the cycle maxima have an RMSE of 1.59 N, a +mean absolute percentage error of 3.12%, a mean bias of +0.45 N, a Pearson correlation of 0.993 and a Lin concordance coefficient of 0.989. For the two waveform conditions, halving the nominal -element length and the time step changes the mean cycle maximum by no more than 0.49% and -0.28%, respectively, and the phase-averaged force histories have RMSEs of 5.95% and 2.54% of -the measured force range. The waveform CSVs carry the measured phase averages computed from the +element length and the time step changes the mean cycle maximum by no more than 0.34% and +0.22%, respectively, and the phase-averaged force histories have RMSEs of 5.95% and 2.54% of +the measured force range (computed with the executable of the 2026-10-09 record; see +`provenance.json`). The waveform CSVs carry the measured phase averages computed from the supplement's `expData.dat`. ## Time step @@ -85,7 +86,7 @@ modes up to about 2c/l ≈ 3500 rad/s. The force maxima are snap loads, which co step only once the step resolves these modes, roughly dtM ≲ l/(2c) ≈ 0.29 ms (see "Snap loads on slack lines" in the [modelling guide](https://cabledyn.readthedocs.io/en/latest/modeling.html)). At a coarser step the maxima do not settle: at the T = 1.25 s, 0.20 m condition they are -72.5 N at 0.625 ms, against 68.0 N at 0.3125 ms and 67.8 N at 0.15625 ms. Coarse steps also +71.7 N at 0.625 ms, against 68.0 N at 0.3125 ms and 67.9 N at 0.15625 ms. Coarse steps also leave the maxima sensitive to the Newton tolerance and to small changes in the solver's iteration path. With a 1.25 ms step and a relative tolerance of 1e-5, the five cycle maxima of a condition have standard deviations of up to 1.6 N, their means are 2–15% above the converged diff --git a/validation/experiments/bergdahl/aggregate_metrics.json b/validation/experiments/bergdahl/aggregate_metrics.json index 56f98784..9bd38378 100644 --- a/validation/experiments/bergdahl/aggregate_metrics.json +++ b/validation/experiments/bergdahl/aggregate_metrics.json @@ -1,12 +1,12 @@ { "completed_cases": 30, - "mean_bias_N": 0.4581405133333342, - "mean_bias_percent_of_measured": 1.5799650380013595, - "mae_N": 1.3216888866666683, - "mape_percent": 3.114363588294243, - "rmse_N": 1.5803063158422797, - "maximum_absolute_error_percent": 7.720632768361595, - "pearson_correlation": 0.993312061701205, - "correlation_r_squared": 0.9866688519210985, - "lin_concordance_correlation": 0.9891670912995935 + "mean_bias_N": 0.45431785333333463, + "mean_bias_percent_of_measured": 1.5717214764340497, + "mae_N": 1.324980640000002, + "mape_percent": 3.120217363988557, + "rmse_N": 1.586603785062259, + "maximum_absolute_error_percent": 7.717337853107351, + "pearson_correlation": 0.9932016283673366, + "correlation_r_squared": 0.986449474591529, + "lin_concordance_correlation": 0.989081600333658 } diff --git a/validation/experiments/bergdahl/comparison_summary.csv b/validation/experiments/bergdahl/comparison_summary.csv index 2aa54285..36b7333c 100644 --- a/validation/experiments/bergdahl/comparison_summary.csv +++ b/validation/experiments/bergdahl/comparison_summary.csv @@ -1,31 +1,31 @@ case,period_s,radius_m,measured_maximum_N,dt_s,number_of_elements,element_length_m,total_cycles,ramp_cycles,rho_inf,published_ground_modulus_Pa_per_m,published_ground_damping_ratio,published_contact_diameter_m,equivalent_volume_diameter_m,kbot_Pa_per_m,cbot_Pa_s_per_m,contact_coefficients_overridden,ba_N_s,friction_mu,solver_relative_tolerance,analysis_start_s,deck_sha256,motion_sha256,samples_analysed,predicted_mean_N,predicted_minimum_N,predicted_absolute_maximum_N,predicted_mean_cycle_maximum_N,predicted_cycle_maximum_std_N,predicted_range_N,maximum_error_N,maximum_error_percent -bergdahl_T1p25_R0p075_h0p200_dt0p0003,1.25,0.075,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,9a15c83cd584db2d41b7425c2464d45b951e064312e22d2bd5f2bdc5d62c78be,200c532b956836233ff1706360190a636fa05d658c6e4dc8b0eeda6ac38665d7,20001,22.757913497956103,0.91928107,41.741344,41.5666928,0.15081908732385152,40.82206293,-0.9333072000000016,-2.1960169411764743 -bergdahl_T1p25_R0p100_h0p200_dt0p0003,1.25,0.1,46.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,35f623bef1aa930eca217ccf056b72d26a2a3003af68a8efbce83fadb8921146,deb435829efdb15fd5c8f0b8db9dd0c83cfa10aab269a24dcd1fae02d0156547,20001,23.42198186325699,0.080218397,47.574447,47.3751466,0.13386717413279436,47.494228602999996,0.5751466000000036,1.2289457264957342 -bergdahl_T1p25_R0p125_h0p200_dt0p0003,1.25,0.125,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,3db8b8c41f6fd9b122135c92bb6311db9c79ed022cea0e9341c82e382ea2d8c4,350bd646ce87b6afcfec808548ada2624a25186efabbcd00dc72864f1b20fbf0,20001,24.47982608920114,0.080218397,53.386241,53.1851858,0.12232783660598176,53.306022602999995,-0.9148142000000021,-1.6909689463955677 -bergdahl_T1p25_R0p150_h0p200_dt0p0003,1.25,0.15,60.4,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,6db3b6e1e3a34c320567820a2b227905aea57c8940efdebb14afb0b1a4bb6b8b,a8a5c083de018445740094b398496386e405db1c896d75c8e01c6acd0c985d3c,20001,25.727289597256586,0.080218397,58.143098,58.109511600000005,0.03453248117787073,58.062879603,-2.290488399999994,-3.7921993377483343 -bergdahl_T1p25_R0p200_h0p200_dt0p0003,1.25,0.2,70.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,79b6ad075892ffbad6f63343cb55454aa2380387002b23c95dd63ec99ad89757,a3f02e630a2f80e08b9367d4362b4bb09c37f3fb5935ecdc3f548d38fb0f22da,20001,28.52542219594885,0.042117789,68.112197,67.993336,0.09316263462086093,68.07007921099999,-2.306663999999998,-3.281172119487906 -bergdahl_T1p50_R0p075_h0p200_dt0p0003,1.5,0.075,41.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,c84e640a68f2f9a806a08b3afb2b220a49025cf6cf3f75a4439df1e5007eb536,c93b19181604134c73d29a1e343dadd769c4cf5510d2214a929e96ad98bab6d7,24001,22.593075607858005,2.2231129,39.931283,39.884565599999995,0.03634136753480782,37.708170100000004,-1.1154344000000052,-2.720571707317086 -bergdahl_T1p50_R0p100_h0p200_dt0p0003,1.5,0.1,45.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,89df9b353f05c33ad5b47160fb17b0ef2fb9aaaddc5f9c1bb6faa1aa651345b0,08aff391d95ba06a6e36de8101f986e34725034f826dcb56c079f6de0e8c63db,24001,23.09723013602354,0.080218397,46.281435,46.079744999999996,0.18946747132291658,46.201216603,0.7797449999999984,1.7212913907284733 -bergdahl_T1p50_R0p125_h0p200_dt0p0003,1.5,0.125,51.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,b08f6f7411a4c6bf6c51479886cdd5e5ec05048995f7df56b314f38602a6ac68,8da6cf5077f315d1445f9fa86597eb0c45f4a47ea564b2a14f53dbfcb12d70c0,24001,24.025272591529433,0.080218397,51.735435,51.464737400000004,0.1866767005582109,51.655216603,-0.035262599999995814,-0.06847106796115691 -bergdahl_T1p50_R0p150_h0p200_dt0p0003,1.5,0.15,59.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4adab994765aca18aa52757ef82e30d15cd9ad09a908cf44bae00cd890218bcb,d399fa50a0dcd35fa3a55d5e8cfddae96652df14bc08b3707dae3766fb725531,24001,25.22633455551252,0.080218397,56.478759,56.4289086,0.059061602122699515,56.398540602999994,-2.5710914000000002,-4.357782033898306 -bergdahl_T1p50_R0p200_h0p200_dt0p0003,1.5,0.2,68.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4087f2ecb4c0dc5d8d29440397162646e11ea24585c1bff5229079b1c9e4bda0,80096d02b10970eabc9320273215f978a016c2ea4add6012ca7ecd21c68c2851,24001,27.948856067797383,0.049679647,67.019091,66.9282054,0.06287931010515363,66.969411353,-1.071794600000004,-1.5761685294117707 -bergdahl_T2p00_R0p075_h0p200_dt0p0003,2.0,0.075,36.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,788d6c963eaccba31443ed29b33d8dd37dcde8e5945ac02f4c63728f4bcede11,06b2ee6b12d716e9c4757c91d6e330d7985b118f411d8673f0e3be1317cd10b7,32001,22.50804684523296,7.0649794,36.03519,36.0282418,0.006254782426273169,28.9702106,0.028241800000003536,0.07844944444445427 -bergdahl_T2p00_R0p100_h0p200_dt0p0003,2.0,0.1,39.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,66b4e4070897810cc0c2db78a9da33350dbf480ff297311b5ade518c36518e72,7cfeecfbc7673140d72af2c7a475ead3ce77736e54552c663e5df1b72cf6afdd,32001,22.72296470571639,0.17566248,41.917193,41.8896122,0.020646613613374106,41.74153052,2.389612200000002,6.0496511392405115 -bergdahl_T2p00_R0p125_h0p200_dt0p0003,2.0,0.125,47.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,11d53518b7f6d58facee9b5d62e582bbdc94a289098bbf6d3ac61defaf82c7e8,b2a8c64acddab4c852169269cca4e60bb258479eda2a6495d094c99f39cf76d3,32001,23.436324952588418,0.080218397,47.558421,47.498478,0.04779005098867373,47.478202603,-0.0015220000000013556,-0.0032042105263186435 -bergdahl_T2p00_R0p150_h0p200_dt0p0003,2.0,0.15,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,d423c8a5aeb69a63655c03060d6f2b45742420795e5d8004b716da8908cd126d,71ae7988f4e286c2a5c4f8b21cbdf9cf0c5138bb68f74c9e2e7083d2bd8a9c39,32001,24.446300337184304,0.080218397,52.9366,52.902586799999995,0.04157151256208951,52.856381602999996,-1.1974132000000068,-2.213333086876168 -bergdahl_T2p00_R0p200_h0p200_dt0p0003,2.0,0.2,62.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,a640e7f76fa6bb1ae074d28e43f3958084d3e75bf7d9d368fd414b9849f14e25,5211abe84187c30899ee1759f47f60ddd307427b5aaa577a132c9269b8d0b0f1,32001,26.993355555060432,0.068192523,63.169503,63.11926520000001,0.045996168396943246,63.101310477,0.8192652000000109,1.315032423756037 -bergdahl_T2p50_R0p075_h0p200_dt0p0003,2.5,0.075,31.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,87645fbd5487107bb7b4710a95d6eebc3da8d0309ba5de053694f17590581d35,b3a5ceda599c59b5516c7f95d48a53c5a9082ba4573eb87d0f4ebdb816c9918d,40001,22.57345595815105,10.514789,33.064567,33.06116960000001,0.0036382951089751693,22.549777999999996,1.9611696000000052,6.306011575562717 -bergdahl_T2p50_R0p100_h0p200_dt0p0003,2.5,0.1,35.4,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,9898a74d88ffedf8e9585d680862587b7382f129aa1cbf90dcec137bcd6f3f7d,69865be17566563fed41360b3b26602dd059e960ddf492a02bb8474239fe8617,40001,22.64221530362491,4.3028273,38.141965,38.133104,0.007708355790958404,33.8391377,2.7331040000000044,7.720632768361594 -bergdahl_T2p50_R0p125_h0p200_dt0p0003,2.5,0.125,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6c1845719020a1b825f0878b9722de394658a468d2576549e8ac44e3854c1943,4606eb29aac566ef9436af19d60063e21915d8e535ee1a29cb8164bf36832ac1,40001,23.063226984025796,0.080218397,43.659712,43.6057238,0.03343434428398325,43.579493602999996,1.1057237999999998,2.601703058823529 -bergdahl_T2p50_R0p150_h0p200_dt0p0003,2.5,0.15,49.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6ebf7ca718808043f57a87bb177c1d5a25f86e13ebcf6a1129e7ef8d9f73fe77,f96b5df08fdfbafbf1a73f3a476ab4bd83f366340e729a555fff4abfbdcb128f,40001,23.947584062742383,0.080218397,48.958646,48.9347036,0.02767322203502985,48.878427603,-0.06529640000000114,-0.1332579591836758 -bergdahl_T2p50_R0p200_h0p200_dt0p0003,2.5,0.2,57.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,2d0261069c6689ebe857731f237f70a2883a5980112b9f277246377d0230c9cf,da167b278b0560de961de703952a1e36a22f7e4ff637e7a8453f90eeada7281d,40001,26.2713484617819,0.074387183,59.590532,59.52854119999999,0.03768002434580043,59.516144817000004,2.228541199999995,3.8892516579406546 -bergdahl_T3p00_R0p075_h0p200_dt0p0003,3.0,0.075,29.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,302324da0849af35df6392af12635f08555aba2a6e69de515e79fb9705bbab04,d9ad6838f7015b0e7d32a70eb86534166089bd80a096e0a2989cf5cef41dbd05,48001,22.653321671548508,13.201922,31.05484,31.0521838,0.0022818153299513423,17.852918,1.5521838000000017,5.261640000000006 -bergdahl_T3p00_R0p100_h0p200_dt0p0003,3.0,0.1,33.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,eb00be510264d4ead391c24cc9a240da7dec29658c898bbc9b481e894d73bd07,8a90048a3f3bab35a054f704a11342f580f746ec87972031da7d49d02217f6cc,48001,22.680061588904394,7.8365592,35.578014,35.5748904,0.0028894399630385627,27.741454800000003,2.4748903999999996,7.477010271903322 -bergdahl_T3p00_R0p125_h0p200_dt0p0003,3.0,0.125,39.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,ced08cb707dbc660e07d97949e7422b7326d083dc99d18a5ae84378a21fc84ef,bde9b1a9923f0d4e4c3158d7df37ba31838710c39d672bb8241ec6cab8e55722,48001,22.90067164456157,1.1656807,40.395291,40.388267400000004,0.004843008496790544,39.2296103,1.0882674000000065,2.769128244274826 -bergdahl_T3p00_R0p150_h0p200_dt0p0003,3.0,0.15,45.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,47aa51d93408ca527f8a8ac85613ab9b0f7a4f9a2459ec9bca396e62de32dfb2,402811dda2da329a55b8e7816c5134f5aecb0a59bdbefc6b13eeb232cb4fb15b,48001,23.53138338057414,0.080218397,45.358608,45.3498628,0.011396939005714707,45.278389602999994,-0.45013720000000035,-0.9828323144104811 -bergdahl_T3p00_R0p200_h0p200_dt0p0003,3.0,0.2,54.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,96e1dda1aa324b9669d601026fb6ad0831cadaf6dcc32492235ee05cd7d7d3b5,f03dc52610fa2de64c497f78321355d34ea6fad14109005aafde665c707b0e35,48001,25.69230404263532,0.080218397,55.69477,55.679851400000004,0.01399851811085599,55.614551602999995,1.679851400000004,3.1108359259259335 -bergdahl_T3p50_R0p075_h0p200_dt0p0003,3.5,0.075,27.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,235d4acffaff2133c0833b4dde65d4f746a980e483bf1a184fbda1789d26d32b,832f1074f37014ce95341e0baea190a6c995ca381de72b85ef1d8e4ffbecc7ed,56001,22.741865147425937,15.169385,29.867323,29.866587799999998,0.0007635055337064214,14.697937999999999,2.066587799999997,7.433769064748191 -bergdahl_T3p50_R0p100_h0p200_dt0p0003,3.5,0.1,31.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,dfd71b038e2016e837ca8d2976ff4dabbdbc579d663b3e4d6cc02c867bde1e35,d70c6750c97b8271d7f0604166e62a41a1e57b583932f16598c4ebe75de573aa,56001,22.765262908930197,10.483049,33.720301,33.7186382,0.0012345295460219937,23.237251999999998,2.218638200000001,7.043295873015876 -bergdahl_T3p50_R0p125_h0p200_dt0p0003,3.5,0.125,37.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,0c91662ea48cc2fa12539fc97fc123c1b3dff743ead2bace86bdf2ac3ac53997,2fe336ce9ff36b4af7c8d698c3e68f372b762b8127ecdda730fb5e07c46f68ea,56001,22.890656535624366,5.6774456,38.03026,38.027284200000004,0.002001978446437134,32.3528144,0.527284200000004,1.4060912000000105 -bergdahl_T3p50_R0p150_h0p200_dt0p0003,3.5,0.15,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,f2a0f779cd4f722e64114a1d24d297d7b71ce71b3234ebf98d0ee02349768a0e,fd49ce4e3dce2c1d034faeedf52a60633dfb26a3a6cfbc935c66a29ea7297d3c,56001,23.269808068811987,0.37056307,42.730059,42.7063968,0.029921091794918826,42.359495929999994,0.20639680000000027,0.48563952941176536 -bergdahl_T3p50_R0p200_h0p200_dt0p0003,3.5,0.2,50.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,7bdf322dbff579b866971969ad11b066c3aa1da0fb8bd19bf7f64c3e05b85e00,de9d5e2bf50d61ca47a1fb69f0cfabab511139a97cff5ccdf79fc257b156f438,56001,25.19107659317866,0.080218397,52.374052,52.3627916,0.009677467375299544,52.293833602999996,2.2627916,4.516550099800399 +bergdahl_T1p25_R0p075_h0p200_dt0p0003,1.25,0.075,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,9a15c83cd584db2d41b7425c2464d45b951e064312e22d2bd5f2bdc5d62c78be,200c532b956836233ff1706360190a636fa05d658c6e4dc8b0eeda6ac38665d7,20001,22.753548841969902,0.65523395,41.563628,41.5318412,0.029896707330408633,40.90839405,-0.9681587999999977,-2.2780207058823474 +bergdahl_T1p25_R0p100_h0p200_dt0p0003,1.25,0.1,46.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,35f623bef1aa930eca217ccf056b72d26a2a3003af68a8efbce83fadb8921146,deb435829efdb15fd5c8f0b8db9dd0c83cfa10aab269a24dcd1fae02d0156547,20001,23.427066009431577,0.080218397,47.538726,47.2896736,0.1544434092938245,47.458507602999994,0.48967360000000326,1.046311111111118 +bergdahl_T1p25_R0p125_h0p200_dt0p0003,1.25,0.125,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,3db8b8c41f6fd9b122135c92bb6311db9c79ed022cea0e9341c82e382ea2d8c4,350bd646ce87b6afcfec808548ada2624a25186efabbcd00dc72864f1b20fbf0,20001,24.47563511563497,0.080218397,53.344149,53.1288234,0.18391136327399862,53.263930603,-0.9711765999999997,-1.7951508317929754 +bergdahl_T1p25_R0p150_h0p200_dt0p0003,1.25,0.15,60.4,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,6db3b6e1e3a34c320567820a2b227905aea57c8940efdebb14afb0b1a4bb6b8b,a8a5c083de018445740094b398496386e405db1c896d75c8e01c6acd0c985d3c,20001,25.723506170797062,0.080218397,58.264,58.094311600000005,0.11682515060893356,58.183781603,-2.305688399999994,-3.8173649006622417 +bergdahl_T1p25_R0p200_h0p200_dt0p0003,1.25,0.2,70.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,79b6ad075892ffbad6f63343cb55454aa2380387002b23c95dd63ec99ad89757,a3f02e630a2f80e08b9367d4362b4bb09c37f3fb5935ecdc3f548d38fb0f22da,20001,28.5282878239816,0.045982541,68.246358,67.99751539999998,0.1462192030234076,68.200375459,-2.302484600000014,-3.275227027027047 +bergdahl_T1p50_R0p075_h0p200_dt0p0003,1.5,0.075,41.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,c84e640a68f2f9a806a08b3afb2b220a49025cf6cf3f75a4439df1e5007eb536,c93b19181604134c73d29a1e343dadd769c4cf5510d2214a929e96ad98bab6d7,24001,22.59428037364693,2.3293422,39.90029,39.868237799999996,0.027398937994015583,37.5709478,-1.1317622000000043,-2.7603956097561078 +bergdahl_T1p50_R0p100_h0p200_dt0p0003,1.5,0.1,45.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,89df9b353f05c33ad5b47160fb17b0ef2fb9aaaddc5f9c1bb6faa1aa651345b0,08aff391d95ba06a6e36de8101f986e34725034f826dcb56c079f6de0e8c63db,24001,23.102780847709887,0.080218397,46.098397,45.9691302,0.11415026870621027,46.018178602999996,0.669130200000005,1.4771086092715344 +bergdahl_T1p50_R0p125_h0p200_dt0p0003,1.5,0.125,51.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,b08f6f7411a4c6bf6c51479886cdd5e5ec05048995f7df56b314f38602a6ac68,8da6cf5077f315d1445f9fa86597eb0c45f4a47ea564b2a14f53dbfcb12d70c0,24001,24.043843764549646,0.080218397,51.738164,51.52859980000001,0.16426609310871187,51.657945602999995,0.028599800000009168,0.055533592233027514 +bergdahl_T1p50_R0p150_h0p200_dt0p0003,1.5,0.15,59.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4adab994765aca18aa52757ef82e30d15cd9ad09a908cf44bae00cd890218bcb,d399fa50a0dcd35fa3a55d5e8cfddae96652df14bc08b3707dae3766fb725531,24001,25.225714619936713,0.080218397,56.479058,56.377095399999995,0.07503180283253301,56.398839603,-2.6229046000000054,-4.445601016949161 +bergdahl_T1p50_R0p200_h0p200_dt0p0003,1.5,0.2,68.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4087f2ecb4c0dc5d8d29440397162646e11ea24585c1bff5229079b1c9e4bda0,80096d02b10970eabc9320273215f978a016c2ea4add6012ca7ecd21c68c2851,24001,27.954959161516477,0.049427531,67.012399,66.9325532,0.05935785171483416,66.962971469,-1.067446799999999,-1.5697747058823515 +bergdahl_T2p00_R0p075_h0p200_dt0p0003,2.0,0.075,36.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,788d6c963eaccba31443ed29b33d8dd37dcde8e5945ac02f4c63728f4bcede11,06b2ee6b12d716e9c4757c91d6e330d7985b118f411d8673f0e3be1317cd10b7,32001,22.50825846114497,7.1153458,36.047917,36.035346999999994,0.011414748069932139,28.932571199999998,0.035346999999994466,0.09818611111109574 +bergdahl_T2p00_R0p100_h0p200_dt0p0003,2.0,0.1,39.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,66b4e4070897810cc0c2db78a9da33350dbf480ff297311b5ade518c36518e72,7cfeecfbc7673140d72af2c7a475ead3ce77736e54552c663e5df1b72cf6afdd,32001,22.72275428235805,0.28851596,41.963062,41.917736000000005,0.033367880941108825,41.67454604,2.417736000000005,6.120850632911405 +bergdahl_T2p00_R0p125_h0p200_dt0p0003,2.0,0.125,47.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,11d53518b7f6d58facee9b5d62e582bbdc94a289098bbf6d3ac61defaf82c7e8,b2a8c64acddab4c852169269cca4e60bb258479eda2a6495d094c99f39cf76d3,32001,23.437068625304114,0.080218397,47.617533,47.55391720000001,0.07060360080902325,47.537314603,0.05391720000000788,0.1135098947368587 +bergdahl_T2p00_R0p150_h0p200_dt0p0003,2.0,0.15,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,d423c8a5aeb69a63655c03060d6f2b45742420795e5d8004b716da8908cd126d,71ae7988f4e286c2a5c4f8b21cbdf9cf0c5138bb68f74c9e2e7083d2bd8a9c39,32001,24.446372957588075,0.080218397,52.949233,52.9239464,0.018082844212125703,52.869014603,-1.176053600000003,-2.173851386321632 +bergdahl_T2p00_R0p200_h0p200_dt0p0003,2.0,0.2,62.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,a640e7f76fa6bb1ae074d28e43f3958084d3e75bf7d9d368fd414b9849f14e25,5211abe84187c30899ee1759f47f60ddd307427b5aaa577a132c9269b8d0b0f1,32001,26.99762886311297,0.067875028,63.186422,63.12483160000001,0.04305179175481503,63.118546972,0.8248316000000102,1.3239672552167099 +bergdahl_T2p50_R0p075_h0p200_dt0p0003,2.5,0.075,31.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,87645fbd5487107bb7b4710a95d6eebc3da8d0309ba5de053694f17590581d35,b3a5ceda599c59b5516c7f95d48a53c5a9082ba4573eb87d0f4ebdb816c9918d,40001,22.573128677483066,10.591124,33.062585,33.0596916,0.003054553044227603,22.471460999999998,1.9596915999999993,6.301259163987136 +bergdahl_T2p50_R0p100_h0p200_dt0p0003,2.5,0.1,35.4,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,9898a74d88ffedf8e9585d680862587b7382f129aa1cbf90dcec137bcd6f3f7d,69865be17566563fed41360b3b26602dd059e960ddf492a02bb8474239fe8617,40001,22.64237321955451,4.7312149,38.136158,38.1319376,0.002738401960999871,33.404943100000004,2.731937600000002,7.7173378531073515 +bergdahl_T2p50_R0p125_h0p200_dt0p0003,2.5,0.125,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6c1845719020a1b825f0878b9722de394658a468d2576549e8ac44e3854c1943,4606eb29aac566ef9436af19d60063e21915d8e535ee1a29cb8164bf36832ac1,40001,23.06492558125747,0.11575031,43.610903,43.5952714,0.015263411391298226,43.49515269,1.0952714000000014,2.5771091764705916 +bergdahl_T2p50_R0p150_h0p200_dt0p0003,2.5,0.15,49.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6ebf7ca718808043f57a87bb177c1d5a25f86e13ebcf6a1129e7ef8d9f73fe77,f96b5df08fdfbafbf1a73f3a476ab4bd83f366340e729a555fff4abfbdcb128f,40001,23.952926937344316,0.080218397,48.932963,48.924259400000004,0.012833009947006856,48.852744603,-0.07574059999999605,-0.15457265306121643 +bergdahl_T2p50_R0p200_h0p200_dt0p0003,2.5,0.2,57.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,2d0261069c6689ebe857731f237f70a2883a5980112b9f277246377d0230c9cf,da167b278b0560de961de703952a1e36a22f7e4ff637e7a8453f90eeada7281d,40001,26.269954041936774,0.074724364,59.624768,59.571667000000005,0.04028960597970727,59.550043636000005,2.271667000000008,3.9645148342059477 +bergdahl_T3p00_R0p075_h0p200_dt0p0003,3.0,0.075,29.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,302324da0849af35df6392af12635f08555aba2a6e69de515e79fb9705bbab04,d9ad6838f7015b0e7d32a70eb86534166089bd80a096e0a2989cf5cef41dbd05,48001,22.653205223224518,13.239237,31.054133,31.053350599999998,0.0007923962392643522,17.814896,1.5533505999999981,5.265595254237282 +bergdahl_T3p00_R0p100_h0p200_dt0p0003,3.0,0.1,33.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,eb00be510264d4ead391c24cc9a240da7dec29658c898bbc9b481e894d73bd07,8a90048a3f3bab35a054f704a11342f580f746ec87972031da7d49d02217f6cc,48001,22.68028505046978,7.8264702,35.57996,35.577183000000005,0.0018532568629307379,27.7534898,2.4771830000000037,7.483936555891249 +bergdahl_T3p00_R0p125_h0p200_dt0p0003,3.0,0.125,39.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,ced08cb707dbc660e07d97949e7422b7326d083dc99d18a5ae84378a21fc84ef,bde9b1a9923f0d4e4c3158d7df37ba31838710c39d672bb8241ec6cab8e55722,48001,22.899780043517847,1.4983751,40.405212,40.3947704,0.008521936651957626,38.9068369,1.0947704000000016,2.785675318066162 +bergdahl_T3p00_R0p150_h0p200_dt0p0003,3.0,0.15,45.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,47aa51d93408ca527f8a8ac85613ab9b0f7a4f9a2459ec9bca396e62de32dfb2,402811dda2da329a55b8e7816c5134f5aecb0a59bdbefc6b13eeb232cb4fb15b,48001,23.530892854493427,0.080218397,45.381435,45.3614744,0.014002251561802683,45.301216603,-0.4385255999999984,-0.9574794759825294 +bergdahl_T3p00_R0p200_h0p200_dt0p0003,3.0,0.2,54.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,96e1dda1aa324b9669d601026fb6ad0831cadaf6dcc32492235ee05cd7d7d3b5,f03dc52610fa2de64c497f78321355d34ea6fad14109005aafde665c707b0e35,48001,25.691017014398327,0.080218397,55.718632,55.6951518,0.014706974831691614,55.638413603,1.6951517999999979,3.139169999999996 +bergdahl_T3p50_R0p075_h0p200_dt0p0003,3.5,0.075,27.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,235d4acffaff2133c0833b4dde65d4f746a980e483bf1a184fbda1789d26d32b,832f1074f37014ce95341e0baea190a6c995ca381de72b85ef1d8e4ffbecc7ed,56001,22.741663554740096,15.199221,29.866848,29.8664992,0.0004117046271295802,14.667627000000001,2.066499199999999,7.433450359712226 +bergdahl_T3p50_R0p100_h0p200_dt0p0003,3.5,0.1,31.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,dfd71b038e2016e837ca8d2976ff4dabbdbc579d663b3e4d6cc02c867bde1e35,d70c6750c97b8271d7f0604166e62a41a1e57b583932f16598c4ebe75de573aa,56001,22.765204520883554,10.515801,33.721231,33.7197632,0.001419329313444277,23.205430000000003,2.2197632000000027,7.0468673015873105 +bergdahl_T3p50_R0p125_h0p200_dt0p0003,3.5,0.125,37.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,0c91662ea48cc2fa12539fc97fc123c1b3dff743ead2bace86bdf2ac3ac53997,2fe336ce9ff36b4af7c8d698c3e68f372b762b8127ecdda730fb5e07c46f68ea,56001,22.890783096641133,5.7432455,38.029771,38.027166,0.002623257802807864,32.286525499999996,0.5271660000000011,1.405776000000003 +bergdahl_T3p50_R0p150_h0p200_dt0p0003,3.5,0.15,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,f2a0f779cd4f722e64114a1d24d297d7b71ce71b3234ebf98d0ee02349768a0e,fd49ce4e3dce2c1d034faeedf52a60633dfb26a3a6cfbc935c66a29ea7297d3c,56001,23.269789772909412,0.58797798,42.746807,42.7163838,0.019009090606862972,42.15882902,0.21638380000000268,0.5091383529411828 +bergdahl_T3p50_R0p200_h0p200_dt0p0003,3.5,0.2,50.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,7bdf322dbff579b866971969ad11b066c3aa1da0fb8bd19bf7f64c3e05b85e00,de9d5e2bf50d61ca47a1fb69f0cfabab511139a97cff5ccdf79fc257b156f438,56001,25.188428386480563,0.080218397,52.369871,52.3614064,0.008945547372856164,52.289652603,2.2614063999999985,4.513785229540915 diff --git a/validation/experiments/bergdahl/provenance.json b/validation/experiments/bergdahl/provenance.json index 1e1fb647..148b8ee1 100644 --- a/validation/experiments/bergdahl/provenance.json +++ b/validation/experiments/bergdahl/provenance.json @@ -1,9 +1,9 @@ { "CableDyn_release": "v0.1.1", - "validation_date": "2026-10-09", + "validation_date": "2026-10-16", "executable_name": "cabledyn.exe", - "executable_sha256": "71090e2e28c9e1d99c5180d05a395ebcc891a77cc5294d315a57c691904745ac", - "compiler": "GNU Fortran 15.2.0", + "executable_sha256": "bb64e4ebe13a77ead7c73cd51f1c29e5764f0acc78c7dc644148032e561f0c80", + "compiler": "GNU Fortran 16.2.0", "build_type": "Release", "platform": "Windows 11 x86-64", "experimental_supplement_sha256": "e119e594e50d7ecf08b397b57b80fd48882484f220b00b4fee54c9cbafc2a254", @@ -12,14 +12,14 @@ "completed_cases": 30, "nonlinear_misses": 0, "refinement_cases": 8, - "maximum_spatial_refinement_difference_percent": 0.4921365643366542, - "maximum_temporal_refinement_difference_percent": 0.2837639065583831, - "force_maxima_sha256": "82637f52b69a01e32c347c9f48c32bb4672f23db65a5543b0cba10c1ada98e59", - "aggregate_metrics_sha256": "3c2d89b85efda5e36814a9f8a253e3bb83110ecc15fa59cab7e6def515261d09", + "maximum_spatial_refinement_difference_percent": 0.34336628760570426, + "maximum_temporal_refinement_difference_percent": 0.21639367008474694, + "force_maxima_sha256": "e2f8b055f87bdedbb16170cc4c1dc103802151e8b65ce6593c489c51c130a512", + "aggregate_metrics_sha256": "f2dc318dc8767b7eb53ce1f7dcd2ff334b58888625229776fcf01e99ddb652f2", "case_manifest_sha256": "8da5e7b4a8a92755363807902aba48e0ff42abab04ac44912041853db9e56604", "waveform_T1p25_sha256": "65c8c846636c378b800bb3c7a95ccd2bde766d789af3cdffce26a2e688e1a134", "waveform_T3p50_sha256": "b3ca65ebfc1d61b5510e54876fc11d1604fc18ffcca3eab523dc7d67f50da4d8", "waveform_metrics_sha256": "2803a57cb7726f966a00e00bf6eb070231b9c702ae67a81685da50991d0adb11", - "waveform_note": "Waveform metrics were recomputed with the executable above; the measured phase averages are those of the article supplement's expData.dat, as carried in the waveform CSVs.", - "refinement_summary_sha256": "66dc1760fcd43efa73d00c5b58b693fdf5fa59312971f90b82ff4a375c323767" + "waveform_note": "Waveform metrics were computed with the executable of the 2026-10-09 validation (sha256 71090e2e28c9e1d99c5180d05a395ebcc891a77cc5294d315a57c691904745ac); the force-blended EI = 0 step of this release was not rerun on them because the article supplement's expData.dat, which reduce_bergdahl_waveforms.py reads, was not available. The measured phase averages are those of expData.dat, as carried in the waveform CSVs.", + "refinement_summary_sha256": "8ed5569e1af06b0453b8075d440eb362fdf8a2c651cab8fc2a9c6d5e2a7e61d5" } diff --git a/validation/experiments/bergdahl/refinement_summary.csv b/validation/experiments/bergdahl/refinement_summary.csv index c200bacd..27358362 100644 --- a/validation/experiments/bergdahl/refinement_summary.csv +++ b/validation/experiments/bergdahl/refinement_summary.csv @@ -1,3 +1,3 @@ period_s,radius_m,force_h0p400_dt0p0003125_N,force_h0p200_dt0p0003125_N,force_h0p100_dt0p0003125_N,force_h0p200_dt0p00015625_N,force_h0p200_dt0p000625_N,spatial_difference_h0p400_dt0p0003125_percent,spatial_difference_h0p200_dt0p0003125_percent,temporal_difference_h0p200_dt0p0003125_percent,temporal_difference_h0p200_dt0p000625_percent -1.25,0.2,67.98496359999999,67.993336,68.329611,67.8009414,72.53998779999999,-0.50438952447719,-0.4921365643366542,0.2837639065583831,6.9896469018643925 -3.5,0.2,52.3676382,52.3627916,52.34125759999999,52.3462366,54.1330478,0.05040115811051929,0.041141541085191115,0.03162596028919464,3.4134473002401142 +1.25,0.2,68.299543,67.99751539999998,68.2318004,67.85069080000001,71.67719159999999,0.09928303166979387,-0.34336628760570426,0.21639367008474694,5.639590039369174 +3.5,0.2,52.3632726,52.3614064,52.338932799999995,52.3516172,54.1821924,0.046504196203265,0.04293859044830387,0.01869894479592154,3.4966927440018 diff --git a/validation/experiments/bergdahl/refinement_summary.json b/validation/experiments/bergdahl/refinement_summary.json index ff6bf1b5..7b95b6e3 100644 --- a/validation/experiments/bergdahl/refinement_summary.json +++ b/validation/experiments/bergdahl/refinement_summary.json @@ -4,34 +4,34 @@ "temporal_reference_time_step_s": 0.00015625, "primary_nominal_element_length_m": 0.2, "primary_time_step_s": 0.0003125, - "maximum_primary_spatial_difference_percent": 0.4921365643366542, - "maximum_primary_temporal_difference_percent": 0.2837639065583831, + "maximum_primary_spatial_difference_percent": 0.34336628760570426, + "maximum_primary_temporal_difference_percent": 0.21639367008474694, "rows": [ { "period_s": 1.25, "radius_m": 0.2, - "force_h0p400_dt0p0003125_N": 67.98496359999999, - "force_h0p200_dt0p0003125_N": 67.993336, - "force_h0p100_dt0p0003125_N": 68.329611, - "force_h0p200_dt0p00015625_N": 67.8009414, - "force_h0p200_dt0p000625_N": 72.53998779999999, - "spatial_difference_h0p400_dt0p0003125_percent": -0.50438952447719, - "spatial_difference_h0p200_dt0p0003125_percent": -0.4921365643366542, - "temporal_difference_h0p200_dt0p0003125_percent": 0.2837639065583831, - "temporal_difference_h0p200_dt0p000625_percent": 6.9896469018643925 + "force_h0p400_dt0p0003125_N": 68.299543, + "force_h0p200_dt0p0003125_N": 67.99751539999998, + "force_h0p100_dt0p0003125_N": 68.2318004, + "force_h0p200_dt0p00015625_N": 67.85069080000001, + "force_h0p200_dt0p000625_N": 71.67719159999999, + "spatial_difference_h0p400_dt0p0003125_percent": 0.09928303166979387, + "spatial_difference_h0p200_dt0p0003125_percent": -0.34336628760570426, + "temporal_difference_h0p200_dt0p0003125_percent": 0.21639367008474694, + "temporal_difference_h0p200_dt0p000625_percent": 5.639590039369174 }, { "period_s": 3.5, "radius_m": 0.2, - "force_h0p400_dt0p0003125_N": 52.3676382, - "force_h0p200_dt0p0003125_N": 52.3627916, - "force_h0p100_dt0p0003125_N": 52.34125759999999, - "force_h0p200_dt0p00015625_N": 52.3462366, - "force_h0p200_dt0p000625_N": 54.1330478, - "spatial_difference_h0p400_dt0p0003125_percent": 0.05040115811051929, - "spatial_difference_h0p200_dt0p0003125_percent": 0.041141541085191115, - "temporal_difference_h0p200_dt0p0003125_percent": 0.03162596028919464, - "temporal_difference_h0p200_dt0p000625_percent": 3.4134473002401142 + "force_h0p400_dt0p0003125_N": 52.3632726, + "force_h0p200_dt0p0003125_N": 52.3614064, + "force_h0p100_dt0p0003125_N": 52.338932799999995, + "force_h0p200_dt0p00015625_N": 52.3516172, + "force_h0p200_dt0p000625_N": 54.1821924, + "spatial_difference_h0p400_dt0p0003125_percent": 0.046504196203265, + "spatial_difference_h0p200_dt0p0003125_percent": 0.04293859044830387, + "temporal_difference_h0p200_dt0p0003125_percent": 0.01869894479592154, + "temporal_difference_h0p200_dt0p000625_percent": 3.4966927440018 } ] } From aa3ac3e678fbfc00aea0b90520925a9d7d049d74 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Fri, 16 Oct 2026 16:26:01 +0900 Subject: [PATCH 04/11] fix(dynamics): cap viscoelastic and Syrope releases; audit from t = 0 The release cap of the force-blended EI = 0 step bounded only elastic segments: the viscoelastic and Syrope segments have ea_dyn = 0 (their law is a load contributor), so their committed tension entered the alpha_f share uncapped, the energy-creating release the cap exists to prevent, and the run audit skipped them. - CD_Cable_Gen_Alpha_Step takes start_tension, the step-start tension of the segments whose law a load callback carries; the cap bounds their alpha_f share with the same W_n/(e_n - e_{n+1}), W_n = T_n e_n/2 (the energy of the viscoelastic springs at rest, an upper bound below a stiffening Syrope curve), and the same consistent tangent. The line model passes the law tensions of its committed state with the step-start load (one law evaluation, model_contributor_force). A lightly damped viscoelastic light cable in 3 m heave at dtM 0.1 s: anchor peak 0.081 MN, 0.145 MN uncapped, 0.076 to 0.094 MN at 0.5 to 2.5 ms. A taut Syrope line in 4 m surge going slack: 1.64 MN at 0.1 s with or without the cap, 1.78 MN at 1 and 2.5 ms; no spike warning. - The run audit takes the law tension of viscoelastic and Syrope segments (shared with CD_Get_Model_Tension through model_law_tensions) and their dynamic stiffness for the snap Courant number. - Every driver route that audits now audits the initial state before its march, so the audit's initial tension is that of t = 0. - A call that is not an armed re-solve drops the step-start data of the workspace (and the model's step-start load) before its first return: an unarmed call failing early no longer leaves an older step's data to a later armed re-solve. - Tests: the cap of a callback-carried law (closed form, start_tension entries of elastic segments ignored, FD tangent on both paths); the FD tangent and closed form of the blended dynamic load with drag, a position load and added mass; a warm re-solve equals a cold solve bit for bit while given wrong start data, and recomputes them after an early-failing unarmed call; the viscoelastic and Syrope slack runs. Shipped examples: outputs bit-identical, no new notes or warnings. Dynamics robustness campaign (746 decks): 704 runs complete either way and none warns; the viscoelastic runs change their peaks by at most 0.34 % and now carry the turn and snap notes of their segments, and two chain runs count one snap fewer (the initial tension of t = 0). Signed-off-by: Jae Hoon Seo --- src/CableDyn_DeckDriver.f90 | 13 +- src/CableDyn_Dynamic.f90 | 45 ++- src/CableDyn_Model.f90 | 195 +++++++++-- tests/test_ei0_slack_dynamics.f90 | 542 ++++++++++++++++++++++++++++++ 4 files changed, 758 insertions(+), 37 deletions(-) diff --git a/src/CableDyn_DeckDriver.f90 b/src/CableDyn_DeckDriver.f90 index 506b070d..a4d79fbe 100644 --- a/src/CableDyn_DeckDriver.f90 +++ b/src/CableDyn_DeckDriver.f90 @@ -15487,6 +15487,8 @@ SUBROUTINE write_dynamic_out(out_root, channels, lines, points, opts, models, co CALL close_dynamic_line_outputs(pos_units, ten_units) RETURN END IF + ! the run audit starts from the initial state (its tension scale is that of t = 0) + CALL audit_line_models(models, lines, CD_ZERO, opts%dtM) CALL start_driver_progress(progress, nstep, opts%dtM) DO step = 1, nstep t = REAL(step, wp)*opts%dtM @@ -15650,6 +15652,8 @@ SUBROUTINE write_system_dynamic_out(out_root, channels, lines, points, opts, sys CALL close_dynamic_line_outputs(pos_units, ten_units) RETURN END IF + ! the run audit starts from the initial state (its tension scale is that of t = 0) + CALL audit_system_lines(system, lines, CD_ZERO, opts%dtM) CALL start_driver_progress(progress, nstep, opts%dtM) DO step = 1, nstep t = REAL(step, wp)*opts%dtM @@ -16032,6 +16036,8 @@ SUBROUTINE write_rigid6_dynamic_out(out_root, channels, bodies, lines, points, o CALL close_dynamic_line_outputs(pos_units, ten_units) RETURN END IF + ! the run audit starts from the initial state (its tension scale is that of t = 0) + CALL audit_system_lines(system, lines, CD_ZERO, opts%dtM) CALL start_driver_progress(progress, nstep, opts%dtM) DO step = 1, nstep t = REAL(step, wp)*opts%dtM @@ -16220,6 +16226,8 @@ SUBROUTINE write_rod_dynamic_out(out_root, channels, rod_types, rods, lines, poi CALL close_dynamic_rod_outputs(rod_pos_units) RETURN END IF + ! the run audit starts from the initial state (its tension scale is that of t = 0) + CALL audit_system_lines(system, lines, CD_ZERO, opts%dtM) CALL start_driver_progress(progress, nstep, opts%dtM) DO step = 1, nstep t = REAL(step, wp)*opts%dtM @@ -17751,6 +17759,8 @@ SUBROUTINE write_multibody_dynamic_out(deck_path, out_root, channels, types, bod IF (ErrStat /= CD_DECKDRV_OK) GOTO 800 CALL mb_outputs(CD_ZERO) IF (ErrStat /= CD_DECKDRV_OK) GOTO 800 + ! the run audit starts from the initial state (its tension scale is that of t = 0) + IF (mb%has_sys) CALL audit_system_lines(mb%system, sys_lines, CD_ZERO, opts%dtM) CALL start_driver_progress(progress, nstep, opts%dtM) DO step = 1, nstep t = REAL(step, wp)*opts%dtM @@ -26422,7 +26432,8 @@ END SUBROUTINE update_wave_models SUBROUTINE audit_line_models(models, lines, time, dt) !! Run audit of one committed host step over the standalone EI=0 line models (models(i) - !! is deck line i): see CD_Audit_Model_Step. Warns once per line, at the line's first + !! is deck line i): see CD_Audit_Model_Step. Every route that audits calls it once on the + !! initial state (time 0) before its march. Warns once per line, at the line's first !! implausible tension spike. TYPE(CD_ModelType), INTENT(INOUT) :: models(:) TYPE(DeckLine), INTENT(IN) :: lines(:) diff --git a/src/CableDyn_Dynamic.f90 b/src/CableDyn_Dynamic.f90 index f7324129..30230005 100644 --- a/src/CableDyn_Dynamic.f90 +++ b/src/CableDyn_Dynamic.f90 @@ -605,7 +605,8 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on converged, stalled, n_iter, ErrStat, ErrMsg, & load_proc, added_mass_proc, load_force_proc, & load_band_proc, prescribed_q, prescribed_v, prescribed_a, structural_mass, & - workspace, added_mass_band_proc, start_load, probe_q, probe_R, probe_K) + workspace, added_mass_band_proc, start_load, start_tension, & + probe_q, probe_R, probe_K) !! One generalized-alpha step: the constant load f_ext plus the optional load, !! banded-load, force-only and added-mass callbacks (hydrodynamics, damping, contact). !! On a singular effective tangent returns CD_DYN_SINGULAR; on a line-search @@ -656,6 +657,13 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on !! committed force there, not one advanced over the step). Absent: the step evaluates the !! force-only callback (or load_proc) at (q, v). Full (3 n_nodes) array. REAL(wp), INTENT(IN), OPTIONAL :: start_load(:) + !! Force blend on a tension-only line whose load callbacks carry the axial law of some + !! elements (ea = 0 there; the viscoelastic and Syrope elements of a line model): the + !! step-start tension of each element (n_elem), the along-chord force of that law in + !! start_load (or in the step-start load the step evaluates). The release cap then bounds + !! the alpha_f share of those elements as it bounds that of the elastic ones; entries of + !! elements with ea > 0 are ignored. Absent: the cap covers the elastic elements only. + REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:) !! TEST HOOK (unit tests of the tangent; production callers omit it). With probe_q (full !! 3 n_nodes array, the fixed DOFs at their t_{n+1} values) present, the step returns after !! its setup without iterating: probe_R is the residual (3 n_nodes) and probe_K the free-free @@ -711,6 +719,10 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on n_iter = 0 ErrStat = CD_DYN_OK ErrMsg = '' + ! Only a warm re-solve of the step whose step-start data the workspace holds may reuse + ! them (start_valid): any other call drops them before its first return, so an unarmed + ! call that fails early cannot leave an older step's data to a later armed re-solve. + IF (PRESENT(workspace)) workspace%start_valid = workspace%start_valid .AND. workspace%guess_armed n_dof = SIZE(q) has_load_proc = PRESENT(load_proc) has_load_band_proc = PRESENT(load_band_proc) @@ -1472,9 +1484,22 @@ SUBROUTINE start_forces(es_s, em_s) em_s = 'step-start internal-force assembly failed: '//TRIM(em_s) RETURN END IF - ! release cap: the step-start tension, stretch and chord of every taut element (the - ! assembly above has validated the connectivity and the element lengths) + ! release cap: the step-start tension, stretch and chord of every stretched element (the + ! assembly above has validated the connectivity and the element lengths). An element + ! with ea = 0 takes the tension of the law its load callback carries (start_tension). release_cap = tension_only .AND. alpha_f > CD_ZERO + IF (release_cap .AND. PRESENT(start_tension)) THEN + IF (SIZE(start_tension) /= n_elem) THEN + es_s = CD_DYN_BADINPUT + em_s = 'start_tension must have shape (n_elem)' + RETURN + END IF + IF (.NOT. CD_All_Finite(start_tension)) THEN + es_s = CD_DYN_BADINPUT + em_s = 'start_tension must be finite' + RETURN + END IF + END IF IF (release_cap) THEN DO i = 1, n_elem BLOCK @@ -1484,7 +1509,13 @@ SUBROUTINE start_forces(es_s, em_s) chord_n(:, i) = d/ell stretch_n(i) = ell - l0(i) tension_n(i) = CD_ZERO - IF (stretch_n(i) > CD_ZERO) tension_n(i) = ea(i)*(ell/l0(i) - CD_ONE) + IF (stretch_n(i) > CD_ZERO) THEN + IF (ea(i) > CD_ZERO) THEN + tension_n(i) = ea(i)*(ell/l0(i) - CD_ONE) + ELSE IF (PRESENT(start_tension)) THEN + tension_n(i) = MAX(start_tension(i), CD_ZERO) + END IF + END IF END BLOCK END DO END IF @@ -1955,7 +1986,11 @@ SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) !! carries the discrete energy gradient W_0/(e_0 - e_1), which returns exactly W_0 (the !! smaller of the two is kept, so the blend is continuous in e_1). Every other element, !! and every taut one, keeps the force blend. The residual and the tangent are corrected - !! by the difference. + !! by the difference. An element whose axial law a load callback carries (ea = 0, T_0 + !! from start_tension) is capped the same way with the same W_0 = T_0 e_0/2: the energy + !! of the viscoelastic springs at rest, and an upper bound of the energy below a + !! stiffening loading curve such as Syrope's, so the alpha_f share of every + !! tension-only element returns at most T_0 e_0/2 over a release. REAL(wp), INTENT(IN) :: q_eval(:) REAL(wp), INTENT(INOUT) :: Rout(:) REAL(wp), INTENT(INOUT), OPTIONAL :: effout(:, :), effbandout(:, :) diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index 2de03dbc..2b7dccbe 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -172,6 +172,10 @@ MODULE CableDyn_Model ! the load contributors at the committed state, the step-start share of the force-blended ! generalised-alpha residual (scratch, rebuilt every step) REAL(wp), ALLOCATABLE :: load_start_work(:) + ! the tension of the viscoelastic and Syrope elements in load_start_work (n_elem, zero for + ! the other elements; allocated only on a model with either law): the release cap of the + ! force blend bounds their alpha_f share as it bounds that of the elastic elements + REAL(wp), ALLOCATABLE :: tension_start_work(:) ! load_start_work holds the committed-state load of the last step: a warm re-solve of the ! same step (the junction coupling, dynamic_workspace%guess_armed) reuses it LOGICAL :: load_start_valid = .FALSE. @@ -285,11 +289,12 @@ MODULE CableDyn_Model REAL(wp), ALLOCATABLE :: added_mass_cat_elem(:) TYPE(GenAlphaConfig) :: cfg ! Run audit of the committed host steps (CD_Audit_Model_Step), diagnostics only: never part - ! of the state, of a copy, or of a result. audit_t holds the elastic segment tensions of the - ! last two audited states (column 1 the latest; -1 marks a segment whose tension the - ! viscoelastic or Syrope law carries), audit_u the unit chords of the latest one, audit_n - ! how many states are held (0 to 2). audit_floor is the largest tension of the first audited - ! state. audit_max_turn is the largest turn of a taut segment's chord in one step (deg), + ! of the state, of a copy, or of a result. audit_t holds the segment tensions of the last two + ! audited states (column 1 the latest; the elastic tension, or that of the viscoelastic or + ! Syrope law; -1 marks a segment whose law could not be evaluated), audit_u the unit chords + ! of the latest one, audit_n how many states are held (0 to 2). audit_floor is the largest + ! tension of the first audited state (the initial state: the driver audits it before its + ! march). audit_max_turn is the largest turn of a taut segment's chord in one step (deg), ! audit_snaps the segments that went from slack to taut above audit_floor in one step and ! audit_snap_courant the largest dt*c/l0 (c the axial wave speed) among them. audit_spikes ! counts the implausible tension spikes, the first one recorded with its time, segment, @@ -1856,6 +1861,10 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, n_iter = 0 ErrStat = CD_MODEL_OK ErrMsg = '' + ! Only a warm re-solve of the step whose committed-state load load_start_work holds may + ! reuse it: any other call drops it before its first return (see the step workspace's + ! start_valid), so an unarmed call that fails early leaves no older step's load behind. + IF (.NOT. model%dynamic_workspace%guess_armed) model%load_start_valid = .FALSE. IF (.NOT. model%initialized) THEN ErrStat = CD_MODEL_NOT_INITIALIZED ErrMsg = 'CableDyn_Model: model is not initialized' @@ -1878,9 +1887,10 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, model%has_froude_krylov .OR. model%has_buoyancy_recovery ! Force-blended generalised alpha: the load contributors at the committed state (q_n, v_n) ! carry the alpha_f share of the residual. They are evaluated here, in the instantaneous - ! limit (ve_dt = 0), so the viscoelastic and Syrope elements give their committed force. - ! A warm re-solve of the same step (the junction coupling re-steps the line from the same - ! committed state with moved ends) reuses the load of the previous call. + ! limit (ve_dt = 0), so the viscoelastic and Syrope elements give their committed force, + ! whose tension (tension_start_work) the release cap of the step bounds like the elastic + ! tension. A warm re-solve of the same step (the junction coupling re-steps the line from + ! the same committed state with moved ends) reuses the load of the previous call. IF (.NOT. (has_load .AND. model%cfg%force_blend)) THEN model%load_start_valid = .FALSE. ELSE IF (.NOT. (model%dynamic_workspace%guess_armed .AND. model%load_start_valid)) THEN @@ -1896,8 +1906,27 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, RETURN END IF END IF + ! tension_start_work stays unallocated without a viscoelastic or Syrope element, and the + ! step then sees start_tension absent + IF (ALLOCATED(model%tension_start_work)) THEN + IF (SIZE(model%tension_start_work) /= model%n_elem .OR. & + .NOT. (model%has_viscoelastic .OR. model%has_syrope)) DEALLOCATE (model%tension_start_work) + END IF + IF ((model%has_viscoelastic .OR. model%has_syrope) .AND. .NOT. ALLOCATED(model%tension_start_work)) THEN + ALLOCATE (model%tension_start_work(model%n_elem), STAT=es) + IF (es /= 0) THEN + ErrStat = CD_MODEL_ALLOCFAIL + ErrMsg = 'CableDyn_Model: step-start tension workspace allocation failed' + RETURN + END IF + END IF model%ve_dt = CD_ZERO - CALL model_contributor_force(model, model%q, model%v, model%load_start_work, es, em) + IF (ALLOCATED(model%tension_start_work)) THEN + CALL model_contributor_force(model, model%q, model%v, model%load_start_work, es, em, & + law_tension=model%tension_start_work) + ELSE + CALL model_contributor_force(model, model%q, model%v, model%load_start_work, es, em) + END IF IF (es /= CD_MODEL_OK) THEN ErrStat = es ErrMsg = 'CableDyn_Model: step-start load failed: '//TRIM(em) @@ -1918,7 +1947,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, es, em, load_force_proc=model_force, load_band_proc=model_load_band, & added_mass_band_proc=model_added_mass_band, prescribed_q=prescribed_q, & prescribed_v=prescribed_v, prescribed_a=prescribed_a, & - workspace=model%dynamic_workspace, start_load=model%load_start_work) + workspace=model%dynamic_workspace, start_load=model%load_start_work, & + start_tension=model%tension_start_work) ELSE IF (PRESENT(prescribed_q) .AND. has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1927,7 +1957,7 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, es, em, load_force_proc=model_force, load_band_proc=model_load_band, & prescribed_q=prescribed_q, prescribed_v=prescribed_v, & prescribed_a=prescribed_a, workspace=model%dynamic_workspace, & - start_load=model%load_start_work) + start_load=model%load_start_work, start_tension=model%tension_start_work) ELSE IF (PRESENT(prescribed_q) .AND. model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1950,14 +1980,15 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, n_iter, es, em, & load_force_proc=model_force, load_band_proc=model_load_band, & added_mass_band_proc=model_added_mass_band, workspace=model%dynamic_workspace, & - start_load=model%load_start_work) + start_load=model%load_start_work, start_tension=model%tension_start_work) ELSE IF (has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & dt, model%cfg, model%q_step, model%v_step, model%a_step, converged, stalled, & n_iter, es, em, & load_force_proc=model_force, load_band_proc=model_load_band, & - workspace=model%dynamic_workspace, start_load=model%load_start_work) + workspace=model%dynamic_workspace, start_load=model%load_start_work, & + start_tension=model%tension_start_work) ELSE IF (model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -4030,10 +4061,27 @@ SUBROUTINE CD_Get_Model_Tension(model, tension, ErrStat, ErrMsg) END DO END BLOCK END IF + ! the viscoelastic and Syrope elements report their own law's tension + CALL model_law_tensions(model, tension, ErrStat, ErrMsg) + END SUBROUTINE CD_Get_Model_Tension + + SUBROUTINE model_law_tensions(model, tension, ErrStat, ErrMsg) + !! Overwrite the entries of the viscoelastic and Syrope elements of tension (n_elem) with + !! their law's tension at the committed state (CD_Get_Model_Tension); the other entries + !! are left as they are. + TYPE(CD_ModelType), INTENT(IN) :: model + REAL(wp), INTENT(INOUT) :: tension(:) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + INTEGER :: es + CHARACTER(160) :: em + + ErrStat = CD_MODEL_OK + ErrMsg = '' IF (model%has_viscoelastic) THEN ! viscoelastic elements report the series-Kelvin tension MagT + MagTd at the - ! COMMITTED state and dl_1 (the elastic EA recovery above does not apply - ! to them -- their dynamic elastic stiffness lives in the state) + ! COMMITTED state and dl_1 (the elastic EA recovery of CD_Get_Model_Tension does not + ! apply to them -- their dynamic elastic stiffness lives in the state) BLOCK INTEGER :: e, na, nb REAL(wp) :: ea_d_eff, ea_1_eff @@ -4062,8 +4110,8 @@ SUBROUTINE CD_Get_Model_Tension(model, tension, ErrStat, ErrMsg) END IF IF (model%has_syrope) THEN ! Syrope elements report the working-curve tension at the COMMITTED state - ! (the along-tangent component of the element force; the elastic EA - ! recovery above does not apply -- their stiffness lives in the states) + ! (the along-tangent component of the element force; the elastic EA recovery of + ! CD_Get_Model_Tension does not apply -- their stiffness lives in the states) BLOCK INTEGER :: e, idx_scr(6) REAL(wp) :: q2b(6), v2b(6), f6(6), j6(6, 6), jv6(6, 6), tmean, dslow, chord(3) @@ -4081,7 +4129,7 @@ SUBROUTINE CD_Get_Model_Tension(model, tension, ErrStat, ErrMsg) END DO END BLOCK END IF - END SUBROUTINE CD_Get_Model_Tension + END SUBROUTINE model_law_tensions SUBROUTINE CD_Update_Model_Hydro_Fields(model, ErrStat, ErrMsg, fluid_velocity, drag_waterline_z, & fluid_acceleration, fk_waterline_z, added_mass_waterline_z, & @@ -4660,16 +4708,18 @@ END SUBROUTINE model_added_mass_band END SUBROUTINE CD_Recompute_Model_Acceleration SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) - !! Audit one committed host step of an EI=0 line (called once per output step by the - !! standalone driver, after the step's plausibility guard). Cheap, O(n_elem), and + !! Audit one committed host step of an EI=0 line (called by the standalone driver on the + !! initial state and once per output step, after the step's plausibility guard). Cheap, + !! O(n_elem) (and one evaluation of the viscoelastic and Syrope laws), and !! diagnostic only. It tracks !! !! * the largest turn of a taut segment's chord over one step, the measure of how well !! dtM resolves the rotation of the line (time-step advisory); !! * slack-to-taut snaps above the initial tension scale, with the largest dt*c/l0 among - !! them (c = sqrt(EA/m) the axial wave speed): dt*c/l0 > 1 leaves the snap peak - !! unresolved in time; - !! * implausible tension spikes. A segment's elastic tension T_n at the previous audited + !! them (c = sqrt(EA/m) the axial wave speed; EA the dynamic stiffness: EA_D of a + !! viscoelastic segment, alpha + beta*T of a Syrope one): dt*c/l0 > 1 leaves the snap + !! peak unresolved in time; + !! * implausible tension spikes. A segment's tension T_n at the previous audited !! step is a spike when it exceeds four times its own tension one step before and one !! step after, ten times the largest tension anywhere on the line one step before and !! one step after, and the largest tension of the initial state. A physical snap or @@ -4678,8 +4728,10 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) !! integrator artefact (an under-resolved slack-taut transition) does. !! !! new_spike reports the line's first spike (so the caller warns once per line). The - !! elastic tension is EA*max(strain, 0) of the plain elements; viscoelastic and Syrope - !! elements, whose tension comes from their own laws, are skipped. + !! tension is EA*max(strain, 0) of the elastic elements (EA*strain on a line that allows + !! compression) and the tension of their own law at the committed state for the + !! viscoelastic and Syrope elements (CD_Get_Model_Tension); the driver calls the audit + !! once on the initial state, so the "initial tension" is that of t = 0. TYPE(CD_ModelType), INTENT(INOUT) :: model REAL(wp), INTENT(IN) :: time, dt LOGICAL, INTENT(OUT) :: new_spike @@ -4689,9 +4741,11 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) ! the spike test needs this many segments (the neighbours share the axial wave). REAL(wp), PARAMETER :: TURN_TAUT_FRACTION = 1.0e-3_wp INTEGER, PARAMETER :: SPIKE_MIN_ELEMS = 3 - INTEGER :: e, na, nb, istat + INTEGER :: e, na, nb, istat, es REAL(wp) :: d(3), ell, strain, u(3), c, line_max, tn - LOGICAL :: fresh + REAL(wp), ALLOCATABLE :: law(:) + LOGICAL :: fresh, laws + CHARACTER(160) :: em new_spike = .FALSE. IF (.NOT. model%initialized .OR. model%n_elem < 1) RETURN @@ -4706,7 +4760,22 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) IF (istat /= 0) RETURN model%audit_n = 0 END IF - ! current elastic tensions, chords and the chord turn against the previous audited state + ! the law tensions of the viscoelastic and Syrope segments at the committed state (a + ! segment whose law cannot be evaluated is left out, -1, as is every segment without a + ! tension when the evaluation fails) + laws = model%has_viscoelastic .OR. model%has_syrope + IF (laws) THEN + ! a local array, not model%audit_now itself (the law evaluation reads the model) + ALLOCATE (law(model%n_elem), STAT=istat) + laws = istat == 0 + END IF + IF (laws) THEN + law = -CD_ONE + CALL model_law_tensions(model, law, es, em) + laws = es == CD_MODEL_OK + IF (laws) model%audit_now = law + END IF + ! current tensions, chords and the chord turn against the previous audited state DO e = 1, model%n_elem na = model%elem_conn(1, e) nb = model%elem_conn(2, e) @@ -4721,6 +4790,13 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) strain = ell/model%l0(e) - CD_ONE IF (model%tension_only .AND. strain < CD_ZERO) strain = CD_ZERO model%audit_now(e) = model%ea_dyn(e)*strain + ELSE IF (laws .AND. law_element(e)) THEN + ! a tension-only law reports no compression; keep a finite value only + IF (.NOT. CD_Is_Finite(model%audit_now(e))) THEN + model%audit_now(e) = -CD_ONE + ELSE IF (model%tension_only) THEN + model%audit_now(e) = MAX(model%audit_now(e), CD_ZERO) + END IF ELSE model%audit_now(e) = -CD_ONE END IF @@ -4734,9 +4810,10 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) ACOS(MAX(-CD_ONE, MIN(CD_ONE, DOT_PRODUCT(u, model%audit_u(:, e)))))* & (180.0_wp/ACOS(-CD_ONE))) ! slack at the previous state, taut above the initial tension scale now - IF (model%audit_t(e, 1) == CD_ZERO .AND. model%audit_now(e) > model%audit_floor) THEN + IF (model%audit_t(e, 1) >= CD_ZERO .AND. .NOT. model%audit_t(e, 1) > CD_ZERO .AND. & + model%audit_now(e) > model%audit_floor) THEN model%audit_snaps = model%audit_snaps + 1 - c = SQRT(model%ea_dyn(e)/model%rho_a(e)) + c = SQRT(wave_stiffness(e)/model%rho_a(e)) model%audit_snap_courant = MAX(model%audit_snap_courant, dt*c/model%l0(e)) END IF END IF @@ -4765,6 +4842,40 @@ SUBROUTINE CD_Audit_Model_Step(model, time, dt, new_spike) model%audit_t(:, 1) = model%audit_now model%audit_time = time model%audit_n = MIN(model%audit_n + 1, 2) + + CONTAINS + + LOGICAL FUNCTION law_element(k) RESULT(is_law) + !! Segment k carries the viscoelastic or the Syrope law. + INTEGER, INTENT(IN) :: k + is_law = .FALSE. + IF (model%has_viscoelastic) is_law = model%ve_mode(k) /= 0 + IF (model%has_syrope .AND. .NOT. is_law) is_law = model%syrope_is(k) + END FUNCTION law_element + + REAL(wp) FUNCTION wave_stiffness(k) RESULT(stiff) + !! The axial stiffness of segment k that sets its wave speed: EA of an elastic segment, + !! the fast spring of a law (EA_D of the viscoelastic law, alpha + beta*T of the Syrope + !! law at the segment tension T); the static EA if the law's value is unavailable. + INTEGER, INTENT(IN) :: k + REAL(wp) :: ea_d_eff, ea_1_eff + INTEGER :: es_k + CHARACTER(200) :: em_k + stiff = model%ea_dyn(k) + IF (stiff > CD_ZERO) RETURN + stiff = model%ea(k) + IF (model%has_viscoelastic) THEN + IF (model%ve_mode(k) /= 0) THEN + CALL model_viscoelastic_coeffs(model, k, ea_d_eff, ea_1_eff, es_k, em_k) + IF (es_k == CD_MODEL_OK .AND. ea_d_eff > CD_ZERO) stiff = ea_d_eff + RETURN + END IF + END IF + IF (model%has_syrope) THEN + IF (model%syrope_is(k)) stiff = model%syrope_type(k)%alpha + & + model%syrope_type(k)%beta*MAX(model%audit_now(k), CD_ZERO) + END IF + END FUNCTION wave_stiffness END SUBROUTINE CD_Audit_Model_Step SUBROUTINE clear_model_audit(model) @@ -5584,6 +5695,7 @@ SUBROUTINE clear_model_load_contributor_workspace(model) IF (ALLOCATED(model%load_jq_work)) DEALLOCATE (model%load_jq_work) IF (ALLOCATED(model%load_jv_work)) DEALLOCATE (model%load_jv_work) IF (ALLOCATED(model%load_start_work)) DEALLOCATE (model%load_start_work) + IF (ALLOCATED(model%tension_start_work)) DEALLOCATE (model%tension_start_work) model%load_start_valid = .FALSE. END SUBROUTINE clear_model_load_contributor_workspace @@ -6170,7 +6282,7 @@ SUBROUTINE model_contributor_load_banded(model, q, v, free, kl, ku, force, jac_q END IF END SUBROUTINE model_contributor_load_banded - SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_nodes_only) + SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_nodes_only, law_tension) !! Assemble all configured non-structural model load contributors without tangents. !! end_nodes_only: only the first and last node's entries are needed (end-force recovery); !! the other nodes and the elements not touching an end are skipped, and the two end entries @@ -6178,12 +6290,15 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node !! compact 9-vector [first node (3), last node (3), sum over the other nodes the end !! elements reach (3)], so the recovery needs no n_dof-long scratch; the third block only !! carries the finiteness check of the full assembly. + !! law_tension (n_elem; with a full assembly): the along-chord tension of the element force + !! of the viscoelastic and Syrope laws in `force`, zero for every other element. TYPE(CD_ModelType), INTENT(IN) :: model REAL(wp), INTENT(IN) :: q(:), v(:) REAL(wp), INTENT(OUT) :: force(:) INTEGER, INTENT(OUT) :: ErrStat CHARACTER(*), INTENT(OUT) :: ErrMsg LOGICAL, INTENT(IN), OPTIONAL :: end_nodes_only + REAL(wp), INTENT(OUT), OPTIONAL :: law_tension(:) INTEGER :: n, e, i, ix, iy, iz, idx(6), nn LOGICAL :: ends @@ -6201,6 +6316,14 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node ErrMsg = 'CableDyn_Model: model force received inconsistent q/v/force shapes' RETURN END IF + IF (PRESENT(law_tension)) THEN + IF (ends .OR. SIZE(law_tension) /= model%n_elem) THEN + ErrStat = CD_MODEL_BADINPUT + ErrMsg = 'CableDyn_Model: model force law tensions need a full assembly and shape (n_elem)' + RETURN + END IF + law_tension = CD_ZERO + END IF ErrStat = CD_MODEL_OK ErrMsg = '' nn = n/3 @@ -6305,6 +6428,7 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node f2, ErrStat, ErrMsg) IF (ErrStat /= 0) RETURN CALL scatter_element_vector(force, idx, f2) + IF (PRESENT(law_tension)) law_tension(e) = element_law_tension() END IF END IF IF (model%has_syrope) THEN @@ -6312,6 +6436,7 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node CALL model_syrope_element(model, e, q2, v2, f2, syr_jac, syr_jac_v, syr_tm, syr_ds, ErrStat, ErrMsg) IF (ErrStat /= CD_MODEL_OK) RETURN CALL scatter_element_vector(force, idx, f2) + IF (PRESENT(law_tension)) law_tension(e) = element_law_tension() END IF END IF IF (model%has_morison_drag) THEN @@ -6363,6 +6488,14 @@ PURE INTEGER FUNCTION slot(k) RESULT(j) j = j + 6 END IF END FUNCTION slot + + REAL(wp) FUNCTION element_law_tension() RESULT(t) + !! Along-chord tension of the element force f2 on node a (the laws keep the element + !! longer than their collapse length, so the chord is nonzero). + REAL(wp) :: chord(3) + chord = q2(4:6) - q2(1:3) + t = DOT_PRODUCT(f2(1:3), chord/NORM2(chord)) + END FUNCTION element_law_tension END SUBROUTINE model_contributor_force SUBROUTINE seabed_normal_damping_load(q, v, z_floor, c_n, force, jac_q, jac_v, ErrStat, ErrMsg) diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index 3a5edc01..2b83140a 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -23,6 +23,21 @@ PROGRAM test_ei0_slack_dynamics !! taut at t_n and deeply slack at the trial state (cap active, its energy-gradient force !! W_n/(e_n - e_{n+1}) and tangent), and a segment slack at both states; each on the !! banded and the dense path. The cap's residual is also checked against the closed form. + !! 6. The same chain with a segment whose tension-only law a load callback carries (ea = 0, + !! as the viscoelastic and Syrope segments of a line model): with its step-start tension + !! (start_tension) its deep release is capped like an elastic one, closed form and finite + !! difference tangent; without it the segment keeps the plain force blend. + !! 7. The finite-difference tangent of the step with nonzero dynamic loads (a quadratic drag + !! and a cubic position load, plus a position-dependent added mass on the dense path), and + !! the closed form of the blended load (1 - alpha_f) f(q_{n+1}, v_{n+1}) + alpha_f f(q_n, v_n). + !! 8. A warm re-solve of the same step (guess_armed, the junction coupling) reuses the + !! step-start force, load and release-cap data of the previous call: its solution equals a + !! cold solve bit for bit while the start data it is given are wrong (so they are not + !! read); after an unarmed call that fails before computing them, an armed call recomputes + !! them instead of reusing those of an older state. + !! 9. A lightly damped viscoelastic version of the light cable at dtM 0.1 s (the cap on its + !! law segments) and a long taut Syrope line in 4 m surge that goes slack: no spike + !! warning, and peaks within the band of small-step references. USE CableDyn_Precision, ONLY: wp USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_DECKDRV_OK USE CableDyn_Dynamic, ONLY: GenAlphaConfig, CD_CableGenAlphaWorkspace, CD_Cable_Gen_Alpha_Step, CD_DYN_OK @@ -31,18 +46,31 @@ PROGRAM test_ei0_slack_dynamics REAL(wp), PARAMETER :: PI = 3.141592653589793238462643383279502884197_wp CHARACTER(*), PARAMETER :: CABLE = 'cable 0.2 80.0 8.0e8 0.0 0.0 1.2 0.1 1.0 0.0' CHARACTER(*), PARAMETER :: POLY_VE = 'poly_ve 0.1438 22.42 1.424e8|2.50e8 4.0e9|1.1e7 0.0 1.2 0.2 1.0 0.0' + ! the light cable as a lightly damped viscoelastic line (Es|Ed, Bs|Bd) + CHARACTER(*), PARAMETER :: CABLE_VE = 'cable 0.2 80.0 8.0e8|1.6e9 1.0e8|1.0e6 0.0 1.2 0.1 1.0 0.0' INTEGER :: nfail CHARACTER(1024) :: driver + ! dynamic load of the chain cases 6 to 8 (host-associated by the load callbacks): nodal + ! quadratic drag -cb_drag |v| v, nodal cubic load -cb_spring |q - cb_q0|^2 (q - cb_q0), the + ! tension-only law (EA cb_ea_law, length cb_l0_law) of segment cb_law_elem (0: none), and the + ! added mass cb_madd (1 + 0.3 z^2) per DOF of the dense path + REAL(wp) :: cb_drag = 0.0_wp, cb_spring = 0.0_wp, cb_ea_law = 0.0_wp, cb_l0_law = 1.0_wp, cb_madd = 0.0_wp + REAL(wp) :: cb_q0(12) = 0.0_wp + INTEGER :: cb_law_elem = 0 nfail = 0 driver = '' IF (COMMAND_ARGUMENT_COUNT() >= 1) CALL GET_COMMAND_ARGUMENT(1, driver) CALL case_tangent_consistency() + CALL case_law_release_cap() + CALL case_load_share_tangent() + CALL case_warm_resolve_reuse() CALL case_light_cable_coarse_step() CALL case_light_cable_release_cap() CALL case_viscoelastic_surge() IF (LEN_TRIM(driver) > 0) THEN CALL case_run_audit() + CALL case_law_slack_runs() ELSE WRITE (*, '(A)') 'MISMATCH [audit: the driver executable is the first argument]' nfail = nfail + 1 @@ -486,4 +514,518 @@ SUBROUTINE case_run_audit() CALL require(.NOT. file_contains('ei0slack_audit_sway.log', 'Warning: line'), 'audit:sway-no-warning') END SUBROUTINE case_run_audit + ! ------------------------------------------------------------------------------------------ + ! Chain cases 6 to 8: a load callback with drag, a position load and a segment law + ! ------------------------------------------------------------------------------------------ + + FUNCTION outer3(x, y) RESULT(m) + REAL(wp), INTENT(IN) :: x(3), y(3) + REAL(wp) :: m(3, 3) + INTEGER :: i + DO i = 1, 3 + m(:, i) = x*y(i) + END DO + END FUNCTION outer3 + + SUBROUTINE chain_load(q, v, force, jac_q, jac_v) + !! The chain load (see cb_drag) and its residual Jacobians -d(force)/dq, -d(force)/dv. + REAL(wp), INTENT(IN) :: q(:), v(:) + REAL(wp), INTENT(OUT) :: force(:), jac_q(:, :), jac_v(:, :) + INTEGER :: n, i, a, b + REAL(wp) :: d(3), w(3), dd, sp, c(3), ell, t(3), ten, kb(3, 3), eye(3, 3) + force = 0.0_wp + jac_q = 0.0_wp + jac_v = 0.0_wp + eye = 0.0_wp + DO i = 1, 3 + eye(i, i) = 1.0_wp + END DO + DO n = 1, SIZE(q)/3 + d = q(3*n - 2:3*n) - cb_q0(3*n - 2:3*n) + w = v(3*n - 2:3*n) + dd = DOT_PRODUCT(d, d) + sp = NORM2(w) + force(3*n - 2:3*n) = -cb_drag*sp*w - cb_spring*dd*d + jac_q(3*n - 2:3*n, 3*n - 2:3*n) = cb_spring*(dd*eye + 2.0_wp*outer3(d, d)) + IF (sp > 0.0_wp) jac_v(3*n - 2:3*n, 3*n - 2:3*n) = cb_drag*(sp*eye + outer3(w, w)/sp) + END DO + IF (cb_law_elem > 0) THEN + ! the tension-only segment law: force T t on node a, -T t on node b + a = cb_law_elem + b = a + 1 + c = q(3*b - 2:3*b) - q(3*a - 2:3*a) + ell = NORM2(c) + t = c/ell + ten = cb_ea_law*(ell/cb_l0_law - 1.0_wp) + IF (ten > 0.0_wp) THEN + force(3*a - 2:3*a) = force(3*a - 2:3*a) + ten*t + force(3*b - 2:3*b) = force(3*b - 2:3*b) - ten*t + kb = (cb_ea_law/cb_l0_law)*outer3(t, t) + ten*(eye - outer3(t, t))/ell + jac_q(3*a - 2:3*a, 3*a - 2:3*a) = jac_q(3*a - 2:3*a, 3*a - 2:3*a) + kb + jac_q(3*a - 2:3*a, 3*b - 2:3*b) = jac_q(3*a - 2:3*a, 3*b - 2:3*b) - kb + jac_q(3*b - 2:3*b, 3*a - 2:3*a) = jac_q(3*b - 2:3*b, 3*a - 2:3*a) - kb + jac_q(3*b - 2:3*b, 3*b - 2:3*b) = jac_q(3*b - 2:3*b, 3*b - 2:3*b) + kb + END IF + END IF + END SUBROUTINE chain_load + + SUBROUTINE cb_load(q, v, force, jac_q, jac_v, ErrStat, ErrMsg) + REAL(wp), INTENT(IN) :: q(:), v(:) + REAL(wp), INTENT(OUT) :: force(:), jac_q(:, :), jac_v(:, :) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + CALL chain_load(q, v, force, jac_q, jac_v) + ErrStat = 0 + ErrMsg = '' + END SUBROUTINE cb_load + + SUBROUTINE cb_force(q, v, force, ErrStat, ErrMsg) + REAL(wp), INTENT(IN) :: q(:), v(:) + REAL(wp), INTENT(OUT) :: force(:) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + REAL(wp) :: jq(SIZE(q), SIZE(q)), jv(SIZE(q), SIZE(q)) + CALL chain_load(q, v, force, jq, jv) + ErrStat = 0 + ErrMsg = '' + END SUBROUTINE cb_force + + SUBROUTINE cb_load_band(q, v, free, kl, ku, force, jac_q_band, jac_v_band, ErrStat, ErrMsg) + !! The chain load with its Jacobians in the reduced free/free band storage of the step. + REAL(wp), INTENT(IN) :: q(:), v(:) + INTEGER, INTENT(IN) :: free(:), kl, ku + REAL(wp), INTENT(OUT) :: force(:), jac_q_band(:, :), jac_v_band(:, :) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + REAL(wp) :: jq(SIZE(q), SIZE(q)), jv(SIZE(q), SIZE(q)) + INTEGER :: i, j + CALL chain_load(q, v, force, jq, jv) + jac_q_band = 0.0_wp + jac_v_band = 0.0_wp + DO j = 1, SIZE(free) + DO i = 1, SIZE(free) + IF (i - j > kl .OR. j - i > ku) CYCLE + jac_q_band(kl + ku + 1 + i - j, j) = jq(free(i), free(j)) + jac_v_band(kl + ku + 1 + i - j, j) = jv(free(i), free(j)) + END DO + END DO + ErrStat = 0 + ErrMsg = '' + END SUBROUTINE cb_load_band + + SUBROUTINE cb_added_mass(q, accel, M_add, dMa_a_dq, ErrStat, ErrMsg) + !! Position-dependent nodal added mass cb_madd (1 + 0.3 z^2) and d(M_add a)/dq. + REAL(wp), INTENT(IN) :: q(:), accel(:) + REAL(wp), INTENT(OUT) :: M_add(:, :), dMa_a_dq(:, :) + INTEGER, INTENT(OUT) :: ErrStat + CHARACTER(*), INTENT(OUT) :: ErrMsg + INTEGER :: n, i + M_add = 0.0_wp + dMa_a_dq = 0.0_wp + DO n = 1, SIZE(q)/3 + DO i = 3*n - 2, 3*n + M_add(i, i) = cb_madd*(1.0_wp + 0.3_wp*q(3*n)**2) + dMa_a_dq(i, 3*n) = cb_madd*0.6_wp*q(3*n)*accel(i) + END DO + END DO + ErrStat = 0 + ErrMsg = '' + END SUBROUTINE cb_added_mass + + SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension) + !! Residual and effective tangent at q1 of the force-blended step of the chain with the + !! callback load: banded (load_band_proc + load_force_proc) or dense (load_proc, with the + !! added mass when cb_madd > 0). + REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), q1(12), l0(3), ea(3), rho_a(3) + LOGICAL, INTENT(IN) :: banded + REAL(wp), INTENT(OUT) :: R(12), K(9, 9) + REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:) + INTEGER :: conn(2, 3), n_iter, es + REAL(wp) :: qo(12), vo(12), ao(12) + LOGICAL :: converged, stalled + TYPE(GenAlphaConfig) :: cfg + TYPE(CD_CableGenAlphaWorkspace) :: work + CHARACTER(120) :: em + conn = RESHAPE([1, 2, 2, 3, 3, 4], [2, 3]) + cfg%rho_inf = 0.4_wp + IF (banded) THEN + CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & + qo, vo, ao, converged, stalled, n_iter, es, em, load_band_proc=cb_load_band, & + load_force_proc=cb_force, workspace=work, start_tension=start_tension, & + probe_q=q1, probe_R=R, probe_K=K) + ELSE IF (cb_madd > 0.0_wp) THEN + CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & + qo, vo, ao, converged, stalled, n_iter, es, em, load_proc=cb_load, & + added_mass_proc=cb_added_mass, workspace=work, start_tension=start_tension, & + probe_q=q1, probe_R=R, probe_K=K) + ELSE + CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & + qo, vo, ao, converged, stalled, n_iter, es, em, load_proc=cb_load, & + workspace=work, start_tension=start_tension, probe_q=q1, probe_R=R, probe_K=K) + END IF + IF (es /= CD_DYN_OK) THEN + WRITE (*, '(A)') 'MISMATCH [chain:probe '//TRIM(em)//']' + nfail = nfail + 1 + R = 0.0_wp + K = 0.0_wp + END IF + END SUBROUTINE probe_chain + + SUBROUTINE fd_tangent_check(label, qn, vn, an, q1, l0, ea, rho_a, banded, start_tension) + !! The step's tangent against the central difference of its residual. + CHARACTER(*), INTENT(IN) :: label + REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), q1(12), l0(3), ea(3), rho_a(3) + LOGICAL, INTENT(IN) :: banded + REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:) + REAL(wp), PARAMETER :: H = 1.0e-6_wp + INTEGER :: j + REAL(wp) :: qp(12), R(12), Rp(12), Rm(12), K(9, 9), Kfd(9, 9), Kdump(9, 9), err + CALL probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension) + DO j = 1, 9 + qp = q1 + qp(3 + j) = q1(3 + j) + H + CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rp, Kdump, start_tension) + qp(3 + j) = q1(3 + j) - H + CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rm, Kdump, start_tension) + Kfd(:, j) = (Rp(4:12) - Rm(4:12))/(2.0_wp*H) + END DO + err = MAXVAL(ABS(K - Kfd))/MAXVAL(ABS(K)) + WRITE (*, '(A,A,A,L1,A,ES9.2)') ' tangent ', label, ' banded=', banded, ': max |K - K_fd|/max|K| = ', err + CALL require(err < 1.0e-6_wp, label//TRIM(MERGE(':banded', ':dense ', banded))//':fd-tangent') + END SUBROUTINE fd_tangent_check + + SUBROUTINE chain_states(strain_n, strain_1, l0, qn, vn, an, q1) + !! The chain of case 5 at t_n and at the trial state, with a small velocity and + !! acceleration at t_n. + REAL(wp), INTENT(IN) :: strain_n(3), strain_1(3), l0(3) + REAL(wp), INTENT(OUT) :: qn(12), vn(12), an(12), q1(12) + REAL(wp), PARAMETER :: DIRS_N(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & + -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) + REAL(wp), PARAMETER :: DIRS_1(3, 3) = RESHAPE([1.0_wp, 0.27_wp, 0.04_wp, 0.36_wp, 1.0_wp, -0.12_wp, & + -0.12_wp, 0.46_wp, 1.0_wp], [3, 3]) + INTEGER :: i + CALL chain_nodes(DIRS_N, strain_n, l0, qn) + CALL chain_nodes(DIRS_1, strain_1, l0, q1) + vn = 0.0_wp + an = 0.0_wp + DO i = 4, 12 + vn(i) = 0.01_wp*SIN(1.7_wp*REAL(i, wp)) + an(i) = 0.02_wp*COS(2.3_wp*REAL(i, wp)) + END DO + END SUBROUTINE chain_states + + SUBROUTINE reset_chain_load() + cb_drag = 0.0_wp + cb_spring = 0.0_wp + cb_ea_law = 0.0_wp + cb_l0_law = 1.0_wp + cb_madd = 0.0_wp + cb_q0 = 0.0_wp + cb_law_elem = 0 + END SUBROUTINE reset_chain_load + + SUBROUTINE case_law_release_cap() + !! Segment 3 carries a tension-only law through the load callback (ea(3) = 0) and + !! releases deeply within the step. + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.0_wp] + REAL(wp), PARAMETER :: EA_LAW = 0.8e6_wp, ALPHA_F = 0.4_wp/1.4_wp + REAL(wp) :: qn(12), vn(12), an(12), q1(12), R(12), Rnone(12), Rel(12), K(9, 9), f_cap(12), f_raw(12) + REAL(wp) :: t0, scale + INTEGER, PARAMETER :: I8 = SELECTED_INT_KIND(18) + CALL reset_chain_load() + cb_law_elem = 3 + cb_ea_law = EA_LAW + cb_l0_law = L0(3) + CALL chain_states([0.010_wp, 0.020_wp, 0.010_wp], [0.020_wp, 0.015_wp, -0.050_wp], L0, qn, vn, an, q1) + t0 = EA_LAW*0.010_wp + ! nearly massless chain at rest at t_n: the residual is the blended force + CALL probe_chain(qn, 0.0_wp*vn, 0.0_wp*an, q1, L0, EA, [1.0e-9_wp, 1.0e-9_wp, 1.0e-9_wp], .TRUE., R, K, & + start_tension=[0.0_wp, 0.0_wp, t0]) + CALL probe_chain(qn, 0.0_wp*vn, 0.0_wp*an, q1, L0, EA, [1.0e-9_wp, 1.0e-9_wp, 1.0e-9_wp], .TRUE., Rnone, K) + ! the entries of the elastic segments are ignored + CALL probe_chain(qn, 0.0_wp*vn, 0.0_wp*an, q1, L0, EA, [1.0e-9_wp, 1.0e-9_wp, 1.0e-9_wp], .TRUE., Rel, K, & + start_tension=[99.0_wp, -5.0_wp, t0]) + CALL blended_force(qn, q1, L0, [EA(1), EA(2), EA_LAW], ALPHA_F, .TRUE., f_cap) + CALL blended_force(qn, q1, L0, [EA(1), EA(2), EA_LAW], ALPHA_F, .FALSE., f_raw) + scale = MAXVAL(ABS(f_raw)) + CALL require(MAXVAL(ABS(f_cap - f_raw)) > 1.0e-2_wp*scale, 'law-cap:cap-active') + CALL require(MAXVAL(ABS(R(4:12) - f_cap(4:12))) < 1.0e-6_wp*scale, 'law-cap:residual-closed-form') + CALL require(MAXVAL(ABS(Rnone(4:12) - f_raw(4:12))) < 1.0e-6_wp*scale, 'law-cap:no-start-tension-uncapped') + CALL require(ALL(TRANSFER(Rel, [0_I8]) == TRANSFER(R, [0_I8])), 'law-cap:elastic-entries-ignored') + ! the tangent with inertia, on both paths + CALL fd_tangent_check('law-cap', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .TRUE., & + start_tension=[0.0_wp, 0.0_wp, t0]) + CALL fd_tangent_check('law-cap', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .FALSE., & + start_tension=[0.0_wp, 0.0_wp, t0]) + CALL reset_chain_load() + END SUBROUTINE case_law_release_cap + + SUBROUTINE case_load_share_tangent() + !! All segments elastic and taut; the callback load carries a quadratic drag and a cubic + !! position load (and an added mass on the dense path). + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.8e6_wp] + REAL(wp), PARAMETER :: RHO = 0.4_wp, DT = 0.05_wp + REAL(wp) :: qn(12), vn(12), an(12), q1(12), v1(12), R(12), K(9, 9), f_int(12), f1(12), fn0(12) + REAL(wp) :: jq(12, 12), jv(12, 12), alpha_m, alpha_f, beta, gamma, scale, load_scale + INTEGER :: i + CALL reset_chain_load() + CALL chain_states([0.010_wp, 0.020_wp, 0.010_wp], [0.020_wp, 0.015_wp, 0.020_wp], L0, qn, vn, an, q1) + cb_drag = 2.0e4_wp + cb_spring = 1.0e8_wp + DO i = 1, 12 + cb_q0(i) = qn(i) + 0.05_wp*SIN(0.9_wp*REAL(i, wp)) + END DO + alpha_m = (2.0_wp*RHO - 1.0_wp)/(RHO + 1.0_wp) + alpha_f = RHO/(RHO + 1.0_wp) + beta = 0.25_wp*(1.0_wp - alpha_m + alpha_f)**2 + gamma = 0.5_wp - alpha_m + alpha_f + ! closed form, nearly massless chain at rest at t_n: v_{n+1} = gamma/(beta dt) (q1 - qn) at + ! the free nodes, the fixed node held + v1 = gamma/(beta*DT)*(q1 - qn) + v1(1:3) = 0.0_wp + CALL probe_chain(qn, 0.0_wp*vn, 0.0_wp*an, q1, L0, EA, [1.0e-9_wp, 1.0e-9_wp, 1.0e-9_wp], .TRUE., R, K) + CALL blended_force(qn, q1, L0, EA, alpha_f, .TRUE., f_int) + CALL chain_load(q1, v1, f1, jq, jv) + CALL chain_load(qn, 0.0_wp*vn, fn0, jq, jv) + scale = MAXVAL(ABS(f_int)) + load_scale = MAXVAL(ABS(f1(4:12))) + CALL require(load_scale > 0.1_wp*scale, 'load-share:load-significant') + CALL require(MAXVAL(ABS(R(4:12) - (f_int(4:12) - (1.0_wp - alpha_f)*f1(4:12) - alpha_f*fn0(4:12)))) < & + 1.0e-6_wp*scale, 'load-share:residual-closed-form') + ! the tangent with inertia: banded, and dense with the added mass + CALL fd_tangent_check('load-share', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .TRUE.) + cb_madd = 50.0_wp + CALL fd_tangent_check('load-share+added-mass', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .FALSE.) + CALL reset_chain_load() + END SUBROUTINE case_load_share_tangent + + SUBROUTINE solve_chain(work, qn, vn, an, ends, dt, start_load, start_tension, q_out, v_out, a_out, n_iter, es) + !! One banded step of the chain with node 1 prescribed at ends (at rest). + TYPE(CD_CableGenAlphaWorkspace), INTENT(INOUT) :: work + REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), ends(3), dt, start_load(12), start_tension(3) + REAL(wp), INTENT(OUT) :: q_out(12), v_out(12), a_out(12) + INTEGER, INTENT(OUT) :: n_iter, es + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.0_wp] + INTEGER :: conn(2, 3) + REAL(wp) :: pq(12) + LOGICAL :: converged, stalled + TYPE(GenAlphaConfig) :: cfg + CHARACTER(120) :: em + conn = RESHAPE([1, 2, 2, 3, 3, 4], [2, 3]) + cfg%rho_inf = 0.4_wp + pq = qn + pq(1:3) = ends + CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .TRUE., 0.0_wp*qn, [1, 2, 3], & + dt, cfg, q_out, v_out, a_out, converged, stalled, n_iter, es, em, & + load_band_proc=cb_load_band, load_force_proc=cb_force, prescribed_q=pq, & + prescribed_v=0.0_wp*qn, prescribed_a=0.0_wp*qn, workspace=work, & + start_load=start_load, start_tension=start_tension) + IF (es == CD_DYN_OK .AND. .NOT. converged) es = -1 + END SUBROUTINE solve_chain + + LOGICAL FUNCTION same_bits(x, y) RESULT(same) + REAL(wp), INTENT(IN) :: x(:), y(:) + INTEGER, PARAMETER :: I8 = SELECTED_INT_KIND(18) + same = ALL(TRANSFER(x, [0_I8]) == TRANSFER(y, [0_I8])) + END FUNCTION same_bits + + SUBROUTINE case_warm_resolve_reuse() + !! A junction-style re-solve of the same step (guess_armed) from the same committed state + !! with moved ends: the step-start data of the first call are reused. + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA_LAW = 0.8e6_wp, ALPHA_F = 0.4_wp/1.4_wp + REAL(wp), PARAMETER :: DIRS(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & + -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) + TYPE(CD_CableGenAlphaWorkspace) :: warm, cold, wrong, cold2 + REAL(wp) :: qn(12), vn(12), an(12), qn2(12), sl(12), sl2(12), ends_a(3), ends_b(3), u3(3) + REAL(wp) :: qw(12), vw(12), aw(12), qc(12), vc(12), ac(12), qx(12), vx(12), ax(12), t0, t02, e0, e1 + REAL(wp) :: jq(12, 12), jv(12, 12) + INTEGER :: itw, itc, itx, es + CALL reset_chain_load() + cb_law_elem = 3 + cb_ea_law = EA_LAW + cb_l0_law = L0(3) + cb_drag = 500.0_wp + cb_spring = 1.0e6_wp + CALL chain_nodes(DIRS, [0.010_wp, 0.020_wp, 0.010_wp], L0, qn) + cb_q0 = qn + ! node 4 runs toward node 3, so segment 3 (the law) releases deeply within the step + u3 = (qn(10:12) - qn(7:9))/NORM2(qn(10:12) - qn(7:9)) + vn = 0.0_wp + vn(10:12) = -1.5_wp*u3 + vn(4:6) = [0.05_wp, -0.02_wp, 0.01_wp] + an = 0.0_wp + ends_a = qn(1:3) + [0.01_wp, 0.0_wp, 0.0_wp] + ends_b = qn(1:3) + [0.0_wp, 0.012_wp, -0.004_wp] + CALL chain_load(qn, vn, sl, jq, jv) + t0 = EA_LAW*0.010_wp + ! first call (cold), then the armed re-solve given wrong start data, against a cold solve + CALL solve_chain(warm, qn, vn, an, ends_a, 0.05_wp, sl, [0.0_wp, 0.0_wp, t0], qw, vw, aw, itw, es) + CALL require(es == CD_DYN_OK, 'reuse:first-call') + warm%guess_armed = .TRUE. + CALL solve_chain(warm, qn, vn, an, ends_b, 0.05_wp, sl + 1.0e3_wp, [0.0_wp, 0.0_wp, 5.0_wp*t0], qw, vw, aw, & + itw, es) + CALL require(es == CD_DYN_OK, 'reuse:warm-call') + CALL solve_chain(cold, qn, vn, an, ends_b, 0.05_wp, sl, [0.0_wp, 0.0_wp, t0], qc, vc, ac, itc, es) + CALL require(es == CD_DYN_OK, 'reuse:cold-call') + CALL require(itw == itc .AND. same_bits(qw, qc) .AND. same_bits(vw, vc) .AND. same_bits(aw, ac), & + 'reuse:warm-equals-cold-bitwise') + ! the cap is active at the solution, and the wrong start data would change it + e0 = NORM2(qn(10:12) - qn(7:9)) - L0(3) + e1 = NORM2(qc(10:12) - qc(7:9)) - L0(3) + CALL require(e0 - e1 > e0/(2.0_wp*ALPHA_F), 'reuse:cap-active') + CALL solve_chain(wrong, qn, vn, an, ends_b, 0.05_wp, sl + 1.0e3_wp, [0.0_wp, 0.0_wp, 5.0_wp*t0], qx, vx, ax, & + itx, es) + CALL require(es == CD_DYN_OK .AND. .NOT. same_bits(qx, qc), 'reuse:start-data-matter') + ! an unarmed call that fails before computing its start data (dt < 0), then an armed call + ! from another state: it must not reuse the start data of the first state + qn2 = qn + qn2(7:9) = qn2(7:9) + [0.003_wp, -0.002_wp, 0.001_wp] + CALL chain_load(qn2, vn, sl2, jq, jv) + t02 = EA_LAW*(NORM2(qn2(10:12) - qn2(7:9))/L0(3) - 1.0_wp) + CALL solve_chain(warm, qn2, vn, an, ends_b, -1.0_wp, sl2, [0.0_wp, 0.0_wp, t02], qx, vx, ax, itx, es) + CALL require(es /= CD_DYN_OK, 'reuse:early-failure') + warm%guess_armed = .TRUE. + CALL solve_chain(warm, qn2, vn, an, ends_b, 0.05_wp, sl2, [0.0_wp, 0.0_wp, t02], qw, vw, aw, itw, es) + CALL require(es == CD_DYN_OK, 'reuse:armed-after-failure') + CALL solve_chain(cold2, qn2, vn, an, ends_b, 0.05_wp, sl2, [0.0_wp, 0.0_wp, t02], qc, vc, ac, itc, es) + CALL require(es == CD_DYN_OK .AND. itw == itc .AND. same_bits(qw, qc) .AND. same_bits(vw, vc) .AND. & + same_bits(aw, ac), 'reuse:no-stale-start-data') + CALL reset_chain_load() + END SUBROUTINE case_warm_resolve_reuse + + ! ------------------------------------------------------------------------------------------ + ! Case 9: viscoelastic and Syrope lines that go slack (driver runs) + ! ------------------------------------------------------------------------------------------ + + SUBROUTINE write_syrope_files() + !! The settings and OWC table of the shipped Syrope example (examples/data/syrope). + REAL(wp), PARAMETER :: OWC(2, 30) = RESHAPE([ & + 0.00000e+00_wp, 0.00000e+00_wp, 2.06897e-03_wp, 1.71768e+05_wp, & + 4.13793e-03_wp, 3.30952e+05_wp, 6.20690e-03_wp, 4.78788e+05_wp, & + 8.27586e-03_wp, 6.16510e+05_wp, 1.03448e-02_wp, 7.45355e+05_wp, & + 1.24138e-02_wp, 8.66556e+05_wp, 1.44828e-02_wp, 9.81351e+05_wp, & + 1.65517e-02_wp, 1.09097e+06_wp, 1.86207e-02_wp, 1.19666e+06_wp, & + 2.06897e-02_wp, 1.29964e+06_wp, 2.27586e-02_wp, 1.40116e+06_wp, & + 2.48276e-02_wp, 1.50245e+06_wp, 2.68966e-02_wp, 1.60474e+06_wp, & + 2.89655e-02_wp, 1.70927e+06_wp, 3.10345e-02_wp, 1.81728e+06_wp, & + 3.31034e-02_wp, 1.93000e+06_wp, 3.51724e-02_wp, 2.04866e+06_wp, & + 3.72414e-02_wp, 2.17450e+06_wp, 3.93103e-02_wp, 2.30876e+06_wp, & + 4.13793e-02_wp, 2.45267e+06_wp, 4.34483e-02_wp, 2.60747e+06_wp, & + 4.55172e-02_wp, 2.77439e+06_wp, 4.75862e-02_wp, 2.95467e+06_wp, & + 4.96552e-02_wp, 3.14954e+06_wp, 5.17241e-02_wp, 3.36024e+06_wp, & + 5.37931e-02_wp, 3.58800e+06_wp, 5.58621e-02_wp, 3.83406e+06_wp, & + 5.79310e-02_wp, 4.09965e+06_wp, 6.00000e-02_wp, 4.38601e+06_wp], [2, 30]) + INTEGER :: u, i + OPEN (NEWUNIT=u, FILE='ei0slack_syrope_settings.dat', STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'ei0slack_syrope_owc.dat 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) + OPEN (NEWUNIT=u, FILE='ei0slack_syrope_owc.dat', STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'Strain Tension' + WRITE (u, '(A)') '(-) (N)' + DO i = 1, 30 + WRITE (u, '(ES13.5,1X,ES13.5)') OWC(1, i), OWC(2, i) + END DO + CLOSE (u) + END SUBROUTINE write_syrope_files + + SUBROUTINE write_syrope_deck(path, dt, tmax) + !! A 230 m Syrope polyester line (115 segments, 80 kg/m) taut from the fairlead + !! (5, 0, -14) to the anchor (227, 0, -80), working curve of a 1 MN running maximum. + CHARACTER(*), INTENT(IN) :: path + REAL(wp), INTENT(IN) :: dt, tmax + INTEGER :: u + OPEN (NEWUNIT=u, FILE=path, STATUS='REPLACE', ACTION='WRITE') + WRITE (u, '(A)') 'EI = 0 slack-taut dynamics regression deck (Syrope)' + 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)') 'rope 0.2 80.0 "SYROPE:ei0slack_syrope_settings.dat|1.53e8|23.12" 1.0e8|1.0e5 0.0 1.2 0.1 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) (m^3) (m^2) (-)' + WRITE (u, '(A)') '1 Coupled 5.0 0.0 -14.0 0 0 0 0' + WRITE (u, '(A)') '2 Fixed 227.0 0.0 -80.0 0 0 0 0' + WRITE (u, '(A)') '--- LINES ---' + WRITE (u, '(A)') 'ID NodeA NodeB Outputs' + WRITE (u, '(A)') '(-) (-) (-) (-)' + WRITE (u, '(A)') '1 1 2 t' + WRITE (u, '(A)') '--- SYROPE IC ---' + WRITE (u, '(A)') 'Line(s) Tmax0 Tmean0' + WRITE (u, '(A)') '(-) (N) (N)' + WRITE (u, '(A)') '1 1.0e6 5.0e5' + WRITE (u, '(A)') '--- SECTIONS ---' + WRITE (u, '(A)') 'LineID LineType Length NumSegs' + WRITE (u, '(A)') '(-) (-) (m) (-)' + WRITE (u, '(A)') '1 rope 230.0 115' + WRITE (u, '(A)') '--- OPTIONS ---' + WRITE (u, '(A)') '80.0 WtrDpth' + WRITE (u, '(ES14.7,A)') dt, ' dtM' + WRITE (u, '(ES14.7,A)') tmax, ' TMax' + WRITE (u, '(A)') 'ei0slack_surge_syr.txt motionFile' + WRITE (u, '(A)') '--- OUTPUTS ---' + WRITE (u, '(A)') 'FairTen1 AnchTen1' + WRITE (u, '(A)') '--- end ---' + CLOSE (u) + END SUBROUTINE write_syrope_deck + + REAL(wp) FUNCTION column_min(path, first_col, last_col) RESULT(mn) + !! Smallest value of the columns first_col..last_col (last_col 0: through the last column). + CHARACTER(*), INTENT(IN) :: path + INTEGER, INTENT(IN) :: first_col, last_col + REAL(wp), ALLOCATABLE :: d(:, :) + INTEGER :: nrow, lc + mn = HUGE(1.0_wp) + CALL read_out(path, d, nrow) + IF (nrow < 1) RETURN + lc = last_col + IF (lc == 0) lc = SIZE(d, 1) + mn = MINVAL(d(first_col:lc, 1:nrow)) + END FUNCTION column_min + + SUBROUTINE case_law_slack_runs() + LOGICAL :: ok + CHARACTER(64) :: opts(4) + REAL(wp) :: fair, anch, seg_min + ! the light cable as a lightly damped viscoelastic line, 3 m heave at dtM 0.1 s: anchor + ! 7.6e4 to 9.4e4 N and fairlead 0.97e5 to 1.08e5 N at dtM 0.5 to 2.5 ms; without the cap + ! on its law segments 1.45e5 N at the anchor + CALL write_motion('ei0slack_heave_ve.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 3, 3.0_wp, 10.0_wp, 10.0_wp, & + 0.1_wp, 40.0_wp) + opts(1) = '0.1 dtM' + opts(2) = '40.0 TMax' + opts(3) = 'ei0slack_heave_ve.txt motionFile' + opts(4) = '' + CALL write_deck('ei0slack_ve_light.dat', CABLE_VE, [205.0_wp, 0.0_wp, -80.0_wp], [5.0_wp, 0.0_wp, -14.0_wp], & + 230.0_wp, 115, 80.0_wp, 't', opts) + CALL run_driver_logged('ei0slack_ve_light.dat', 'ei0slack_ve_light', 'ei0slack_ve_light.log', ok) + CALL require(ok, 've-slack:run') + fair = column_max('ei0slack_ve_light.out', 2, 2) + anch = column_max('ei0slack_ve_light.out', 3, 3) + seg_min = column_min('ei0slack_ve_light.Line1.t.out', 2, 0) + WRITE (*, '(A,ES10.3,A,ES10.3,A,ES10.3,A)') ' viscoelastic light cable, dtM 0.1 s: FairTen1 max ', fair, & + ' N, AnchTen1 max ', anch, ' N, smallest segment tension ', seg_min, ' N' + CALL require(seg_min <= 0.0_wp, 've-slack:goes-slack') + CALL require(anch > 6.5e4_wp .AND. anch < 1.0e5_wp, 've-slack:anchor-peak') + CALL require(fair > 8.0e4_wp .AND. fair < 1.2e5_wp, 've-slack:fairlead-peak') + CALL require(.NOT. file_contains('ei0slack_ve_light.log', 'Warning: line'), 've-slack:no-spike-warning') + ! a taut Syrope line in 4 m surge that goes slack, dtM 0.1 s: fairlead 1.78 MN at dtM 1 and + ! 2.5 ms + CALL write_syrope_files() + CALL write_motion('ei0slack_surge_syr.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 1, 4.0_wp, 10.0_wp, 10.0_wp, & + 0.1_wp, 40.0_wp) + CALL write_syrope_deck('ei0slack_syrope.dat', 0.1_wp, 40.0_wp) + CALL run_driver_logged('ei0slack_syrope.dat', 'ei0slack_syrope', 'ei0slack_syrope.log', ok) + CALL require(ok, 'syrope-slack:run') + fair = column_max('ei0slack_syrope.out', 2, 2) + seg_min = column_min('ei0slack_syrope.Line1.t.out', 2, 0) + WRITE (*, '(A,ES10.3,A,ES10.3,A)') ' Syrope line, 4 m surge, dtM 0.1 s: FairTen1 max ', fair, & + ' N, smallest segment tension ', seg_min, ' N' + CALL require(seg_min <= 0.0_wp, 'syrope-slack:goes-slack') + CALL require(fair > 1.5e6_wp .AND. fair < 1.95e6_wp, 'syrope-slack:fairlead-peak') + CALL require(.NOT. file_contains('ei0slack_syrope.log', 'Warning: line'), 'syrope-slack:no-spike-warning') + END SUBROUTINE case_law_slack_runs + END PROGRAM test_ei0_slack_dynamics From 87ee8acda50301c908ab5339e5a3181a1f2d22c4 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Fri, 16 Oct 2026 16:26:01 +0900 Subject: [PATCH 05/11] docs: field time level, capped laws, C API scheme, validation caveats - theory: an EI = 0 line holds the fluid fields the host samples for t_{n+1} over the step, so both shares of the force blend (and the configuration blend at q_alpha) use them; the finite-EI path evaluates its end share at t_{n+1} and reuses r_n from its own t_n. The release cap covers the viscoelastic and Syrope segments; the seabed contact lift-off is not capped (its bound is stated). The run audit starts from the initial state and audits the law tensions. - options, capi: the rhoInf note is printed by the standalone driver; CableDyn_InitLine(s) always take the force-blended step and cannot select the configuration blend (no ABI change). - VALIDATION, Bergdahl provenance: the two waveform RMSEs come from the 2026-10-09 executable; the record is labelled as an unreleased development build (v0.1.1+dev (unreleased)), which the records test accepts until the next version bump. The snap-load figure before the force blend is 2.76 %, the value published as 2.7 %. - CHANGELOG entries updated accordingly. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 84 ++++++++++--------- VALIDATION.md | 8 +- doc/capi.rst | 5 +- doc/options.rst | 11 ++- doc/theory.rst | 60 ++++++++++--- doc/troubleshooting.rst | 7 +- tests/test_validation_records.py | 5 +- .../experiments/bergdahl/provenance.json | 4 +- 8 files changed, 121 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 460cd4dc..dabd20a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,18 +93,19 @@ All notable changes to CableDyn are recorded in this file. The format follows Coupling a host (CFD) solver, that compares the call sequence step by step with MoorDyn's C API: initialisation, vector layout, end-of-step motion, outer correctors, load summation, the fixed step of the aggregate route, and units. -- Run audit of tension-only (`EI = 0`) lines in the standalone driver. At every output step it - tracks the largest turn of a taut segment's chord, the segments that snap from slack to - taut, and non-physical tension spikes: a segment whose elastic tension at one step exceeds - four times its own one step before and after, ten times the largest tension anywhere on the - line one step before and after, and the largest tension of the initial state. The first spike - of a line is reported as a warning, once per line, and the run summary counts them. The run - ends with a note when a taut segment turned by more than 1° in one step (the mean and - standard deviation of the tension err by about 1 % and more above it; 1.3 % at 2.9° on a - heaving chain), and when segments snapped taut while the axial wave crosses a segment more - than once per step, so the snap peaks are not resolved in time. A dynamic deck with `rhoInf` - above 0.95 prints a note on the missing numerical dissipation. See the manual's troubleshooting - page. +- Run audit of tension-only (`EI = 0`) lines in the standalone driver. On the initial state and + at every output step it tracks the largest turn of a taut segment's chord, the segments that + snap from slack to taut, and non-physical tension spikes: a segment whose tension (the elastic + tension, or that of its viscoelastic or Syrope law) at one step exceeds four times its own one + step before and after, ten times the largest tension anywhere on the line one step before and + after, and the largest tension of the initial state. The first spike of a line is reported as + a warning, once per line, and the run summary counts them. The run ends with a note when a + taut segment turned by more than 1° in one step (the mean and standard deviation of the + tension err by about 1 % and more above it; 1.3 % at 2.9° on a heaving chain), and when + segments snapped taut while the axial wave crosses a segment more than once per step, so the + snap peaks are not resolved in time. The standalone driver also prints a note for a dynamic + deck with `rhoInf` above 0.95, on the missing numerical dissipation. See the manual's + troubleshooting page. ### Changed @@ -165,8 +166,8 @@ All notable changes to CableDyn are recorded in this file. The format follows ### Fixed -- Tension spikes of tension-only (`EI = 0`) lines that go slack. The generalised-α step - evaluated the axial force and the dynamic loads at the blended configuration +- Tension spikes of tension-only (`EI = 0`) lines that go slack. The generalised-α step evaluated + the axial force and the dynamic loads at the blended configuration `q_α = (1 − α_f) q_{n+1} + α_f q_n`. A segment that was slack at the start of a step and carries tension at `q_α` then ends the step stretched beyond it, `q_{n+1} = (q_α − α_f q_n)/(1 − α_f)`, and a segment going slack within a step returned more @@ -174,31 +175,36 @@ All notable changes to CableDyn are recorded in this file. The format follows `rhoInf = 0.4`, at every `dtM` from 0.002 to 0.2 s, on realistic input: a light, axially stiff cable (80 kg/m, EA 8e8 N) under 3 m heave reported 4.2 MN at the fairlead and 3.4 MN at the anchor (`dtM` 0.0025 s) and 20 MN at the anchor (`dtM` 0.1 s), against 0.1 to 0.18 MN at - `rhoInf = 0`, at `dtM` down to 0.25 ms and with a finite-EI model; the same cable in an - `Hs` 8 m JONSWAP sea 0.41 MN at the anchor against 0.043 MN; the shipped viscoelastic - polyester in 15 m surge 2.69 MN against 1.80 MN; a semi-taut chain–polyester leg 9.5 MN at - the anchor against 4.6 MN; and a line on a stiff seabed failed the plausibility guard. The - step now blends forces, `(1 − α_f) r(q_{n+1}, v_{n+1}) + α_f r(q_n, v_n)`, as the finite-EI - path does, for the axial force and every dynamic load (damping, viscoelastic and Syrope laws, - seabed, drag, Froude–Krylov, buoyancy; added mass stays at `q_α`). The step-start force is - evaluated afresh at the committed state, so no state is added and restarts stay exact. An - element going from taut to slack within a step carries at most its discrete energy gradient - (the strain energy it releases over the shortening), so a release can no longer create - energy. At the default `rhoInf` the reproducers now give 0.14 / 0.08 MN, 0.092 / 0.096 MN, - 0.075 / 0.043 MN and 1.80 MN, as their references, and the stiff-seabed line runs to - completion; the chain–polyester anchor snap peaks at 5.8 MN at `dtM` 0.05 s, a single-step - peak (4.6 MN at 0.0025 s) that the new snap note reports. On a linear element the scheme - is unchanged, so taut lines keep their accuracy: every MoorDyn-C, OrcaFlex, analytic and - experimental comparison that runs locally still passes, and its reported error moves by at - most 0.35 percentage points (the minimum fairlead tension of the one-hour VolturnUS-S - record, 0.15 % to 0.50 %; the snap-load peak at 20 ms improves from 2.8 % to 1.6 %; see - VALIDATION.md). Every `EI = 0` dynamic output changes. Over the shipped examples the - statistics of the tensions change by at most 0.23 % (mean) and 0.9 % (maximum), except the - two `als_volturnus` decks, whose pre-failure anchor snap at 250 s is resolved by one or two - samples and peaks 10 % lower. Static runs and finite-EI lines are unchanged. The step costs - up to 6 % more wall time on `EI = 0` dynamic decks (one more force evaluation per step and - about 4 % more Newton iterations). `False alpha_force_blend`, which until now - applied to finite-EI lines only, selects the former scheme for `EI = 0` lines as well. + `rhoInf = 0`, at `dtM` down to 0.25 ms and with a finite-EI model; the same cable in an `Hs` + 8 m JONSWAP sea 0.41 MN at the anchor against 0.043 MN; the shipped viscoelastic polyester in + 15 m surge 2.69 MN against 1.80 MN; a semi-taut chain–polyester leg 9.5 MN at the anchor + against 4.6 MN; and a line on a stiff seabed failed the plausibility guard. The step now blends + forces, `(1 − α_f) r(q_{n+1}, v_{n+1}) + α_f r(q_n, v_n)`, as the finite-EI path does, for the + axial force and every dynamic load (damping, viscoelastic and Syrope laws, seabed, drag, + Froude–Krylov, buoyancy; added mass stays at `q_α`). The step-start force is evaluated afresh + at the committed state, so no state is added and restarts stay exact. An element going from + taut to slack within a step carries at most its discrete energy gradient (the strain energy it + releases over the shortening), so a release can no longer create energy; the viscoelastic and + Syrope segments are capped the same way with the tension of their law (the same cable made + lightly damped viscoelastic peaks at 0.081 MN at the anchor at `dtM` 0.1 s, against 0.145 MN + without the cap on its segments and 0.076 to 0.094 MN at 0.5 to 2.5 ms). The seabed contact of + a node that lifts off within a step is not capped (see the manual's theory page). At the + default `rhoInf` the reproducers now give 0.14 / 0.08 MN, 0.092 / 0.096 MN, 0.075 / 0.043 MN + and 1.80 MN, as their references, and the stiff-seabed line runs to completion; the + chain–polyester anchor snap peaks at 5.8 MN at `dtM` 0.05 s, a single-step peak (4.6 MN at + 0.0025 s) that the new snap note reports. On a linear element the scheme is unchanged, so taut + lines keep their accuracy: every MoorDyn-C, OrcaFlex, analytic and experimental comparison that + runs locally still passes, and its reported error moves by at most 0.35 percentage points (the + minimum fairlead tension of the one-hour VolturnUS-S record, 0.15 % to 0.50 %; the snap-load + peak at 20 ms improves from 2.76 %, published as 2.7 %, to 1.6 %; see VALIDATION.md). Every + `EI = 0` dynamic output changes. Over the shipped examples the statistics of the tensions + change by at most 0.23 % (mean) and 0.9 % (maximum), except the two `als_volturnus` decks, + whose pre-failure anchor snap at 250 s is resolved by one or two samples and peaks 10 % lower. + Static runs and finite-EI lines are unchanged. The step costs up to 6 % more wall time on + `EI = 0` dynamic decks (one more force evaluation per step and about 4 % more Newton + iterations). `False alpha_force_blend`, which until now applied to finite-EI lines only, + selects the former scheme for `EI = 0` lines as well. Lines that the C API builds without a + deck (`CableDyn_InitLine`, `CableDyn_InitLines`) always take the force blend. - `modified_newton` on `EI = 0` lines (with or without the force blend, so also under `False alpha_force_blend`) rebuilds the tangent when an iterate reduces the residual by less than a factor four, as the manual states; it had kept the first tangent for the whole step, diff --git a/VALIDATION.md b/VALIDATION.md index fd48e38c..22f3dbe2 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -290,7 +290,10 @@ scripts, results, and source provenance are in over the full 30-condition period-radius matrix, cycle-maximum upper-end force has RMSE 1.59 N, mean absolute percentage error 3.12%, Pearson correlation 0.993, and Lin concordance 0.989. Two phase-averaged measured histories have - waveform RMSEs of 5.95% and 2.54% of their force ranges. Halving the mesh length + waveform RMSEs of 5.95% and 2.54% of their force ranges; these two were computed with the + executable of the 2026-10-09 record (the configuration-blended `EI = 0` step), because the + article supplement's `expData.dat` they need was not available for the rerun (see the + experiment's README and `provenance.json`). Halving the mesh length and the time step changes the mean cycle maximum by at most 0.34% and 0.22%. The 0.3125 ms step resolves the segment axial modes that the snap loads excite; at 1.25 ms the maxima are 2–15% higher and vary from cycle to cycle. @@ -375,7 +378,8 @@ scripts, results, and source provenance are in to ~10 MN. Implicit generalised-α integrates it at **dt = 20 ms, above the explicit CFL limit of about 3.2 ms**, with every step converged (stable up to about 30 ms in a sweep); the peak is within **1.6%** of the 0.5 ms sub-CFL reference - (1.1% at 10 ms, 0.05% at 5 ms; 2.8 / 0.6 / 0.16% before the force-blended `EI = 0` step). + (1.1% at 10 ms, 0.05% at 5 ms). Before the force-blended `EI = 0` step these were + 2.76 / 0.62 / 0.16%; the 2.76% at 20 ms is the value published as 2.7% (truncated). - **Implicit and explicit steps**: on the matched near-taut snap, MoorDyn-C's explicit RK2 needs `dtM ≲ 1 ms`, as expected of an explicit scheme at this line stiffness; CableDyn's implicit step remains stable at **20 ms**. diff --git a/doc/capi.rst b/doc/capi.rst index 3bdcab8d..aad269a4 100644 --- a/doc/capi.rst +++ b/doc/capi.rst @@ -1044,7 +1044,10 @@ solve returns ``CD_C_SOLVE_FAIL``. The Newton settings are fixed at their defaults: relative residual tolerance :math:`10^{-8}`, at most 30 iterations per step, and at -most 12 line-search backtracks. +most 12 line-search backtracks. So is the generalised-α scheme: these lines always take the +force-blended step (``alpha_force_blend`` ``True``, with the release cap on a tension-only line, +:doc:`theory`). They cannot select the configuration blend of 0.1.1 and earlier +(``False alpha_force_blend``), which only a deck sets, through ``CableDyn_InitDeck``. ``CableDyn_InitLines`` ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/options.rst b/doc/options.rst index 635a5720..6b96ceb3 100644 --- a/doc/options.rst +++ b/doc/options.rst @@ -298,9 +298,10 @@ rejected as unknown. The dynamic Newton controls are set with ``dynamic_solver`` damp the modes ``dtM`` does not resolve (axial waves, slack-taut transitions) faster; ``0`` annihilates them in one step. Above ``0.95`` the march has almost no numerical dissipation: those modes then keep the residual each Newton step leaves and the energy - of under-resolved snaps, and a run prints a note. In an irregular sea a finite-EI lazy - wave at ``1 rhoInf`` with a ``1e-4`` relative Newton tolerance peaked at 2.0e5 N against - 1.02e4 N (3.1e4 N at ``0.99``) and was exact with ``1e-6``; ``EI = 0`` lines at ``1`` and + of under-resolved snaps, and the standalone driver prints a note. In an irregular sea a + finite-EI lazy wave at ``1 rhoInf`` with a ``1e-4`` relative Newton tolerance peaked at + 2.0e5 N against 1.02e4 N (3.1e4 N at ``0.99``) and was exact with ``1e-6``; ``EI = 0`` + lines at ``1`` and ``1e-4`` failed the ``maxStrain`` guard, and at the default tolerance their peaks rose 2 to 5 times at ``0.95`` to ``1``. Keep ``rhoInf`` at or below ``0.95``, or tighten the ``dynamic_solver`` relative tolerance to ``1e-6`` and resolve the snaps with ``dtM`` @@ -393,7 +394,9 @@ Finite-EI cable controls ``dtM`` 0.1 / 0.05 / 0.025 / 0.0125 s with ``False`` and 9424 / 9322 / 9314 / 9311 N with ``True``. A run prints a note when a nodal tangent turns by more than 0.25 deg (``True``) or 0.1 deg (``False``) in one step. A dynamic run with a torsional line - (``END CONNECTIONS`` ``TorsStiffness`` at both ends) needs ``True`` + (``END CONNECTIONS`` ``TorsStiffness`` at both ends) needs ``True``. The lines the raw C + API builds without a deck (``CableDyn_InitLine``, ``CableDyn_InitLines``) always use + ``True``: their only integrator setting is ``rho_inf`` (:doc:`capi`) - standalone and coupled (finite-EI and ``EI = 0`` lines) - ``False alpha_force_blend`` * - ``cable_statics`` / ``cablestatics`` diff --git a/doc/theory.rst b/doc/theory.rst index 5cf23c7f..0045fcfc 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1280,7 +1280,8 @@ and the residual is evaluated at the intermediate states - \mathbf{f}_\text{ext}(\mathbf{q}_\alpha, \mathbf{v}_\alpha, t_\alpha), \qquad (\cdot)_\alpha = (1 - \alpha_f)(\cdot)_{n+1} + \alpha_f(\cdot)_n . -Time-dependent loads (waves) are evaluated at :math:`t_\alpha`. By default both paths blend the +On the finite-EI path time-dependent loads (waves) are then evaluated at :math:`t_\alpha`; the +``EI = 0`` path holds the fluid fields over the step (below). By default both paths blend the *forces* instead (``alpha_force_blend``, default ``True``; ``False`` selects the form above), .. math:: @@ -1305,9 +1306,19 @@ dynamic load: axial damping, the viscoelastic and Syrope laws, seabed contact, d friction, Morison drag, Froude–Krylov and buoyancy loads. Added mass stays at :math:`(\mathbf{q}_\alpha, \mathbf{a}_{\alpha_m})`. :math:`\mathbf{r}_n` is evaluated afresh at the committed state of every step, with the viscoelastic and Syrope elements at their committed -internal state, and with the fluid fields of the step, so the scheme carries no extra state and -a restart is exact; a re-solve of the same step from the same state (the junction coupling) -reuses it. The configuration blend fails at slack–taut transitions. A tension-only element is a +internal state, so the scheme carries no extra state and a restart is exact; a re-solve of the +same step from the same state (the junction coupling) reuses it. The fluid fields of an +``EI = 0`` line (current, wave velocity and acceleration, and the waterline) are held over the +step: before the step the host (the standalone driver, or the coupling host) samples them for +the end of the step, :math:`t_{n+1}`, at the committed node positions, and every load +evaluation of the step uses them. Both shares of the force blend therefore see the fields of +:math:`t_{n+1}`, so :math:`\mathbf{r}_n` is :math:`\mathbf{r}(\mathbf{q}_n, \mathbf{v}_n)` with +those fields rather than with the fields of :math:`t_n`, and the configuration blend evaluates +the loads with them at :math:`(\mathbf{q}_\alpha, \mathbf{v}_\alpha)` rather than at +:math:`t_\alpha`, as it did before the force blend. The finite-EI path instead evaluates its +wave loads at :math:`t_{n+1}` for the end share and reuses its :math:`\mathbf{r}_n`, evaluated at +its own :math:`t_n` in the previous step. The configuration blend fails at slack–taut +transitions. A tension-only element is a one-sided spring, and the residual sets its force at :math:`\mathbf{q}_\alpha`; the end state :math:`\mathbf{q}_{n+1} = (\mathbf{q}_\alpha - \alpha_f\mathbf{q}_n)/(1 - \alpha_f)` extrapolates past it. A segment slack at :math:`t_n` that carries a tension at :math:`t_\alpha` thus ends the @@ -1335,7 +1346,32 @@ keep the force blend. In the slack-cable case above the internal forces created with the cap; the fairlead peak is 0.14 MN, against 0.13 to 0.19 MN at :math:`\rho_\infty = 0` and at :math:`\Delta t` down to 0.25 ms. For a linear element the force blend and the cap reduce to the configuration blend, so the linear spectral properties and the -second-order accuracy are unchanged. The effective tangent is +second-order accuracy are unchanged. + +The segments whose tension comes from a constitutive law, the viscoelastic and Syrope segments +(whose law enters the step as a dynamic load), are capped in the same way: :math:`T_n` is the +law's tension at the committed state, the force :math:`\mathbf{r}_n` carries, with the same +:math:`e_n` and :math:`W_n = \tfrac{1}{2} T_n e_n`. For the viscoelastic law at rest this is the +energy of its two springs, which both carry :math:`T_n` and whose stretches add up to +:math:`e_n`; for the Syrope law, whose loading curve stiffens, it bounds the energy below the +curve from above. So the :math:`\alpha_f` share of every segment of a tension-only line returns +at most :math:`\tfrac{1}{2} T_n e_n` in a release (a release that ends above :math:`l_0` returns +at most :math:`\alpha_f T_n e_n`, and :math:`\alpha_f \le \tfrac{1}{2}`). With the light cable +above made lightly damped viscoelastic (EA 8e8 | 1.6e9 N, BA 1e8 | 1e6 N s) the anchor peaks at +0.081 MN at :math:`\Delta t` = 0.1 s with the cap on its segments and at 0.145 MN without it, +against 0.076 to 0.094 MN at :math:`\Delta t` from 0.5 to 2.5 ms. A taut Syrope line in 4 m +surge that goes slack peaks at 1.64 MN at 0.1 s, against 1.78 MN at 1 and 2.5 ms, with or +without the cap. + +The one-sided seabed contact is not capped. A node that leaves the floor within a step keeps +:math:`\alpha_f` of its step-start contact force :math:`N_n` for the whole step: over a lift-off +distance :math:`d` it returns at most :math:`\alpha_f N_n d` to the motion, against the energy +:math:`\tfrac{1}{2} N_n g_n` of the penalty spring at the penetration :math:`g_n` (millimetres). +The excess is the step-start support acting for :math:`\alpha_f` of a step longer than it should, +an impulse of at most :math:`\alpha_f N_n \Delta t` per lift-off that vanishes with +:math:`\Delta t`; the contact law's sloped-floor normal and the friction anchors, which the step +does not see, leave no energy bound as simple as the segments'. Seabed damping and friction are +dissipative and keep the plain force blend as well. The effective tangent is .. math:: @@ -1432,8 +1468,8 @@ snap-load verification a slack line snapping to about 10 MN integrates stably at :math:`\Delta t = 20\,\mathrm{ms}`, well above the explicit limit of 3.2 ms, with the peak within 1.6% of a 0.5 ms reference (:doc:`validation`). The time step must still resolve the response of interest and, for explicitly integrated points and bodies (below), their own -stability limit. The standalone driver audits every ``EI = 0`` line at each output step and -reports at the end of the run: +stability limit. The standalone driver audits every ``EI = 0`` line on the initial state and at +each output step, and reports at the end of the run: - the largest turn of the chord of a taut segment in one step. Above 1 deg it prints a note: against a 3.125 ms reference on chain catenaries under 5 m heave, 10 m surge and 15 m sway @@ -1442,10 +1478,12 @@ reports at the end of the run: 1.4 deg and 1.3 % at 2.9 deg (heave, mean), in proportion with the turn; - segments that go from slack to taut above the initial tension in one step while the axial wave crosses a segment more than once per step (:math:`\Delta t\,c/l_0 > 1`, - :math:`c = \sqrt{EA/m}`): the snap peaks are then not resolved in time, and the note asks for a - confirmation at a smaller ``dtM``; -- non-physical tension spikes. The elastic tension of a segment at one step is a spike when it - exceeds four times its own tension one step before and one step after, ten times the largest + :math:`c = \sqrt{EA/m}` with the dynamic stiffness of the segment, :math:`EA_D` of a viscoelastic + segment and :math:`\alpha + \beta T` of a Syrope one): the snap peaks are then not resolved in + time, and the note asks for a confirmation at a smaller ``dtM``; +- non-physical tension spikes. The tension of a segment at one step (its elastic tension, or the + tension of its viscoelastic or Syrope law at the committed state) is a spike when it exceeds + four times its own tension one step before and one step after, ten times the largest tension anywhere on the line one step before and one step after, and the largest tension of the initial state. A physical snap or tension wave persists over the axial transit time and is shared by the neighbouring segments, so no line carries such an isolated single-step peak. diff --git a/doc/troubleshooting.rst b/doc/troubleshooting.rst index 487b6d4a..dfee5c30 100644 --- a/doc/troubleshooting.rst +++ b/doc/troubleshooting.rst @@ -572,15 +572,16 @@ Warnings and notes that do not stop a run confirm design peaks with a smaller ``dtM``. * - ``Warning: line ...: segment ... carried ... N at t = ... s for a single step, ... times the largest tension on the line one step before and after`` - - a non-physical tension spike: the elastic tension of one segment rose and fell within one - step to ten times anything the line carried one step before and after, which no physical + - a non-physical tension spike: the tension of one segment (elastic, viscoelastic or + Syrope) rose and fell within one step to ten times anything the line carried one step + before and after, which no physical snap or tension wave does. It is the signature of an under-resolved slack–taut transition integrated without energy control, for example with ``False alpha_force_blend`` (the ``EI = 0`` scheme of 0.1.1 and earlier) or with ``rhoInf`` near 1. Remove ``False alpha_force_blend``, keep ``rhoInf`` at or below 0.95, or reduce ``dtM``; the run summary counts the spikes of the line. * - ``Note: rhoInf = ... leaves almost no numerical dissipation`` - - ``rhoInf`` above 0.95: the modes ``dtM`` does not resolve keep the residual of each + - printed by the standalone driver for a dynamic deck with ``rhoInf`` above 0.95: the modes ``dtM`` does not resolve keep the residual of each Newton step and the energy of under-resolved snaps. In an irregular sea this can raise the tensions several times (a lazy wave at ``1 rhoInf`` with a ``1e-4`` Newton tolerance peaked at twenty times the converged value). Use ``rhoInf`` ≤ 0.95 (default 0.4), or a diff --git a/tests/test_validation_records.py b/tests/test_validation_records.py index 0bac61da..b4085527 100644 --- a/tests/test_validation_records.py +++ b/tests/test_validation_records.py @@ -42,11 +42,14 @@ def test_provenance_uses_the_release_version(self) -> None: match = re.search(r"project\(CableDynCore VERSION (\d+\.\d+\.\d+)", cmake) self.assertIsNotNone(match) expected = f"v{match.group(1)}" + # A record rerun on an unreleased development build after that release says so; the + # version bump of the next release makes it fail here until the record is rerun. + development = f"{expected}+dev (unreleased)" for relative in ( "experiments/holcombe/provenance.json", "experiments/bergdahl/provenance.json", ): - self.assertEqual(load_json(VALIDATION / relative)["CableDyn_release"], expected) + self.assertIn(load_json(VALIDATION / relative)["CableDyn_release"], (expected, development)) def test_holcombe_marker_curvature_summary(self) -> None: directory = VALIDATION / "experiments" / "holcombe" diff --git a/validation/experiments/bergdahl/provenance.json b/validation/experiments/bergdahl/provenance.json index 148b8ee1..9a5dff35 100644 --- a/validation/experiments/bergdahl/provenance.json +++ b/validation/experiments/bergdahl/provenance.json @@ -1,5 +1,5 @@ { - "CableDyn_release": "v0.1.1", + "CableDyn_release": "v0.1.1+dev (unreleased)", "validation_date": "2026-10-16", "executable_name": "cabledyn.exe", "executable_sha256": "bb64e4ebe13a77ead7c73cd51f1c29e5764f0acc78c7dc644148032e561f0c80", @@ -20,6 +20,6 @@ "waveform_T1p25_sha256": "65c8c846636c378b800bb3c7a95ccd2bde766d789af3cdffce26a2e688e1a134", "waveform_T3p50_sha256": "b3ca65ebfc1d61b5510e54876fc11d1604fc18ffcca3eab523dc7d67f50da4d8", "waveform_metrics_sha256": "2803a57cb7726f966a00e00bf6eb070231b9c702ae67a81685da50991d0adb11", - "waveform_note": "Waveform metrics were computed with the executable of the 2026-10-09 validation (sha256 71090e2e28c9e1d99c5180d05a395ebcc891a77cc5294d315a57c691904745ac); the force-blended EI = 0 step of this release was not rerun on them because the article supplement's expData.dat, which reduce_bergdahl_waveforms.py reads, was not available. The measured phase averages are those of expData.dat, as carried in the waveform CSVs.", + "waveform_note": "Waveform metrics were computed with the executable of the 2026-10-09 validation (sha256 71090e2e28c9e1d99c5180d05a395ebcc891a77cc5294d315a57c691904745ac); the force-blended EI = 0 step of this development build was not rerun on them because the article supplement's expData.dat, which reduce_bergdahl_waveforms.py reads, was not available. The measured phase averages are those of expData.dat, as carried in the waveform CSVs.", "refinement_summary_sha256": "8ed5569e1af06b0453b8075d440eb362fdf8a2c651cab8fc2a9c6d5e2a7e61d5" } From 9923d96d66ba5853e1350ff2f634066dc8ca194c Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Fri, 16 Oct 2026 21:31:35 +0900 Subject: [PATCH 06/11] test(dynamics): platform-robust bound on the viscoelastic slack peak The viscoelastic light cable in 3 m heave at dtM 0.1 s peaks at the anchor at 8.1e4 N with gfortran on Windows and 5.6e4 N on Linux: at that step the snap is not resolved in time (the run notes it), so the peak depends on round-off. The test's lower bound of 6.5e4 N failed on Linux; it now only asks that the snap reaches the anchor (4.0e4 N). The upper bound of 1.0e5 N, which checks the release cap against the 1.45e5 N of the uncapped law segments, is unchanged. The CHANGELOG and theory quote the range 0.056 to 0.081 MN. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 5 +++-- doc/theory.rst | 5 +++-- tests/test_ei0_slack_dynamics.f90 | 7 +++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dabd20a5..a5b6cd51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -186,8 +186,9 @@ All notable changes to CableDyn are recorded in this file. The format follows taut to slack within a step carries at most its discrete energy gradient (the strain energy it releases over the shortening), so a release can no longer create energy; the viscoelastic and Syrope segments are capped the same way with the tension of their law (the same cable made - lightly damped viscoelastic peaks at 0.081 MN at the anchor at `dtM` 0.1 s, against 0.145 MN - without the cap on its segments and 0.076 to 0.094 MN at 0.5 to 2.5 ms). The seabed contact of + lightly damped viscoelastic peaks at 0.056 to 0.081 MN at the anchor at `dtM` 0.1 s, a snap + that step does not resolve, against 0.145 MN without the cap on its segments and 0.076 to + 0.094 MN at 0.5 to 2.5 ms). The seabed contact of a node that lifts off within a step is not capped (see the manual's theory page). At the default `rhoInf` the reproducers now give 0.14 / 0.08 MN, 0.092 / 0.096 MN, 0.075 / 0.043 MN and 1.80 MN, as their references, and the stiff-seabed line runs to completion; the diff --git a/doc/theory.rst b/doc/theory.rst index 0045fcfc..4919d26a 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1358,8 +1358,9 @@ curve from above. So the :math:`\alpha_f` share of every segment of a tension-on at most :math:`\tfrac{1}{2} T_n e_n` in a release (a release that ends above :math:`l_0` returns at most :math:`\alpha_f T_n e_n`, and :math:`\alpha_f \le \tfrac{1}{2}`). With the light cable above made lightly damped viscoelastic (EA 8e8 | 1.6e9 N, BA 1e8 | 1e6 N s) the anchor peaks at -0.081 MN at :math:`\Delta t` = 0.1 s with the cap on its segments and at 0.145 MN without it, -against 0.076 to 0.094 MN at :math:`\Delta t` from 0.5 to 2.5 ms. A taut Syrope line in 4 m +0.056 to 0.081 MN at :math:`\Delta t` = 0.1 s with the cap on its segments (the snap is not +resolved at that step, so the peak depends on round-off: Linux and Windows builds differ) and +at 0.145 MN without it, against 0.076 to 0.094 MN at :math:`\Delta t` from 0.5 to 2.5 ms. A taut Syrope line in 4 m surge that goes slack peaks at 1.64 MN at 0.1 s, against 1.78 MN at 1 and 2.5 ms, with or without the cap. diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index 2b83140a..10112c4f 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -991,7 +991,10 @@ SUBROUTINE case_law_slack_runs() REAL(wp) :: fair, anch, seg_min ! the light cable as a lightly damped viscoelastic line, 3 m heave at dtM 0.1 s: anchor ! 7.6e4 to 9.4e4 N and fairlead 0.97e5 to 1.08e5 N at dtM 0.5 to 2.5 ms; without the cap - ! on its law segments 1.45e5 N at the anchor + ! on its law segments 1.45e5 N at the anchor. At 0.1 s the anchor snap is not resolved in + ! time (the run notes it), so its peak depends on round-off: 8.1e4 N with gfortran on + ! Windows, 5.6e4 N on Linux. The upper bound is the check of the cap; the lower bound only + ! asks that the snap reaches the anchor. CALL write_motion('ei0slack_heave_ve.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 3, 3.0_wp, 10.0_wp, 10.0_wp, & 0.1_wp, 40.0_wp) opts(1) = '0.1 dtM' @@ -1008,7 +1011,7 @@ SUBROUTINE case_law_slack_runs() WRITE (*, '(A,ES10.3,A,ES10.3,A,ES10.3,A)') ' viscoelastic light cable, dtM 0.1 s: FairTen1 max ', fair, & ' N, AnchTen1 max ', anch, ' N, smallest segment tension ', seg_min, ' N' CALL require(seg_min <= 0.0_wp, 've-slack:goes-slack') - CALL require(anch > 6.5e4_wp .AND. anch < 1.0e5_wp, 've-slack:anchor-peak') + CALL require(anch > 4.0e4_wp .AND. anch < 1.0e5_wp, 've-slack:anchor-peak') CALL require(fair > 8.0e4_wp .AND. fair < 1.2e5_wp, 've-slack:fairlead-peak') CALL require(.NOT. file_contains('ei0slack_ve_light.log', 'Warning: line'), 've-slack:no-spike-warning') ! a taut Syrope line in 4 m surge that goes slack, dtM 0.1 s: fairlead 1.78 MN at dtM 1 and From 1d03379c5ea0c6d61b6e6fe6553bc593a60c984f Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Fri, 16 Oct 2026 22:18:12 +0900 Subject: [PATCH 07/11] test(dynamics): audit checks that do not depend on a chaotic run The run-audit case drives the light cable with the configuration blend (False alpha_force_blend), whose non-physical spikes make the run chaotic: on two Linux CI runners the same commit completed once and was stopped fail-closed by a later spike once, so the snap note printed at the end of the run was missing. The configuration-blend run is now only required to warn at its first spike; the snap note is checked on the force-blended run of the same cable, which notes its snaps on every platform. A driver run that stops prints the end of its log. Signed-off-by: Jae Hoon Seo --- tests/test_ei0_slack_dynamics.f90 | 41 +++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index 10112c4f..0eb87989 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -264,6 +264,29 @@ LOGICAL FUNCTION file_contains(path, needle) RESULT(found) CLOSE (u) END FUNCTION file_contains + SUBROUTINE echo_tail(path, n) + !! Print the last n lines of a log (the reason a driver run stopped). + CHARACTER(*), INTENT(IN) :: path + INTEGER, INTENT(IN) :: n + CHARACTER(4096) :: ring(16), line + INTEGER :: u, ios, k, m, i + m = MIN(MAX(n, 1), SIZE(ring)) + k = 0 + OPEN (NEWUNIT=u, FILE=path, STATUS='OLD', ACTION='READ', IOSTAT=ios) + IF (ios /= 0) RETURN + DO + READ (u, '(A)', IOSTAT=ios) line + IF (ios /= 0) EXIT + k = k + 1 + ring(MOD(k - 1, m) + 1) = line + END DO + CLOSE (u) + WRITE (*, '(A)') ' --- end of '//path//':' + DO i = MAX(1, k - m + 1), k + WRITE (*, '(A)') ' '//TRIM(ring(MOD(i - 1, m) + 1)) + END DO + END SUBROUTINE echo_tail + SUBROUTINE run_driver_logged(deck, root, log, ok) !! Run the driver executable on a deck, its stdout and stderr to log. CHARACTER(*), INTENT(IN) :: deck, root, log @@ -474,23 +497,27 @@ END SUBROUTINE case_viscoelastic_surge SUBROUTINE case_run_audit() LOGICAL :: ok CHARACTER(64) :: opts(4) - ! the configuration blend of case 1: its spikes are reported once, as a warning + ! the configuration blend of case 1: its spikes are reported once, as a warning. Its + ! non-physical spikes make the run chaotic: whether it completes or a later spike stops it + ! fail-closed depends on round-off (it did both on Linux CI runners of the same commit), so + ! only the warning, written at the first spike, is required of it CALL light_cable_deck('ei0slack_audit_cfg.dat', 0.1_wp, 40.0_wp, 'False alpha_force_blend', '-') CALL run_driver_logged('ei0slack_audit_cfg.dat', 'ei0slack_audit_cfg', 'ei0slack_audit_cfg.log', ok) - CALL require(ok, 'audit:configuration-blend-run') + IF (.NOT. ok) CALL echo_tail('ei0slack_audit_cfg.log', 6) CALL require(file_contains('ei0slack_audit_cfg.log', 'Warning: line 1: segment '), & 'audit:configuration-blend-spike-warned') CALL require(file_contains('ei0slack_audit_cfg.log', 'for a single step'), 'audit:spike-message') - ! the snaps of the light cable (axial wave crossing a segment ~160 times per step) are noted - CALL require(file_contains('ei0slack_audit_cfg.log', 'went from slack to taut above the initial tension'), & - 'audit:snap-note') - CALL require(file_contains('ei0slack_audit_cfg.log', 'snap-load peaks are not resolved in time'), & - 'audit:snap-note-text') ! the default force blend: no spike warning CALL light_cable_deck('ei0slack_audit_fb.dat', 0.1_wp, 40.0_wp, '', '-') CALL run_driver_logged('ei0slack_audit_fb.dat', 'ei0slack_audit_fb', 'ei0slack_audit_fb.log', ok) + IF (.NOT. ok) CALL echo_tail('ei0slack_audit_fb.log', 6) CALL require(ok, 'audit:force-blend-run') CALL require(.NOT. file_contains('ei0slack_audit_fb.log', 'Warning: line'), 'audit:force-blend-no-warning') + ! the snaps of the light cable (axial wave crossing a segment ~160 times per step) are noted + CALL require(file_contains('ei0slack_audit_fb.log', 'went from slack to taut above the initial tension'), & + 'audit:snap-note') + CALL require(file_contains('ei0slack_audit_fb.log', 'snap-load peaks are not resolved in time'), & + 'audit:snap-note-text') CALL require(.NOT. file_contains('ei0slack_audit_fb.log', 'Note: rhoInf'), 'audit:default-rhoinf-no-note') ! rhoInf above 0.95 CALL light_cable_deck('ei0slack_audit_rho.dat', 0.1_wp, 12.0_wp, '0.99 rhoInf', '-') From 8f8322e73043cf753f4630a9d5a914b744e1508c Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Sat, 17 Oct 2026 00:25:08 +0900 Subject: [PATCH 08/11] fix(dynamics): cap rotating releases on the projected chord displacement The force-blended EI = 0 step keeps alpha_f T_n of a tension-only element along its step-start chord t_n for the whole step. Over the relative end displacement d_{n+1} - d_n that constant force returns alpha_f T_n p, with the projected shortening p = |d_n| - t_n . d_{n+1}, not alpha_f T_n (e_n - e_{n+1}). The release cap bounded the latter, so a segment that turns as it goes slack still returned far more than its strain energy W_n = T_n e_n / 2: a segment stretched 0.1 % that turns by 90 degrees and ends 0.1 % slack returned 160 J against 0.32 J, and a reversed chord up to 1100 W_n. The cap now bounds the work of the element's whole blend by W_n. The element carries along t_n the smaller of alpha_f T_n and (W_n + (1 - alpha_f) T_{n+1} p_{n+1}) / p, with p_{n+1} = |d_{n+1}| - t_{n+1} . d_n the displacement the end share works through. An element that ends slack carries W_n / p and returns exactly W_n. On a taut end state T_{n+1} = T_n e_{n+1} / e_n (the elastic tension; a secant for the viscoelastic and Syrope segments), so the cap fades out as the end state crosses the rest length and the residual stays continuous in q_{n+1}; a cap on slack end states alone would jump there by up to alpha_f T_n. It acts on a taut end state only when the element turned and ends below alpha_f / (1 - alpha_f) T_n, and never on an element that keeps its direction and ends taut, so taut lines are unchanged. Since the numerator is at least W_n / 2, 4 alpha_f p <= e_n decides an inactive cap without a root. The tangent follows from dp/dd_{n+1} = -t_n, dT_{n+1}/dd_{n+1} = k t_{n+1} and dp_{n+1}/dd_{n+1} = t_{n+1} - (|d_n| / |d_{n+1}|)(t_n - (t_n . t_{n+1}) t_{n+1}), on the banded and the dense path. Tests: the blend of a segment turned by 0 to 180 degrees and ending slack or taut returns at most W_n (1143 W_n before), and its force is continuous across the rest length; the finite-difference tangent of turning releases (slack end, taut end capped, taut end uncapped) and of turning law segments agrees to about 1e-10, now required below 1e-8 for every case. Every shipped example deck gives byte-identical output except the two als_volturnus line-break decks, whose tension statistics move by less than 1e-4. On the light-cable reproducer the energy the internal forces create falls from 0.19 J to 4e-4 J; its unresolved fairlead snap peaks at 0.10 MN instead of 0.14 MN, within the 0.10 to 0.18 MN it takes at steps down to 0.25 ms. The viscoelastic light cable peaks at 0.072 MN at the anchor (0.087 to 0.095 MN at 0.5 to 2.5 ms). The snap-load peak at 20 ms moves from 1.62 % to 1.54 % of its 0.5 ms reference. The Bergdahl matrix, rerun, moves from RMSE 1.59 N and MAPE 3.12 % to 1.58 N and 3.13 %, its refinement differences to 0.52 % (mesh) and 0.19 % (step). The theory page, the changelog, the validation record and the Bergdahl experiment files carry the new numbers. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 21 ++- VALIDATION.md | 10 +- doc/theory.rst | 77 +++++---- src/CableDyn_Dynamic.f90 | 91 ++++++---- tests/test_ei0_slack_dynamics.f90 | 162 ++++++++++++++---- validation/experiments/bergdahl/README.md | 10 +- .../bergdahl/aggregate_metrics.json | 16 +- .../bergdahl/comparison_summary.csv | 44 ++--- .../experiments/bergdahl/provenance.json | 12 +- .../bergdahl/refinement_summary.csv | 4 +- .../bergdahl/refinement_summary.json | 40 ++--- 11 files changed, 323 insertions(+), 164 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5b6cd51..68d0cd69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -182,22 +182,25 @@ All notable changes to CableDyn are recorded in this file. The format follows forces, `(1 − α_f) r(q_{n+1}, v_{n+1}) + α_f r(q_n, v_n)`, as the finite-EI path does, for the axial force and every dynamic load (damping, viscoelastic and Syrope laws, seabed, drag, Froude–Krylov, buoyancy; added mass stays at `q_α`). The step-start force is evaluated afresh - at the committed state, so no state is added and restarts stay exact. An element going from - taut to slack within a step carries at most its discrete energy gradient (the strain energy it - releases over the shortening), so a release can no longer create energy; the viscoelastic and - Syrope segments are capped the same way with the tension of their law (the same cable made - lightly damped viscoelastic peaks at 0.056 to 0.081 MN at the anchor at `dtM` 0.1 s, a snap - that step does not resolve, against 0.145 MN without the cap on its segments and 0.076 to - 0.094 MN at 0.5 to 2.5 ms). The seabed contact of + at the committed state, so no state is added and restarts stay exact. An element that + releases within a step returns at most its strain energy over the step, so a release can no + longer create energy. Its step-start force acts along its step-start chord for the whole step, + so the cap takes the shortening projected on that chord, which a segment that turns as it goes + slack exceeds by far (a nearly unstretched segment turning by 90° would otherwise return + hundreds of times its strain energy), and it fades out continuously as the end state crosses + the rest length. The viscoelastic and Syrope segments are capped the same way with the tension + of their law (the same cable made lightly damped viscoelastic peaks at 0.072 MN at the anchor + at `dtM` 0.1 s, a snap that step does not resolve, against 0.145 MN without the cap on its + segments and 0.087 to 0.095 MN at 0.5 to 2.5 ms). The seabed contact of a node that lifts off within a step is not capped (see the manual's theory page). At the - default `rhoInf` the reproducers now give 0.14 / 0.08 MN, 0.092 / 0.096 MN, 0.075 / 0.043 MN + default `rhoInf` the reproducers now give 0.10 / 0.09 MN, 0.092 / 0.106 MN, 0.075 / 0.043 MN and 1.80 MN, as their references, and the stiff-seabed line runs to completion; the chain–polyester anchor snap peaks at 5.8 MN at `dtM` 0.05 s, a single-step peak (4.6 MN at 0.0025 s) that the new snap note reports. On a linear element the scheme is unchanged, so taut lines keep their accuracy: every MoorDyn-C, OrcaFlex, analytic and experimental comparison that runs locally still passes, and its reported error moves by at most 0.35 percentage points (the minimum fairlead tension of the one-hour VolturnUS-S record, 0.15 % to 0.50 %; the snap-load - peak at 20 ms improves from 2.76 %, published as 2.7 %, to 1.6 %; see VALIDATION.md). Every + peak at 20 ms improves from 2.76 %, published as 2.7 %, to 1.5 %; see VALIDATION.md). Every `EI = 0` dynamic output changes. Over the shipped examples the statistics of the tensions change by at most 0.23 % (mean) and 0.9 % (maximum), except the two `als_volturnus` decks, whose pre-failure anchor snap at 250 s is resolved by one or two samples and peaks 10 % lower. diff --git a/VALIDATION.md b/VALIDATION.md index 22f3dbe2..cd0fe35a 100644 --- a/VALIDATION.md +++ b/VALIDATION.md @@ -76,13 +76,13 @@ article's methods, are compared in | **L3-6e** | Out-of-plane / 3D whirl response | OrcaFlex 11.6d | 3D curv 0.52%, interior Y env ≤1.0 mm, sag ≤22 mm, tension 0.14/0.17/0.12% | curv <3%, env <5 cm, tension <2–3% | Pass | | **L3-7** | 1-hour VolturnUS-S mooring dynamic | OrcaFlex 11.6d | `FairTen` mean 0.27%, std 0.26%, min/max 0.50/0.43%, Fourier 0.27/1.14% | ≤5% | Pass | | **L3-H** | Holcombe static lazy-wave experiment | measured marker geometry | position RMSE 1.07–1.89% of suspended length; peak marker-curvature error 0.34–5.54% | end-restraint bracket | Pass | -| **L3-B** | Bergdahl chain experiment, 30 orbit conditions | measured upper-end force | RMSE 1.59 N; MAPE 3.12%; Pearson 0.993; Lin concordance 0.989 | full published matrix | Pass | +| **L3-B** | Bergdahl chain experiment, 30 orbit conditions | measured upper-end force | RMSE 1.58 N; MAPE 3.13%; Pearson 0.993; Lin concordance 0.989 | full published matrix | Pass | | **L-fig** | Along-arc curvature overlay (CableDyn / OrcaFlex / MoorDyn-F ±4×) | 3-code committed record | CableDyn peak 0.11% from OrcaFlex | <0.5% | Pass | | **L4-1** | Coupled platform + mooring | synthetic reference | bit-for-bit | — | Pass | | **L4-1b** | VolturnUS-S coupled platform + power cable | OpenFAST v5.0.0 (CompMooring 5 vs 3) | platform DOFs <0.6% (3-seed DLC-1.1); fairlead and anchor <0.001% static | <3% platform | Pass | | **L4-1c** | Lozon lazy-wave cable under coupled FOWT motion, 3 depths | OrcaFlex 11.6d | curv amplification 0.05/0.09/0.01%; dyn curv 0.24/0.35/1.01%; tension <0.7% | ampl <2%, curv <2–3%, tension <1.5–2% | Pass | | **L4-rot** | Coupled mooring rotational stiffness | held 1° pitch geometry | upwind −16.0 kN, downwind +7.8 kN each; first-order restoring moment | signs + first-order | Pass | -| **L5-stab** | Snap-load Δt-stability | sub-CFL fine-dt (0.5 ms) self-ref | peak 1.6% at dt = 20 ms (explicit limit 3.2 ms) | — | Pass | +| **L5-stab** | Snap-load Δt-stability | sub-CFL fine-dt (0.5 ms) self-ref | peak 1.5% at dt = 20 ms (explicit limit 3.2 ms) | — | Pass | | **L5-stab** | Snap-load Δt-stability, implicit and explicit steps | MoorDyn-C explicit step limit | 20 ms implicit; ~1 ms explicit | — | Pass | | **L5-V** | VolturnUS-S 1-hr mooring wall-clock | measured, matched protocol | CableDyn 18.1–32 s across repeated runs (full Newton) vs OrcaFlex 14.5 s; heave-only config 10.3 s | — | Pass (response at L3-7) | | **L5-wc** | Wall-clock vs explicit C solver | external-C RK2 (WD chain) | L2 0.967 s vs external-C 0.541 s; traces validated | matched comparison reported | Pass measured | @@ -288,13 +288,13 @@ scripts, results, and source provenance are in - **L3-B Bergdahl dynamic chain test** ([Bergdahl et al., 2016](https://cabledyn.readthedocs.io/en/latest/references.html#ref-bergdahl2016)): over the full 30-condition period-radius matrix, cycle-maximum upper-end force - has RMSE 1.59 N, mean absolute percentage error 3.12%, Pearson correlation + has RMSE 1.58 N, mean absolute percentage error 3.13%, Pearson correlation 0.993, and Lin concordance 0.989. Two phase-averaged measured histories have waveform RMSEs of 5.95% and 2.54% of their force ranges; these two were computed with the executable of the 2026-10-09 record (the configuration-blended `EI = 0` step), because the article supplement's `expData.dat` they need was not available for the rerun (see the experiment's README and `provenance.json`). Halving the mesh length - and the time step changes the mean cycle maximum by at most 0.34% and 0.22%. The + and the time step changes the mean cycle maximum by at most 0.52% and 0.19%. The 0.3125 ms step resolves the segment axial modes that the snap loads excite; at 1.25 ms the maxima are 2–15% higher and vary from cycle to cycle. @@ -377,7 +377,7 @@ scripts, results, and source provenance are in - **Snap load** (`snap_load`): a grounded tension-only line goes slack, then snaps to ~10 MN. Implicit generalised-α integrates it at **dt = 20 ms, above the explicit CFL limit of about 3.2 ms**, with every step converged (stable up to about - 30 ms in a sweep); the peak is within **1.6%** of the 0.5 ms sub-CFL reference + 30 ms in a sweep); the peak is within **1.5%** of the 0.5 ms sub-CFL reference (1.1% at 10 ms, 0.05% at 5 ms). Before the force-blended `EI = 0` step these were 2.76 / 0.62 / 0.16%; the 2.76% at 20 ms is the value published as 2.7% (truncated). - **Implicit and explicit steps**: on the matched near-taut snap, MoorDyn-C's diff --git a/doc/theory.rst b/doc/theory.rst index 4919d26a..55949c18 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1329,38 +1329,57 @@ was 0.2 m slack reports about 30 MN. A mass dropped 1 m onto a tension-only spri blend, against the resolved 0.35 MN; the force blend gives 5.7 kN, the under-resolved impact dissipated as at :math:`\rho_\infty = 0`. -**Release cap.** The force blend alone still creates energy when a taut element goes slack -within one step. An element with tension :math:`T_n` and stretch :math:`e_n = l_n - l_0 > 0` at -:math:`t_n` and :math:`e_{n+1} < 0` at :math:`t_{n+1}` carries :math:`\alpha_f T_n` along its -step-start chord while it shortens by :math:`e_n - e_{n+1}`. That force returns the work -:math:`\alpha_f T_n (e_n - e_{n+1})` to the motion, but the element released only its strain -energy :math:`W_n = \tfrac{1}{2} T_n e_n`: a release deeper than -:math:`e_n (1/(2\alpha_f) - 1)` (0.75 :math:`e_n` at :math:`\rho_\infty = 0.4`) creates energy. -On a slack light cable this feeds a sustained rattle of single-step tension spikes. Such an -element carries instead the discrete energy gradient :math:`W_n/(e_n - e_{n+1})`, which returns -exactly :math:`W_n`; the smaller of the two is kept, so the blend is continuous in -:math:`e_{n+1}`, and the residual and the tangent take the difference. Every taut element, every -element going taut (where the force blend dissipates), and every line that allows compression -keep the force blend. In the slack-cable case above the internal forces created 2.7e8 J over -20 s with the configuration blend and 6.7e7 J with the force blend alone, and 0.2 J (round-off) -with the cap; the fairlead peak is 0.14 MN, against 0.13 to 0.19 MN at -:math:`\rho_\infty = 0` and at :math:`\Delta t` down to 0.25 ms. For a linear element the force -blend and the cap reduce to the configuration blend, so the linear spectral properties and the -second-order accuracy are unchanged. +**Release cap.** The force blend alone still creates energy when a taut element releases +within one step. An element with tension :math:`T_n`, stretch :math:`e_n = l_n - l_0 > 0` and +chord :math:`\mathbf{d}_n = l_n \mathbf{t}_n` at :math:`t_n` keeps :math:`\alpha_f T_n` along +:math:`\mathbf{t}_n` for the whole step, a constant force. Over the relative displacement +:math:`\mathbf{d}_{n+1} - \mathbf{d}_n` of its ends it returns the work :math:`\alpha_f T_n p` to +the motion, with the projected shortening :math:`p = l_n - \mathbf{t}_n \cdot \mathbf{d}_{n+1}`. +This is not the shortening :math:`e_n - e_{n+1}` of the element: since +:math:`p = (e_n - e_{n+1}) + l_{n+1}(1 - \mathbf{t}_n \cdot \mathbf{t}_{n+1})`, a segment that +turns as it releases moves much further against that force than it shortens. The end share +:math:`(1 - \alpha_f) T_{n+1} \mathbf{t}_{n+1}` returns :math:`-(1 - \alpha_f) T_{n+1} p_{n+1}`, +with :math:`p_{n+1} = l_{n+1} - \mathbf{t}_{n+1} \cdot \mathbf{d}_n`. The element released only +its strain energy :math:`W_n = \tfrac{1}{2} T_n e_n`. An element that ends slack +(:math:`T_{n+1} = 0`) therefore creates energy once :math:`p > e_n/(2\alpha_f)`: along a fixed +chord, a release deeper than :math:`e_n (1/(2\alpha_f) - 1)` (0.75 :math:`e_n` at +:math:`\rho_\infty = 0.4`); a nearly unstretched segment that turns by 90° returns about +:math:`\alpha_f T_n l_n`, hundreds of times :math:`W_n`. On a slack light cable this feeds a +sustained rattle of single-step tension spikes. The cap bounds the work of the element's blended +force by :math:`W_n`: along :math:`\mathbf{t}_n` the element carries the smaller of +:math:`\alpha_f T_n` and :math:`(W_n + (1 - \alpha_f) T_{n+1} p_{n+1})/p`, which is the discrete +energy gradient :math:`W_n/p` when it ends slack, and the residual and the tangent take the +difference (:math:`\partial p/\partial \mathbf{d}_{n+1} = -\mathbf{t}_n`). With +:math:`T_{n+1} = T_n e_{n+1}/e_n`, the tension of a linear element, the cap fades out as the end +state crosses the rest length, so the residual stays continuous in :math:`\mathbf{q}_{n+1}`. A +cap on the slack end states alone would jump there, by up to :math:`\alpha_f T_n` for a turned +element. The cap does not act on an element that ends above :math:`\alpha_f/(1 - \alpha_f)\,T_n` +(0.4 :math:`T_n`), nor on one that keeps its direction and ends taut, nor on one slack at +:math:`t_n`: those elements, every element going taut (where the force blend dissipates), and +every line that allows compression keep the force blend. In the slack-cable case above the +internal forces created 2.7e8 J over 20 s with the configuration blend, 6.7e7 J with the force +blend alone, 0.19 J with a cap on :math:`e_n - e_{n+1}` (the turn of the releasing segments) and +4e-4 J (round-off) with the projected cap. The fairlead peak is 0.10 MN. The snap is not +resolved in time: with the cap the peak ranges from 0.10 to 0.18 MN over :math:`\Delta t` from +2.5 to 0.25 ms, against 0.13 to 0.19 MN at :math:`\rho_\infty = 0`. For a linear element the +force blend and the cap reduce to the configuration blend, so the linear spectral properties and +the second-order accuracy are unchanged. The segments whose tension comes from a constitutive law, the viscoelastic and Syrope segments (whose law enters the step as a dynamic load), are capped in the same way: :math:`T_n` is the law's tension at the committed state, the force :math:`\mathbf{r}_n` carries, with the same -:math:`e_n` and :math:`W_n = \tfrac{1}{2} T_n e_n`. For the viscoelastic law at rest this is the -energy of its two springs, which both carry :math:`T_n` and whose stretches add up to -:math:`e_n`; for the Syrope law, whose loading curve stiffens, it bounds the energy below the -curve from above. So the :math:`\alpha_f` share of every segment of a tension-only line returns -at most :math:`\tfrac{1}{2} T_n e_n` in a release (a release that ends above :math:`l_0` returns -at most :math:`\alpha_f T_n e_n`, and :math:`\alpha_f \le \tfrac{1}{2}`). With the light cable -above made lightly damped viscoelastic (EA 8e8 | 1.6e9 N, BA 1e8 | 1e6 N s) the anchor peaks at -0.056 to 0.081 MN at :math:`\Delta t` = 0.1 s with the cap on its segments (the snap is not -resolved at that step, so the peak depends on round-off: Linux and Windows builds differ) and -at 0.145 MN without it, against 0.076 to 0.094 MN at :math:`\Delta t` from 0.5 to 2.5 ms. A taut Syrope line in 4 m +:math:`e_n`, :math:`W_n = \tfrac{1}{2} T_n e_n` and secant end tension +:math:`T_{n+1} = T_n e_{n+1}/e_n`. For the viscoelastic law at rest :math:`W_n` is the energy of +its two springs, which both carry :math:`T_n` and whose stretches add up to :math:`e_n`; for the +Syrope law, whose loading curve stiffens, it bounds the energy below the curve from above. So the +blend of every segment of a tension-only line that ends slack returns at most +:math:`\tfrac{1}{2} T_n e_n` over the step, and so does that of an elastic segment that ends +taut; for a law segment that ends taut the bound holds with the secant end tension in place of +the law's. With the light cable above made lightly damped viscoelastic (EA 8e8 | 1.6e9 N, +BA 1e8 | 1e6 N s) the anchor peaks at 0.072 MN at :math:`\Delta t` = 0.1 s with the cap on its +segments (the snap is not resolved at that step, so the peak depends on round-off: other +compilers and platforms give other values) and at 0.145 MN without it, against 0.087 to +0.095 MN at :math:`\Delta t` from 0.5 to 2.5 ms. A taut Syrope line in 4 m surge that goes slack peaks at 1.64 MN at 0.1 s, against 1.78 MN at 1 and 2.5 ms, with or without the cap. @@ -1467,7 +1486,7 @@ partly subdivided state is ever committed. **Step size.** Being implicit, the scheme is not bound by the explicit axial-wave limit. In the snap-load verification a slack line snapping to about 10 MN integrates stably at :math:`\Delta t = 20\,\mathrm{ms}`, well above the explicit limit of 3.2 ms, with the peak -within 1.6% of a 0.5 ms reference (:doc:`validation`). The time step must still resolve the +within 1.5% of a 0.5 ms reference (:doc:`validation`). The time step must still resolve the response of interest and, for explicitly integrated points and bodies (below), their own stability limit. The standalone driver audits every ``EI = 0`` line on the initial state and at each output step, and reports at the end of the run: diff --git a/src/CableDyn_Dynamic.f90 b/src/CableDyn_Dynamic.f90 index 30230005..9e030930 100644 --- a/src/CableDyn_Dynamic.f90 +++ b/src/CableDyn_Dynamic.f90 @@ -13,7 +13,7 @@ MODULE CableDyn_Dynamic !! over dt by solving the force-blended residual (GenAlphaConfig%force_blend, default) !! R(q) = M a_alpha + (1 - alpha_f) r(q_{n+1}, v_{n+1}) + alpha_f r(q_n, v_n) = 0, !! r = f_int - f_ext - f_load, - !! with a release cap on tension-only elements that go slack within the step (see + !! with a release cap on tension-only elements that release within the step (see !! apply_release_cap), or the configuration-blended R(q) = M a_alpha + f_int(q_alpha) - ..., !! for the Newton variable q = q_{n+1} with a Newton + Armijo line search on the !! 1/2||R||^2 merit. Optional callbacks add dynamic loads, force-only residual @@ -661,7 +661,7 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on !! elements (ea = 0 there; the viscoelastic and Syrope elements of a line model): the !! step-start tension of each element (n_elem), the along-chord force of that law in !! start_load (or in the step-start load the step evaluates). The release cap then bounds - !! the alpha_f share of those elements as it bounds that of the elastic ones; entries of + !! the force blend of those elements as it bounds that of the elastic ones; entries of !! elements with ea > 0 are ignored. Absent: the cap covers the elastic elements only. REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:) !! TEST HOOK (unit tests of the tangent; production callers omit it). With probe_q (full @@ -1978,50 +1978,83 @@ END SUBROUTINE eval_dynamic SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) !! Release cap of the force blend. A tension-only element taut at t_n (tension T_0, - !! stretch e_0 = l_n - l0 > 0) and slack at t_{n+1} (e_1 < 0) carries alpha_f T_0 along - !! its step-start chord in the blended residual. While the element shortens by - !! e_0 - e_1 that force returns the work alpha_f T_0 (e_0 - e_1) to the motion, but the - !! element only released its strain energy W_0 = T_0 e_0/2: a release deeper than - !! e_0 (1/(2 alpha_f) - 1) within one step would create energy. Such an element instead - !! carries the discrete energy gradient W_0/(e_0 - e_1), which returns exactly W_0 (the - !! smaller of the two is kept, so the blend is continuous in e_1). Every other element, - !! and every taut one, keeps the force blend. The residual and the tangent are corrected - !! by the difference. An element whose axial law a load callback carries (ea = 0, T_0 - !! from start_tension) is capped the same way with the same W_0 = T_0 e_0/2: the energy - !! of the viscoelastic springs at rest, and an upper bound of the energy below a - !! stiffening loading curve such as Syrope's, so the alpha_f share of every - !! tension-only element returns at most T_0 e_0/2 over a release. + !! stretch e_0 = l_n - l0 > 0, chord d_0 = l_n t_0) carries alpha_f T_0 along its + !! step-start chord t_0 in the blended residual, a constant force over the step. Over the + !! relative displacement d_1 - d_0 of its ends it returns the work alpha_f T_0 p to the + !! motion, with the projected shortening p = l_n - t_0 . d_1, not the shortening + !! e_0 - e_1 = l_n - |d_1|: a segment that turns as it releases has p well above e_0 - e_1 + !! (up to l_n + |d_1| for a reversed chord). The end share (1 - alpha_f) T_1 t_1, T_1 the + !! tension at t_{n+1}, returns -(1 - alpha_f) T_1 p_1 with p_1 = |d_1| - t_1 . d_0. The + !! element itself only released its strain energy W_0 = T_0 e_0/2, so the blend of an + !! element that releases (deeply, or turning) within one step can create energy. The cap + !! bounds the work of the blended force by W_0: when alpha_f T_0 p exceeds + !! N = W_0 + (1 - alpha_f) T_1 p_1 the element carries N/p instead of alpha_f T_0 along t_0 + !! (the smaller of the two is kept, so the blend is continuous in d_1). An element slack at + !! t_{n+1} (T_1 = 0) carries the discrete energy gradient W_0/p and returns exactly W_0. + !! For e_1 > 0, T_1 = T_0 e_1/e_0, the tension of an elastic element, so the cap fades out + !! continuously as the end state crosses the rest length (a cap on slack end states alone + !! would jump there by up to alpha_f T_0). It acts on a taut end state only when the + !! element turned and T_1 < alpha_f/(1 - alpha_f) T_0; an element slack at t_n keeps the + !! force blend. N >= W_0/2 always, so 4 alpha_f p <= e_0 is a sufficient test of an + !! inactive cap. The residual and the tangent are corrected by the difference. An element + !! whose axial law a load callback carries (ea = 0, T_0 from start_tension) is capped the + !! same way with the same W_0 = T_0 e_0/2 (the energy of the viscoelastic springs at + !! rest, an upper bound of the energy below a stiffening loading curve such as Syrope's) + !! and the same secant T_1, so the blend of every tension-only element that ends slack + !! returns at most T_0 e_0/2 (an elastic one also when it ends taut). REAL(wp), INTENT(IN) :: q_eval(:) REAL(wp), INTENT(INOUT) :: Rout(:) REAL(wp), INTENT(INOUT), OPTIONAL :: effout(:, :), effbandout(:, :) INTEGER :: e, na, nb, i, j, gi(6), fi, fj - REAL(wp) :: d1(3), l1, e1, e0, t0, den, dg, delta, ddg, t1(3), blk(3, 3), sgn + REAL(wp) :: d1(3), l1, e1, e0, t0, p, p1, num, ln, k0, ten1, cosang, dg, delta, t1(3), g(3), blk(3, 3), sgn + LOGICAL :: taut_end DO e = 1, n_elem t0 = tension_n(e) IF (.NOT. t0 > CD_ZERO) CYCLE na = elem_conn(1, e) nb = elem_conn(2, e) d1 = q_eval(3*nb - 2:3*nb) - q_eval(3*na - 2:3*na) - ! a taut end state (the common case) is decided on the squared length, without a root - IF (d1(1)*d1(1) + d1(2)*d1(2) + d1(3)*d1(3) >= l0(e)*l0(e)) CYCLE - l1 = NORM2(d1) - e1 = l1 - l0(e) - IF (e1 >= CD_ZERO) CYCLE e0 = stretch_n(e) - den = e0 - e1 - dg = 0.5_wp*t0*e0/den + ! projected shortening p = l_n - t_0 . d_1 (l_n = l0 + e_0); the common case, an element + ! that does not release, is decided here without a root + p = e0 + (l0(e) - (chord_n(1, e)*d1(1) + chord_n(2, e)*d1(2) + chord_n(3, e)*d1(3))) + IF (.NOT. 4.0_wp*alpha_f*p > e0) CYCLE + num = 0.5_wp*t0*e0 + taut_end = d1(1)*d1(1) + d1(2)*d1(2) + d1(3)*d1(3) > l0(e)*l0(e) + l1 = CD_ZERO + e1 = CD_ZERO + ten1 = CD_ZERO + IF (taut_end) THEN + ! the end share's work: p_1 = |d_1| - t_1 . d_0 = (e_1 - e_0) + l_n (1 - t_1 . t_0), + ! with 1 - t_1 . t_0 = |t_1 - t_0|^2/2 (no cancellation at small turns) + l1 = NORM2(d1) + e1 = l1 - l0(e) + taut_end = e1 > CD_ZERO + END IF + IF (taut_end) THEN + ln = l0(e) + e0 + k0 = t0/e0 + ten1 = k0*e1 + t1 = d1/l1 + cosang = t1(1)*chord_n(1, e) + t1(2)*chord_n(2, e) + t1(3)*chord_n(3, e) + p1 = (e1 - e0) + 0.5_wp*ln*((t1(1) - chord_n(1, e))**2 + (t1(2) - chord_n(2, e))**2 + & + (t1(3) - chord_n(3, e))**2) + num = num + (CD_ONE - alpha_f)*ten1*p1 + END IF + dg = num/p IF (dg >= alpha_f*t0) CYCLE delta = dg - alpha_f*t0 Rout(3*na - 2:3*na) = Rout(3*na - 2:3*na) - delta*chord_n(:, e) Rout(3*nb - 2:3*nb) = Rout(3*nb - 2:3*nb) + delta*chord_n(:, e) IF (.NOT. (PRESENT(effout) .OR. PRESENT(effbandout))) CYCLE - ! d(delta)/d(x_b) = ddg t1, d(delta)/d(x_a) = -ddg t1 - IF (.NOT. l1 > CD_ZERO) CYCLE - t1 = d1/l1 - ddg = 0.5_wp*t0*e0/(den*den) + ! d(delta)/d(x_b) = g, d(delta)/d(x_a) = -g, with dp/dd_1 = -t_0, + ! dT_1/dd_1 = k0 t_1 and dp_1/dd_1 = t_1 - (l_n/|d_1|)(t_0 - (t_1 . t_0) t_1) + g = (num/(p*p))*chord_n(:, e) + IF (taut_end) g = g + ((CD_ONE - alpha_f)/p)*((k0*p1 + ten1)*t1 - & + ten1*(ln/l1)*(chord_n(:, e) - cosang*t1)) DO j = 1, 3 DO i = 1, 3 - blk(i, j) = ddg*chord_n(i, e)*t1(j) + blk(i, j) = chord_n(i, e)*g(j) END DO END DO DO i = 1, 3 @@ -2030,7 +2063,7 @@ SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) END DO DO j = 1, 6 DO i = 1, 6 - ! rows of node a carry -delta t0, columns of node a d(delta)/d(x_a) = -ddg t1 + ! rows of node a carry -delta t_0, columns of node a d(delta)/d(x_a) = -g sgn = MERGE(-CD_ONE, CD_ONE, i <= 3)*MERGE(-CD_ONE, CD_ONE, j <= 3) IF (PRESENT(effout)) THEN effout(gi(i), gi(j)) = effout(gi(i), gi(j)) + sgn*blk(MOD(i - 1, 3) + 1, MOD(j - 1, 3) + 1) diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index 0eb87989..d775354d 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -21,12 +21,18 @@ PROGRAM test_ei0_slack_dynamics !! residual (the step's probe_q hook), on a three-segment tension-only chain with one fixed !! node: all segments taut at t_n and at the trial state (release cap inactive), a segment !! taut at t_n and deeply slack at the trial state (cap active, its energy-gradient force - !! W_n/(e_n - e_{n+1}) and tangent), and a segment slack at both states; each on the - !! banded and the dense path. The cap's residual is also checked against the closed form. + !! W_n/p on the projected shortening p and tangent), a segment slack at both states, and a + !! segment that turns by 45 degrees and ends slack (capped), taut at a tenth of its + !! tension (capped with the work of the end share) or taut at 3/4 of it (not capped); + !! each on the banded and the dense path. The residual is also checked against the closed + !! form. The blend of a segment that turns by 0 to 180 degrees within the step and ends + !! slack or taut returns at most its step-start strain energy W_n (up to 1100 W_n before + !! the cap took the projected shortening), and its force is continuous across the rest + !! length. !! 6. The same chain with a segment whose tension-only law a load callback carries (ea = 0, !! as the viscoelastic and Syrope segments of a line model): with its step-start tension - !! (start_tension) its deep release is capped like an elastic one, closed form and finite - !! difference tangent; without it the segment keeps the plain force blend. + !! (start_tension) its release, deep or turning, is capped like an elastic one, closed + !! form and finite difference tangent; without it the segment keeps the plain force blend. !! 7. The finite-difference tangent of the step with nonzero dynamic loads (a quadratic drag !! and a cubic position load, plus a position-dependent added mass on the dense path), and !! the closed form of the blended load (1 - alpha_f) f(q_{n+1}, v_{n+1}) + alpha_f f(q_n, v_n). @@ -62,6 +68,7 @@ PROGRAM test_ei0_slack_dynamics driver = '' IF (COMMAND_ARGUMENT_COUNT() >= 1) CALL GET_COMMAND_ARGUMENT(1, driver) CALL case_tangent_consistency() + CALL case_release_energy() CALL case_law_release_cap() CALL case_load_share_tangent() CALL case_warm_resolve_reuse() @@ -324,12 +331,15 @@ END SUBROUTINE chain_nodes SUBROUTINE blended_force(qn, q1, l0, ea, alpha_f, capped, f) !! Closed form of the blended internal force (1 - alpha_f) f(q1) + alpha_f f(qn) of the - !! tension-only chain, with the release cap (capped) or without it. + !! tension-only chain, with the release cap (capped) or without it: the retained share + !! alpha_f T_n along the step-start chord t_n is at most + !! (W_n + (1 - alpha_f) T_1 p_1)/p, W_n = T_n e_n/2, with the projected shortening + !! p = |d_n| - t_n . d_1 and p_1 = |d_1| - t_1 . d_n, so that the blend returns at most W_n. REAL(wp), INTENT(IN) :: qn(12), q1(12), l0(3), ea(3), alpha_f LOGICAL, INTENT(IN) :: capped REAL(wp), INTENT(OUT) :: f(12) INTEGER :: e - REAL(wp) :: dn(3), d1(3), ln, l1, t0, t1, e0, e1, dg, share(3) + REAL(wp) :: dn(3), d1(3), ln, l1, t0, t1, e0, dg, p, p1, share(3) f = 0.0_wp DO e = 1, 3 dn = qn(3*e + 1:3*e + 3) - qn(3*e - 2:3*e) @@ -339,9 +349,10 @@ SUBROUTINE blended_force(qn, q1, l0, ea, alpha_f, capped, f) t0 = MAX(0.0_wp, ea(e)*(ln/l0(e) - 1.0_wp)) t1 = MAX(0.0_wp, ea(e)*(l1/l0(e) - 1.0_wp)) e0 = ln - l0(e) - e1 = l1 - l0(e) dg = alpha_f*t0 - IF (capped .AND. t0 > 0.0_wp .AND. e1 < 0.0_wp) dg = MIN(dg, 0.5_wp*t0*e0/(e0 - e1)) + p = ln - DOT_PRODUCT(dn/ln, d1) + p1 = l1 - DOT_PRODUCT(d1/l1, dn) + IF (capped .AND. t0 > 0.0_wp .AND. p > 0.0_wp) dg = MIN(dg, (0.5_wp*t0*e0 + (1.0_wp - alpha_f)*t1*p1)/p) share = (1.0_wp - alpha_f)*t1*d1/l1 + dg*dn/ln f(3*e - 2:3*e) = f(3*e - 2:3*e) - share f(3*e + 1:3*e + 3) = f(3*e + 1:3*e + 3) + share @@ -378,12 +389,14 @@ SUBROUTINE probe_step(qn, vn, an, q1, l0, ea, rho_a, dense, R, K) END IF END SUBROUTINE probe_step - SUBROUTINE tangent_config(label, strain_n, strain_1, expect_cap) + SUBROUTINE tangent_config(label, strain_n, strain_1, expect_cap, dirs_trial) !! One configuration of the three-segment chain (node 1 fixed): segment strains at t_n and !! at the trial state of the step, t_n at rest but for a small velocity and acceleration. + !! dirs_trial: the segment directions at the trial state (default: turned a few degrees). CHARACTER(*), INTENT(IN) :: label REAL(wp), INTENT(IN) :: strain_n(3), strain_1(3) LOGICAL, INTENT(IN) :: expect_cap + REAL(wp), INTENT(IN), OPTIONAL :: dirs_trial(3, 3) REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.8e6_wp] REAL(wp), PARAMETER :: DIRS_N(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) @@ -396,7 +409,11 @@ SUBROUTINE tangent_config(label, strain_n, strain_1, expect_cap) LOGICAL :: dense free = [(i + 3, i=1, 9)] CALL chain_nodes(DIRS_N, strain_n, L0, qn) - CALL chain_nodes(DIRS_1, strain_1, L0, q1) + IF (PRESENT(dirs_trial)) THEN + CALL chain_nodes(dirs_trial, strain_1, L0, q1) + ELSE + CALL chain_nodes(DIRS_1, strain_1, L0, q1) + END IF vn = 0.0_wp an = 0.0_wp DO i = 4, 12 @@ -431,11 +448,14 @@ SUBROUTINE tangent_config(label, strain_n, strain_1, expect_cap) scale = MAXVAL(ABS(K)) err = MAXVAL(ABS(K - Kfd))/scale WRITE (*, '(A,A,A,L1,A,ES9.2)') ' tangent ', label, ' dense=', dense, ': max |K - K_fd|/max|K| = ', err - CALL require(err < 1.0e-6_wp, 'tangent:'//label//TRIM(MERGE(':dense ', ':banded', dense))//':fd-tangent') + CALL require(err < 1.0e-8_wp, 'tangent:'//label//TRIM(MERGE(':dense ', ':banded', dense))//':fd-tangent') END DO END SUBROUTINE tangent_config SUBROUTINE case_tangent_consistency() + ! segment 1 turned by 45 degrees from (1, 0.2, 0.1), the others as in DIRS_1 + REAL(wp), PARAMETER :: DIRS_TURN(3, 3) = RESHAPE([0.6_wp, 0.9_wp, 0.1_wp, 0.36_wp, 1.0_wp, -0.12_wp, & + -0.12_wp, 0.46_wp, 1.0_wp], [3, 3]) ! (a) all segments taut at t_n and at the trial state: the cap is inactive CALL tangent_config('taut-taut', [0.010_wp, 0.020_wp, 0.010_wp], [0.020_wp, 0.015_wp, 0.020_wp], .FALSE.) ! (b) segment 1 taut at t_n and deeply slack at the trial state (release deeper than @@ -443,8 +463,73 @@ SUBROUTINE case_tangent_consistency() CALL tangent_config('release-cap', [0.010_wp, 0.020_wp, 0.010_wp], [-0.050_wp, 0.015_wp, 0.020_wp], .TRUE.) ! (c) segment 2 slack at both states CALL tangent_config('slack-slack', [0.010_wp, -0.020_wp, 0.010_wp], [0.020_wp, -0.030_wp, 0.015_wp], .FALSE.) + ! (d) segment 1 turns by 45 degrees and ends 0.05 % slack, a quarter of its stretch e_n + ! below the rest length (the former cap on e_n - e_{n+1} left it uncapped), but shortens + ! by about 150 e_n along its step-start chord: capped at W_n/p + CALL tangent_config('turning-release', [0.002_wp, 0.020_wp, 0.010_wp], [-0.0005_wp, 0.015_wp, 0.020_wp], & + .TRUE., DIRS_TURN) + ! (e) the same turn ending taut at a tenth of its step-start tension: capped with the work + ! of the end share, (W_n + (1 - alpha_f) T_1 p_1)/p + CALL tangent_config('turning-taut-release', [0.002_wp, 0.020_wp, 0.010_wp], [0.0002_wp, 0.015_wp, 0.020_wp], & + .TRUE., DIRS_TURN) + ! (f) the same turn ending at 3/4 of its step-start tension: the force blend is kept + CALL tangent_config('turning-taut', [0.002_wp, 0.020_wp, 0.010_wp], [0.0015_wp, 0.015_wp, 0.020_wp], & + .FALSE., DIRS_TURN) END SUBROUTINE case_tangent_consistency + SUBROUTINE case_release_energy() + !! Energy of the force blend over one step of a segment that turns while it releases: the + !! end segment of the chain (l0 0.8 m, EA 0.8e6 N, stretch e_n = 0.8 mm, W_n = 0.32 J) turns + !! by theta about an axis normal to its chord and ends at the strain s1, slack or taut, the + !! rest of the chain held. The blended force on its free node returns the work + !! W = -f . (x_{n+1} - x_n) to the motion; the retained share alone (slack end) or with the + !! end share (taut end) must return at most W_n. Before the projected cap the 90 degree turn + !! of a segment that ends 0.1 % slack returned 160 J. + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.8e6_wp] + REAL(wp), PARAMETER :: DIRS(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & + -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) + REAL(wp), PARAMETER :: THETA(8) = [0.0_wp, 2.0_wp, 5.0_wp, 20.0_wp, 45.0_wp, 90.0_wp, 135.0_wp, 180.0_wp] + REAL(wp), PARAMETER :: S1(11) = [-0.5_wp, -0.01_wp, -1.0e-3_wp, -1.0e-4_wp, -1.0e-12_wp, 1.0e-12_wp, & + 1.0e-4_wp, 2.0e-4_wp, 5.0e-4_wp, 1.0e-3_wp, 2.0e-3_wp] + REAL(wp) :: qn(12), q1(12), z(12), R(12), Rm(12), K(9, 9), tn(3), u(3), dir(3), w0, wk, wmax, ratio, jump + INTEGER :: i, j + CALL chain_nodes(DIRS, [0.010_wp, 0.020_wp, 0.001_wp], L0, qn) + z = 0.0_wp + tn = (qn(10:12) - qn(7:9))/NORM2(qn(10:12) - qn(7:9)) + u = [tn(2), -tn(1), 0.0_wp] + u = u/NORM2(u) + w0 = 0.5_wp*(EA(3)*0.001_wp)*(L0(3)*0.001_wp) + wmax = -HUGE(1.0_wp) + DO i = 1, SIZE(THETA) + DO j = 1, SIZE(S1) + dir = COS(THETA(i)*PI/180.0_wp)*tn + SIN(THETA(i)*PI/180.0_wp)*u + q1 = qn + q1(10:12) = qn(7:9) + L0(3)*(1.0_wp + S1(j))*dir + ! a nearly massless chain at rest at t_n: the residual is the blended force + CALL probe_step(qn, z, z, q1, L0, EA, [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp], .FALSE., R, K) + wk = -DOT_PRODUCT(R(10:12), q1(10:12) - qn(10:12)) + wmax = MAX(wmax, wk/w0) + IF (.NOT. wk <= w0*(1.0_wp + 1.0e-9_wp)) THEN + WRITE (*, '(A,F6.1,A,ES10.2,A,ES10.3,A,ES10.3,A)') ' release energy: theta ', THETA(i), ' s1 ', S1(j), & + ': returned ', wk, ' J, W_n ', w0, ' J' + CALL require(.FALSE., 'release-energy:bounded') + END IF + END DO + END DO + WRITE (*, '(A,ES10.3)') ' release energy: largest returned work / W_n over the turns = ', wmax + ! the retained force is continuous where the end state crosses the rest length (turned 45 deg) + dir = COS(PI/4.0_wp)*tn + SIN(PI/4.0_wp)*u + q1 = qn + q1(10:12) = qn(7:9) + L0(3)*(1.0_wp + 1.0e-12_wp)*dir + CALL probe_step(qn, z, z, q1, L0, EA, [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp], .FALSE., R, K) + q1(10:12) = qn(7:9) + L0(3)*(1.0_wp - 1.0e-12_wp)*dir + CALL probe_step(qn, z, z, q1, L0, EA, [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp], .FALSE., Rm, K) + jump = MAXVAL(ABS(R(10:12) - Rm(10:12))) + ratio = jump/(EA(3)*0.001_wp) + WRITE (*, '(A,ES10.3)') ' release energy: force jump across the rest length / T_n = ', ratio + CALL require(ratio < 1.0e-6_wp, 'release-energy:continuous-at-rest-length') + END SUBROUTINE case_release_energy + SUBROUTINE case_light_cable_coarse_step() LOGICAL :: conv INTEGER :: es @@ -718,21 +803,26 @@ SUBROUTINE fd_tangent_check(label, qn, vn, an, q1, l0, ea, rho_a, banded, start_ END DO err = MAXVAL(ABS(K - Kfd))/MAXVAL(ABS(K)) WRITE (*, '(A,A,A,L1,A,ES9.2)') ' tangent ', label, ' banded=', banded, ': max |K - K_fd|/max|K| = ', err - CALL require(err < 1.0e-6_wp, label//TRIM(MERGE(':banded', ':dense ', banded))//':fd-tangent') + CALL require(err < 1.0e-8_wp, label//TRIM(MERGE(':banded', ':dense ', banded))//':fd-tangent') END SUBROUTINE fd_tangent_check - SUBROUTINE chain_states(strain_n, strain_1, l0, qn, vn, an, q1) + SUBROUTINE chain_states(strain_n, strain_1, l0, qn, vn, an, q1, dirs_trial) !! The chain of case 5 at t_n and at the trial state, with a small velocity and - !! acceleration at t_n. + !! acceleration at t_n (dirs_trial: the segment directions at the trial state). REAL(wp), INTENT(IN) :: strain_n(3), strain_1(3), l0(3) REAL(wp), INTENT(OUT) :: qn(12), vn(12), an(12), q1(12) + REAL(wp), INTENT(IN), OPTIONAL :: dirs_trial(3, 3) REAL(wp), PARAMETER :: DIRS_N(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) REAL(wp), PARAMETER :: DIRS_1(3, 3) = RESHAPE([1.0_wp, 0.27_wp, 0.04_wp, 0.36_wp, 1.0_wp, -0.12_wp, & -0.12_wp, 0.46_wp, 1.0_wp], [3, 3]) INTEGER :: i CALL chain_nodes(DIRS_N, strain_n, l0, qn) - CALL chain_nodes(DIRS_1, strain_1, l0, q1) + IF (PRESENT(dirs_trial)) THEN + CALL chain_nodes(dirs_trial, strain_1, l0, q1) + ELSE + CALL chain_nodes(DIRS_1, strain_1, l0, q1) + END IF vn = 0.0_wp an = 0.0_wp DO i = 4, 12 @@ -753,7 +843,21 @@ END SUBROUTINE reset_chain_load SUBROUTINE case_law_release_cap() !! Segment 3 carries a tension-only law through the load callback (ea(3) = 0) and - !! releases deeply within the step. + !! releases within the step: deeply, turning by about 50 degrees as it goes slack, and + !! turning as it ends taut at a tenth of its step-start tension. + REAL(wp), PARAMETER :: DIRS_TURN(3, 3) = RESHAPE([1.0_wp, 0.27_wp, 0.04_wp, 0.36_wp, 1.0_wp, -0.12_wp, & + 0.6_wp, 0.4_wp, 0.6_wp], [3, 3]) + CALL law_cap_config('law-cap', [0.010_wp, 0.020_wp, 0.010_wp], [0.020_wp, 0.015_wp, -0.050_wp]) + CALL law_cap_config('law-cap-turning', [0.010_wp, 0.020_wp, 0.002_wp], [0.020_wp, 0.015_wp, -0.0005_wp], & + DIRS_TURN) + CALL law_cap_config('law-cap-turning-taut', [0.010_wp, 0.020_wp, 0.002_wp], [0.020_wp, 0.015_wp, 0.0002_wp], & + DIRS_TURN) + END SUBROUTINE case_law_release_cap + + SUBROUTINE law_cap_config(label, strain_n, strain_1, dirs_trial) + CHARACTER(*), INTENT(IN) :: label + REAL(wp), INTENT(IN) :: strain_n(3), strain_1(3) + REAL(wp), INTENT(IN), OPTIONAL :: dirs_trial(3, 3) REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.0_wp] REAL(wp), PARAMETER :: EA_LAW = 0.8e6_wp, ALPHA_F = 0.4_wp/1.4_wp REAL(wp) :: qn(12), vn(12), an(12), q1(12), R(12), Rnone(12), Rel(12), K(9, 9), f_cap(12), f_raw(12) @@ -763,8 +867,8 @@ SUBROUTINE case_law_release_cap() cb_law_elem = 3 cb_ea_law = EA_LAW cb_l0_law = L0(3) - CALL chain_states([0.010_wp, 0.020_wp, 0.010_wp], [0.020_wp, 0.015_wp, -0.050_wp], L0, qn, vn, an, q1) - t0 = EA_LAW*0.010_wp + CALL chain_states(strain_n, strain_1, L0, qn, vn, an, q1, dirs_trial) + t0 = EA_LAW*(NORM2(qn(10:12) - qn(7:9))/L0(3) - 1.0_wp) ! nearly massless chain at rest at t_n: the residual is the blended force CALL probe_chain(qn, 0.0_wp*vn, 0.0_wp*an, q1, L0, EA, [1.0e-9_wp, 1.0e-9_wp, 1.0e-9_wp], .TRUE., R, K, & start_tension=[0.0_wp, 0.0_wp, t0]) @@ -775,17 +879,17 @@ SUBROUTINE case_law_release_cap() CALL blended_force(qn, q1, L0, [EA(1), EA(2), EA_LAW], ALPHA_F, .TRUE., f_cap) CALL blended_force(qn, q1, L0, [EA(1), EA(2), EA_LAW], ALPHA_F, .FALSE., f_raw) scale = MAXVAL(ABS(f_raw)) - CALL require(MAXVAL(ABS(f_cap - f_raw)) > 1.0e-2_wp*scale, 'law-cap:cap-active') - CALL require(MAXVAL(ABS(R(4:12) - f_cap(4:12))) < 1.0e-6_wp*scale, 'law-cap:residual-closed-form') - CALL require(MAXVAL(ABS(Rnone(4:12) - f_raw(4:12))) < 1.0e-6_wp*scale, 'law-cap:no-start-tension-uncapped') - CALL require(ALL(TRANSFER(Rel, [0_I8]) == TRANSFER(R, [0_I8])), 'law-cap:elastic-entries-ignored') + CALL require(MAXVAL(ABS(f_cap - f_raw)) > 1.0e-2_wp*scale, label//':cap-active') + CALL require(MAXVAL(ABS(R(4:12) - f_cap(4:12))) < 1.0e-6_wp*scale, label//':residual-closed-form') + CALL require(MAXVAL(ABS(Rnone(4:12) - f_raw(4:12))) < 1.0e-6_wp*scale, label//':no-start-tension-uncapped') + CALL require(ALL(TRANSFER(Rel, [0_I8]) == TRANSFER(R, [0_I8])), label//':elastic-entries-ignored') ! the tangent with inertia, on both paths - CALL fd_tangent_check('law-cap', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .TRUE., & + CALL fd_tangent_check(label, qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .TRUE., & start_tension=[0.0_wp, 0.0_wp, t0]) - CALL fd_tangent_check('law-cap', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .FALSE., & + CALL fd_tangent_check(label, qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .FALSE., & start_tension=[0.0_wp, 0.0_wp, t0]) CALL reset_chain_load() - END SUBROUTINE case_law_release_cap + END SUBROUTINE law_cap_config SUBROUTINE case_load_share_tangent() !! All segments elastic and taut; the callback load carries a quadratic drag and a cubic @@ -1017,11 +1121,11 @@ SUBROUTINE case_law_slack_runs() CHARACTER(64) :: opts(4) REAL(wp) :: fair, anch, seg_min ! the light cable as a lightly damped viscoelastic line, 3 m heave at dtM 0.1 s: anchor - ! 7.6e4 to 9.4e4 N and fairlead 0.97e5 to 1.08e5 N at dtM 0.5 to 2.5 ms; without the cap + ! 8.7e4 to 9.5e4 N and fairlead 0.97e5 to 1.11e5 N at dtM 0.5 to 2.5 ms; without the cap ! on its law segments 1.45e5 N at the anchor. At 0.1 s the anchor snap is not resolved in - ! time (the run notes it), so its peak depends on round-off: 8.1e4 N with gfortran on - ! Windows, 5.6e4 N on Linux. The upper bound is the check of the cap; the lower bound only - ! asks that the snap reaches the anchor. + ! time (the run notes it), so its peak depends on round-off: 7.2e4 N with gfortran on + ! Windows, other values on other platforms. The upper bound is the check of the cap; the + ! lower bound only asks that the snap reaches the anchor. CALL write_motion('ei0slack_heave_ve.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 3, 3.0_wp, 10.0_wp, 10.0_wp, & 0.1_wp, 40.0_wp) opts(1) = '0.1 dtM' diff --git a/validation/experiments/bergdahl/README.md b/validation/experiments/bergdahl/README.md index dd657eb7..1d7a615b 100644 --- a/validation/experiments/bergdahl/README.md +++ b/validation/experiments/bergdahl/README.md @@ -70,11 +70,11 @@ committed summary file (`sha256sum`, or `Get-FileHash` in PowerShell). `comparison_summary.csv`, `aggregate_metrics.json` and `provenance.json` hold the compact results and the checksum of the executable used. The calculated force is `FairTen1`, the force -at the upper line end. Across the 30 conditions, the cycle maxima have an RMSE of 1.59 N, a -mean absolute percentage error of 3.12%, a mean bias of +0.45 N, a Pearson correlation of 0.993 +at the upper line end. Across the 30 conditions, the cycle maxima have an RMSE of 1.58 N, a +mean absolute percentage error of 3.13%, a mean bias of +0.46 N, a Pearson correlation of 0.993 and a Lin concordance coefficient of 0.989. For the two waveform conditions, halving the nominal -element length and the time step changes the mean cycle maximum by no more than 0.34% and -0.22%, respectively, and the phase-averaged force histories have RMSEs of 5.95% and 2.54% of +element length and the time step changes the mean cycle maximum by no more than 0.52% and +0.19%, respectively, and the phase-averaged force histories have RMSEs of 5.95% and 2.54% of the measured force range (computed with the executable of the 2026-10-09 record; see `provenance.json`). The waveform CSVs carry the measured phase averages computed from the supplement's `expData.dat`. @@ -86,7 +86,7 @@ modes up to about 2c/l ≈ 3500 rad/s. The force maxima are snap loads, which co step only once the step resolves these modes, roughly dtM ≲ l/(2c) ≈ 0.29 ms (see "Snap loads on slack lines" in the [modelling guide](https://cabledyn.readthedocs.io/en/latest/modeling.html)). At a coarser step the maxima do not settle: at the T = 1.25 s, 0.20 m condition they are -71.7 N at 0.625 ms, against 68.0 N at 0.3125 ms and 67.9 N at 0.15625 ms. Coarse steps also +72.2 N at 0.625 ms, against 68.0 N at 0.3125 ms and 67.8 N at 0.15625 ms. Coarse steps also leave the maxima sensitive to the Newton tolerance and to small changes in the solver's iteration path. With a 1.25 ms step and a relative tolerance of 1e-5, the five cycle maxima of a condition have standard deviations of up to 1.6 N, their means are 2–15% above the converged diff --git a/validation/experiments/bergdahl/aggregate_metrics.json b/validation/experiments/bergdahl/aggregate_metrics.json index 9bd38378..7e090b78 100644 --- a/validation/experiments/bergdahl/aggregate_metrics.json +++ b/validation/experiments/bergdahl/aggregate_metrics.json @@ -1,12 +1,12 @@ { "completed_cases": 30, - "mean_bias_N": 0.45431785333333463, - "mean_bias_percent_of_measured": 1.5717214764340497, - "mae_N": 1.324980640000002, - "mape_percent": 3.120217363988557, - "rmse_N": 1.586603785062259, + "mean_bias_N": 0.4616683466666679, + "mean_bias_percent_of_measured": 1.5855886766627234, + "mae_N": 1.327560893333332, + "mape_percent": 3.1267980284256174, + "rmse_N": 1.5827470765235303, "maximum_absolute_error_percent": 7.717337853107351, - "pearson_correlation": 0.9932016283673366, - "correlation_r_squared": 0.986449474591529, - "lin_concordance_correlation": 0.989081600333658 + "pearson_correlation": 0.9932561631491675, + "correlation_r_squared": 0.9865578056338057, + "lin_concordance_correlation": 0.9891388894227845 } diff --git a/validation/experiments/bergdahl/comparison_summary.csv b/validation/experiments/bergdahl/comparison_summary.csv index 36b7333c..cb97a7df 100644 --- a/validation/experiments/bergdahl/comparison_summary.csv +++ b/validation/experiments/bergdahl/comparison_summary.csv @@ -1,31 +1,31 @@ case,period_s,radius_m,measured_maximum_N,dt_s,number_of_elements,element_length_m,total_cycles,ramp_cycles,rho_inf,published_ground_modulus_Pa_per_m,published_ground_damping_ratio,published_contact_diameter_m,equivalent_volume_diameter_m,kbot_Pa_per_m,cbot_Pa_s_per_m,contact_coefficients_overridden,ba_N_s,friction_mu,solver_relative_tolerance,analysis_start_s,deck_sha256,motion_sha256,samples_analysed,predicted_mean_N,predicted_minimum_N,predicted_absolute_maximum_N,predicted_mean_cycle_maximum_N,predicted_cycle_maximum_std_N,predicted_range_N,maximum_error_N,maximum_error_percent -bergdahl_T1p25_R0p075_h0p200_dt0p0003,1.25,0.075,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,9a15c83cd584db2d41b7425c2464d45b951e064312e22d2bd5f2bdc5d62c78be,200c532b956836233ff1706360190a636fa05d658c6e4dc8b0eeda6ac38665d7,20001,22.753548841969902,0.65523395,41.563628,41.5318412,0.029896707330408633,40.90839405,-0.9681587999999977,-2.2780207058823474 -bergdahl_T1p25_R0p100_h0p200_dt0p0003,1.25,0.1,46.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,35f623bef1aa930eca217ccf056b72d26a2a3003af68a8efbce83fadb8921146,deb435829efdb15fd5c8f0b8db9dd0c83cfa10aab269a24dcd1fae02d0156547,20001,23.427066009431577,0.080218397,47.538726,47.2896736,0.1544434092938245,47.458507602999994,0.48967360000000326,1.046311111111118 -bergdahl_T1p25_R0p125_h0p200_dt0p0003,1.25,0.125,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,3db8b8c41f6fd9b122135c92bb6311db9c79ed022cea0e9341c82e382ea2d8c4,350bd646ce87b6afcfec808548ada2624a25186efabbcd00dc72864f1b20fbf0,20001,24.47563511563497,0.080218397,53.344149,53.1288234,0.18391136327399862,53.263930603,-0.9711765999999997,-1.7951508317929754 -bergdahl_T1p25_R0p150_h0p200_dt0p0003,1.25,0.15,60.4,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,6db3b6e1e3a34c320567820a2b227905aea57c8940efdebb14afb0b1a4bb6b8b,a8a5c083de018445740094b398496386e405db1c896d75c8e01c6acd0c985d3c,20001,25.723506170797062,0.080218397,58.264,58.094311600000005,0.11682515060893356,58.183781603,-2.305688399999994,-3.8173649006622417 -bergdahl_T1p25_R0p200_h0p200_dt0p0003,1.25,0.2,70.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,79b6ad075892ffbad6f63343cb55454aa2380387002b23c95dd63ec99ad89757,a3f02e630a2f80e08b9367d4362b4bb09c37f3fb5935ecdc3f548d38fb0f22da,20001,28.5282878239816,0.045982541,68.246358,67.99751539999998,0.1462192030234076,68.200375459,-2.302484600000014,-3.275227027027047 -bergdahl_T1p50_R0p075_h0p200_dt0p0003,1.5,0.075,41.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,c84e640a68f2f9a806a08b3afb2b220a49025cf6cf3f75a4439df1e5007eb536,c93b19181604134c73d29a1e343dadd769c4cf5510d2214a929e96ad98bab6d7,24001,22.59428037364693,2.3293422,39.90029,39.868237799999996,0.027398937994015583,37.5709478,-1.1317622000000043,-2.7603956097561078 -bergdahl_T1p50_R0p100_h0p200_dt0p0003,1.5,0.1,45.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,89df9b353f05c33ad5b47160fb17b0ef2fb9aaaddc5f9c1bb6faa1aa651345b0,08aff391d95ba06a6e36de8101f986e34725034f826dcb56c079f6de0e8c63db,24001,23.102780847709887,0.080218397,46.098397,45.9691302,0.11415026870621027,46.018178602999996,0.669130200000005,1.4771086092715344 -bergdahl_T1p50_R0p125_h0p200_dt0p0003,1.5,0.125,51.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,b08f6f7411a4c6bf6c51479886cdd5e5ec05048995f7df56b314f38602a6ac68,8da6cf5077f315d1445f9fa86597eb0c45f4a47ea564b2a14f53dbfcb12d70c0,24001,24.043843764549646,0.080218397,51.738164,51.52859980000001,0.16426609310871187,51.657945602999995,0.028599800000009168,0.055533592233027514 -bergdahl_T1p50_R0p150_h0p200_dt0p0003,1.5,0.15,59.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4adab994765aca18aa52757ef82e30d15cd9ad09a908cf44bae00cd890218bcb,d399fa50a0dcd35fa3a55d5e8cfddae96652df14bc08b3707dae3766fb725531,24001,25.225714619936713,0.080218397,56.479058,56.377095399999995,0.07503180283253301,56.398839603,-2.6229046000000054,-4.445601016949161 -bergdahl_T1p50_R0p200_h0p200_dt0p0003,1.5,0.2,68.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4087f2ecb4c0dc5d8d29440397162646e11ea24585c1bff5229079b1c9e4bda0,80096d02b10970eabc9320273215f978a016c2ea4add6012ca7ecd21c68c2851,24001,27.954959161516477,0.049427531,67.012399,66.9325532,0.05935785171483416,66.962971469,-1.067446799999999,-1.5697747058823515 +bergdahl_T1p25_R0p075_h0p200_dt0p0003,1.25,0.075,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,9a15c83cd584db2d41b7425c2464d45b951e064312e22d2bd5f2bdc5d62c78be,200c532b956836233ff1706360190a636fa05d658c6e4dc8b0eeda6ac38665d7,20001,22.75729029778711,0.84961577,41.55663,41.518083000000004,0.0364163607119109,40.70701423,-0.9819169999999957,-2.3103929411764605 +bergdahl_T1p25_R0p100_h0p200_dt0p0003,1.25,0.1,46.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,35f623bef1aa930eca217ccf056b72d26a2a3003af68a8efbce83fadb8921146,deb435829efdb15fd5c8f0b8db9dd0c83cfa10aab269a24dcd1fae02d0156547,20001,23.423043792491978,0.080218397,47.463795,47.3005878,0.10685080749437453,47.383576602999995,0.5005878000000052,1.0696320512820625 +bergdahl_T1p25_R0p125_h0p200_dt0p0003,1.25,0.125,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,3db8b8c41f6fd9b122135c92bb6311db9c79ed022cea0e9341c82e382ea2d8c4,350bd646ce87b6afcfec808548ada2624a25186efabbcd00dc72864f1b20fbf0,20001,24.476081125954803,0.080218397,53.264162,53.1698942,0.0748986296049524,53.183943602999996,-0.9301057999999998,-1.7192343807763397 +bergdahl_T1p25_R0p150_h0p200_dt0p0003,1.25,0.15,60.4,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,6db3b6e1e3a34c320567820a2b227905aea57c8940efdebb14afb0b1a4bb6b8b,a8a5c083de018445740094b398496386e405db1c896d75c8e01c6acd0c985d3c,20001,25.732057802401027,0.080218397,58.343019,58.232365200000004,0.0759659228615041,58.262800602999995,-2.1676347999999948,-3.588799337748336 +bergdahl_T1p25_R0p200_h0p200_dt0p0003,1.25,0.2,70.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,8.75,79b6ad075892ffbad6f63343cb55454aa2380387002b23c95dd63ec99ad89757,a3f02e630a2f80e08b9367d4362b4bb09c37f3fb5935ecdc3f548d38fb0f22da,20001,28.52452245713629,0.047432814,68.254513,67.9673104,0.20436951680913815,68.207080186,-2.332689599999995,-3.3181928876244595 +bergdahl_T1p50_R0p075_h0p200_dt0p0003,1.5,0.075,41.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,c84e640a68f2f9a806a08b3afb2b220a49025cf6cf3f75a4439df1e5007eb536,c93b19181604134c73d29a1e343dadd769c4cf5510d2214a929e96ad98bab6d7,24001,22.592768295391856,2.1826476,39.942296,39.862761,0.06165540456034704,37.759648399999996,-1.137239000000001,-2.7737536585365876 +bergdahl_T1p50_R0p100_h0p200_dt0p0003,1.5,0.1,45.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,89df9b353f05c33ad5b47160fb17b0ef2fb9aaaddc5f9c1bb6faa1aa651345b0,08aff391d95ba06a6e36de8101f986e34725034f826dcb56c079f6de0e8c63db,24001,23.099262985012874,0.080218397,46.163762,45.9797466,0.12750091794885285,46.083543602999995,0.6797466000000014,1.5005443708609303 +bergdahl_T1p50_R0p125_h0p200_dt0p0003,1.5,0.125,51.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,b08f6f7411a4c6bf6c51479886cdd5e5ec05048995f7df56b314f38602a6ac68,8da6cf5077f315d1445f9fa86597eb0c45f4a47ea564b2a14f53dbfcb12d70c0,24001,24.037791008454146,0.080218397,51.738263,51.5905316,0.10014122989208964,51.658044603,0.09053159999999849,0.17578951456310388 +bergdahl_T1p50_R0p150_h0p200_dt0p0003,1.5,0.15,59.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4adab994765aca18aa52757ef82e30d15cd9ad09a908cf44bae00cd890218bcb,d399fa50a0dcd35fa3a55d5e8cfddae96652df14bc08b3707dae3766fb725531,24001,25.22877844669226,0.080218397,56.421491,56.337508400000004,0.07367940691129274,56.341272603,-2.6624915999999956,-4.512697627118636 +bergdahl_T1p50_R0p200_h0p200_dt0p0003,1.5,0.2,68.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,10.5,4087f2ecb4c0dc5d8d29440397162646e11ea24585c1bff5229079b1c9e4bda0,80096d02b10970eabc9320273215f978a016c2ea4add6012ca7ecd21c68c2851,24001,27.95913363490667,0.049391599,67.036091,66.92867720000001,0.09692043402812402,66.986699401,-1.0713227999999901,-1.5754747058823384 bergdahl_T2p00_R0p075_h0p200_dt0p0003,2.0,0.075,36.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,788d6c963eaccba31443ed29b33d8dd37dcde8e5945ac02f4c63728f4bcede11,06b2ee6b12d716e9c4757c91d6e330d7985b118f411d8673f0e3be1317cd10b7,32001,22.50825846114497,7.1153458,36.047917,36.035346999999994,0.011414748069932139,28.932571199999998,0.035346999999994466,0.09818611111109574 -bergdahl_T2p00_R0p100_h0p200_dt0p0003,2.0,0.1,39.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,66b4e4070897810cc0c2db78a9da33350dbf480ff297311b5ade518c36518e72,7cfeecfbc7673140d72af2c7a475ead3ce77736e54552c663e5df1b72cf6afdd,32001,22.72275428235805,0.28851596,41.963062,41.917736000000005,0.033367880941108825,41.67454604,2.417736000000005,6.120850632911405 -bergdahl_T2p00_R0p125_h0p200_dt0p0003,2.0,0.125,47.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,11d53518b7f6d58facee9b5d62e582bbdc94a289098bbf6d3ac61defaf82c7e8,b2a8c64acddab4c852169269cca4e60bb258479eda2a6495d094c99f39cf76d3,32001,23.437068625304114,0.080218397,47.617533,47.55391720000001,0.07060360080902325,47.537314603,0.05391720000000788,0.1135098947368587 -bergdahl_T2p00_R0p150_h0p200_dt0p0003,2.0,0.15,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,d423c8a5aeb69a63655c03060d6f2b45742420795e5d8004b716da8908cd126d,71ae7988f4e286c2a5c4f8b21cbdf9cf0c5138bb68f74c9e2e7083d2bd8a9c39,32001,24.446372957588075,0.080218397,52.949233,52.9239464,0.018082844212125703,52.869014603,-1.176053600000003,-2.173851386321632 -bergdahl_T2p00_R0p200_h0p200_dt0p0003,2.0,0.2,62.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,a640e7f76fa6bb1ae074d28e43f3958084d3e75bf7d9d368fd414b9849f14e25,5211abe84187c30899ee1759f47f60ddd307427b5aaa577a132c9269b8d0b0f1,32001,26.99762886311297,0.067875028,63.186422,63.12483160000001,0.04305179175481503,63.118546972,0.8248316000000102,1.3239672552167099 +bergdahl_T2p00_R0p100_h0p200_dt0p0003,2.0,0.1,39.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,66b4e4070897810cc0c2db78a9da33350dbf480ff297311b5ade518c36518e72,7cfeecfbc7673140d72af2c7a475ead3ce77736e54552c663e5df1b72cf6afdd,32001,22.725582901798692,0.20156104,41.949945,41.8937148,0.043681995812919115,41.74838396,2.393714799999998,6.060037468354425 +bergdahl_T2p00_R0p125_h0p200_dt0p0003,2.0,0.125,47.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,11d53518b7f6d58facee9b5d62e582bbdc94a289098bbf6d3ac61defaf82c7e8,b2a8c64acddab4c852169269cca4e60bb258479eda2a6495d094c99f39cf76d3,32001,23.438071037375487,0.080218397,47.713108,47.5727352,0.1101758711342915,47.632889602999995,0.07273519999999678,0.1531267368420985 +bergdahl_T2p00_R0p150_h0p200_dt0p0003,2.0,0.15,54.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,d423c8a5aeb69a63655c03060d6f2b45742420795e5d8004b716da8908cd126d,71ae7988f4e286c2a5c4f8b21cbdf9cf0c5138bb68f74c9e2e7083d2bd8a9c39,32001,24.44123775418168,0.080218397,53.034022,52.9313364,0.08391372617039487,52.953803603,-1.1686636000000021,-2.160191497227361 +bergdahl_T2p00_R0p200_h0p200_dt0p0003,2.0,0.2,62.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,14.0,a640e7f76fa6bb1ae074d28e43f3958084d3e75bf7d9d368fd414b9849f14e25,5211abe84187c30899ee1759f47f60ddd307427b5aaa577a132c9269b8d0b0f1,32001,26.998362808274205,0.069770449,63.216109,63.1520804,0.03968285901746634,63.146338551,0.8520804000000055,1.3677052969502497 bergdahl_T2p50_R0p075_h0p200_dt0p0003,2.5,0.075,31.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,87645fbd5487107bb7b4710a95d6eebc3da8d0309ba5de053694f17590581d35,b3a5ceda599c59b5516c7f95d48a53c5a9082ba4573eb87d0f4ebdb816c9918d,40001,22.573128677483066,10.591124,33.062585,33.0596916,0.003054553044227603,22.471460999999998,1.9596915999999993,6.301259163987136 bergdahl_T2p50_R0p100_h0p200_dt0p0003,2.5,0.1,35.4,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,9898a74d88ffedf8e9585d680862587b7382f129aa1cbf90dcec137bcd6f3f7d,69865be17566563fed41360b3b26602dd059e960ddf492a02bb8474239fe8617,40001,22.64237321955451,4.7312149,38.136158,38.1319376,0.002738401960999871,33.404943100000004,2.731937600000002,7.7173378531073515 -bergdahl_T2p50_R0p125_h0p200_dt0p0003,2.5,0.125,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6c1845719020a1b825f0878b9722de394658a468d2576549e8ac44e3854c1943,4606eb29aac566ef9436af19d60063e21915d8e535ee1a29cb8164bf36832ac1,40001,23.06492558125747,0.11575031,43.610903,43.5952714,0.015263411391298226,43.49515269,1.0952714000000014,2.5771091764705916 -bergdahl_T2p50_R0p150_h0p200_dt0p0003,2.5,0.15,49.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6ebf7ca718808043f57a87bb177c1d5a25f86e13ebcf6a1129e7ef8d9f73fe77,f96b5df08fdfbafbf1a73f3a476ab4bd83f366340e729a555fff4abfbdcb128f,40001,23.952926937344316,0.080218397,48.932963,48.924259400000004,0.012833009947006856,48.852744603,-0.07574059999999605,-0.15457265306121643 -bergdahl_T2p50_R0p200_h0p200_dt0p0003,2.5,0.2,57.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,2d0261069c6689ebe857731f237f70a2883a5980112b9f277246377d0230c9cf,da167b278b0560de961de703952a1e36a22f7e4ff637e7a8453f90eeada7281d,40001,26.269954041936774,0.074724364,59.624768,59.571667000000005,0.04028960597970727,59.550043636000005,2.271667000000008,3.9645148342059477 +bergdahl_T2p50_R0p125_h0p200_dt0p0003,2.5,0.125,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6c1845719020a1b825f0878b9722de394658a468d2576549e8ac44e3854c1943,4606eb29aac566ef9436af19d60063e21915d8e535ee1a29cb8164bf36832ac1,40001,23.06203512397165,0.080218397,43.671052,43.619687400000004,0.03978410596331384,43.590833603,1.1196874000000037,2.634558588235303 +bergdahl_T2p50_R0p150_h0p200_dt0p0003,2.5,0.15,49.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,6ebf7ca718808043f57a87bb177c1d5a25f86e13ebcf6a1129e7ef8d9f73fe77,f96b5df08fdfbafbf1a73f3a476ab4bd83f366340e729a555fff4abfbdcb128f,40001,23.951691448754932,0.080218397,48.966114,48.918578600000004,0.03350533006552719,48.885895602999994,-0.08142139999999642,-0.1661661224489723 +bergdahl_T2p50_R0p200_h0p200_dt0p0003,2.5,0.2,57.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,17.5,2d0261069c6689ebe857731f237f70a2883a5980112b9f277246377d0230c9cf,da167b278b0560de961de703952a1e36a22f7e4ff637e7a8453f90eeada7281d,40001,26.27020682526119,0.074341225,59.599114,59.5508086,0.03514053619112935,59.524772775,2.2508086000000063,3.928112739965107 bergdahl_T3p00_R0p075_h0p200_dt0p0003,3.0,0.075,29.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,302324da0849af35df6392af12635f08555aba2a6e69de515e79fb9705bbab04,d9ad6838f7015b0e7d32a70eb86534166089bd80a096e0a2989cf5cef41dbd05,48001,22.653205223224518,13.239237,31.054133,31.053350599999998,0.0007923962392643522,17.814896,1.5533505999999981,5.265595254237282 bergdahl_T3p00_R0p100_h0p200_dt0p0003,3.0,0.1,33.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,eb00be510264d4ead391c24cc9a240da7dec29658c898bbc9b481e894d73bd07,8a90048a3f3bab35a054f704a11342f580f746ec87972031da7d49d02217f6cc,48001,22.68028505046978,7.8264702,35.57996,35.577183000000005,0.0018532568629307379,27.7534898,2.4771830000000037,7.483936555891249 -bergdahl_T3p00_R0p125_h0p200_dt0p0003,3.0,0.125,39.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,ced08cb707dbc660e07d97949e7422b7326d083dc99d18a5ae84378a21fc84ef,bde9b1a9923f0d4e4c3158d7df37ba31838710c39d672bb8241ec6cab8e55722,48001,22.899780043517847,1.4983751,40.405212,40.3947704,0.008521936651957626,38.9068369,1.0947704000000016,2.785675318066162 -bergdahl_T3p00_R0p150_h0p200_dt0p0003,3.0,0.15,45.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,47aa51d93408ca527f8a8ac85613ab9b0f7a4f9a2459ec9bca396e62de32dfb2,402811dda2da329a55b8e7816c5134f5aecb0a59bdbefc6b13eeb232cb4fb15b,48001,23.530892854493427,0.080218397,45.381435,45.3614744,0.014002251561802683,45.301216603,-0.4385255999999984,-0.9574794759825294 -bergdahl_T3p00_R0p200_h0p200_dt0p0003,3.0,0.2,54.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,96e1dda1aa324b9669d601026fb6ad0831cadaf6dcc32492235ee05cd7d7d3b5,f03dc52610fa2de64c497f78321355d34ea6fad14109005aafde665c707b0e35,48001,25.691017014398327,0.080218397,55.718632,55.6951518,0.014706974831691614,55.638413603,1.6951517999999979,3.139169999999996 +bergdahl_T3p00_R0p125_h0p200_dt0p0003,3.0,0.125,39.3,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,ced08cb707dbc660e07d97949e7422b7326d083dc99d18a5ae84378a21fc84ef,bde9b1a9923f0d4e4c3158d7df37ba31838710c39d672bb8241ec6cab8e55722,48001,22.90058616806525,1.1527348,40.40689,40.401079200000005,0.005300698180428831,39.2541552,1.101079200000008,2.80172824427483 +bergdahl_T3p00_R0p150_h0p200_dt0p0003,3.0,0.15,45.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,47aa51d93408ca527f8a8ac85613ab9b0f7a4f9a2459ec9bca396e62de32dfb2,402811dda2da329a55b8e7816c5134f5aecb0a59bdbefc6b13eeb232cb4fb15b,48001,23.530885720303036,0.080218397,45.358404,45.3450974,0.010693752699590463,45.278185603,-0.45490259999999694,-0.9932371179039235 +bergdahl_T3p00_R0p200_h0p200_dt0p0003,3.0,0.2,54.0,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,21.0,96e1dda1aa324b9669d601026fb6ad0831cadaf6dcc32492235ee05cd7d7d3b5,f03dc52610fa2de64c497f78321355d34ea6fad14109005aafde665c707b0e35,48001,25.689062797173765,0.080218397,55.736209,55.698312599999994,0.03162717803250884,55.655990603,1.6983125999999942,3.1450233333333224 bergdahl_T3p50_R0p075_h0p200_dt0p0003,3.5,0.075,27.8,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,235d4acffaff2133c0833b4dde65d4f746a980e483bf1a184fbda1789d26d32b,832f1074f37014ce95341e0baea190a6c995ca381de72b85ef1d8e4ffbecc7ed,56001,22.741663554740096,15.199221,29.866848,29.8664992,0.0004117046271295802,14.667627000000001,2.066499199999999,7.433450359712226 bergdahl_T3p50_R0p100_h0p200_dt0p0003,3.5,0.1,31.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,dfd71b038e2016e837ca8d2976ff4dabbdbc579d663b3e4d6cc02c867bde1e35,d70c6750c97b8271d7f0604166e62a41a1e57b583932f16598c4ebe75de573aa,56001,22.765204520883554,10.515801,33.721231,33.7197632,0.001419329313444277,23.205430000000003,2.2197632000000027,7.0468673015873105 bergdahl_T3p50_R0p125_h0p200_dt0p0003,3.5,0.125,37.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,0c91662ea48cc2fa12539fc97fc123c1b3dff743ead2bace86bdf2ac3ac53997,2fe336ce9ff36b4af7c8d698c3e68f372b762b8127ecdda730fb5e07c46f68ea,56001,22.890783096641133,5.7432455,38.029771,38.027166,0.002623257802807864,32.286525499999996,0.5271660000000011,1.405776000000003 -bergdahl_T3p50_R0p150_h0p200_dt0p0003,3.5,0.15,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,f2a0f779cd4f722e64114a1d24d297d7b71ce71b3234ebf98d0ee02349768a0e,fd49ce4e3dce2c1d034faeedf52a60633dfb26a3a6cfbc935c66a29ea7297d3c,56001,23.269789772909412,0.58797798,42.746807,42.7163838,0.019009090606862972,42.15882902,0.21638380000000268,0.5091383529411828 -bergdahl_T3p50_R0p200_h0p200_dt0p0003,3.5,0.2,50.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,7bdf322dbff579b866971969ad11b066c3aa1da0fb8bd19bf7f64c3e05b85e00,de9d5e2bf50d61ca47a1fb69f0cfabab511139a97cff5ccdf79fc257b156f438,56001,25.188428386480563,0.080218397,52.369871,52.3614064,0.008945547372856164,52.289652603,2.2614063999999985,4.513785229540915 +bergdahl_T3p50_R0p150_h0p200_dt0p0003,3.5,0.15,42.5,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,f2a0f779cd4f722e64114a1d24d297d7b71ce71b3234ebf98d0ee02349768a0e,fd49ce4e3dce2c1d034faeedf52a60633dfb26a3a6cfbc935c66a29ea7297d3c,56001,23.270828354333318,0.38777922,42.77665,42.75414859999999,0.026079876654231008,42.38887078,0.2541485999999935,0.5979967058823377 +bergdahl_T3p50_R0p200_h0p200_dt0p0003,3.5,0.2,50.1,0.0003125,165,0.2,12,3,0.4,3000000000.0,1.0,0.0022,0.003654133499998645,1806173748.168327,402155.67857087706,False,0.0,0.3,1e-08,24.5,7bdf322dbff579b866971969ad11b066c3aa1da0fb8bd19bf7f64c3e05b85e00,de9d5e2bf50d61ca47a1fb69f0cfabab511139a97cff5ccdf79fc257b156f438,56001,25.18984178717771,0.080218397,52.364122,52.35406759999999,0.00952333220569378,52.283903603,2.254067599999992,4.499136926147688 diff --git a/validation/experiments/bergdahl/provenance.json b/validation/experiments/bergdahl/provenance.json index 9a5dff35..6569d610 100644 --- a/validation/experiments/bergdahl/provenance.json +++ b/validation/experiments/bergdahl/provenance.json @@ -2,7 +2,7 @@ "CableDyn_release": "v0.1.1+dev (unreleased)", "validation_date": "2026-10-16", "executable_name": "cabledyn.exe", - "executable_sha256": "bb64e4ebe13a77ead7c73cd51f1c29e5764f0acc78c7dc644148032e561f0c80", + "executable_sha256": "78a3fed9390fd77392a1dcaec244f79f9174d9e2e94e4b3032fb53c7b8bd4395", "compiler": "GNU Fortran 16.2.0", "build_type": "Release", "platform": "Windows 11 x86-64", @@ -12,14 +12,14 @@ "completed_cases": 30, "nonlinear_misses": 0, "refinement_cases": 8, - "maximum_spatial_refinement_difference_percent": 0.34336628760570426, - "maximum_temporal_refinement_difference_percent": 0.21639367008474694, - "force_maxima_sha256": "e2f8b055f87bdedbb16170cc4c1dc103802151e8b65ce6593c489c51c130a512", - "aggregate_metrics_sha256": "f2dc318dc8767b7eb53ce1f7dcd2ff334b58888625229776fcf01e99ddb652f2", + "maximum_spatial_refinement_difference_percent": 0.5236270564721716, + "maximum_temporal_refinement_difference_percent": 0.18888172026785752, + "force_maxima_sha256": "978889378964c6d6749bc27c11d99d6584956e3c8eac146ae79bf5f7a05e2e95", + "aggregate_metrics_sha256": "35d800fa34137a3a1500cbd0081a490bc1b61cf636cfef5a923b5c18947ba1a7", "case_manifest_sha256": "8da5e7b4a8a92755363807902aba48e0ff42abab04ac44912041853db9e56604", "waveform_T1p25_sha256": "65c8c846636c378b800bb3c7a95ccd2bde766d789af3cdffce26a2e688e1a134", "waveform_T3p50_sha256": "b3ca65ebfc1d61b5510e54876fc11d1604fc18ffcca3eab523dc7d67f50da4d8", "waveform_metrics_sha256": "2803a57cb7726f966a00e00bf6eb070231b9c702ae67a81685da50991d0adb11", "waveform_note": "Waveform metrics were computed with the executable of the 2026-10-09 validation (sha256 71090e2e28c9e1d99c5180d05a395ebcc891a77cc5294d315a57c691904745ac); the force-blended EI = 0 step of this development build was not rerun on them because the article supplement's expData.dat, which reduce_bergdahl_waveforms.py reads, was not available. The measured phase averages are those of expData.dat, as carried in the waveform CSVs.", - "refinement_summary_sha256": "8ed5569e1af06b0453b8075d440eb362fdf8a2c651cab8fc2a9c6d5e2a7e61d5" + "refinement_summary_sha256": "b3ef33659ba852ce8b6667032a9f2c44bf0336d988c29c2a80fddc2ab4053859" } diff --git a/validation/experiments/bergdahl/refinement_summary.csv b/validation/experiments/bergdahl/refinement_summary.csv index 27358362..ddbd61e6 100644 --- a/validation/experiments/bergdahl/refinement_summary.csv +++ b/validation/experiments/bergdahl/refinement_summary.csv @@ -1,3 +1,3 @@ period_s,radius_m,force_h0p400_dt0p0003125_N,force_h0p200_dt0p0003125_N,force_h0p100_dt0p0003125_N,force_h0p200_dt0p00015625_N,force_h0p200_dt0p000625_N,spatial_difference_h0p400_dt0p0003125_percent,spatial_difference_h0p200_dt0p0003125_percent,temporal_difference_h0p200_dt0p0003125_percent,temporal_difference_h0p200_dt0p000625_percent -1.25,0.2,68.299543,67.99751539999998,68.2318004,67.85069080000001,71.67719159999999,0.09928303166979387,-0.34336628760570426,0.21639367008474694,5.639590039369174 -3.5,0.2,52.3632726,52.3614064,52.338932799999995,52.3516172,54.1821924,0.046504196203265,0.04293859044830387,0.01869894479592154,3.4966927440018 +1.25,0.2,68.15018140000001,67.9673104,68.32507899999999,67.8391746,72.2422804,-0.25597862828666473,-0.5236270564721716,0.18888172026785752,6.490506150704244 +3.5,0.2,52.3714018,52.35406759999999,52.345151599999994,52.3533266,53.9582166,0.0501482930083001,0.01703309614638552,0.0014153828383290867,3.0654976564564618 diff --git a/validation/experiments/bergdahl/refinement_summary.json b/validation/experiments/bergdahl/refinement_summary.json index 7b95b6e3..f5f934c3 100644 --- a/validation/experiments/bergdahl/refinement_summary.json +++ b/validation/experiments/bergdahl/refinement_summary.json @@ -4,34 +4,34 @@ "temporal_reference_time_step_s": 0.00015625, "primary_nominal_element_length_m": 0.2, "primary_time_step_s": 0.0003125, - "maximum_primary_spatial_difference_percent": 0.34336628760570426, - "maximum_primary_temporal_difference_percent": 0.21639367008474694, + "maximum_primary_spatial_difference_percent": 0.5236270564721716, + "maximum_primary_temporal_difference_percent": 0.18888172026785752, "rows": [ { "period_s": 1.25, "radius_m": 0.2, - "force_h0p400_dt0p0003125_N": 68.299543, - "force_h0p200_dt0p0003125_N": 67.99751539999998, - "force_h0p100_dt0p0003125_N": 68.2318004, - "force_h0p200_dt0p00015625_N": 67.85069080000001, - "force_h0p200_dt0p000625_N": 71.67719159999999, - "spatial_difference_h0p400_dt0p0003125_percent": 0.09928303166979387, - "spatial_difference_h0p200_dt0p0003125_percent": -0.34336628760570426, - "temporal_difference_h0p200_dt0p0003125_percent": 0.21639367008474694, - "temporal_difference_h0p200_dt0p000625_percent": 5.639590039369174 + "force_h0p400_dt0p0003125_N": 68.15018140000001, + "force_h0p200_dt0p0003125_N": 67.9673104, + "force_h0p100_dt0p0003125_N": 68.32507899999999, + "force_h0p200_dt0p00015625_N": 67.8391746, + "force_h0p200_dt0p000625_N": 72.2422804, + "spatial_difference_h0p400_dt0p0003125_percent": -0.25597862828666473, + "spatial_difference_h0p200_dt0p0003125_percent": -0.5236270564721716, + "temporal_difference_h0p200_dt0p0003125_percent": 0.18888172026785752, + "temporal_difference_h0p200_dt0p000625_percent": 6.490506150704244 }, { "period_s": 3.5, "radius_m": 0.2, - "force_h0p400_dt0p0003125_N": 52.3632726, - "force_h0p200_dt0p0003125_N": 52.3614064, - "force_h0p100_dt0p0003125_N": 52.338932799999995, - "force_h0p200_dt0p00015625_N": 52.3516172, - "force_h0p200_dt0p000625_N": 54.1821924, - "spatial_difference_h0p400_dt0p0003125_percent": 0.046504196203265, - "spatial_difference_h0p200_dt0p0003125_percent": 0.04293859044830387, - "temporal_difference_h0p200_dt0p0003125_percent": 0.01869894479592154, - "temporal_difference_h0p200_dt0p000625_percent": 3.4966927440018 + "force_h0p400_dt0p0003125_N": 52.3714018, + "force_h0p200_dt0p0003125_N": 52.35406759999999, + "force_h0p100_dt0p0003125_N": 52.345151599999994, + "force_h0p200_dt0p00015625_N": 52.3533266, + "force_h0p200_dt0p000625_N": 53.9582166, + "spatial_difference_h0p400_dt0p0003125_percent": 0.0501482930083001, + "spatial_difference_h0p200_dt0p0003125_percent": 0.01703309614638552, + "temporal_difference_h0p200_dt0p0003125_percent": 0.0014153828383290867, + "temporal_difference_h0p200_dt0p000625_percent": 3.0654976564564618 } ] } From 43f2a40459937ba22dbb6d163d05511809c225c8 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Sat, 17 Oct 2026 00:57:17 +0900 Subject: [PATCH 09/11] fix(dynamics): bound the release cap's law secant by the law stiffness The release cap estimates the end tension of a segment that ends taut as T_n e_{n+1} / e_n. That is the tension of an elastic segment, but the viscoelastic and Syrope laws are not proportional to the stretch: damping or the lagged internal state can carry T_n at a vanishing e_n. The secant then grows without bound, and the cap switches off within a band of width about e_n, nearly a jump for the Newton iteration. The step now takes the committed axial stiffness of each law element (start_stiffness: the viscoelastic EA_D / l0, the Syrope K1 / l0 = (alpha + beta T_mean) / l0, computed by the line model next to the committed law tension) and estimates the end tension with min(T_n / e_n, k_n) e_{n+1}. Elastic elements keep the exact secant, so their results are unchanged bit for bit. The routine comment and the theory page now state the energy bound exactly: the blend returns at most W_n + (1 - alpha_f)(T^_{n+1} - T_{n+1}) p_{n+1} and never more than without the cap. For an elastic segment that is W_n. A law segment that ends above l0 with less law tension than the estimate can exceed W_n by up to (1 - alpha_f) k e_{n+1} p_{n+1}. Tests: a damped law segment whose step-start tension is almost all damping at a 1e-6 strain keeps the cap force's slope in the end stretch at 0.73 k_n (357 k_n, a jump, with the unbounded secant), satisfies the stated bound over the sweep, and has a finite-difference tangent within 1.2e-10 on both paths. A segment that keeps its direction and ends taut is checked to keep the plain force blend. The comment of the deep-release tangent case now names W_n / p, and the options page gives the 0.10 MN the light-cable reproducer now reaches. Every shipped example deck gives byte-identical output against the previous commit. The viscoelastic surge reproducer moves by 1e-6. The lightly damped viscoelastic light cable peaks at 0.085 MN at the anchor at dtM 0.1 s (0.072 MN before), against 0.082 to 0.095 MN at 0.5 to 2.5 ms; the documented figures follow. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 8 +- doc/options.rst | 2 +- doc/theory.rst | 30 ++++-- src/CableDyn_Dynamic.f90 | 78 ++++++++++----- src/CableDyn_Model.f90 | 52 ++++++++-- tests/test_ei0_slack_dynamics.f90 | 151 ++++++++++++++++++++++++++---- 6 files changed, 262 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68d0cd69..aa469df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -189,9 +189,11 @@ All notable changes to CableDyn are recorded in this file. The format follows slack exceeds by far (a nearly unstretched segment turning by 90° would otherwise return hundreds of times its strain energy), and it fades out continuously as the end state crosses the rest length. The viscoelastic and Syrope segments are capped the same way with the tension - of their law (the same cable made lightly damped viscoelastic peaks at 0.072 MN at the anchor - at `dtM` 0.1 s, a snap that step does not resolve, against 0.145 MN without the cap on its - segments and 0.087 to 0.095 MN at 0.5 to 2.5 ms). The seabed contact of + of their law, their end tension estimated with a secant stiffness bounded by the law's axial + stiffness, so that damping carried at a vanishing stretch does not make the cap switch + abruptly (the same cable made lightly damped viscoelastic peaks at 0.085 MN at the anchor at + `dtM` 0.1 s, a snap that step does not resolve, against 0.145 MN without the cap on its + segments and 0.082 to 0.095 MN at 0.5 to 2.5 ms). The seabed contact of a node that lifts off within a step is not capped (see the manual's theory page). At the default `rhoInf` the reproducers now give 0.10 / 0.09 MN, 0.092 / 0.106 MN, 0.075 / 0.043 MN and 1.80 MN, as their references, and the stiff-seabed line runs to completion; the diff --git a/doc/options.rst b/doc/options.rst index 6b96ceb3..6129c06d 100644 --- a/doc/options.rst +++ b/doc/options.rst @@ -387,7 +387,7 @@ Finite-EI cable controls earlier. On ``EI = 0`` lines ``False`` lets a segment that turns taut within a step carry the stretch extrapolated past the blended state, and lets a release create energy: on a light, axially stiff cable (80 kg/m, EA 8e8 N) under 3 m heave the fairlead peaks at - 4.2 MN against 0.14 MN with ``True`` (see :doc:`theory`). On finite-EI lines the blended + 4.2 MN against 0.10 MN with ``True`` (see :doc:`theory`). On finite-EI lines the blended tangent vectors are shortened while the line rotates and raise the mean tension at large ``dtM``: on the Lozon Gulf of Mexico 80 m cable in 3 m surge the mean hang-off tension is 12511 / 10097 / 9507 / 9360 N at diff --git a/doc/theory.rst b/doc/theory.rst index 55949c18..1739b782 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1368,17 +1368,27 @@ the second-order accuracy are unchanged. The segments whose tension comes from a constitutive law, the viscoelastic and Syrope segments (whose law enters the step as a dynamic load), are capped in the same way: :math:`T_n` is the law's tension at the committed state, the force :math:`\mathbf{r}_n` carries, with the same -:math:`e_n`, :math:`W_n = \tfrac{1}{2} T_n e_n` and secant end tension -:math:`T_{n+1} = T_n e_{n+1}/e_n`. For the viscoelastic law at rest :math:`W_n` is the energy of -its two springs, which both carry :math:`T_n` and whose stretches add up to :math:`e_n`; for the -Syrope law, whose loading curve stiffens, it bounds the energy below the curve from above. So the -blend of every segment of a tension-only line that ends slack returns at most -:math:`\tfrac{1}{2} T_n e_n` over the step, and so does that of an elastic segment that ends -taut; for a law segment that ends taut the bound holds with the secant end tension in place of -the law's. With the light cable above made lightly damped viscoelastic (EA 8e8 | 1.6e9 N, -BA 1e8 | 1e6 N s) the anchor peaks at 0.072 MN at :math:`\Delta t` = 0.1 s with the cap on its +:math:`e_n` and :math:`W_n = \tfrac{1}{2} T_n e_n`. For the viscoelastic law at rest :math:`W_n` +is the energy of its two springs, which both carry :math:`T_n` and whose stretches add up to +:math:`e_n`; for the Syrope law, whose loading curve stiffens, it bounds the energy below the +curve from above. A law's tension is not proportional to the stretch: damping or the lagged +internal state can carry :math:`T_n` at a vanishing :math:`e_n`, where the secant +:math:`T_n/e_n` is unbounded and the cap would switch off within a band of width about +:math:`e_n`, nearly a jump for the Newton iteration. The cap therefore estimates the end +tension as :math:`\hat T_{n+1} = k\,e_{n+1}` with :math:`k = \min(T_n/e_n, k_n)`, :math:`k_n` +the law's axial stiffness at the committed state (:math:`EA_D/l_0` for the viscoelastic law, +:math:`K_1/l_0 = (\alpha + \beta T_\text{mean})/l_0` for Syrope). In general the blend of an +element returns at most :math:`W_n + (1 - \alpha_f)(\hat T_{n+1} - T_{n+1})\,p_{n+1}` over the +step, :math:`T_{n+1}` its actual end tension, and never more than without the cap. For an +elastic segment the two tensions coincide and the bound is :math:`W_n`. A law segment that ends +below :math:`l_0` with no law tension returns at most :math:`W_n` as well; one that ends above +:math:`l_0` with less law tension than the estimate (zero once the slow branch has taken up the +stretch, or below Syrope's minimum strain) can return up to +:math:`(1 - \alpha_f)\,k\,e_{n+1} p_{n+1}` more. With the light cable above made lightly damped +viscoelastic (EA 8e8 | 1.6e9 N, BA 1e8 | 1e6 N s) the anchor peaks at 0.085 MN at +:math:`\Delta t` = 0.1 s with the cap on its segments (the snap is not resolved at that step, so the peak depends on round-off: other -compilers and platforms give other values) and at 0.145 MN without it, against 0.087 to +compilers and platforms give other values) and at 0.145 MN without it, against 0.082 to 0.095 MN at :math:`\Delta t` from 0.5 to 2.5 ms. A taut Syrope line in 4 m surge that goes slack peaks at 1.64 MN at 0.1 s, against 1.78 MN at 1 and 2.5 ms, with or without the cap. diff --git a/src/CableDyn_Dynamic.f90 b/src/CableDyn_Dynamic.f90 index 9e030930..8592cb3f 100644 --- a/src/CableDyn_Dynamic.f90 +++ b/src/CableDyn_Dynamic.f90 @@ -130,8 +130,9 @@ MODULE CableDyn_Dynamic REAL(wp), ALLOCATABLE :: fint_n(:) REAL(wp), ALLOCATABLE :: load_n(:) ! release cap of the force blend (tension-only elements): the step-start tension, stretch - ! l - l0 and unit chord of every element - REAL(wp), ALLOCATABLE :: tension_n(:), stretch_n(:), chord_n(:, :) + ! l - l0 and unit chord of every element, and the bound of its secant stiffness + ! (start_stiffness of a law element, HUGE otherwise) + REAL(wp), ALLOCATABLE :: tension_n(:), stretch_n(:), chord_n(:, :), stiff_n(:) ! fint_n, load_n and the release-cap data hold the step-start values of the last call: a ! warm re-solve of the same step (guess_armed, from the same committed state) reuses them LOGICAL :: start_valid = .FALSE. @@ -321,6 +322,7 @@ SUBROUTINE CD_Clear_GenAlpha_Workspace(work) IF (ALLOCATED(work%tension_n)) DEALLOCATE (work%tension_n) IF (ALLOCATED(work%stretch_n)) DEALLOCATE (work%stretch_n) IF (ALLOCATED(work%chord_n)) DEALLOCATE (work%chord_n) + IF (ALLOCATED(work%stiff_n)) DEALLOCATE (work%stiff_n) work%start_valid = .FALSE. IF (ALLOCATED(work%eff)) DEALLOCATE (work%eff) IF (ALLOCATED(work%eff_free)) DEALLOCATE (work%eff_free) @@ -606,7 +608,7 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on load_proc, added_mass_proc, load_force_proc, & load_band_proc, prescribed_q, prescribed_v, prescribed_a, structural_mass, & workspace, added_mass_band_proc, start_load, start_tension, & - probe_q, probe_R, probe_K) + probe_q, probe_R, probe_K, start_stiffness) !! One generalized-alpha step: the constant load f_ext plus the optional load, !! banded-load, force-only and added-mass callbacks (hydrodynamics, damping, contact). !! On a singular effective tangent returns CD_DYN_SINGULAR; on a line-search @@ -664,6 +666,13 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on !! the force blend of those elements as it bounds that of the elastic ones; entries of !! elements with ea > 0 are ignored. Absent: the cap covers the elastic elements only. REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:) + !! With start_tension: the axial stiffness of each law element at the step-start state + !! (n_elem, N per metre of elongation, >= 0; the viscoelastic EA_D/l0 and the Syrope + !! K1/l0 = (alpha + beta T_mean)/l0 of a line model). It bounds the secant stiffness + !! T_n/e_n with which the release cap estimates the end tension of a law element that ends + !! taut (see apply_release_cap). Entries of elements with ea > 0 are ignored. Absent: the + !! secant is not bounded. + REAL(wp), INTENT(IN), OPTIONAL :: start_stiffness(:) !! TEST HOOK (unit tests of the tangent; production callers omit it). With probe_q (full !! 3 n_nodes array, the fixed DOFs at their t_{n+1} values) present, the step returns after !! its setup without iterating: probe_R is the residual (3 n_nodes) and probe_K the free-free @@ -687,7 +696,7 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on ! q_alpha, v_alpha without) REAL(wp), POINTER :: q_force(:), q_n_nodes(:, :), fint_n(:), load_n(:) REAL(wp), POINTER :: qf(:), vf(:), qf_nodes(:, :) - REAL(wp), POINTER :: tension_n(:), stretch_n(:), chord_n(:, :) + REAL(wp), POINTER :: tension_n(:), stretch_n(:), chord_n(:, :), stiff_n(:) LOGICAL :: force_blend, release_cap LOGICAL :: topo_ok, bw_hit, mb_hit INTEGER :: il, jl @@ -1486,7 +1495,8 @@ SUBROUTINE start_forces(es_s, em_s) END IF ! release cap: the step-start tension, stretch and chord of every stretched element (the ! assembly above has validated the connectivity and the element lengths). An element - ! with ea = 0 takes the tension of the law its load callback carries (start_tension). + ! with ea = 0 takes the tension of the law its load callback carries (start_tension) and + ! the bound of its secant stiffness (start_stiffness). release_cap = tension_only .AND. alpha_f > CD_ZERO IF (release_cap .AND. PRESENT(start_tension)) THEN IF (SIZE(start_tension) /= n_elem) THEN @@ -1499,6 +1509,18 @@ SUBROUTINE start_forces(es_s, em_s) em_s = 'start_tension must be finite' RETURN END IF + IF (PRESENT(start_stiffness)) THEN + IF (SIZE(start_stiffness) /= n_elem) THEN + es_s = CD_DYN_BADINPUT + em_s = 'start_stiffness must have shape (n_elem)' + RETURN + END IF + IF (.NOT. CD_All_Finite(start_stiffness) .OR. ANY(start_stiffness < CD_ZERO)) THEN + es_s = CD_DYN_BADINPUT + em_s = 'start_stiffness must be finite and non-negative' + RETURN + END IF + END IF END IF IF (release_cap) THEN DO i = 1, n_elem @@ -1509,11 +1531,13 @@ SUBROUTINE start_forces(es_s, em_s) chord_n(:, i) = d/ell stretch_n(i) = ell - l0(i) tension_n(i) = CD_ZERO + stiff_n(i) = HUGE(CD_ONE) IF (stretch_n(i) > CD_ZERO) THEN IF (ea(i) > CD_ZERO) THEN tension_n(i) = ea(i)*(ell/l0(i) - CD_ONE) ELSE IF (PRESENT(start_tension)) THEN tension_n(i) = MAX(start_tension(i), CD_ZERO) + IF (PRESENT(start_stiffness)) stiff_n(i) = start_stiffness(i) END IF END IF END BLOCK @@ -1611,6 +1635,7 @@ SUBROUTINE bind_step_workspace(workspace_ref) tension_n => workspace_ref%tension_n(1:n_elem) stretch_n => workspace_ref%stretch_n(1:n_elem) chord_n => workspace_ref%chord_n(1:3, 1:n_elem) + stiff_n => workspace_ref%stiff_n(1:n_elem) v_eval => workspace_ref%v_eval(1:n_dof) v_alpha => workspace_ref%v_alpha(1:n_dof) IF (cfg%force_blend) THEN @@ -1987,21 +2012,29 @@ SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) !! tension at t_{n+1}, returns -(1 - alpha_f) T_1 p_1 with p_1 = |d_1| - t_1 . d_0. The !! element itself only released its strain energy W_0 = T_0 e_0/2, so the blend of an !! element that releases (deeply, or turning) within one step can create energy. The cap - !! bounds the work of the blended force by W_0: when alpha_f T_0 p exceeds - !! N = W_0 + (1 - alpha_f) T_1 p_1 the element carries N/p instead of alpha_f T_0 along t_0 - !! (the smaller of the two is kept, so the blend is continuous in d_1). An element slack at - !! t_{n+1} (T_1 = 0) carries the discrete energy gradient W_0/p and returns exactly W_0. - !! For e_1 > 0, T_1 = T_0 e_1/e_0, the tension of an elastic element, so the cap fades out - !! continuously as the end state crosses the rest length (a cap on slack end states alone - !! would jump there by up to alpha_f T_0). It acts on a taut end state only when the - !! element turned and T_1 < alpha_f/(1 - alpha_f) T_0; an element slack at t_n keeps the - !! force blend. N >= W_0/2 always, so 4 alpha_f p <= e_0 is a sufficient test of an - !! inactive cap. The residual and the tangent are corrected by the difference. An element - !! whose axial law a load callback carries (ea = 0, T_0 from start_tension) is capped the - !! same way with the same W_0 = T_0 e_0/2 (the energy of the viscoelastic springs at - !! rest, an upper bound of the energy below a stiffening loading curve such as Syrope's) - !! and the same secant T_1, so the blend of every tension-only element that ends slack - !! returns at most T_0 e_0/2 (an elastic one also when it ends taut). + !! uses an estimate T^_1 of T_1: T^_1 = k e_1 for e_1 > 0 and 0 otherwise, with the secant + !! k = T_0/e_0. When alpha_f T_0 p exceeds N = W_0 + (1 - alpha_f) T^_1 p_1 the element + !! carries N/p instead of alpha_f T_0 along t_0 (the smaller of the two is kept, so the + !! blend is continuous in d_1), so its blend returns at most + !! W_0 + (1 - alpha_f)(T^_1 - T_1) p_1 over the step, and never more than without the cap. + !! T^_1 vanishes as the end state crosses the rest length, so the cap fades out + !! continuously there (a cap on slack end states alone would jump by up to alpha_f T_0). + !! For an elastic element T^_1 = T_1: its blend returns at most W_0 over every step (an + !! element that ends slack carries the discrete energy gradient W_0/p and returns exactly + !! W_0), and the cap acts on a taut end state only when the element turned and + !! T_1 < alpha_f/(1 - alpha_f) T_0. An element slack at t_n keeps the force blend. + !! N >= W_0/2 always (k e_0 <= T_0), so 4 alpha_f p <= e_0 is a sufficient test of an + !! inactive cap. The residual and the tangent are corrected by the difference. + !! An element whose axial law a load callback carries (ea = 0, T_0 from start_tension) is + !! capped the same way with the same W_0 = T_0 e_0/2 (the energy of the viscoelastic + !! springs at rest, an upper bound of the energy below a stiffening loading curve such as + !! Syrope's) and k = min(T_0/e_0, k_n), k_n its step-start axial stiffness + !! (start_stiffness), which bounds the secant where T_0 is mostly damping or lagged state + !! at a small e_0. Its law tension T_1 is not that of a linear spring, so its blend + !! returns at most W_0 when (T^_1 - T_1) p_1 <= 0: always when it ends below l0 with no + !! law tension, and otherwise not guaranteed, e.g. when it ends above l0 with less law + !! tension than T^_1 (zero once the slow branch has taken up the stretch, or below + !! Syrope's minimum strain), by up to (1 - alpha_f) k e_1 p_1. REAL(wp), INTENT(IN) :: q_eval(:) REAL(wp), INTENT(INOUT) :: Rout(:) REAL(wp), INTENT(INOUT), OPTIONAL :: effout(:, :), effbandout(:, :) @@ -2033,7 +2066,8 @@ SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) END IF IF (taut_end) THEN ln = l0(e) + e0 - k0 = t0/e0 + ! the secant stiffness, bounded for a law element by its step-start axial stiffness + k0 = MIN(t0/e0, stiff_n(e)) ten1 = k0*e1 t1 = d1/l1 cosang = t1(1)*chord_n(1, e) + t1(2)*chord_n(2, e) + t1(3)*chord_n(3, e) @@ -2172,6 +2206,8 @@ SUBROUTINE ensure_step_workspace(work, n_dof, n_elem, n_free, ldab, need_band, n IF (ErrStat /= CD_DYN_OK) RETURN CALL ensure_real_matrix(work%chord_n, 3, n_elem, ErrStat, ErrMsg) IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%stiff_n, n_elem, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN IF (need_band) THEN ! a reallocated mass band no longer holds the remembered one IF (ALLOCATED(work%M_band)) THEN diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index 2b7dccbe..eaf50d79 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -176,6 +176,9 @@ MODULE CableDyn_Model ! the other elements; allocated only on a model with either law): the release cap of the ! force blend bounds their alpha_f share as it bounds that of the elastic elements REAL(wp), ALLOCATABLE :: tension_start_work(:) + ! their axial stiffness at the committed state (EA_D/l0, Syrope K1/l0; n_elem, allocated + ! with tension_start_work), which bounds the secant end tension of the release cap + REAL(wp), ALLOCATABLE :: stiffness_start_work(:) ! load_start_work holds the committed-state load of the last step: a warm re-solve of the ! same step (the junction coupling, dynamic_workspace%guess_armed) reuses it LOGICAL :: load_start_valid = .FALSE. @@ -1920,10 +1923,26 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, RETURN END IF END IF + IF (ALLOCATED(model%stiffness_start_work)) THEN + IF (.NOT. ALLOCATED(model%tension_start_work)) THEN + DEALLOCATE (model%stiffness_start_work) + ELSE IF (SIZE(model%stiffness_start_work) /= model%n_elem) THEN + DEALLOCATE (model%stiffness_start_work) + END IF + END IF + IF (ALLOCATED(model%tension_start_work) .AND. .NOT. ALLOCATED(model%stiffness_start_work)) THEN + ALLOCATE (model%stiffness_start_work(model%n_elem), STAT=es) + IF (es /= 0) THEN + ErrStat = CD_MODEL_ALLOCFAIL + ErrMsg = 'CableDyn_Model: step-start stiffness workspace allocation failed' + RETURN + END IF + END IF model%ve_dt = CD_ZERO IF (ALLOCATED(model%tension_start_work)) THEN CALL model_contributor_force(model, model%q, model%v, model%load_start_work, es, em, & - law_tension=model%tension_start_work) + law_tension=model%tension_start_work, & + law_stiffness=model%stiffness_start_work) ELSE CALL model_contributor_force(model, model%q, model%v, model%load_start_work, es, em) END IF @@ -1948,7 +1967,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, added_mass_band_proc=model_added_mass_band, prescribed_q=prescribed_q, & prescribed_v=prescribed_v, prescribed_a=prescribed_a, & workspace=model%dynamic_workspace, start_load=model%load_start_work, & - start_tension=model%tension_start_work) + start_tension=model%tension_start_work, & + start_stiffness=model%stiffness_start_work) ELSE IF (PRESENT(prescribed_q) .AND. has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1957,7 +1977,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, es, em, load_force_proc=model_force, load_band_proc=model_load_band, & prescribed_q=prescribed_q, prescribed_v=prescribed_v, & prescribed_a=prescribed_a, workspace=model%dynamic_workspace, & - start_load=model%load_start_work, start_tension=model%tension_start_work) + start_load=model%load_start_work, start_tension=model%tension_start_work, & + start_stiffness=model%stiffness_start_work) ELSE IF (PRESENT(prescribed_q) .AND. model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1980,7 +2001,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, n_iter, es, em, & load_force_proc=model_force, load_band_proc=model_load_band, & added_mass_band_proc=model_added_mass_band, workspace=model%dynamic_workspace, & - start_load=model%load_start_work, start_tension=model%tension_start_work) + start_load=model%load_start_work, start_tension=model%tension_start_work, & + start_stiffness=model%stiffness_start_work) ELSE IF (has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1988,7 +2010,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, n_iter, es, em, & load_force_proc=model_force, load_band_proc=model_load_band, & workspace=model%dynamic_workspace, start_load=model%load_start_work, & - start_tension=model%tension_start_work) + start_tension=model%tension_start_work, & + start_stiffness=model%stiffness_start_work) ELSE IF (model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -5696,6 +5719,7 @@ SUBROUTINE clear_model_load_contributor_workspace(model) IF (ALLOCATED(model%load_jv_work)) DEALLOCATE (model%load_jv_work) IF (ALLOCATED(model%load_start_work)) DEALLOCATE (model%load_start_work) IF (ALLOCATED(model%tension_start_work)) DEALLOCATE (model%tension_start_work) + IF (ALLOCATED(model%stiffness_start_work)) DEALLOCATE (model%stiffness_start_work) model%load_start_valid = .FALSE. END SUBROUTINE clear_model_load_contributor_workspace @@ -6282,7 +6306,8 @@ SUBROUTINE model_contributor_load_banded(model, q, v, free, kl, ku, force, jac_q END IF END SUBROUTINE model_contributor_load_banded - SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_nodes_only, law_tension) + SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_nodes_only, law_tension, & + law_stiffness) !! Assemble all configured non-structural model load contributors without tangents. !! end_nodes_only: only the first and last node's entries are needed (end-force recovery); !! the other nodes and the elements not touching an end are skipped, and the two end entries @@ -6292,6 +6317,9 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node !! carries the finiteness check of the full assembly. !! law_tension (n_elem; with a full assembly): the along-chord tension of the element force !! of the viscoelastic and Syrope laws in `force`, zero for every other element. + !! law_stiffness (n_elem; with law_tension): the axial stiffness of those laws at (q, v), in + !! N per metre of elongation: EA_D/l0 (the dynamic branch, at the committed state of a + !! load-dependent EA_D) and Syrope's K1/l0 = (alpha + beta T_mean)/l0; zero elsewhere. TYPE(CD_ModelType), INTENT(IN) :: model REAL(wp), INTENT(IN) :: q(:), v(:) REAL(wp), INTENT(OUT) :: force(:) @@ -6299,6 +6327,7 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node CHARACTER(*), INTENT(OUT) :: ErrMsg LOGICAL, INTENT(IN), OPTIONAL :: end_nodes_only REAL(wp), INTENT(OUT), OPTIONAL :: law_tension(:) + REAL(wp), INTENT(OUT), OPTIONAL :: law_stiffness(:) INTEGER :: n, e, i, ix, iy, iz, idx(6), nn LOGICAL :: ends @@ -6324,6 +6353,14 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node END IF law_tension = CD_ZERO END IF + IF (PRESENT(law_stiffness)) THEN + IF (.NOT. PRESENT(law_tension) .OR. SIZE(law_stiffness) /= model%n_elem) THEN + ErrStat = CD_MODEL_BADINPUT + ErrMsg = 'CableDyn_Model: model force law stiffnesses need the law tensions and shape (n_elem)' + RETURN + END IF + law_stiffness = CD_ZERO + END IF ErrStat = CD_MODEL_OK ErrMsg = '' nn = n/3 @@ -6429,6 +6466,7 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node IF (ErrStat /= 0) RETURN CALL scatter_element_vector(force, idx, f2) IF (PRESENT(law_tension)) law_tension(e) = element_law_tension() + IF (PRESENT(law_stiffness)) law_stiffness(e) = ea_d_eff/model%l0(e) END IF END IF IF (model%has_syrope) THEN @@ -6437,6 +6475,8 @@ SUBROUTINE model_contributor_force(model, q, v, force, ErrStat, ErrMsg, end_node IF (ErrStat /= CD_MODEL_OK) RETURN CALL scatter_element_vector(force, idx, f2) IF (PRESENT(law_tension)) law_tension(e) = element_law_tension() + IF (PRESENT(law_stiffness)) law_stiffness(e) = (model%syrope_type(e)%alpha + & + model%syrope_type(e)%beta*syr_tm)/model%l0(e) END IF END IF IF (model%has_morison_drag) THEN diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index d775354d..b543a66e 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -27,12 +27,17 @@ PROGRAM test_ei0_slack_dynamics !! each on the banded and the dense path. The residual is also checked against the closed !! form. The blend of a segment that turns by 0 to 180 degrees within the step and ends !! slack or taut returns at most its step-start strain energy W_n (up to 1100 W_n before - !! the cap took the projected shortening), and its force is continuous across the rest - !! length. + !! the cap took the projected shortening), one that keeps its direction and ends taut keeps + !! the plain force blend, and the force is continuous across the rest length. !! 6. The same chain with a segment whose tension-only law a load callback carries (ea = 0, !! as the viscoelastic and Syrope segments of a line model): with its step-start tension !! (start_tension) its release, deep or turning, is capped like an elastic one, closed !! form and finite difference tangent; without it the segment keeps the plain force blend. + !! A damped law segment whose step-start tension is almost all damping at a vanishing + !! stretch: with its axial stiffness (start_stiffness) bounding the secant end tension, + !! the cap force varies with the end stretch at a slope of order that stiffness (a jump + !! with the unbounded secant), the blend keeps the stated energy bound, and the tangent + !! matches the finite difference. !! 7. The finite-difference tangent of the step with nonzero dynamic loads (a quadratic drag !! and a cubic position load, plus a position-dependent added mass on the dense path), and !! the closed form of the blended load (1 - alpha_f) f(q_{n+1}, v_{n+1}) + alpha_f f(q_n, v_n). @@ -61,6 +66,8 @@ PROGRAM test_ei0_slack_dynamics ! tension-only law (EA cb_ea_law, length cb_l0_law) of segment cb_law_elem (0: none), and the ! added mass cb_madd (1 + 0.3 z^2) per DOF of the dense path REAL(wp) :: cb_drag = 0.0_wp, cb_spring = 0.0_wp, cb_ea_law = 0.0_wp, cb_l0_law = 1.0_wp, cb_madd = 0.0_wp + ! axial damping of the segment law, tension cb_ea_law (l/l0 - 1) + cb_ba_law (dl/dt)/l0 + REAL(wp) :: cb_ba_law = 0.0_wp REAL(wp) :: cb_q0(12) = 0.0_wp INTEGER :: cb_law_elem = 0 @@ -70,6 +77,7 @@ PROGRAM test_ei0_slack_dynamics CALL case_tangent_consistency() CALL case_release_energy() CALL case_law_release_cap() + CALL case_law_damped_release() CALL case_load_share_tangent() CALL case_warm_resolve_reuse() CALL case_light_cable_coarse_step() @@ -459,7 +467,8 @@ SUBROUTINE case_tangent_consistency() ! (a) all segments taut at t_n and at the trial state: the cap is inactive CALL tangent_config('taut-taut', [0.010_wp, 0.020_wp, 0.010_wp], [0.020_wp, 0.015_wp, 0.020_wp], .FALSE.) ! (b) segment 1 taut at t_n and deeply slack at the trial state (release deeper than - ! 0.75 e_n): it carries the energy gradient W_n/(e_n - e_{n+1}) instead of alpha_f T_n + ! 0.75 e_n, turned a few degrees): it carries the energy gradient W_n/p on its projected + ! shortening p instead of alpha_f T_n CALL tangent_config('release-cap', [0.010_wp, 0.020_wp, 0.010_wp], [-0.050_wp, 0.015_wp, 0.020_wp], .TRUE.) ! (c) segment 2 slack at both states CALL tangent_config('slack-slack', [0.010_wp, -0.020_wp, 0.010_wp], [0.020_wp, -0.030_wp, 0.015_wp], .FALSE.) @@ -492,6 +501,7 @@ SUBROUTINE case_release_energy() REAL(wp), PARAMETER :: S1(11) = [-0.5_wp, -0.01_wp, -1.0e-3_wp, -1.0e-4_wp, -1.0e-12_wp, 1.0e-12_wp, & 1.0e-4_wp, 2.0e-4_wp, 5.0e-4_wp, 1.0e-3_wp, 2.0e-3_wp] REAL(wp) :: qn(12), q1(12), z(12), R(12), Rm(12), K(9, 9), tn(3), u(3), dir(3), w0, wk, wmax, ratio, jump + REAL(wp) :: f_raw(12), dev INTEGER :: i, j CALL chain_nodes(DIRS, [0.010_wp, 0.020_wp, 0.001_wp], L0, qn) z = 0.0_wp @@ -509,6 +519,12 @@ SUBROUTINE case_release_energy() CALL probe_step(qn, z, z, q1, L0, EA, [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp], .FALSE., R, K) wk = -DOT_PRODUCT(R(10:12), q1(10:12) - qn(10:12)) wmax = MAX(wmax, wk/w0) + IF (THETA(i) == 0.0_wp .AND. S1(j) > 0.0_wp) THEN + ! a segment that keeps its direction and ends taut keeps the plain force blend + CALL blended_force(qn, q1, L0, EA, 0.4_wp/1.4_wp, .FALSE., f_raw) + dev = MAXVAL(ABS(R(10:12) - f_raw(10:12))) + CALL require(dev < 1.0e-9_wp*EA(3)*0.001_wp, 'release-energy:taut-end-uncapped') + END IF IF (.NOT. wk <= w0*(1.0_wp + 1.0e-9_wp)) THEN WRITE (*, '(A,F6.1,A,ES10.2,A,ES10.3,A,ES10.3,A)') ' release energy: theta ', THETA(i), ' s1 ', S1(j), & ': returned ', wk, ' J, W_n ', w0, ' J' @@ -644,7 +660,7 @@ SUBROUTINE chain_load(q, v, force, jac_q, jac_v) REAL(wp), INTENT(IN) :: q(:), v(:) REAL(wp), INTENT(OUT) :: force(:), jac_q(:, :), jac_v(:, :) INTEGER :: n, i, a, b - REAL(wp) :: d(3), w(3), dd, sp, c(3), ell, t(3), ten, kb(3, 3), eye(3, 3) + REAL(wp) :: d(3), w(3), dd, sp, c(3), ell, t(3), ten, kb(3, 3), eye(3, 3), kv(3, 3) force = 0.0_wp jac_q = 0.0_wp jac_v = 0.0_wp @@ -668,15 +684,23 @@ SUBROUTINE chain_load(q, v, force, jac_q, jac_v) c = q(3*b - 2:3*b) - q(3*a - 2:3*a) ell = NORM2(c) t = c/ell - ten = cb_ea_law*(ell/cb_l0_law - 1.0_wp) + w = v(3*b - 2:3*b) - v(3*a - 2:3*a) + ten = cb_ea_law*(ell/cb_l0_law - 1.0_wp) + cb_ba_law*DOT_PRODUCT(t, w)/cb_l0_law IF (ten > 0.0_wp) THEN force(3*a - 2:3*a) = force(3*a - 2:3*a) + ten*t force(3*b - 2:3*b) = force(3*b - 2:3*b) - ten*t - kb = (cb_ea_law/cb_l0_law)*outer3(t, t) + ten*(eye - outer3(t, t))/ell + ! kb = d(force_a)/d(q_b), kv = d(force_a)/d(v_b) + kb = (cb_ea_law/cb_l0_law)*outer3(t, t) + ten*(eye - outer3(t, t))/ell + & + (cb_ba_law/cb_l0_law)*outer3(t, MATMUL(eye - outer3(t, t), w)/ell) + kv = (cb_ba_law/cb_l0_law)*outer3(t, t) jac_q(3*a - 2:3*a, 3*a - 2:3*a) = jac_q(3*a - 2:3*a, 3*a - 2:3*a) + kb jac_q(3*a - 2:3*a, 3*b - 2:3*b) = jac_q(3*a - 2:3*a, 3*b - 2:3*b) - kb jac_q(3*b - 2:3*b, 3*a - 2:3*a) = jac_q(3*b - 2:3*b, 3*a - 2:3*a) - kb jac_q(3*b - 2:3*b, 3*b - 2:3*b) = jac_q(3*b - 2:3*b, 3*b - 2:3*b) + kb + jac_v(3*a - 2:3*a, 3*a - 2:3*a) = jac_v(3*a - 2:3*a, 3*a - 2:3*a) + kv + jac_v(3*a - 2:3*a, 3*b - 2:3*b) = jac_v(3*a - 2:3*a, 3*b - 2:3*b) - kv + jac_v(3*b - 2:3*b, 3*a - 2:3*a) = jac_v(3*b - 2:3*b, 3*a - 2:3*a) - kv + jac_v(3*b - 2:3*b, 3*b - 2:3*b) = jac_v(3*b - 2:3*b, 3*b - 2:3*b) + kv END IF END IF END SUBROUTINE chain_load @@ -744,14 +768,14 @@ SUBROUTINE cb_added_mass(q, accel, M_add, dMa_a_dq, ErrStat, ErrMsg) ErrMsg = '' END SUBROUTINE cb_added_mass - SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension) + SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension, start_stiffness) !! Residual and effective tangent at q1 of the force-blended step of the chain with the !! callback load: banded (load_band_proc + load_force_proc) or dense (load_proc, with the !! added mass when cb_madd > 0). REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), q1(12), l0(3), ea(3), rho_a(3) LOGICAL, INTENT(IN) :: banded REAL(wp), INTENT(OUT) :: R(12), K(9, 9) - REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:) + REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:), start_stiffness(:) INTEGER :: conn(2, 3), n_iter, es REAL(wp) :: qo(12), vo(12), ao(12) LOGICAL :: converged, stalled @@ -764,16 +788,17 @@ SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tensio CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & qo, vo, ao, converged, stalled, n_iter, es, em, load_band_proc=cb_load_band, & load_force_proc=cb_force, workspace=work, start_tension=start_tension, & - probe_q=q1, probe_R=R, probe_K=K) + start_stiffness=start_stiffness, probe_q=q1, probe_R=R, probe_K=K) ELSE IF (cb_madd > 0.0_wp) THEN CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & qo, vo, ao, converged, stalled, n_iter, es, em, load_proc=cb_load, & added_mass_proc=cb_added_mass, workspace=work, start_tension=start_tension, & - probe_q=q1, probe_R=R, probe_K=K) + start_stiffness=start_stiffness, probe_q=q1, probe_R=R, probe_K=K) ELSE CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & qo, vo, ao, converged, stalled, n_iter, es, em, load_proc=cb_load, & - workspace=work, start_tension=start_tension, probe_q=q1, probe_R=R, probe_K=K) + workspace=work, start_tension=start_tension, & + start_stiffness=start_stiffness, probe_q=q1, probe_R=R, probe_K=K) END IF IF (es /= CD_DYN_OK) THEN WRITE (*, '(A)') 'MISMATCH [chain:probe '//TRIM(em)//']' @@ -783,22 +808,22 @@ SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tensio END IF END SUBROUTINE probe_chain - SUBROUTINE fd_tangent_check(label, qn, vn, an, q1, l0, ea, rho_a, banded, start_tension) + SUBROUTINE fd_tangent_check(label, qn, vn, an, q1, l0, ea, rho_a, banded, start_tension, start_stiffness) !! The step's tangent against the central difference of its residual. CHARACTER(*), INTENT(IN) :: label REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), q1(12), l0(3), ea(3), rho_a(3) LOGICAL, INTENT(IN) :: banded - REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:) + REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:), start_stiffness(:) REAL(wp), PARAMETER :: H = 1.0e-6_wp INTEGER :: j REAL(wp) :: qp(12), R(12), Rp(12), Rm(12), K(9, 9), Kfd(9, 9), Kdump(9, 9), err - CALL probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension) + CALL probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension, start_stiffness) DO j = 1, 9 qp = q1 qp(3 + j) = q1(3 + j) + H - CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rp, Kdump, start_tension) + CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rp, Kdump, start_tension, start_stiffness) qp(3 + j) = q1(3 + j) - H - CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rm, Kdump, start_tension) + CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rm, Kdump, start_tension, start_stiffness) Kfd(:, j) = (Rp(4:12) - Rm(4:12))/(2.0_wp*H) END DO err = MAXVAL(ABS(K - Kfd))/MAXVAL(ABS(K)) @@ -839,6 +864,7 @@ SUBROUTINE reset_chain_load() cb_madd = 0.0_wp cb_q0 = 0.0_wp cb_law_elem = 0 + cb_ba_law = 0.0_wp END SUBROUTINE reset_chain_load SUBROUTINE case_law_release_cap() @@ -854,6 +880,95 @@ SUBROUTINE case_law_release_cap() DIRS_TURN) END SUBROUTINE case_law_release_cap + SUBROUTINE case_law_damped_release() + !! A law segment whose step-start tension is almost all damping: segment 3 (law EA 0.8e6 N, + !! BA 2e5 N s) stretched by e_n = 0.8 um and lengthening at 0.05 m/s carries T_n = 1.25e4 N, + !! a secant T_n/e_n = 1.6e10 N/m against its axial stiffness k_n = EA/l0 = 1e6 N/m. It turns + !! by 45 degrees and ends at a stretch e_{n+1} from -0.1 to 1.9 mm. With start_stiffness the + !! cap's force varies with e_{n+1} at a slope of order k_n; with the unbounded secant it + !! switches over a band of width ~e_n, a jump at this resolution. The blend returns at most + !! W_n + (1 - alpha_f)(T^_{n+1} - T_{n+1}) p_{n+1} (T^ the estimate k e_{n+1}, T_{n+1} the + !! law's end tension), and the tangent matches the finite difference where the cap acts. + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.0_wp] + REAL(wp), PARAMETER :: DIRS(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & + -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) + REAL(wp), PARAMETER :: EA_LAW = 0.8e6_wp, BA_LAW = 2.0e5_wp, ALPHA_F = 0.4_wp/1.4_wp + REAL(wp), PARAMETER :: RHO_TINY(3) = [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp] + INTEGER, PARAMETER :: NG = 201 + REAL(wp) :: qn(12), vn(12), an(12), q1(12), sl(12), jq(12, 12), jv(12, 12), tn(3), u(3), dir(3) + REAL(wp) :: Rk(12), Ru(12), Rp(12), K(9, 9), ck(3, NG), cu(3, NG), e1(NG), t0, e0, w0, kn, kc, de + REAL(wp) :: d0(3), d1(3), l1, t1(3), p1, ten1, that, wk, bound, slope_k, slope_u, worst + INTEGER :: i, nact + CALL reset_chain_load() + cb_law_elem = 3 + cb_ea_law = EA_LAW + cb_l0_law = L0(3) + cb_ba_law = BA_LAW + CALL chain_nodes(DIRS, [0.010_wp, 0.020_wp, 1.0e-6_wp], L0, qn) + d0 = qn(10:12) - qn(7:9) + tn = d0/NORM2(d0) + u = [tn(2), -tn(1), 0.0_wp] + u = u/NORM2(u) + vn = 0.0_wp + vn(10:12) = 0.05_wp*tn + an = 0.0_wp + CALL chain_load(qn, vn, sl, jq, jv) + t0 = DOT_PRODUCT(sl(7:9), tn) + e0 = NORM2(d0) - L0(3) + w0 = 0.5_wp*t0*e0 + kn = EA_LAW/L0(3) + kc = MIN(t0/e0, kn) + CALL require(t0 > 1.2e4_wp .AND. t0/e0 > 1.0e4_wp*kn, 'law-damped:damping-dominated-start') + dir = COS(PI/4.0_wp)*tn + SIN(PI/4.0_wp)*u + de = 2.0e-3_wp/REAL(NG - 1, wp) + nact = 0 + worst = -HUGE(1.0_wp) + DO i = 1, NG + e1(i) = -1.0e-4_wp + REAL(i - 1, wp)*de + q1 = qn + q1(10:12) = qn(7:9) + (L0(3) + e1(i))*dir + CALL probe_chain(qn, vn, an, q1, L0, EA, RHO_TINY, .TRUE., Rk, K, start_tension=[0.0_wp, 0.0_wp, t0], & + start_stiffness=[0.0_wp, 0.0_wp, kn]) + CALL probe_chain(qn, vn, an, q1, L0, EA, RHO_TINY, .TRUE., Ru, K, start_tension=[0.0_wp, 0.0_wp, t0]) + CALL probe_chain(qn, vn, an, q1, L0, EA, RHO_TINY, .TRUE., Rp, K) + ck(:, i) = Rk(10:12) - Rp(10:12) + cu(:, i) = Ru(10:12) - Rp(10:12) + IF (NORM2(ck(:, i)) > 1.0e-6_wp*t0) nact = nact + 1 + ! the law's end tension from the plain blend at the free node: (1 - alpha_f) T_1 t_1 + + ! alpha_f T_n t_n (the step-start law force), inertia negligible + d1 = q1(10:12) - q1(7:9) + l1 = NORM2(d1) + t1 = d1/l1 + ten1 = (DOT_PRODUCT(Rp(10:12), t1) - ALPHA_F*t0*DOT_PRODUCT(tn, t1))/(1.0_wp - ALPHA_F) + p1 = l1 - DOT_PRODUCT(t1, d0) + that = kc*MAX(e1(i), 0.0_wp) + wk = -DOT_PRODUCT(Rk(10:12), q1(10:12) - qn(10:12)) + bound = w0 + (1.0_wp - ALPHA_F)*(that - ten1)*p1 + worst = MAX(worst, wk - bound) + END DO + slope_k = 0.0_wp + slope_u = 0.0_wp + DO i = 1, NG - 1 + slope_k = MAX(slope_k, NORM2(ck(:, i + 1) - ck(:, i))/de) + slope_u = MAX(slope_u, NORM2(cu(:, i + 1) - cu(:, i))/de) + END DO + WRITE (*, '(A,I0,A,ES10.3,A,ES10.3,A,ES10.3,A)') ' law damped release: cap active at ', nact, & + ' stretches; largest slope of the cap force ', slope_k/kn, ' k_n (unbounded secant ', slope_u/kn, & + ' k_n); work above the bound ', worst, ' J' + CALL require(nact > NG/2, 'law-damped:cap-active') + CALL require(slope_k < 3.0_wp*kn, 'law-damped:bounded-slope') + CALL require(slope_u > 100.0_wp*kn, 'law-damped:unbounded-secant-jumps') + CALL require(worst <= 1.0e-6_wp, 'law-damped:energy-bound') + ! the tangent where the cap acts on a taut end state with the bounded secant (e_{n+1} = 0.8 mm) + q1 = qn + q1(10:12) = qn(7:9) + (L0(3) + 8.0e-4_wp)*dir + CALL fd_tangent_check('law-damped', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .TRUE., & + start_tension=[0.0_wp, 0.0_wp, t0], start_stiffness=[0.0_wp, 0.0_wp, kn]) + CALL fd_tangent_check('law-damped', qn, vn, an, q1, L0, EA, [2.0_wp, 3.0_wp, 1.5_wp], .FALSE., & + start_tension=[0.0_wp, 0.0_wp, t0], start_stiffness=[0.0_wp, 0.0_wp, kn]) + CALL reset_chain_load() + END SUBROUTINE case_law_damped_release + SUBROUTINE law_cap_config(label, strain_n, strain_1, dirs_trial) CHARACTER(*), INTENT(IN) :: label REAL(wp), INTENT(IN) :: strain_n(3), strain_1(3) @@ -1121,9 +1236,9 @@ SUBROUTINE case_law_slack_runs() CHARACTER(64) :: opts(4) REAL(wp) :: fair, anch, seg_min ! the light cable as a lightly damped viscoelastic line, 3 m heave at dtM 0.1 s: anchor - ! 8.7e4 to 9.5e4 N and fairlead 0.97e5 to 1.11e5 N at dtM 0.5 to 2.5 ms; without the cap + ! 8.2e4 to 9.5e4 N and fairlead 0.97e5 to 1.02e5 N at dtM 0.5 to 2.5 ms; without the cap ! on its law segments 1.45e5 N at the anchor. At 0.1 s the anchor snap is not resolved in - ! time (the run notes it), so its peak depends on round-off: 7.2e4 N with gfortran on + ! time (the run notes it), so its peak depends on round-off: 8.5e4 N with gfortran on ! Windows, other values on other platforms. The upper bound is the check of the cap; the ! lower bound only asks that the snap reaches the anchor. CALL write_motion('ei0slack_heave_ve.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 3, 3.0_wp, 10.0_wp, 10.0_wp, & From 2d8ccd7c106740c4cdba3437a93c3173a2bc3220 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Sat, 17 Oct 2026 02:26:07 +0900 Subject: [PATCH 10/11] test(dynamics): check the snap note on a line that snaps with margin The light cable's 3 m heave snaps only just past its initial tension, so whether a coarse step counts a snap there depends on round-off: on a Linux CI runner the force-blended run counted none and printed no snap note, where Windows counts four. The snap note is now checked on the same cable heaving 6 m at 8 s, which snaps 315 segment steps past the initial tension. Signed-off-by: Jae Hoon Seo --- tests/test_ei0_slack_dynamics.f90 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index b543a66e..b1557a04 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -614,10 +614,23 @@ SUBROUTINE case_run_audit() IF (.NOT. ok) CALL echo_tail('ei0slack_audit_fb.log', 6) CALL require(ok, 'audit:force-blend-run') CALL require(.NOT. file_contains('ei0slack_audit_fb.log', 'Warning: line'), 'audit:force-blend-no-warning') - ! the snaps of the light cable (axial wave crossing a segment ~160 times per step) are noted - CALL require(file_contains('ei0slack_audit_fb.log', 'went from slack to taut above the initial tension'), & + ! snaps of the light cable (axial wave crossing a segment ~160 times per step) are noted. The + ! 3 m heave above snaps only just past the initial tension, so whether a coarse step counts a + ! snap there depends on round-off; a 6 m heave at 8 s snaps the line well past it + CALL write_motion('ei0slack_snap.txt', 1, [5.0_wp, 0.0_wp, -14.0_wp], 3, 6.0_wp, 8.0_wp, 8.0_wp, & + 0.1_wp, 40.0_wp) + opts(1) = '0.1 dtM' + opts(2) = '40.0 TMax' + opts(3) = 'ei0slack_snap.txt motionFile' + opts(4) = '' + CALL write_deck('ei0slack_audit_snap.dat', CABLE, [205.0_wp, 0.0_wp, -80.0_wp], [5.0_wp, 0.0_wp, -14.0_wp], & + 230.0_wp, 115, 80.0_wp, '-', opts) + CALL run_driver_logged('ei0slack_audit_snap.dat', 'ei0slack_audit_snap', 'ei0slack_audit_snap.log', ok) + IF (.NOT. ok) CALL echo_tail('ei0slack_audit_snap.log', 6) + CALL require(ok, 'audit:snap-run') + CALL require(file_contains('ei0slack_audit_snap.log', 'went from slack to taut above the initial tension'), & 'audit:snap-note') - CALL require(file_contains('ei0slack_audit_fb.log', 'snap-load peaks are not resolved in time'), & + CALL require(file_contains('ei0slack_audit_snap.log', 'snap-load peaks are not resolved in time'), & 'audit:snap-note-text') CALL require(.NOT. file_contains('ei0slack_audit_fb.log', 'Note: rhoInf'), 'audit:default-rhoinf-no-note') ! rhoInf above 0.95 From f227a80d68e5744ad7555ec73b0d83d1b69e85d8 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Sat, 17 Oct 2026 04:26:42 +0900 Subject: [PATCH 11/11] fix(dynamics): cover the kept axial-damping share in the release cap An elastic EI = 0 segment with axial damping keeps alpha_f of its step-start dashpot tension T_d,n along its old chord, in the step-start load, while the release cap bounded only the elastic share. A segment that extends at t_n and turns and releases within the step then still returned energy through that force: in the test chain (dashpot tension 1.6 to 62 times the elastic one) the kept share returned up to 7e4 W_n and the whole blend, dashpot end share included, up to 2750 W_n. The line model now passes the step its axial damping (BA per element and the payout rate l0_dot, as its damping contributor evaluates them). The step computes T_d,n at the committed state. Where the end state lies at or below the rest length, or above it by less than c e_n with c = alpha_f / (1 - alpha_f), the cap covers the dashpot with a weight phi: 1 at and below l0, falling linearly to 0 at l0 + c e_n. It replaces the kept force alpha_f (T_n + phi T_d,n) by N / p when that is smaller, with N = max(W_n + (1 - alpha_f)(T^_{n+1} + phi T_d,{n+1}) p_{n+1}, 0) and T_d,{n+1} the dashpot tension the residual carries at (q_{n+1}, v_{n+1}). The dashpot pushes and pulls, so its end share acts at a slack end too and is credited. It stores no energy, so the budget stays the elastic W_n. The tangent carries T_d,{n+1}'s dependence on q_{n+1} through v_{n+1} (gamma / (beta dt)), on the banded, dense and probe paths. Over a step with p > 0 the blend then returns at most W_n + (1 - phi) D, D the work of the uncapped blended dashpot, except when its end share alone returns more than W_n (the capped kept force is then zero). At and below l0 that is W_n. Above the band, and on undamped elements, the cap is unchanged, so taut damped segments keep the standard force blend. phi is continuous, and so is the capped force. The viscoelastic law keeps its total tension, dashpots included, as before. Tests: over turns of 0 to 180 degrees, slack and taut ends and three extension rates: - a segment ending slack returns at most W_n (2794 W_n uncapped); - every row keeps the stated bound to 1.6e-11 W_n; - non-turning taut rows keep the plain force blend; - the force jumps by 1e-9 T_d,n across the rest length and the band edge; - the finite-difference tangent of a slack end and of an end in the band agrees to 1.1e-10 on both paths. Outputs against 2d8ccd7: every shipped example is byte-identical except the two als_volturnus line-break decks, whose broken line goes slack (tension statistics move by at most 3.8e-4, maxima by 4e-4). The semi-taut chain-polyester reproducer's coarse-step anchor snap moves from 5.77 to 5.74 MN; the changelog and troubleshooting page now say 5.7 MN (4.6 MN at 2.5 ms, unchanged). The Bergdahl record (no axial damping) and the snap-load record (its own callbacks) are unchanged. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 10 +- doc/theory.rst | 28 +++++ doc/troubleshooting.rst | 2 +- src/CableDyn_Dynamic.f90 | 184 +++++++++++++++++++++++----- src/CableDyn_Model.f90 | 12 +- tests/test_ei0_slack_dynamics.f90 | 195 ++++++++++++++++++++++++++++-- 6 files changed, 384 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa469df1..d476efcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -193,11 +193,17 @@ All notable changes to CableDyn are recorded in this file. The format follows stiffness, so that damping carried at a vanishing stretch does not make the cap switch abruptly (the same cable made lightly damped viscoelastic peaks at 0.085 MN at the anchor at `dtM` 0.1 s, a snap that step does not resolve, against 0.145 MN without the cap on its - segments and 0.082 to 0.095 MN at 0.5 to 2.5 ms). The seabed contact of + segments and 0.082 to 0.095 MN at 0.5 to 2.5 ms). An elastic segment with axial damping + keeps the step-start dashpot force along its old chord too; where its end state is slack, or + taut by less than `α_f/(1 − α_f)` of its stretch, the cap covers that force as well, crediting + the dashpot's end share, so that the whole blend of a segment ending slack returns at most its + strain energy unless that end share alone returns more (in the test chain it returned up to + 2750 times that with only the elastic share capped); a damped segment that ends taut beyond + that band keeps the plain force blend. The seabed contact of a node that lifts off within a step is not capped (see the manual's theory page). At the default `rhoInf` the reproducers now give 0.10 / 0.09 MN, 0.092 / 0.106 MN, 0.075 / 0.043 MN and 1.80 MN, as their references, and the stiff-seabed line runs to completion; the - chain–polyester anchor snap peaks at 5.8 MN at `dtM` 0.05 s, a single-step peak (4.6 MN at + chain–polyester anchor snap peaks at 5.7 MN at `dtM` 0.05 s, a single-step peak (4.6 MN at 0.0025 s) that the new snap note reports. On a linear element the scheme is unchanged, so taut lines keep their accuracy: every MoorDyn-C, OrcaFlex, analytic and experimental comparison that runs locally still passes, and its reported error moves by at most 0.35 percentage points (the diff --git a/doc/theory.rst b/doc/theory.rst index 1739b782..c71717d6 100644 --- a/doc/theory.rst +++ b/doc/theory.rst @@ -1393,6 +1393,34 @@ compilers and platforms give other values) and at 0.145 MN without it, against 0 surge that goes slack peaks at 1.64 MN at 0.1 s, against 1.78 MN at 1 and 2.5 ms, with or without the cap. +An elastic segment with axial damping (``BA``) also keeps :math:`\alpha_f T_{d,n}` along +:math:`\mathbf{t}_n`, :math:`T_{d,n}` the tension of its dashpot at :math:`t_n`. A segment that +extends at :math:`t_n` and releases within the step carries that force against the shortening +as well: in the test chain (dashpot tension 1.6 to 62 times the elastic one) the blend of a +segment that turns and releases returned up to 2750 :math:`W_n` with only its elastic share +capped. +The dashpot pushes as well as pulls, so its end share +:math:`(1 - \alpha_f) T_{d,n+1}\mathbf{t}_{n+1}` acts at a slack end state too, and it stores no +energy, so the budget stays :math:`W_n`. The cap covers the dashpot with a weight :math:`\phi` +that is 1 while the end state is at or below :math:`l_0` and falls linearly to 0 at +:math:`l_0 + c\,e_n`, :math:`c = \alpha_f/(1 - \alpha_f)` (the end stretch below which the cap +can act on an elastic segment): the kept force :math:`\alpha_f (T_n + \phi T_{d,n})` is replaced +by :math:`N/p` when that is smaller, with +:math:`N = \max(W_n + (1 - \alpha_f)(\hat T_{n+1} + \phi T_{d,n+1})\,p_{n+1}, 0)` and +:math:`T_{d,n+1}` the dashpot tension the residual carries at +:math:`(\mathbf{q}_{n+1}, \mathbf{v}_{n+1})`; the tangent carries its dependence on +:math:`\mathbf{q}_{n+1}` through :math:`\mathbf{v}_{n+1}` (the factor +:math:`\gamma/(\beta\Delta t)`). Over a step in which it shortens along :math:`\mathbf{t}_n` +(:math:`p > 0`; the cap leaves the other steps alone) the blend of such a segment then returns +at most :math:`W_n + (1 - \phi) D`, :math:`D = \alpha_f T_{d,n} p - (1 - \alpha_f) +T_{d,n+1} p_{n+1}` the work of its uncapped blended dashpot, except when the end share alone +returns more than :math:`W_n` (:math:`N` would be negative; the capped kept force is then +zero). At +and below :math:`l_0` that is :math:`W_n`. Above :math:`l_0 + c\,e_n` the cap is the elastic one, +so the force-blended dashpot of a taut segment keeps the standard generalised-α treatment, under +which a linear dashpot is dissipative; :math:`\phi` is continuous, and so is the capped force. +The viscoelastic law keeps its total tension, dashpots included, as :math:`T_n` (above). + The one-sided seabed contact is not capped. A node that leaves the floor within a step keeps :math:`\alpha_f` of its step-start contact force :math:`N_n` for the whole step: over a lift-off distance :math:`d` it returns at most :math:`\alpha_f N_n d` to the motion, against the energy diff --git a/doc/troubleshooting.rst b/doc/troubleshooting.rst index dfee5c30..2ef21c85 100644 --- a/doc/troubleshooting.rst +++ b/doc/troubleshooting.rst @@ -568,7 +568,7 @@ Warnings and notes that do not stop a run * - ``Note: line ...: ... segment step(s) went from slack to taut above the initial tension`` - snap loads on an ``EI = 0`` line at a ``dtM`` that does not resolve the axial wave over a segment: the peak is set by a single step (a 15 m surge of a semi-taut chain–polyester - line peaks at 5.8 MN at ``dtM`` 0.05 s against 4.6 MN at 0.0025 s). The run is valid; + line peaks at 5.7 MN at ``dtM`` 0.05 s against 4.6 MN at 0.0025 s). The run is valid; confirm design peaks with a smaller ``dtM``. * - ``Warning: line ...: segment ... carried ... N at t = ... s for a single step, ... times the largest tension on the line one step before and after`` diff --git a/src/CableDyn_Dynamic.f90 b/src/CableDyn_Dynamic.f90 index 8592cb3f..e7646397 100644 --- a/src/CableDyn_Dynamic.f90 +++ b/src/CableDyn_Dynamic.f90 @@ -133,6 +133,9 @@ MODULE CableDyn_Dynamic ! l - l0 and unit chord of every element, and the bound of its secant stiffness ! (start_stiffness of a law element, HUGE otherwise) REAL(wp), ALLOCATABLE :: tension_n(:), stretch_n(:), chord_n(:, :), stiff_n(:) + ! the axial dashpot of an elastic element (axial_damping): BA/l0, the payout rate l0_dot/l0 + ! and the dashpot tension at the step start, zero without one + REAL(wp), ALLOCATABLE :: dcoef_n(:), rl0dot_n(:), damp_n(:) ! fint_n, load_n and the release-cap data hold the step-start values of the last call: a ! warm re-solve of the same step (guess_armed, from the same committed state) reuses them LOGICAL :: start_valid = .FALSE. @@ -323,6 +326,9 @@ SUBROUTINE CD_Clear_GenAlpha_Workspace(work) IF (ALLOCATED(work%stretch_n)) DEALLOCATE (work%stretch_n) IF (ALLOCATED(work%chord_n)) DEALLOCATE (work%chord_n) IF (ALLOCATED(work%stiff_n)) DEALLOCATE (work%stiff_n) + IF (ALLOCATED(work%dcoef_n)) DEALLOCATE (work%dcoef_n) + IF (ALLOCATED(work%rl0dot_n)) DEALLOCATE (work%rl0dot_n) + IF (ALLOCATED(work%damp_n)) DEALLOCATE (work%damp_n) work%start_valid = .FALSE. IF (ALLOCATED(work%eff)) DEALLOCATE (work%eff) IF (ALLOCATED(work%eff_free)) DEALLOCATE (work%eff_free) @@ -608,7 +614,8 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on load_proc, added_mass_proc, load_force_proc, & load_band_proc, prescribed_q, prescribed_v, prescribed_a, structural_mass, & workspace, added_mass_band_proc, start_load, start_tension, & - probe_q, probe_R, probe_K, start_stiffness) + probe_q, probe_R, probe_K, start_stiffness, axial_damping, & + axial_l0_rate) !! One generalized-alpha step: the constant load f_ext plus the optional load, !! banded-load, force-only and added-mass callbacks (hydrodynamics, damping, contact). !! On a singular effective tangent returns CD_DYN_SINGULAR; on a line-search @@ -673,6 +680,14 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on !! taut (see apply_release_cap). Entries of elements with ea > 0 are ignored. Absent: the !! secant is not bounded. REAL(wp), INTENT(IN), OPTIONAL :: start_stiffness(:) + !! Force blend on a tension-only line whose load callbacks carry a linear axial dashpot on + !! elements with ea > 0 (the axial damping of a line model): its coefficient BA per element + !! (n_elem, N s, >= 0), the dashpot force on node a being (BA/l0) (t . (v_b - v_a) + !! - (l/l0) l0_dot) t, with axial_l0_rate the unstretched-length rate l0_dot (n_elem; absent: + !! zero). The release cap then covers the dashpot's step-start share too (see + !! apply_release_cap). Entries of elements with ea = 0 are ignored. Absent: the cap covers + !! the elastic force only. + REAL(wp), INTENT(IN), OPTIONAL :: axial_damping(:), axial_l0_rate(:) !! TEST HOOK (unit tests of the tangent; production callers omit it). With probe_q (full !! 3 n_nodes array, the fixed DOFs at their t_{n+1} values) present, the step returns after !! its setup without iterating: probe_R is the residual (3 n_nodes) and probe_K the free-free @@ -697,6 +712,7 @@ SUBROUTINE CD_Cable_Gen_Alpha_Step(q, v, a, elem_conn, l0, ea, rho_a, tension_on REAL(wp), POINTER :: q_force(:), q_n_nodes(:, :), fint_n(:), load_n(:) REAL(wp), POINTER :: qf(:), vf(:), qf_nodes(:, :) REAL(wp), POINTER :: tension_n(:), stretch_n(:), chord_n(:, :), stiff_n(:) + REAL(wp), POINTER :: dcoef_n(:), rl0dot_n(:), damp_n(:) LOGICAL :: force_blend, release_cap LOGICAL :: topo_ok, bw_hit, mb_hit INTEGER :: il, jl @@ -1522,6 +1538,30 @@ SUBROUTINE start_forces(es_s, em_s) END IF END IF END IF + IF (release_cap .AND. PRESENT(axial_damping)) THEN + IF (SIZE(axial_damping) /= n_elem) THEN + es_s = CD_DYN_BADINPUT + em_s = 'axial_damping must have shape (n_elem)' + RETURN + END IF + IF (.NOT. CD_All_Finite(axial_damping) .OR. ANY(axial_damping < CD_ZERO)) THEN + es_s = CD_DYN_BADINPUT + em_s = 'axial_damping must be finite and non-negative' + RETURN + END IF + IF (PRESENT(axial_l0_rate)) THEN + IF (SIZE(axial_l0_rate) /= n_elem) THEN + es_s = CD_DYN_BADINPUT + em_s = 'axial_l0_rate must have shape (n_elem)' + RETURN + END IF + IF (.NOT. CD_All_Finite(axial_l0_rate)) THEN + es_s = CD_DYN_BADINPUT + em_s = 'axial_l0_rate must be finite' + RETURN + END IF + END IF + END IF IF (release_cap) THEN DO i = 1, n_elem BLOCK @@ -1532,6 +1572,18 @@ SUBROUTINE start_forces(es_s, em_s) stretch_n(i) = ell - l0(i) tension_n(i) = CD_ZERO stiff_n(i) = HUGE(CD_ONE) + dcoef_n(i) = CD_ZERO + rl0dot_n(i) = CD_ZERO + damp_n(i) = CD_ZERO + IF (ea(i) > CD_ZERO .AND. PRESENT(axial_damping)) THEN + IF (axial_damping(i) > CD_ZERO) THEN + ! the dashpot tension the start load carries, as the callback evaluates it + dcoef_n(i) = axial_damping(i)/l0(i) + IF (PRESENT(axial_l0_rate)) rl0dot_n(i) = axial_l0_rate(i)/l0(i) + damp_n(i) = dcoef_n(i)*(DOT_PRODUCT(chord_n(:, i), v_n(3*elem_conn(2, i) - 2:3*elem_conn(2, i)) - & + v_n(3*elem_conn(1, i) - 2:3*elem_conn(1, i))) - ell*rl0dot_n(i)) + END IF + END IF IF (stretch_n(i) > CD_ZERO) THEN IF (ea(i) > CD_ZERO) THEN tension_n(i) = ea(i)*(ell/l0(i) - CD_ONE) @@ -1636,6 +1688,9 @@ SUBROUTINE bind_step_workspace(workspace_ref) stretch_n => workspace_ref%stretch_n(1:n_elem) chord_n => workspace_ref%chord_n(1:3, 1:n_elem) stiff_n => workspace_ref%stiff_n(1:n_elem) + dcoef_n => workspace_ref%dcoef_n(1:n_elem) + rl0dot_n => workspace_ref%rl0dot_n(1:n_elem) + damp_n => workspace_ref%damp_n(1:n_elem) v_eval => workspace_ref%v_eval(1:n_dof) v_alpha => workspace_ref%v_alpha(1:n_dof) IF (cfg%force_blend) THEN @@ -2035,12 +2090,31 @@ SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) !! law tension, and otherwise not guaranteed, e.g. when it ends above l0 with less law !! tension than T^_1 (zero once the slow branch has taken up the stretch, or below !! Syrope's minimum strain), by up to (1 - alpha_f) k e_1 p_1. + !! An elastic element with a linear axial dashpot (axial_damping) also keeps alpha_f T_d,0 + !! along t_0, T_d,0 the dashpot tension at t_n, and its end share carries + !! (1 - alpha_f) T_d,1 t_1 (the dashpot pushes and pulls; it is not tension-only). The + !! dashpot stores no energy, so the budget stays W_0. Where the end state lies below the + !! band edge l0 + c e_0, c = alpha_f/(1 - alpha_f), the cap covers the dashpot with the + !! weight phi = 1 at and below l0, falling linearly to 0 at the band edge: it replaces the + !! kept force alpha_f (T_0 + phi T_d,0) by N/p when that is smaller, with + !! N = max(W_0 + (1 - alpha_f)(T^_1 + phi T_d,1) p_1, 0), T_d,1 the dashpot tension the + !! residual carries at (q_{n+1}, v_{n+1}). Over a step with p > 0 (the cap leaves an + !! element that does not shorten along t_0) the blend of such an element then returns at + !! most W_0 + (1 - phi) D, D the work of its uncapped blended dashpot + !! alpha_f T_d,0 p - (1 - alpha_f) T_d,1 p_1, unless N would be negative (its end share + !! alone returns more than W_0; the capped kept force is then zero). At and below l0 + !! (phi = 1) that is W_0. Above the band edge (phi = 0), and on every element without a + !! dashpot, the cap is the one above, so the force-blended dashpot of a taut line keeps the + !! standard generalised-alpha treatment. The weight is continuous, so is the capped force; + !! the tangent carries dT_d,1/dq_{n+1} through v_{n+1} (gamma/(beta dt)). REAL(wp), INTENT(IN) :: q_eval(:) REAL(wp), INTENT(INOUT) :: Rout(:) REAL(wp), INTENT(INOUT), OPTIONAL :: effout(:, :), effbandout(:, :) INTEGER :: e, na, nb, i, j, gi(6), fi, fj REAL(wp) :: d1(3), l1, e1, e0, t0, p, p1, num, ln, k0, ten1, cosang, dg, delta, t1(3), g(3), blk(3, 3), sgn - LOGICAL :: taut_end + REAL(wp) :: band, phi, dphi, td1, dv(3), dp1(3), dtd1(3), kc + LOGICAL :: taut_end, damped + band = alpha_f/(CD_ONE - alpha_f) DO e = 1, n_elem t0 = tension_n(e) IF (.NOT. t0 > CD_ZERO) CYCLE @@ -2051,41 +2125,87 @@ SUBROUTINE apply_release_cap(q_eval, Rout, effout, effbandout) ! projected shortening p = l_n - t_0 . d_1 (l_n = l0 + e_0); the common case, an element ! that does not release, is decided here without a root p = e0 + (l0(e) - (chord_n(1, e)*d1(1) + chord_n(2, e)*d1(2) + chord_n(3, e)*d1(3))) - IF (.NOT. 4.0_wp*alpha_f*p > e0) CYCLE - num = 0.5_wp*t0*e0 - taut_end = d1(1)*d1(1) + d1(2)*d1(2) + d1(3)*d1(3) > l0(e)*l0(e) - l1 = CD_ZERO - e1 = CD_ZERO - ten1 = CD_ZERO - IF (taut_end) THEN - ! the end share's work: p_1 = |d_1| - t_1 . d_0 = (e_1 - e_0) + l_n (1 - t_1 . t_0), - ! with 1 - t_1 . t_0 = |t_1 - t_0|^2/2 (no cancellation at small turns) + ! a damped element whose end state lies below the band edge l0 + band e_0 + damped = dcoef_n(e) > CD_ZERO + IF (damped) damped = d1(1)*d1(1) + d1(2)*d1(2) + d1(3)*d1(3) < (l0(e) + band*e0)**2 + IF (damped) THEN + IF (.NOT. p > CD_ZERO) CYCLE l1 = NORM2(d1) + IF (.NOT. l1 > CD_ZERO) CYCLE e1 = l1 - l0(e) - taut_end = e1 > CD_ZERO - END IF - IF (taut_end) THEN ln = l0(e) + e0 - ! the secant stiffness, bounded for a law element by its step-start axial stiffness - k0 = MIN(t0/e0, stiff_n(e)) - ten1 = k0*e1 t1 = d1/l1 cosang = t1(1)*chord_n(1, e) + t1(2)*chord_n(2, e) + t1(3)*chord_n(3, e) p1 = (e1 - e0) + 0.5_wp*ln*((t1(1) - chord_n(1, e))**2 + (t1(2) - chord_n(2, e))**2 + & (t1(3) - chord_n(3, e))**2) - num = num + (CD_ONE - alpha_f)*ten1*p1 + k0 = MIN(t0/e0, stiff_n(e)) + ten1 = k0*MAX(e1, CD_ZERO) + ! the dashpot weight and its slope along t_1 (zero at and below l0) + phi = CD_ONE + dphi = CD_ZERO + IF (e1 > CD_ZERO) THEN + phi = MAX(CD_ONE - e1/(band*e0), CD_ZERO) + IF (phi > CD_ZERO) dphi = -CD_ONE/(band*e0) + END IF + ! the end share's dashpot tension, as the residual evaluates it at (q_eval, v_eval) + dv = v_eval(3*nb - 2:3*nb) - v_eval(3*na - 2:3*na) + td1 = dcoef_n(e)*(DOT_PRODUCT(t1, dv) - l1*rl0dot_n(e)) + num = 0.5_wp*t0*e0 + (CD_ONE - alpha_f)*(ten1 + phi*td1)*p1 + kc = t0 + phi*damp_n(e) + dg = MAX(num, CD_ZERO)/p + IF (dg >= alpha_f*kc) CYCLE + delta = dg - alpha_f*kc + Rout(3*na - 2:3*na) = Rout(3*na - 2:3*na) - delta*chord_n(:, e) + Rout(3*nb - 2:3*nb) = Rout(3*nb - 2:3*nb) + delta*chord_n(:, e) + IF (.NOT. (PRESENT(effout) .OR. PRESENT(effbandout))) CYCLE + ! d(delta)/d(x_b) = g, d(delta)/d(x_a) = -g: dp/dd_1 = -t_0, dp_1/dd_1 as above, + ! d(phi)/dd_1 = dphi t_1, and dT_d,1/dx_b = (BA/l0)((dv - (t_1 . dv) t_1)/l_1 + ! + (gamma/(beta dt) - l0_dot/l0) t_1), v_b moving with gamma/(beta dt) x_b + g = -alpha_f*damp_n(e)*dphi*t1 + IF (num > CD_ZERO) THEN + dp1 = t1 - (ln/l1)*(chord_n(:, e) - cosang*t1) + dtd1 = dcoef_n(e)*((dv - DOT_PRODUCT(t1, dv)*t1)/l1 + (gamma/(beta*dt) - rl0dot_n(e))*t1) + g = g + (num/(p*p))*chord_n(:, e) + ((CD_ONE - alpha_f)/p)*((ten1 + phi*td1)*dp1 + phi*p1*dtd1 + & + dphi*td1*p1*t1) + IF (e1 > CD_ZERO) g = g + ((CD_ONE - alpha_f)/p)*k0*p1*t1 + END IF + ELSE + IF (.NOT. 4.0_wp*alpha_f*p > e0) CYCLE + num = 0.5_wp*t0*e0 + taut_end = d1(1)*d1(1) + d1(2)*d1(2) + d1(3)*d1(3) > l0(e)*l0(e) + l1 = CD_ZERO + e1 = CD_ZERO + ten1 = CD_ZERO + IF (taut_end) THEN + ! the end share's work: p_1 = |d_1| - t_1 . d_0 = (e_1 - e_0) + l_n (1 - t_1 . t_0), + ! with 1 - t_1 . t_0 = |t_1 - t_0|^2/2 (no cancellation at small turns) + l1 = NORM2(d1) + e1 = l1 - l0(e) + taut_end = e1 > CD_ZERO + END IF + IF (taut_end) THEN + ln = l0(e) + e0 + ! the secant stiffness, bounded for a law element by its step-start axial stiffness + k0 = MIN(t0/e0, stiff_n(e)) + ten1 = k0*e1 + t1 = d1/l1 + cosang = t1(1)*chord_n(1, e) + t1(2)*chord_n(2, e) + t1(3)*chord_n(3, e) + p1 = (e1 - e0) + 0.5_wp*ln*((t1(1) - chord_n(1, e))**2 + (t1(2) - chord_n(2, e))**2 + & + (t1(3) - chord_n(3, e))**2) + num = num + (CD_ONE - alpha_f)*ten1*p1 + END IF + dg = num/p + IF (dg >= alpha_f*t0) CYCLE + delta = dg - alpha_f*t0 + Rout(3*na - 2:3*na) = Rout(3*na - 2:3*na) - delta*chord_n(:, e) + Rout(3*nb - 2:3*nb) = Rout(3*nb - 2:3*nb) + delta*chord_n(:, e) + IF (.NOT. (PRESENT(effout) .OR. PRESENT(effbandout))) CYCLE + ! d(delta)/d(x_b) = g, d(delta)/d(x_a) = -g, with dp/dd_1 = -t_0, + ! dT_1/dd_1 = k0 t_1 and dp_1/dd_1 = t_1 - (l_n/|d_1|)(t_0 - (t_1 . t_0) t_1) + g = (num/(p*p))*chord_n(:, e) + IF (taut_end) g = g + ((CD_ONE - alpha_f)/p)*((k0*p1 + ten1)*t1 - & + ten1*(ln/l1)*(chord_n(:, e) - cosang*t1)) END IF - dg = num/p - IF (dg >= alpha_f*t0) CYCLE - delta = dg - alpha_f*t0 - Rout(3*na - 2:3*na) = Rout(3*na - 2:3*na) - delta*chord_n(:, e) - Rout(3*nb - 2:3*nb) = Rout(3*nb - 2:3*nb) + delta*chord_n(:, e) - IF (.NOT. (PRESENT(effout) .OR. PRESENT(effbandout))) CYCLE - ! d(delta)/d(x_b) = g, d(delta)/d(x_a) = -g, with dp/dd_1 = -t_0, - ! dT_1/dd_1 = k0 t_1 and dp_1/dd_1 = t_1 - (l_n/|d_1|)(t_0 - (t_1 . t_0) t_1) - g = (num/(p*p))*chord_n(:, e) - IF (taut_end) g = g + ((CD_ONE - alpha_f)/p)*((k0*p1 + ten1)*t1 - & - ten1*(ln/l1)*(chord_n(:, e) - cosang*t1)) DO j = 1, 3 DO i = 1, 3 blk(i, j) = chord_n(i, e)*g(j) @@ -2208,6 +2328,12 @@ SUBROUTINE ensure_step_workspace(work, n_dof, n_elem, n_free, ldab, need_band, n IF (ErrStat /= CD_DYN_OK) RETURN CALL ensure_real_vector(work%stiff_n, n_elem, ErrStat, ErrMsg) IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%dcoef_n, n_elem, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%rl0dot_n, n_elem, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN + CALL ensure_real_vector(work%damp_n, n_elem, ErrStat, ErrMsg) + IF (ErrStat /= CD_DYN_OK) RETURN IF (need_band) THEN ! a reallocated mass band no longer holds the remembered one IF (ALLOCATED(work%M_band)) THEN diff --git a/src/CableDyn_Model.f90 b/src/CableDyn_Model.f90 index eaf50d79..ffa0736a 100644 --- a/src/CableDyn_Model.f90 +++ b/src/CableDyn_Model.f90 @@ -1968,7 +1968,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, prescribed_v=prescribed_v, prescribed_a=prescribed_a, & workspace=model%dynamic_workspace, start_load=model%load_start_work, & start_tension=model%tension_start_work, & - start_stiffness=model%stiffness_start_work) + start_stiffness=model%stiffness_start_work, & + axial_damping=model%ba_dyn, axial_l0_rate=model%l0_dot) ELSE IF (PRESENT(prescribed_q) .AND. has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -1978,7 +1979,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, prescribed_q=prescribed_q, prescribed_v=prescribed_v, & prescribed_a=prescribed_a, workspace=model%dynamic_workspace, & start_load=model%load_start_work, start_tension=model%tension_start_work, & - start_stiffness=model%stiffness_start_work) + start_stiffness=model%stiffness_start_work, & + axial_damping=model%ba_dyn, axial_l0_rate=model%l0_dot) ELSE IF (PRESENT(prescribed_q) .AND. model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -2002,7 +2004,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, load_force_proc=model_force, load_band_proc=model_load_band, & added_mass_band_proc=model_added_mass_band, workspace=model%dynamic_workspace, & start_load=model%load_start_work, start_tension=model%tension_start_work, & - start_stiffness=model%stiffness_start_work) + start_stiffness=model%stiffness_start_work, & + axial_damping=model%ba_dyn, axial_l0_rate=model%l0_dot) ELSE IF (has_load) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & @@ -2011,7 +2014,8 @@ SUBROUTINE CD_Step_Model(model, dt, converged, stalled, n_iter, ErrStat, ErrMsg, load_force_proc=model_force, load_band_proc=model_load_band, & workspace=model%dynamic_workspace, start_load=model%load_start_work, & start_tension=model%tension_start_work, & - start_stiffness=model%stiffness_start_work) + start_stiffness=model%stiffness_start_work, & + axial_damping=model%ba_dyn, axial_l0_rate=model%l0_dot) ELSE IF (model%has_added_mass) THEN CALL CD_Cable_Gen_Alpha_Step(model%q, model%v, model%a, model%elem_conn, model%l0, model%ea_dyn, & model%rho_a, model%tension_only, model%f_ext, model%fixed_dofs, & diff --git a/tests/test_ei0_slack_dynamics.f90 b/tests/test_ei0_slack_dynamics.f90 index b1557a04..167883b1 100644 --- a/tests/test_ei0_slack_dynamics.f90 +++ b/tests/test_ei0_slack_dynamics.f90 @@ -37,7 +37,11 @@ PROGRAM test_ei0_slack_dynamics !! stretch: with its axial stiffness (start_stiffness) bounding the secant end tension, !! the cap force varies with the end stretch at a slope of order that stiffness (a jump !! with the unbounded secant), the blend keeps the stated energy bound, and the tangent - !! matches the finite difference. + !! matches the finite difference. An elastic segment with a two-sided axial dashpot + !! (axial_damping) that extends at t_n and turns and releases within the step: the blend, + !! dashpot included, keeps the stated bound (W_n when it ends slack), a segment that keeps + !! its direction and ends taut keeps the plain force blend, the force is continuous at the + !! rest length and the band edge, and the tangent matches the finite difference. !! 7. The finite-difference tangent of the step with nonzero dynamic loads (a quadratic drag !! and a cubic position load, plus a position-dependent added mass on the dense path), and !! the closed form of the blended load (1 - alpha_f) f(q_{n+1}, v_{n+1}) + alpha_f f(q_n, v_n). @@ -68,6 +72,10 @@ PROGRAM test_ei0_slack_dynamics REAL(wp) :: cb_drag = 0.0_wp, cb_spring = 0.0_wp, cb_ea_law = 0.0_wp, cb_l0_law = 1.0_wp, cb_madd = 0.0_wp ! axial damping of the segment law, tension cb_ea_law (l/l0 - 1) + cb_ba_law (dl/dt)/l0 REAL(wp) :: cb_ba_law = 0.0_wp + ! a two-sided axial dashpot (BA cb_ba_dash, force cb_ba_dash (dl/dt)/l0 along the chord, as the + ! line model's axial damping) on segment cb_dash_elem (0: none) of rest length cb_l0_dash + REAL(wp) :: cb_ba_dash = 0.0_wp, cb_l0_dash = 1.0_wp + INTEGER :: cb_dash_elem = 0 REAL(wp) :: cb_q0(12) = 0.0_wp INTEGER :: cb_law_elem = 0 @@ -78,6 +86,7 @@ PROGRAM test_ei0_slack_dynamics CALL case_release_energy() CALL case_law_release_cap() CALL case_law_damped_release() + CALL case_damped_elastic_release() CALL case_load_share_tangent() CALL case_warm_resolve_reuse() CALL case_light_cable_coarse_step() @@ -716,6 +725,28 @@ SUBROUTINE chain_load(q, v, force, jac_q, jac_v) jac_v(3*b - 2:3*b, 3*b - 2:3*b) = jac_v(3*b - 2:3*b, 3*b - 2:3*b) + kv END IF END IF + IF (cb_dash_elem > 0) THEN + ! the dashpot: force (BA/l0) (t . w) t on node a, the opposite on node b, in both senses + a = cb_dash_elem + b = a + 1 + c = q(3*b - 2:3*b) - q(3*a - 2:3*a) + ell = NORM2(c) + t = c/ell + w = v(3*b - 2:3*b) - v(3*a - 2:3*a) + ten = cb_ba_dash*DOT_PRODUCT(t, w)/cb_l0_dash + force(3*a - 2:3*a) = force(3*a - 2:3*a) + ten*t + force(3*b - 2:3*b) = force(3*b - 2:3*b) - ten*t + kb = ten*(eye - outer3(t, t))/ell + (cb_ba_dash/cb_l0_dash)*outer3(t, MATMUL(eye - outer3(t, t), w)/ell) + kv = (cb_ba_dash/cb_l0_dash)*outer3(t, t) + jac_q(3*a - 2:3*a, 3*a - 2:3*a) = jac_q(3*a - 2:3*a, 3*a - 2:3*a) + kb + jac_q(3*a - 2:3*a, 3*b - 2:3*b) = jac_q(3*a - 2:3*a, 3*b - 2:3*b) - kb + jac_q(3*b - 2:3*b, 3*a - 2:3*a) = jac_q(3*b - 2:3*b, 3*a - 2:3*a) - kb + jac_q(3*b - 2:3*b, 3*b - 2:3*b) = jac_q(3*b - 2:3*b, 3*b - 2:3*b) + kb + jac_v(3*a - 2:3*a, 3*a - 2:3*a) = jac_v(3*a - 2:3*a, 3*a - 2:3*a) + kv + jac_v(3*a - 2:3*a, 3*b - 2:3*b) = jac_v(3*a - 2:3*a, 3*b - 2:3*b) - kv + jac_v(3*b - 2:3*b, 3*a - 2:3*a) = jac_v(3*b - 2:3*b, 3*a - 2:3*a) - kv + jac_v(3*b - 2:3*b, 3*b - 2:3*b) = jac_v(3*b - 2:3*b, 3*b - 2:3*b) + kv + END IF END SUBROUTINE chain_load SUBROUTINE cb_load(q, v, force, jac_q, jac_v, ErrStat, ErrMsg) @@ -781,14 +812,15 @@ SUBROUTINE cb_added_mass(q, accel, M_add, dMa_a_dq, ErrStat, ErrMsg) ErrMsg = '' END SUBROUTINE cb_added_mass - SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension, start_stiffness) + SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension, start_stiffness, & + axial_damping) !! Residual and effective tangent at q1 of the force-blended step of the chain with the !! callback load: banded (load_band_proc + load_force_proc) or dense (load_proc, with the !! added mass when cb_madd > 0). REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), q1(12), l0(3), ea(3), rho_a(3) LOGICAL, INTENT(IN) :: banded REAL(wp), INTENT(OUT) :: R(12), K(9, 9) - REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:), start_stiffness(:) + REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:), start_stiffness(:), axial_damping(:) INTEGER :: conn(2, 3), n_iter, es REAL(wp) :: qo(12), vo(12), ao(12) LOGICAL :: converged, stalled @@ -801,17 +833,20 @@ SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tensio CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & qo, vo, ao, converged, stalled, n_iter, es, em, load_band_proc=cb_load_band, & load_force_proc=cb_force, workspace=work, start_tension=start_tension, & - start_stiffness=start_stiffness, probe_q=q1, probe_R=R, probe_K=K) + start_stiffness=start_stiffness, axial_damping=axial_damping, & + probe_q=q1, probe_R=R, probe_K=K) ELSE IF (cb_madd > 0.0_wp) THEN CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & qo, vo, ao, converged, stalled, n_iter, es, em, load_proc=cb_load, & added_mass_proc=cb_added_mass, workspace=work, start_tension=start_tension, & - start_stiffness=start_stiffness, probe_q=q1, probe_R=R, probe_K=K) + start_stiffness=start_stiffness, axial_damping=axial_damping, & + probe_q=q1, probe_R=R, probe_K=K) ELSE CALL CD_Cable_Gen_Alpha_Step(qn, vn, an, conn, l0, ea, rho_a, .TRUE., 0.0_wp*qn, [1, 2, 3], 0.05_wp, cfg, & qo, vo, ao, converged, stalled, n_iter, es, em, load_proc=cb_load, & workspace=work, start_tension=start_tension, & - start_stiffness=start_stiffness, probe_q=q1, probe_R=R, probe_K=K) + start_stiffness=start_stiffness, axial_damping=axial_damping, & + probe_q=q1, probe_R=R, probe_K=K) END IF IF (es /= CD_DYN_OK) THEN WRITE (*, '(A)') 'MISMATCH [chain:probe '//TRIM(em)//']' @@ -821,22 +856,25 @@ SUBROUTINE probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tensio END IF END SUBROUTINE probe_chain - SUBROUTINE fd_tangent_check(label, qn, vn, an, q1, l0, ea, rho_a, banded, start_tension, start_stiffness) + SUBROUTINE fd_tangent_check(label, qn, vn, an, q1, l0, ea, rho_a, banded, start_tension, start_stiffness, & + axial_damping) !! The step's tangent against the central difference of its residual. CHARACTER(*), INTENT(IN) :: label REAL(wp), INTENT(IN) :: qn(12), vn(12), an(12), q1(12), l0(3), ea(3), rho_a(3) LOGICAL, INTENT(IN) :: banded - REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:), start_stiffness(:) + REAL(wp), INTENT(IN), OPTIONAL :: start_tension(:), start_stiffness(:), axial_damping(:) REAL(wp), PARAMETER :: H = 1.0e-6_wp INTEGER :: j REAL(wp) :: qp(12), R(12), Rp(12), Rm(12), K(9, 9), Kfd(9, 9), Kdump(9, 9), err - CALL probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension, start_stiffness) + CALL probe_chain(qn, vn, an, q1, l0, ea, rho_a, banded, R, K, start_tension, start_stiffness, axial_damping) DO j = 1, 9 qp = q1 qp(3 + j) = q1(3 + j) + H - CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rp, Kdump, start_tension, start_stiffness) + CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rp, Kdump, start_tension, start_stiffness, & + axial_damping) qp(3 + j) = q1(3 + j) - H - CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rm, Kdump, start_tension, start_stiffness) + CALL probe_chain(qn, vn, an, qp, l0, ea, rho_a, banded, Rm, Kdump, start_tension, start_stiffness, & + axial_damping) Kfd(:, j) = (Rp(4:12) - Rm(4:12))/(2.0_wp*H) END DO err = MAXVAL(ABS(K - Kfd))/MAXVAL(ABS(K)) @@ -878,6 +916,9 @@ SUBROUTINE reset_chain_load() cb_q0 = 0.0_wp cb_law_elem = 0 cb_ba_law = 0.0_wp + cb_ba_dash = 0.0_wp + cb_l0_dash = 1.0_wp + cb_dash_elem = 0 END SUBROUTINE reset_chain_load SUBROUTINE case_law_release_cap() @@ -982,6 +1023,138 @@ SUBROUTINE case_law_damped_release() CALL reset_chain_load() END SUBROUTINE case_law_damped_release + SUBROUTINE case_damped_elastic_release() + !! An elastic segment with a two-sided axial dashpot (BA 2e4 N s on the end segment, l0 0.8 m, + !! EA 0.8e6 N, e_n = 0.8 mm, W_n = 0.32 J) that extends at t_n at 0.05, 0.5 or 2 m/s + !! (dashpot tension 1.6 to 62 times the elastic one) and turns by 0 to 180 degrees within + !! the step, ending slack or taut. Its kept dashpot share alone returned up to 7e4 W_n and + !! the whole blend up to 2.8e3 W_n before the cap covered it. With axial_damping the blend + !! returns at most W_n + (1 - phi) D (D the uncapped blended dashpot's work, phi the dashpot + !! weight: 1 at and below l0, 0 above l0 + c e_n), more only by the end share's own excess + !! when N < 0; at and below l0 that is W_n. A segment that keeps its direction and ends taut + !! keeps the plain force blend, and the tangent matches the finite difference. + REAL(wp), PARAMETER :: L0(3) = [1.0_wp, 1.2_wp, 0.8_wp], EA(3) = [1.0e6_wp, 1.5e6_wp, 0.8e6_wp] + REAL(wp), PARAMETER :: DIRS(3, 3) = RESHAPE([1.0_wp, 0.2_wp, 0.1_wp, 0.3_wp, 1.0_wp, -0.2_wp, & + -0.2_wp, 0.4_wp, 1.0_wp], [3, 3]) + REAL(wp), PARAMETER :: THETA(8) = [0.0_wp, 2.0_wp, 5.0_wp, 20.0_wp, 45.0_wp, 90.0_wp, 135.0_wp, 180.0_wp] + REAL(wp), PARAMETER :: S1(11) = [-0.5_wp, -0.01_wp, -1.0e-3_wp, -1.0e-4_wp, -1.0e-12_wp, 1.0e-12_wp, & + 1.0e-4_wp, 2.0e-4_wp, 5.0e-4_wp, 1.0e-3_wp, 2.0e-3_wp] + REAL(wp), PARAMETER :: RATE(3) = [0.05_wp, 0.5_wp, 2.0_wp], DT = 0.05_wp, RHO = 0.4_wp, BA = 2.0e4_wp + REAL(wp), PARAMETER :: RHO_TINY(3) = [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp], AD(3) = [0.0_wp, 0.0_wp, BA] + REAL(wp) :: qn(12), q1(12), vn(12), z(12), v1(12), R(12), Rp(12), K(9, 9), tn(3), u(3), dir(3) + REAL(wp) :: d0(3), d1(3), t1(3), w0, t0, e0, wt, l1, e1, tel1, td0, td1, p, p1, am, af, beta, gamma, band + REAL(wp) :: phi, dash, nn, excess, worst, slack_worst, unc_max, dev, uncapped + INTEGER :: i, j, ir, nact, nneg + CALL reset_chain_load() + cb_dash_elem = 3 + cb_ba_dash = BA + cb_l0_dash = L0(3) + am = (2.0_wp*RHO - 1.0_wp)/(RHO + 1.0_wp) + af = RHO/(RHO + 1.0_wp) + beta = 0.25_wp*(1.0_wp - am + af)**2 + gamma = 0.5_wp - am + af + band = af/(1.0_wp - af) + CALL chain_nodes(DIRS, [0.010_wp, 0.020_wp, 0.001_wp], L0, qn) + z = 0.0_wp + d0 = qn(10:12) - qn(7:9) + tn = d0/NORM2(d0) + u = [tn(2), -tn(1), 0.0_wp] + u = u/NORM2(u) + e0 = NORM2(d0) - L0(3) + t0 = EA(3)*e0/L0(3) + w0 = 0.5_wp*t0*e0 + worst = -HUGE(1.0_wp) + slack_worst = -HUGE(1.0_wp) + unc_max = -HUGE(1.0_wp) + nact = 0 + nneg = 0 + DO ir = 1, SIZE(RATE) + vn = 0.0_wp + vn(10:12) = RATE(ir)*tn + td0 = BA*RATE(ir)/L0(3) + DO i = 1, SIZE(THETA) + DO j = 1, SIZE(S1) + dir = COS(THETA(i)*PI/180.0_wp)*tn + SIN(THETA(i)*PI/180.0_wp)*u + q1 = qn + q1(10:12) = qn(7:9) + L0(3)*(1.0_wp + S1(j))*dir + CALL probe_chain(qn, vn, z, q1, L0, EA, RHO_TINY, .TRUE., R, K, axial_damping=AD) + CALL probe_chain(qn, vn, z, q1, L0, EA, RHO_TINY, .TRUE., Rp, K) + ! the closed-form kinematics and forces of the end segment at the trial state + v1 = gamma/(beta*DT)*(q1 - qn) + (1.0_wp - gamma/beta)*vn + v1(1:3) = 0.0_wp + d1 = q1(10:12) - q1(7:9) + l1 = NORM2(d1) + t1 = d1/l1 + e1 = l1 - L0(3) + p = NORM2(d0) - DOT_PRODUCT(tn, d1) + p1 = l1 - DOT_PRODUCT(t1, d0) + tel1 = MAX(0.0_wp, EA(3)*e1/L0(3)) + td1 = BA*DOT_PRODUCT(t1, v1(10:12) - v1(7:9))/L0(3) + phi = MIN(1.0_wp, MAX(0.0_wp, 1.0_wp - e1/(band*e0))) + dash = af*td0*p - (1.0_wp - af)*td1*p1 + nn = w0 + (1.0_wp - af)*(tel1 + phi*td1)*p1 + wt = -DOT_PRODUCT(R(10:12), q1(10:12) - qn(10:12)) + uncapped = af*(t0 + td0)*p - (1.0_wp - af)*(tel1 + td1)*p1 + IF (MAXVAL(ABS(R(10:12) - Rp(10:12))) > 1.0e-9_wp*t0) nact = nact + 1 + IF (nn < 0.0_wp) nneg = nneg + 1 + excess = wt - (w0 + (1.0_wp - phi)*dash + MAX(-nn, 0.0_wp)) + worst = MAX(worst, excess/w0) + IF (e1 <= 0.0_wp .AND. nn >= 0.0_wp) slack_worst = MAX(slack_worst, wt/w0) + IF (e1 <= 0.0_wp) unc_max = MAX(unc_max, uncapped/w0) + IF (THETA(i) == 0.0_wp .AND. S1(j) > 0.0_wp) THEN + ! a segment that keeps its direction and ends taut: the cap stays inactive + dev = MAXVAL(ABS(R(10:12) - Rp(10:12))) + CALL require(dev < 1.0e-9_wp*t0, 'damped-release:taut-end-uncapped') + END IF + END DO + END DO + END DO + WRITE (*, '(A,I0,A,I0,A,ES10.3,A,ES10.3,A,ES10.3)') ' damped release: cap active at ', nact, & + ' rows (N < 0 at ', nneg, '); slack-end blend work / W_n ', slack_worst, & + ' (uncapped ', unc_max, '); largest excess over the bound / W_n ', worst + CALL require(unc_max > 10.0_wp, 'damped-release:uncapped-creates-energy') + CALL require(slack_worst <= 1.0_wp + 1.0e-9_wp, 'damped-release:slack-end-bounded') + CALL require(worst <= 1.0e-9_wp, 'damped-release:bound') + ! the capped force is continuous where the end state crosses the rest length and the band + ! edge l0 + c e_n (turning 5 degrees, extending at 0.5 m/s at t_n) + vn = 0.0_wp + vn(10:12) = 0.5_wp*tn + dir = COS(5.0_wp*PI/180.0_wp)*tn + SIN(5.0_wp*PI/180.0_wp)*u + DO i = 1, 2 + e1 = MERGE(0.0_wp, band*e0, i == 1) + q1 = qn + q1(10:12) = qn(7:9) + (L0(3) + e1 + 1.0e-12_wp)*dir + CALL probe_chain(qn, vn, z, q1, L0, EA, RHO_TINY, .TRUE., R, K, axial_damping=AD) + q1(10:12) = qn(7:9) + (L0(3) + e1 - 1.0e-12_wp)*dir + CALL probe_chain(qn, vn, z, q1, L0, EA, RHO_TINY, .TRUE., Rp, K, axial_damping=AD) + dev = MAXVAL(ABS(R(10:12) - Rp(10:12)))/(BA*0.5_wp/L0(3)) + WRITE (*, '(A,A,A,ES10.3)') ' damped release: force jump across the ', & + TRIM(MERGE('rest length', 'band edge ', i == 1)), ' / T_d,n = ', dev + CALL require(dev < 1.0e-6_wp, 'damped-release:continuous') + END DO + ! the tangent where the cap acts: a slack end and a taut end in the band, turning 5 degrees + q1 = qn + q1(10:12) = qn(7:9) + L0(3)*(1.0_wp - 1.0e-4_wp)*dir + CALL damped_tangent_case('damped-release-slack', qn, vn, q1, L0, EA, AD, t0) + q1(10:12) = qn(7:9) + L0(3)*(1.0_wp + 1.0e-4_wp)*dir + CALL damped_tangent_case('damped-release-band', qn, vn, q1, L0, EA, AD, t0) + CALL reset_chain_load() + END SUBROUTINE case_damped_elastic_release + + SUBROUTINE damped_tangent_case(label, qn, vn, q1, l0, ea, ad, t0) + !! The damped chain of case_damped_elastic_release at one trial state where the cap acts: + !! the cap is active, and the tangent matches the finite difference on both paths. + CHARACTER(*), INTENT(IN) :: label + REAL(wp), INTENT(IN) :: qn(12), vn(12), q1(12), l0(3), ea(3), ad(3), t0 + REAL(wp) :: Ra(12), Rb(12), Kd(9, 9), z(12) + z = 0.0_wp + CALL probe_chain(qn, vn, z, q1, l0, ea, [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp], .TRUE., Ra, Kd, axial_damping=ad) + CALL probe_chain(qn, vn, z, q1, l0, ea, [1.0e-12_wp, 1.0e-12_wp, 1.0e-12_wp], .TRUE., Rb, Kd) + CALL require(MAXVAL(ABS(Ra(10:12) - Rb(10:12))) > 1.0e-2_wp*t0, label//':cap-active') + CALL fd_tangent_check(label, qn, vn, z, q1, l0, ea, [2.0_wp, 3.0_wp, 1.5_wp], .TRUE., axial_damping=ad) + CALL fd_tangent_check(label, qn, vn, z, q1, l0, ea, [2.0_wp, 3.0_wp, 1.5_wp], .FALSE., axial_damping=ad) + END SUBROUTINE damped_tangent_case + SUBROUTINE law_cap_config(label, strain_n, strain_1, dirs_trial) CHARACTER(*), INTENT(IN) :: label REAL(wp), INTENT(IN) :: strain_n(3), strain_1(3)