From 1f9bbbf8e5ce17e3e64ce262e25f58d8440ec782 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Wed, 21 Oct 2026 13:11:30 +0900 Subject: [PATCH] perf(openfast): skip the discarded cable reactions in CalcOutput At the glue rate (nsuper = 1) CalcOutput saves the committed coupled kinematics, transfers the current ones, evaluates the loads and channels and restores the committed state. The save read the kinematics with CD_AGG_GetMovingPointMesh, which also evaluated the reaction of every finite-EI cable (a full residual and added-mass assembly) only for the caller to overwrite it with the loads evaluated after the transfer. The profile put this at 17 of the 41 s of CalcOutput in a 600 s run of the IEA-15 VolturnUS-S with a 248-element power cable. CD_AGG_GetMovingPointMesh takes an optional cable_loads = .FALSE. that skips the cable reactions and returns their load columns as zero; the save uses it. The reactions write only the cable's scratch, which the loads evaluation that follows overwrites, so the outputs are unchanged: the coupled chain-only and mixed runs write byte-identical OpenFAST and CableDyn outputs, and the mixed run takes 212 s instead of 227 s. Signed-off-by: Jae Hoon Seo --- CHANGELOG.md | 7 +++++++ src/CableDyn_OpenFAST_Aggregate.f90 | 11 ++++++++++- src/openfast/CableDyn_OF.f90 | 7 +++++-- tests/test_openfast_aggregate.f90 | 10 ++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aed8135..a65c5ca6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,13 @@ All notable changes to CableDyn are recorded in this file. The format follows and the restore, and the SeaState sampling into the node queries, the grid checks and the hand-over of the fields. Results do not change. +### Changed + +- OpenFAST: `CalcOutput` no longer evaluates the reactions of the finite-EI cables when it saves + the committed kinematics before transferring the current ones; it discarded them. With a + 248-element power cable in the IEA-15 VolturnUS-S mooring this cuts `CalcOutput` from 41 s to + 25 s and the 600 s run from 227 s to 212 s. Results do not change. + ## [0.2.0] - 2026-10-20 ### Added diff --git a/src/CableDyn_OpenFAST_Aggregate.f90 b/src/CableDyn_OpenFAST_Aggregate.f90 index e60e5abf..783ee0c6 100644 --- a/src/CableDyn_OpenFAST_Aggregate.f90 +++ b/src/CableDyn_OpenFAST_Aggregate.f90 @@ -561,7 +561,7 @@ SUBROUTINE CD_AGG_TurbineOfMoving(self, turbine_of, ErrStat, ErrMsg) END SUBROUTINE CD_AGG_TurbineOfMoving SUBROUTINE CD_AGG_GetMovingPointMesh(self, position, velocity, acceleration, load, ErrStat, ErrMsg, & - orientation, moment, angular_velocity, angular_acceleration) + orientation, moment, angular_velocity, angular_acceleration, cable_loads) !! Copy the moving-point state and loads out. System columns come from !! CD_FMF_GetMovingPointMesh; each cable column carries its coupled-node !! position/velocity/acceleration (committed state) and its fairlead reaction from @@ -581,11 +581,19 @@ SUBROUTINE CD_AGG_GetMovingPointMesh(self, position, velocity, acceleration, loa CHARACTER(*), INTENT(OUT) :: ErrMsg REAL(wp), INTENT(OUT), OPTIONAL :: orientation(:, :, :), moment(:, :) REAL(wp), INTENT(OUT), OPTIONAL :: angular_velocity(:, :), angular_acceleration(:, :) + ! .FALSE. skips the reactions of the finite-EI cables (one full residual assembly each) and + ! returns their load and moment columns as zero: for a caller that wants only the + ! kinematics, such as the OpenFAST CalcOutput saving the committed kinematics. The + ! reactions write only the cable's scratch, so the other outputs are unchanged. + LOGICAL, INTENT(IN), OPTIONAL :: cable_loads INTEGER :: c, col, es REAL(wp) :: y_fair(3) + LOGICAL :: want_cable_loads CHARACTER(1024) :: em + want_cable_loads = .TRUE. + IF (PRESENT(cable_loads)) want_cable_loads = cable_loads position = CD_ZERO velocity = CD_ZERO acceleration = CD_ZERO @@ -664,6 +672,7 @@ SUBROUTINE CD_AGG_GetMovingPointMesh(self, position, velocity, acceleration, loa CALL map_hfmf_status(es, em, ErrStat, ErrMsg) RETURN END IF + IF (.NOT. want_cable_loads) CYCLE IF (PRESENT(moment)) THEN CALL CD_HFMF_CalcOutput(self%cables(c), y_fair, es, em, moment(:, col)) ELSE diff --git a/src/openfast/CableDyn_OF.f90 b/src/openfast/CableDyn_OF.f90 index ccbac0e9..241a6914 100644 --- a/src/openfast/CableDyn_OF.f90 +++ b/src/openfast/CableDyn_OF.f90 @@ -2224,10 +2224,13 @@ SUBROUTINE CD_CalcOutput( t, u, p, x, xd, z, other, y, m, ErrStat, ErrMsg ) ! evaluations, probes), and committing those boundary kinematics would move the ! module's committed state. Save the committed coupled kinematics, transfer, ! evaluate, restore: the direct-feedthrough loads keep their semantics and the - ! committed state is untouched on exit. + ! committed state is untouched on exit. The save needs only the kinematics: the + ! cable reactions (a full cable assembly each) are skipped, and ws_fld is overwritten + ! by the loads evaluated below. CALL CD_AGG_GetMovingPointMesh( Inst(id)%agg, Inst(id)%sv_pos, Inst(id)%sv_vel, Inst(id)%sv_acc, & Inst(id)%ws_fld, es, em, orientation=Inst(id)%sv_orient, & - angular_velocity=Inst(id)%sv_omega, angular_acceleration=Inst(id)%sv_alpha ) + angular_velocity=Inst(id)%sv_omega, angular_acceleration=Inst(id)%sv_alpha, & + cable_loads=.FALSE. ) IF (es /= CD_AGG_OK) THEN CALL SetErrStat( ErrID_Fatal, 'CableDyn mooring module: '//TRIM(em), ErrStat, ErrMsg, RoutineName ); RETURN END IF diff --git a/tests/test_openfast_aggregate.f90 b/tests/test_openfast_aggregate.f90 index 5dd249bc..7736be0a 100644 --- a/tests/test_openfast_aggregate.f90 +++ b/tests/test_openfast_aggregate.f90 @@ -1222,6 +1222,16 @@ SUBROUTINE case_cable_no_advance_transfer() CALL require(NORM2(l1(:, 1) - l0m(:, 1)) < 1.0e-6_wp, 'transfer:mooring-load-unchanged') WRITE (*, '(A,ES12.4,A,ES12.4)') 'no-advance transfer: cable |dLoad| = ', & NORM2(l1(:, ccol) - l0m(:, ccol)), ' N; mooring |dLoad| = ', NORM2(l1(:, 1) - l0m(:, 1)) + ! A kinematics-only read (cable_loads = .FALSE., the OpenFAST CalcOutput save) returns the + ! same kinematics and mooring load bit for bit, zero cable load, and leaves the cable's next + ! reaction unchanged. + CALL CD_AGG_GetMovingPointMesh(agg, pos, vel, acc, l0m, es, em, cable_loads=.FALSE.) + CALL require(es == CD_AGG_OK, 'transfer:mesh-kinematics-only: '//TRIM(em)) + CALL require(ALL(pos == p1) .AND. ALL(vel == v1) .AND. ALL(acc == a1), 'transfer:kinematics-only-same-kinematics') + CALL require(ALL(l0m(:, 1) == l1(:, 1)), 'transfer:kinematics-only-mooring-load') + CALL require(ALL(l0m(:, ccol) == 0.0_wp), 'transfer:kinematics-only-cable-load-zero') + CALL CD_AGG_GetMovingPointMesh(agg, pos, vel, acc, l0m, es, em) + CALL require(es == CD_AGG_OK .AND. ALL(l0m == l1), 'transfer:kinematics-only-leaves-reaction') CALL CD_AGG_End(agg, es, em) END SUBROUTINE case_cable_no_advance_transfer