Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,11 @@ the exchange buildable and testable without OpenFAST.
committed positions and holds them for the step.
- **State mirror.** The authoritative state lives in the module instance, and
`x%states` carries a mirror of it: line node velocities and positions, finite-EI
cable DOFs, constitutive states (`dl_1`, Syrope), friction anchors, and body and
rod states. Checkpoint/restart, correction iterations, and the framework
metadata use the mirror; a restart rebuilds the model from the packed deck and
the mirror.
cable DOFs, constitutive states (`dl_1`, Syrope), friction anchors, the committed
boundary kinematics of the coupled ends, and body and rod states.
Checkpoint/restart, correction iterations, and the framework metadata use the
mirror; a restart rebuilds the model from the packed deck and the mirror, which
then overrides the restored input mesh at the coupled ends.
- **Scope.** Correction iterations, quasi-static linearisation, FAST.Farm shared
moorings (`MooringMod = 5`), line failures, and active line-length control are
supported. Combinations that are not supported coupled stop with a named error;
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ All notable changes to CableDyn are recorded in this file. The format follows
have a three-digit exponent (`ES15.6E3`, same width). The mixed `EI = 0` + finite-EI `.out`,
the modal results, the static driver's mesh file and the OpenFAST module driver, which wrote
such values without the exponent letter, do too.
- `openfast -restart` with a finite-EI cable continues the run bit for bit. The rebuild moved the
cable's fairlead to the restored input mesh, whose last bits differ from the boundary the
uninterrupted run committed, and the cable's `.CD.out` channels drifted by up to 1e-6
(relative) within seconds. The checkpoint now carries the cable's committed boundary.

## [0.3.0] - 2026-10-23

Expand Down
2 changes: 1 addition & 1 deletion VALIDATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ stop with a named error.
| Nonzero `PtfmInit` | Pass verified | 6-DOF displaced free decay ≤0.51% |
| Correction iterations (`NumCrctn > 0`) | Pass verified | bit-identical to own `NumCrctn = 0` run |
| SeaState wave/current kinematics | Pass verified | wave A/B ≤0.16% of range |
| Checkpoint-restart (incl. Free/Connect points) | Pass verified | restarted window = continuous run to 0.0; also with supercycling (`dtM` > `DT`, the held SeaState fields and the predictor loads checkpointed): IEA-15 VolturnUS-S, turbulent wind and JONSWAP sea, `openfast -restart` at 50 s reproduces every later OpenFAST and `.CD.out` row of the chain mooring at `dtM` = 4 `DT` (extrapolated and held loads) and `DT`, and of the chain + 248-element power-cable mooring at `dtM` = 2 `DT` |
| Checkpoint-restart (incl. Free/Connect points) | Pass verified | restarted window = continuous run to 0.0; also with supercycling (`dtM` > `DT`, the held SeaState fields and the predictor loads checkpointed): IEA-15 VolturnUS-S, turbulent wind and JONSWAP sea, `openfast -restart` at 50 s reproduces every later OpenFAST and `.CD.out` row of the chain mooring at `dtM` = 4 `DT` (extrapolated and held loads) and `DT`, and of the chain + 248-element power-cable mooring at `dtM` = 2 `DT`. A finite-EI cable also checkpoints its committed boundary (held DOFs, end-connection directions, vessel frame): before, the rebuild took its fairlead from the restored input mesh, which differs in the last bits, and on the IEA-15 mixed deck restarted at 6 s the lazy-wave cable's `.CD.out` channels drifted by up to 9.4e-7 (relative) within 4 s; now all rows to 10 s match bit for bit at `dtM` = `DT` and 2 `DT`, `NumCrctn` 0 and 1, and with a rigid fairlead END CONNECTIONS row |
| Linearisation | Pass verified (quasi-static stiffness) | quasi-static `dYdu` compared entry by entry with stock MoorDyn's zero-frequency reduction `D − C A⁻¹ B` (full-precision `.lin` output): fairlead stiffness 0.07–0.10%, transverse `H/X` term 0.29%, platform 6×6 diagonals ≤0.10%; standalone static FD 1.5e-5; transverse term equals `H/X`. Velocity/acceleration columns are zero by design ([`openfast_lin_ab.py`](https://github.com/SMI-Lab-Inha/CableDyn/blob/main/validation/scripts/openfast_lin_ab.py)) |
| FAST.Farm shared moorings + clumps + channel record | Pass verified | 600 s A/B of the r-test `MD_Shared` farm against stock MoorDyn (same deck, analysis from 100 s; [`fastfarm_shared_ab.py`](https://github.com/SMI-Lab-Inha/CableDyn/blob/main/validation/scripts/fastfarm_shared_ab.py)): tension means ≤0.02%, minima and maxima ≤0.25%, platform motions within millimetres and 0.001°; shared-line tension std 2.2–2.7% lower, 1.0% at half the mooring step (CableDyn's implicit step at the 0.05 s coupling step against MoorDyn's 1e-4 s explicit step). On the shared lines, which have no Fixed end, `FairTen`/`AnchTen` name the opposite ends from MoorDyn's (see the migration guide). MoorDyn's initial settling does not converge for the anchor legs 6 and 7 (2.4 m excess length at t = 0), a start-up transient over by 100 s that most likely set the 3% end of the earlier 60 s record |
| Slack-line tension convention | Pass verified | tension-only dynamics; BA on slack lines matches `MoorDyn_Line.f90` |
Expand Down
125 changes: 77 additions & 48 deletions src/CableDyn_OpenFAST_HermiteFMF.f90
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ MODULE CableDyn_OpenFAST_HermiteFMF
PUBLIC :: CD_HFMF_MinSpanZ
PUBLIC :: CD_HFMF_MirrorSize
PUBLIC :: CD_HFMF_FrictionMirrorSize
PUBLIC :: CD_HFMF_BoundaryMirrorSize
PUBLIC :: CD_HFMF_ForceMirrorSize
PUBLIC :: CD_HFMF_TorsionMirrorSize
PUBLIC :: CD_HFMF_PackMirror
Expand Down Expand Up @@ -1527,16 +1528,31 @@ INTEGER FUNCTION CD_HFMF_MirrorSize(self) RESULT(n)
!! carries the committed acceleration, and unlike the EI=0 side (whose acceleration
!! is re-derived by CD_Recompute_System_Acceleration) the cable reloads it exactly.
!! A cable on a frictional seabed appends its stick-slip friction anchors, (x, y) per
!! node (CD_HFMF_FrictionMirrorSize slots): they are committed state like q. Zero if
!! uninitialised.
!! node (CD_HFMF_FrictionMirrorSize slots): they are committed state like q. Then come
!! the committed boundary (CD_HFMF_BoundaryMirrorSize), the force-blend state and the
!! torsion state. Zero if uninitialised.
TYPE(CD_HFMF_ModuleType), INTENT(IN) :: self
n = 0
IF (.NOT. self%initialized) RETURN
IF (ALLOCATED(self%line%freemask)) n = 3*COUNT(self%line%freemask)
n = n + CD_HFMF_FrictionMirrorSize(self) + CD_HFMF_ForceMirrorSize(self) + &
CD_HFMF_TorsionMirrorSize(self)
n = n + CD_HFMF_FrictionMirrorSize(self) + CD_HFMF_BoundaryMirrorSize(self) + &
CD_HFMF_ForceMirrorSize(self) + CD_HFMF_TorsionMirrorSize(self)
END FUNCTION CD_HFMF_MirrorSize

INTEGER FUNCTION CD_HFMF_BoundaryMirrorSize(self) RESULT(n)
!! Mirror slots of the committed boundary: [q; v; a] of the held (prescribed or fixed)
!! DOFs, the end-connection directions (6) and the parent frame the coupled end was
!! committed with (orientation 9, angular velocity 3, angular acceleration 3). A restart
!! rebuild moves the coupled end to the host's restored input mesh, the glue's input at
!! the restart time, which need not carry the bits the uninterrupted run committed (with
!! NumCrctn = 0 that run stepped with the extrapolated input); reloading this block after
!! the move continues from exactly the committed state.
TYPE(CD_HFMF_ModuleType), INTENT(IN) :: self
n = 0
IF (.NOT. self%initialized) RETURN
n = 3*(self%line%ndof - COUNT(self%line%freemask)) + 21
END FUNCTION CD_HFMF_BoundaryMirrorSize

INTEGER FUNCTION CD_HFMF_TorsionMirrorSize(self) RESULT(n)
!! Mirror slots of the condensed torsion, last: the accepted (unwrapped) Theta, Phi and the
!! four end-frame vectors (14 values); zero without torsion.
Expand All @@ -1547,15 +1563,14 @@ INTEGER FUNCTION CD_HFMF_TorsionMirrorSize(self) RESULT(n)
END FUNCTION CD_HFMF_TorsionMirrorSize

INTEGER FUNCTION CD_HFMF_ForceMirrorSize(self) RESULT(n)
!! Mirror slots of the force-blended generalised-alpha integrator state beyond [v; q; a] of
!! the free DOFs: a validity flag and the committed force F_n (ndof values), then the
!! committed accelerations of the held DOFs; zero with the configuration blend. The
!! force blend carries F_n and a_n of the prescribed end into the next step, so a restart
!! reloads them instead of re-evaluating F_n and taking a_n from the host input mesh.
!! Mirror slots of the force-blended generalised-alpha integrator state beyond the free
!! and boundary blocks: a validity flag and the committed force F_n (ndof values); zero
!! with the configuration blend. The force blend carries F_n into the next step, so a
!! restart reloads it instead of re-evaluating it.
TYPE(CD_HFMF_ModuleType), INTENT(IN) :: self
n = 0
IF (.NOT. self%initialized) RETURN
IF (self%line%force_blend) n = 1 + self%line%ndof + (self%line%ndof - COUNT(self%line%freemask))
IF (self%line%force_blend) n = 1 + self%line%ndof
END FUNCTION CD_HFMF_ForceMirrorSize

INTEGER FUNCTION CD_HFMF_FrictionMirrorSize(self) RESULT(n)
Expand All @@ -1567,21 +1582,23 @@ INTEGER FUNCTION CD_HFMF_FrictionMirrorSize(self) RESULT(n)
END FUNCTION CD_HFMF_FrictionMirrorSize

SUBROUTINE CD_HFMF_PackMirror(self, buf, ErrStat, ErrMsg)
!! Write the cable's continuous state into buf as [v_free; q_free; a_free] -- the
!! layout CD_HFMF_MirrorSize sizes. The mirror is written every mooring step and
!! reloaded ONLY by a checkpoint-restart rebuild (CD_HFMF_UnpackMirror); the module
!! stays self-authoritative in normal marching.
!! Write the cable's continuous state into buf as [v_free; q_free; a_free], then the
!! friction, boundary, force-blend and torsion blocks -- the layout CD_HFMF_MirrorSize
!! sizes. The mirror is written every mooring step and reloaded ONLY by a
!! checkpoint-restart rebuild or the state-const CalcOutput restore
!! (CD_HFMF_UnpackMirror); the module stays self-authoritative in normal marching.
TYPE(CD_HFMF_ModuleType), INTENT(IN) :: self
REAL(wp), INTENT(OUT) :: buf(:)
INTEGER, INTENT(OUT) :: ErrStat
CHARACTER(*), INTENT(OUT) :: ErrMsg
INTEGER :: i, nf, k
INTEGER :: i, nf, nh, k
ErrStat = CD_HFMF_OK; ErrMsg = ''
buf = CD_ZERO
IF (.NOT. self%initialized) THEN
ErrStat = CD_HFMF_BADINPUT; ErrMsg = 'CD_HFMF_PackMirror: module not initialised'; RETURN
END IF
nf = COUNT(self%line%freemask)
nh = self%line%ndof - nf
IF (SIZE(buf) /= CD_HFMF_MirrorSize(self)) THEN
ErrStat = CD_HFMF_BADINPUT
ErrMsg = 'CD_HFMF_PackMirror: buffer must be sized CD_HFMF_MirrorSize'
Expand All @@ -1602,18 +1619,27 @@ SUBROUTINE CD_HFMF_PackMirror(self, buf, ErrStat, ErrMsg)
buf(k + 1:k + 2*self%line%nn) = RESHAPE(self%line%fr_anchor, [2*self%line%nn])
k = k + 2*self%line%nn
END IF
! committed boundary: [q; v; a] of the held DOFs, end-connection directions, parent frame
DO i = 1, self%line%ndof
IF (self%line%freemask(i)) CYCLE
k = k + 1
buf(k) = self%line%q(i)
buf(nh + k) = self%line%v(i)
buf(2*nh + k) = self%line%a(i)
END DO
k = k + 2*nh
buf(k + 1:k + 6) = RESHAPE(self%line%endconn_d0, [6])
buf(k + 7:k + 15) = RESHAPE(self%parent_dcm, [9])
buf(k + 16:k + 18) = self%parent_omega
buf(k + 19:k + 21) = self%parent_alpha
k = k + 21
! force-blend committed force: flag (1 when the cache holds F at the committed state)
IF (self%line%force_blend) THEN
IF (self%line%fc_valid .AND. .NOT. (ABS(self%line%fc_t - self%line%t) > CD_ZERO)) THEN
buf(k + 1) = 1.0_wp
buf(k + 2:k + 1 + self%line%ndof) = self%line%fc_R
END IF
k = k + 1 + self%line%ndof
DO i = 1, self%line%ndof
IF (self%line%freemask(i)) CYCLE
k = k + 1
buf(k) = self%line%a(i)
END DO
END IF
IF (self%line%torsion%active) THEN
buf(k + 1) = self%line%torsion%theta
Expand All @@ -1623,18 +1649,19 @@ SUBROUTINE CD_HFMF_PackMirror(self, buf, ErrStat, ErrMsg)
END SUBROUTINE CD_HFMF_PackMirror

SUBROUTINE CD_HFMF_UnpackMirror(self, buf, t, ErrStat, ErrMsg)
!! CHECKPOINT-RESTART reload: overwrite the cable's free-DOF state from a mirror
!! written by CD_HFMF_PackMirror ([v_free; q_free; a_free]) and set the line clock
!! to the restart time. The prescribed (coupled) and fixed DOFs are untouched -- the
!! caller re-prescribes the coupled endpoint from the host mesh
!! (CD_HFMF_SetCoupledKinematics) around this call. The module must already be
!! initialised from the SAME deck (the rebuild re-runs the static build first).
!! CHECKPOINT-RESTART reload: overwrite the cable's committed state from a mirror
!! written by CD_HFMF_PackMirror and set the line clock to the restart time. The held
!! DOFs, end-connection directions and parent frame reload from the boundary block, so
!! a caller that first moved the coupled endpoint to the host's restored input mesh
!! (CD_HFMF_SetCoupledKinematics) continues from the committed boundary bit for bit. The
!! module must already be initialised from the SAME deck (the rebuild re-runs the
!! static build first).
TYPE(CD_HFMF_ModuleType), INTENT(INOUT) :: self
REAL(wp), INTENT(IN) :: buf(:)
REAL(wp), INTENT(IN) :: t
INTEGER, INTENT(OUT) :: ErrStat
CHARACTER(*), INTENT(OUT) :: ErrMsg
INTEGER :: i, nf, k
INTEGER :: i, nf, nh, k, kb
ErrStat = CD_HFMF_OK; ErrMsg = ''
IF (.NOT. self%initialized) THEN
ErrStat = CD_HFMF_BADINPUT; ErrMsg = 'CD_HFMF_UnpackMirror: module not initialised'; RETURN
Expand Down Expand Up @@ -1666,6 +1693,14 @@ SUBROUTINE CD_HFMF_UnpackMirror(self, buf, t, ErrStat, ErrMsg)
END ASSOCIATE
END DO
END IF
! the boundary block's parent orientation, checked before anything is written as well
nh = self%line%ndof - nf
kb = 3*nf + CD_HFMF_FrictionMirrorSize(self) + 3*nh
IF (.NOT. valid_parent_dcm(RESHAPE(buf(kb + 7:kb + 15), [3, 3]))) THEN
ErrStat = CD_HFMF_BADINPUT
ErrMsg = 'CD_HFMF_UnpackMirror: the parent orientation must be a proper orthogonal DCM'
RETURN
END IF
k = 0
DO i = 1, self%line%ndof
IF (self%line%freemask(i)) THEN
Expand All @@ -1681,6 +1716,19 @@ SUBROUTINE CD_HFMF_UnpackMirror(self, buf, t, ErrStat, ErrMsg)
self%line%ws_recovery_fr = self%line%fr_anchor
k = k + 2*self%line%nn
END IF
DO i = 1, self%line%ndof
IF (self%line%freemask(i)) CYCLE
k = k + 1
self%line%q(i) = buf(k)
self%line%v(i) = buf(nh + k)
self%line%a(i) = buf(2*nh + k)
END DO
k = k + 2*nh
self%line%endconn_d0 = RESHAPE(buf(k + 1:k + 6), [3, 2])
self%parent_dcm = RESHAPE(buf(k + 7:k + 15), [3, 3])
self%parent_omega = buf(k + 16:k + 18)
self%parent_alpha = buf(k + 19:k + 21)
k = k + 21
self%line%t = t
! The reloaded acceleration is committed history: a first held fluid field after the
! reload (the host re-sampling its field on the restored state) must keep it.
Expand All @@ -1705,11 +1753,6 @@ SUBROUTINE CD_HFMF_UnpackMirror(self, buf, t, ErrStat, ErrMsg)
self%line%fc_valid = .TRUE.
END IF
k = k + 1 + self%line%ndof
DO i = 1, self%line%ndof
IF (self%line%freemask(i)) CYCLE
k = k + 1
self%line%a(i) = buf(k)
END DO
END IF
IF (self%line%torsion%active) THEN
self%line%torsion%theta = buf(k + 1)
Expand All @@ -1718,22 +1761,8 @@ SUBROUTINE CD_HFMF_UnpackMirror(self, buf, t, ErrStat, ErrMsg)
self%line%torsion%torque = (self%line%torsion%phi - self%line%torsion%theta)/ &
CD_HermiteTorsion_Compliance(self%line%torsion, self%line%l0)
self%line%tors_drive_set = .FALSE.
! A parent-attached torsion frame without a parent end connection: the parent orientation
! is not in the mirror but follows from the restored end frame (its director and normal
! in parent axes, tors_frame_parent, and in global axes), so a later step without
! u_orientation holds it instead of turning the frame back to the static orientation.
IF (self%tors_parent .AND. .NOT. self%has_parent_endconn) THEN
BLOCK
REAL(wp) :: fp(3, 3), gg(3, 3)
fp(:, 1) = self%tors_frame_parent(:, 1)
fp(:, 2) = self%tors_frame_parent(:, 2)
fp(:, 3) = cross3(fp(:, 1), fp(:, 2))
gg(:, 1) = frame_to_global(self, self%line%torsion%ends(:, 2*self%tors_index - 1))
gg(:, 2) = frame_to_global(self, self%line%torsion%ends(:, 2*self%tors_index))
gg(:, 3) = cross3(gg(:, 1), gg(:, 2))
self%parent_dcm = MATMUL(fp, TRANSPOSE(gg))
END BLOCK
END IF
! (a parent-attached torsion frame turns with the parent orientation, which the boundary
! block restored as committed, so a later step without u_orientation holds it)
END IF
END SUBROUTINE CD_HFMF_UnpackMirror

Expand Down
Loading
Loading