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
4 changes: 2 additions & 2 deletions app/cabledyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PROGRAM cabledyn
USE CableDyn_Conventions, ONLY: CD_CHANNEL_FMT
USE CableDyn_DeckDriver, ONLY: CD_Run_Deck_Driver, CD_Deck_Query_dtM, &
CD_Classify_Dynamic_Completion, CD_DECKDRV_OK, &
CD_DECKDRV_BADINPUT, CD_DECKDRV_SOLVEFAIL, CD_DECK_PATHLEN
CD_DECKDRV_BADINPUT, CD_DECKDRV_SOLVEFAIL, CD_DECK_PATHLEN, CD_INIT_NOTE_LEN
USE CableDyn_PathIO, ONLY: CD_Get_Argument, CD_Native_Path, CD_Lock_Path, CD_PATH_OK, &
CD_LOCK_ACQUIRED, CD_LOCK_HELD, CD_Open_Read, CD_Open_Write
USE CableDyn_OpenFAST_Aggregate, ONLY: CD_AGG_ModuleType, CD_AGG_Init_From_Deck, &
Expand Down Expand Up @@ -777,7 +777,7 @@ SUBROUTINE print_mixed_initialization(aggregate, stat, msg)
INTEGER :: n_lines, n_points, n_sections, n_ei0, n_finite, i, line_id, es
REAL(wp) :: tension, force(3), inclination, declination, azimuth
CHARACTER(4096) :: em
CHARACTER(2048) :: note
CHARACTER(CD_INIT_NOTE_LEN) :: note

CALL CD_AGG_GetInitMetadata(aggregate, n_lines, n_points, n_sections, n_ei0, n_finite, es, em)
IF (es /= CD_AGG_OK) THEN
Expand Down
2 changes: 1 addition & 1 deletion doc/openfast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ channels ``AnchFz<L>``, ``AnchFH<L>`` and ``TDP<L>Grd``) and units are in :doc:`
* - ``<RootName>.CD.Line<L>.range.out``
- CableDyn-owned, for a line with the ``LINES`` ``Outputs`` flag ``r``: the range graph, the
minimum, maximum and mean at every node over the committed steps from ``RangeStart``,
written when the run reaches ``TMax`` (:doc:`outputs`)
written at the end of a run that completes (:doc:`outputs`)
* - ``<RootName>.CD.rst.dat``
- temporary CableDyn-owned copy of the deck, written in the ``MooringFile`` folder only
when a run restarts from a checkpoint (see *Lifecycle features*), and removed after use
Expand Down
16 changes: 9 additions & 7 deletions doc/outputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,12 @@ samples are the rows of ``<RootName>.CD.out``: the state at ``t = 0`` and every
step, once each whatever ``DT``, ``DT_Out`` and the correction iterations are; a step OpenFAST
corrects counts once, with its corrected state. The accumulators are double precision on every
OpenFAST build and travel in the checkpoint, so a restart continues them. The file is written at
the end of a run that reaches ``TMax``; the run removes one left by an earlier run when it starts,
and one that stops before ``TMax`` says so and leaves none. An OpenFAST run stopped early on
purpose (``CalcSteady`` once steady) counts as stopping early. A FAST.Farm shared mooring and the
C API write no range file and reject the flag by name.
the end of a run that completes, whenever the host ends it: at ``TMax``, at a steady state found
by ``CalcSteady``, or at FAST.Farm's last whole ``DT_Low``, and holds the samples up to there.
The run removes a file left by an earlier run when it starts; a run that stops on an error, in any
module, says so and leaves none. A turbine's own CableDyn instance in FAST.Farm (``CompMooring = 5``
in its ``.fst``) writes ``<RootName>.T<n>.CD.Line<L>.range.out``. A FAST.Farm shared mooring and
the C API write no range file and reject the flag by name.

Layout: title line, header row, **units row**, then one row per node, End A first. The title reads
``CableDyn range graph (line <L>; <n> samples from t = <t0> s to t = <t1> s; public node order
Expand Down Expand Up @@ -1022,9 +1024,9 @@ output root:
The first data row is the static initialisation at ``t = 0``; every further row is written after
each committed CableDyn step, at every ``dtM`` boundary. It is independent of OpenFAST's ``DT_Out``
and never repeats held values between
CableDyn steps. If OpenFAST corrects a step (predictor–corrector iterations), the provisional row
is replaced rather than duplicated; the file is flushed after every row, so it is readable during
a run and intact after a crash.
CableDyn steps. If OpenFAST retries a step, at any ``dtM``, the provisional row is replaced rather
than duplicated, and a restore of an operating point (``CalcSteady``) keeps the rows of the run;
the file is flushed after every row, so it is readable during a run and intact after a crash.

Select CableDyn channels in the ``OUTPUTS`` section of the CableDyn ``MooringFile``; they are not
members of the top-level ``.fst`` ``OutList``. The ``TDP<L>`` channels are evaluated from the
Expand Down
16 changes: 13 additions & 3 deletions integration/openfast/patches/0014-fast-subs.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/modules/openfast-library/src/FAST_Subs.f90 b/modules/openfast-library/src/FAST_Subs.f90
index 48d3be5ed..3284a8c5d 100644
index 48d3be5ed..2ad5a40fc 100644
--- a/modules/openfast-library/src/FAST_Subs.f90
+++ b/modules/openfast-library/src/FAST_Subs.f90
@@ -40,6 +40,7 @@ MODULE FAST_Subs
Expand Down Expand Up @@ -540,7 +540,18 @@ index 48d3be5ed..3284a8c5d 100644
end if

! If we are doing AeroMaps, there is leftover data in AD15 parameters
@@ -7621,7 +7752,7 @@ contains
@@ -6900,6 +7031,10 @@ SUBROUTINE ExitThisProgram_T( Turbine, ErrLevel_in, StopTheProgram, ErrLocMsg, S
if (associated(Turbine%AD%p%FlowField)) deallocate(Turbine%AD%p%FlowField)
endif

+ ! CableDyn writes its whole-run outputs only after a run that ended without an error. FAST.Farm
+ ! ends its turbines with no error level either way and sets this itself after its last step.
+ if (ErrorLevel < AbortErrLev .and. .not. Turbine%p_FAST%FarmIntegration) Turbine%CD%m%HostComplete = .true.
+
! End all modules
if (allocated(Turbine%m_Glue%ModData)) then
CALL FAST_ModEnd(Turbine%m_Glue%ModData, Turbine, ErrStat, ErrMsg)
@@ -7621,7 +7756,7 @@ contains
! Write VTK output
call WriteVTK(TimeVTK, T%p_FAST, T%y_FAST, &
T%ED, T%SED, T%BD, T%AD, T%IfW, T%ExtInfw, T%SeaSt, T%HD, T%SD, &
Expand All @@ -549,4 +560,3 @@ index 48d3be5ed..3284a8c5d 100644

end subroutine


17 changes: 17 additions & 0 deletions integration/openfast/patches/0023-fast-farm-end.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/glue-codes/fast-farm/src/FAST_Farm.f90 b/glue-codes/fast-farm/src/FAST_Farm.f90
index c3d63ed75..c7ecdcedc 100644
--- a/glue-codes/fast-farm/src/FAST_Farm.f90
+++ b/glue-codes/fast-farm/src/FAST_Farm.f90
@@ -160,6 +160,12 @@ type(All_FastFarm_Data) :: farm
! End:
!...............................................................................................................................

+ ! the run is complete: a turbine's CableDyn instance writes its whole-run outputs (an abort, in
+ ! CheckError, ends the turbines without this)
+ do i_turb = 1, farm%p%NumTurbines
+ farm%FWrap(i_turb)%m%Turbine%CD%m%HostComplete = .true.
+ end do
+
call FARM_End(farm, ErrStat, ErrMsg)

! Finalize AMReX library
13 changes: 9 additions & 4 deletions src/CableDyn_DeckDriver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ MODULE CableDyn_DeckDriver
PUBLIC :: CD_Deck_Query_dtM
PUBLIC :: CD_End_Deck_Aggregate
PUBLIC :: CD_DeckAggregateType
PUBLIC :: CD_LineInitSummary
PUBLIC :: CD_LineInitSummary, CD_INIT_NOTE_LEN
! Coupled Rigid6 runtime: the aggregate facade owns a CD_Rigid6RuntimeType and marches
! it over the EI=0 system each mooring step (opaque; RigidBodyState/DeckOptions stay private).
PUBLIC :: CD_Rigid6RuntimeType
Expand Down Expand Up @@ -1133,6 +1133,12 @@ MODULE CableDyn_DeckDriver
TYPE(HydroUpdateWorkspace) :: work
END TYPE

! Length of the initialisation notes of one line, and of a caller's buffer for them
! (CD_LineInitSummary%note). A line reports each of its notes at most once per end, fewer than
! 32 in all, and none is longer than 1024 characters, so every note fits and the omission marker
! of append_note_line is never reached.
INTEGER, PARAMETER :: CD_INIT_NOTE_LEN = 32*1024

TYPE :: CD_LineInitSummary
!! Engineering quantities at the converged static initial condition. The
!! fairlead force is the force exerted by the line on public End A and the
Expand All @@ -1148,8 +1154,7 @@ MODULE CableDyn_DeckDriver
! finite-EI line (compression, mesh refinement, accepted residual floor, a run past its
! anchor), the fold note of an EI = 0 line (ei0_fold_note), and the static strain note and
! the dtM advisory (axial_period_note) of any line; empty when there is nothing to report.
! It holds a whole cable note (1024) and the two others.
CHARACTER(2048) :: note = ''
CHARACTER(CD_INIT_NOTE_LEN) :: note = ''
END TYPE CD_LineInitSummary

TYPE :: CD_DeckAggregateType
Expand Down Expand Up @@ -1187,7 +1192,7 @@ MODULE CableDyn_DeckDriver
TYPE(CD_SystemType) :: sys
TYPE(CD_HFMF_ModuleType), ALLOCATABLE :: cables(:)
! Static-initialisation notes of each finite-EI cable (build_one_hermite_cable).
CHARACTER(1024), ALLOCATABLE :: cable_note(:)
CHARACTER(CD_INIT_NOTE_LEN), ALLOCATABLE :: cable_note(:)
! Deck point ids of each cable's End A and End B (Point<P>F channels).
INTEGER, ALLOCATABLE :: cable_points(:, :)
REAL(wp) :: gravity = CD_ZERO, rho_water = CD_ZERO
Expand Down
20 changes: 15 additions & 5 deletions src/CableDyn_HermiteCableDynamic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ MODULE CableDyn_HermiteCableDynamic
REAL(wp) :: snap_fc_t = 0.0_wp, snap_fc_d0(3, 2) = 0.0_wp
LOGICAL :: snap_fc_valid = .FALSE.
INTEGER :: snap_fc_clears = 0
! fc_clears when the first step after the snapshot began: what happens to the cache after
! that (the setters of an output probe) is no part of the path a restored step must repeat
LOGICAL :: snap_stepped = .FALSE.
INTEGER :: snap_step_clears = 0
! Generalised-alpha blend: .TRUE. blends the forces (the default), .FALSE. evaluates the
! forces at the blended configuration q_alpha = (1-af) q_{n+1} + af q_n.
LOGICAL :: force_blend = CD_HC_FORCE_BLEND_DEFAULT
Expand Down Expand Up @@ -3874,6 +3878,10 @@ SUBROUTINE dyn_step_core(model, dt, max_iter, tol, ErrStat, ErrMsg, iters_out, r
! lengths the committed state was reached with (active line control: l0_c): reused from
! the previous step's converged evaluation when its key matches the committed state
! exactly, evaluated here otherwise (one residual assembly).
IF (.NOT. model%snap_stepped) THEN
model%snap_stepped = .TRUE.
model%snap_step_clears = model%fc_clears
END IF
fc_hit = .FALSE.
IF (model%force_blend) fc_hit = force_cache_matches()
! Cross-step factor reuse needs the step to continue bitwise from the state the carried
Expand Down Expand Up @@ -7946,6 +7954,7 @@ SUBROUTINE CD_HermiteCable_Dyn_Snapshot(model, ErrStat, ErrMsg)
! the cached committed force goes with the state it describes (see fc_clears)
model%snap_fc_valid = model%fc_valid .AND. ALLOCATED(model%fc_R)
model%snap_fc_clears = model%fc_clears
model%snap_stepped = .FALSE.
IF (model%snap_fc_valid) THEN
model%snap_fc_R = model%fc_R
model%snap_fc_q = model%fc_q
Expand Down Expand Up @@ -8036,11 +8045,12 @@ SUBROUTINE CD_HermiteCable_Dyn_Restore(model, ErrStat, ErrMsg)
model%max_step_rotation = model%snap_max_step_rotation
model%recovery_event_count = model%snap_recovery_event_count
model%recovery_max_substeps_used = model%snap_recovery_max_substeps_used
! The snapshot's cached committed force comes back with its state unless a setter has
! invalidated the cache since the snapshot, so the next step takes the path it took after
! the snapshot (the cache differs from a fresh evaluation in the last bits where a
! friction anchor slid). Otherwise the next step evaluates it afresh.
IF (model%snap_fc_valid .AND. model%snap_fc_clears == model%fc_clears) THEN
! The snapshot's cached committed force comes back with its state unless a setter
! invalidated the cache between the snapshot and the step that followed it, so the next
! step takes the path that step took (the cache differs from a fresh evaluation in the last
! bits where a friction anchor slid). Otherwise the next step evaluates it afresh.
IF (.NOT. model%snap_stepped) model%snap_step_clears = model%fc_clears
IF (model%snap_fc_valid .AND. model%snap_fc_clears == model%snap_step_clears) THEN
IF (model%tw_active) model%tw_fcR = model%snap_tw_fcR
model%fc_R = model%snap_fc_R
model%fc_q = model%snap_fc_q
Expand Down
Loading
Loading