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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ All notable changes to CableDyn are recorded in this file. The format follows
static stiffness (each matches its deck's static solutions to 7e-5; held, they would read the
chain 0.6 % and the polyester 2.9 times too stiff). Free/Connect points, a `Rigid` cable end
connection, VIV lines, bodies, rods, buoys and `CONTROL` fail closed with named messages. This
replaces the quasi-static linearisation without states.
replaces the quasi-static linearisation without states. The output differences use
CableDyn's double-precision loads, so a single-precision OpenFAST build (the release
`openfast.exe`, Visual Studio `Release`) linearises as a double-precision one; through its
7-digit output mesh the UMaine chains' surge stiffness read 3.2e3 instead of 7.7e4 N/m.
- Composite Syrope lines: a Syrope polyester section between plain `EI = 0` sections, such as a
chain-polyester-chain mooring, in one LINE. The static start puts every Syrope element on the
rest curve of its load history with its own secant EA (the tension varies along a sagging
Expand Down
3 changes: 2 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ only the `cabledyn` package and its metadata.
[DEVELOPMENT.md](DEVELOPMENT.md#openfast-integration)). It builds
`openfast.exe` with CableDyn, checks that a coupled run prints the CableDyn
banner, and checks that the output is finite.
2. **Linearisation check**: with the built executable, run
2. **Linearisation check**: with the built executable and again with the release workflow's
`openfast.exe` (single precision, the Visual Studio `Release` configuration), run
`python validation/scripts/openfast_lin_ab.py --exe <openfast.exe> --case-dir <case-dir>`,
where `<case-dir>` holds the `examples/openfast` IEA-15 UMaine twin decks and
the r-test `MD_Shared` turbine-1 ElastoDyn, HydroDyn, SeaState and HydroData
Expand Down
6 changes: 5 additions & 1 deletion doc/openfast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,11 @@ are named ``Cable 1 node 2 Px, m``, ``Cable 1 node 2 Tx, -`` (tangent) and ``Cab
differences: at each perturbed state or input, the accelerations are solved without a time step.
Positions, tangents and coupled-point displacements are stepped by 1 µm, which stays inside the
seabed penetration of a light cable and the stretch of every taut element. Velocities are stepped
by 0.1 m/s, MoorDyn-F's step.
by 0.1 m/s, MoorDyn-F's step. The output differences are taken from CableDyn's own
double-precision loads and channels, not from the OpenFAST output mesh, so a single-precision
OpenFAST build (the Visual Studio ``Release`` configuration, as the release ``openfast.exe``)
linearises as a double-precision one: its mesh carries 7 digits, too few for loads of a few MN
over a 1 µm step.

A line restrained in torsion adds the twist angle of every node that its end frames do not hold
(all nodes but a torsionally ``Rigid`` end), after the cables' positions and tangents, and their
Expand Down
55 changes: 51 additions & 4 deletions src/openfast/CableDyn_OF.f90
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ END FUNCTION cd_cpu_guard_armed
REAL(wp), ALLOCATABLE :: ws_pos(:,:), ws_vel(:,:), ws_acc(:,:), ws_fld(:,:), ws_moment(:,:)
REAL(wp), ALLOCATABLE :: ws_omega(:,:), ws_alpha(:,:)
REAL(wp), ALLOCATABLE :: ws_orient(:,:,:)
! the coupled loads (3, ncp) and deck channels of the last lin_eval, in double precision:
! the linearization Jacobians difference these (pack_lin_outputs), not the ReKi output
! mesh, which a single-precision OpenFAST build (the Visual Studio Release configuration)
! rounds to 7 digits, too few for loads of order 1e6 N over a 1 um step
REAL(wp), ALLOCATABLE :: lin_fld(:,:), lin_moment(:,:), lin_chan(:)
! saved committed coupled kinematics for the state-const CalcOutput at nsuper = 1
! (save -> transfer u -> evaluate -> restore; see CD_CalcOutput)
REAL(wp), ALLOCATABLE :: sv_pos(:,:), sv_vel(:,:), sv_acc(:,:), sv_orient(:,:,:)
Expand Down Expand Up @@ -3066,9 +3071,18 @@ SUBROUTINE lin_eval( id, p, m, u, x_in, ErrStat, ErrMsg, dxdt, y_out )
CALL SetErrStat( ErrID_Fatal, 'CableDyn mooring module: '//TRIM(em), ErrStat, ErrMsg, RoutineName )
CALL restore; RETURN
END IF
IF (ALLOCATED(Inst(id)%lin_fld)) THEN
IF (SIZE(Inst(id)%lin_fld, 2) /= Inst(id)%ncp .OR. SIZE(Inst(id)%lin_chan) /= p%NumOuts) &
DEALLOCATE (Inst(id)%lin_fld, Inst(id)%lin_moment, Inst(id)%lin_chan)
END IF
IF (.NOT. ALLOCATED(Inst(id)%lin_fld)) &
ALLOCATE (Inst(id)%lin_fld(3, Inst(id)%ncp), Inst(id)%lin_moment(3, Inst(id)%ncp), &
Inst(id)%lin_chan(p%NumOuts))
DO i = 1, Inst(id)%ncp
y_out%CoupledLoads(1)%Force(:, i) = REAL(Inst(id)%ws_fld(:, i), ReKi)
y_out%CoupledLoads(1)%Moment(:, i) = REAL(Inst(id)%ws_moment(:, i), ReKi)
Inst(id)%lin_fld(:, i) = Inst(id)%ws_fld(:, i)
Inst(id)%lin_moment(:, i) = Inst(id)%ws_moment(:, i)
END DO
DO i = 1, p%NumOuts
CALL CD_AGG_EvalChannel( Inst(id)%agg, i, cval, es, em )
Expand All @@ -3078,6 +3092,7 @@ SUBROUTINE lin_eval( id, p, m, u, x_in, ErrStat, ErrMsg, dxdt, y_out )
CALL restore; RETURN
END IF
y_out%WriteOutput(i) = REAL(cval, ReKi)
Inst(id)%lin_chan(i) = cval
END DO
END IF
CALL restore
Expand All @@ -3097,6 +3112,38 @@ SUBROUTINE restore()
END SUBROUTINE restore
END SUBROUTINE lin_eval

SUBROUTINE pack_lin_outputs( id, Vars, y_lin, ValAry )
!! The outputs of the last lin_eval packed as CD_VarsPackOutput packs y_lin, with the
!! coupled loads and the deck channels taken from lin_eval's double-precision copies: the
!! central differences of the loads over a 1 um position step resolve the stiffness of a
!! fairlead carrying a few MN in every build, the single-precision one included, where
!! the ReKi mesh carries 7 digits (the stiffness of the IEA-15 MW UMaine chains read 3.2e3
!! instead of 7.7e4 N/m in surge). The other outputs (visualisation meshes) keep y_lin's.
INTEGER(IntKi), INTENT(IN ) :: id
TYPE(ModVarsType), INTENT(IN ) :: Vars
TYPE(CD_OutputType), INTENT(IN ) :: y_lin
REAL(R8Ki), INTENT(INOUT) :: ValAry(:)
INTEGER(IntKi) :: i, n
CALL CD_VarsPackOutput( Vars, y_lin, ValAry )
IF (.NOT. ALLOCATED(Inst(id)%lin_fld)) RETURN
DO i = 1, SIZE(Vars%y)
n = Vars%y(i)%iLoc(2) - Vars%y(i)%iLoc(1) + 1
SELECT CASE (Vars%y(i)%DL%Num)
CASE (CD_y_CoupledLoads)
IF (Vars%y(i)%DL%i1 /= 1 .OR. n /= SIZE(Inst(id)%lin_fld)) CYCLE
IF (Vars%y(i)%Field == FieldForce) THEN
ValAry(Vars%y(i)%iLoc(1):Vars%y(i)%iLoc(2)) = PACK(REAL(Inst(id)%lin_fld, R8Ki), .TRUE.)
ELSE IF (Vars%y(i)%Field == FieldMoment) THEN
ValAry(Vars%y(i)%iLoc(1):Vars%y(i)%iLoc(2)) = PACK(REAL(Inst(id)%lin_moment, R8Ki), .TRUE.)
END IF
CASE (CD_y_WriteOutput)
IF (Vars%y(i)%iLB < 1 .OR. Vars%y(i)%iUB > SIZE(Inst(id)%lin_chan) .OR. &
n /= Vars%y(i)%iUB - Vars%y(i)%iLB + 1) CYCLE
ValAry(Vars%y(i)%iLoc(1):Vars%y(i)%iLoc(2)) = REAL(Inst(id)%lin_chan(Vars%y(i)%iLB:Vars%y(i)%iUB), R8Ki)
END SELECT
END DO
END SUBROUTINE pack_lin_outputs

!----------------------------------------------------------------------------------------------------------------------------------
SUBROUTINE CD_End(u, p, x, xd, z, other, y, m, ErrStat , ErrMsg)
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY: int64
Expand Down Expand Up @@ -3306,13 +3353,13 @@ SUBROUTINE CD_JacobianPInput(Vars, t, u, p, x, xd, z, OtherState, y, m, ErrStat,
CALL CD_VarsUnpackInput( Vars, m%Jac%u_perturb, m%u_perturb )
CALL lin_eval( m%CDInst, p, m, m%u_perturb, x, ErrStat2, ErrMsg2, dxdt=m%dxdt_lin, y_out=m%y_lin )
IF (Failed()) RETURN
CALL CD_VarsPackOutput( Vars, m%y_lin, m%Jac%y_pos )
CALL pack_lin_outputs( m%CDInst, Vars, m%y_lin, m%Jac%y_pos )
CALL CD_VarsPackContStateDeriv( Vars, m%dxdt_lin, m%Jac%x_pos )
CALL MV_Perturb( Vars%u(i), j, -1, m%Jac%u, m%Jac%u_perturb )
CALL CD_VarsUnpackInput( Vars, m%Jac%u_perturb, m%u_perturb )
CALL lin_eval( m%CDInst, p, m, m%u_perturb, x, ErrStat2, ErrMsg2, dxdt=m%dxdt_lin, y_out=m%y_lin )
IF (Failed()) RETURN
CALL CD_VarsPackOutput( Vars, m%y_lin, m%Jac%y_neg )
CALL pack_lin_outputs( m%CDInst, Vars, m%y_lin, m%Jac%y_neg )
CALL CD_VarsPackContStateDeriv( Vars, m%dxdt_lin, m%Jac%x_neg )
IF (PRESENT(dYdu)) CALL MV_ComputeCentralDiff( Vars%y, Vars%u(i)%Perturb, m%Jac%y_pos, m%Jac%y_neg, &
dYdu(:, iCol) )
Expand Down Expand Up @@ -3452,14 +3499,14 @@ SUBROUTINE CD_JacobianPContState(Vars, t, u, p, x, xd, z, OtherState, y, m, ErrS
CALL lin_eval( m%CDInst, p, m, u, m%x_perturb, ErrStat2, ErrMsg2, dxdt=m%dxdt_lin, y_out=m%y_lin )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
IF (ErrStat >= AbortErrLev) RETURN
CALL CD_VarsPackOutput( Vars, m%y_lin, m%Jac%y_pos )
CALL pack_lin_outputs( m%CDInst, Vars, m%y_lin, m%Jac%y_pos )
CALL CD_VarsPackContStateDeriv( Vars, m%dxdt_lin, m%Jac%x_pos )
CALL MV_Perturb( Vars%x(i), j, -1, m%Jac%x, m%Jac%x_perturb )
CALL CD_VarsUnpackContState( Vars, m%Jac%x_perturb, m%x_perturb )
CALL lin_eval( m%CDInst, p, m, u, m%x_perturb, ErrStat2, ErrMsg2, dxdt=m%dxdt_lin, y_out=m%y_lin )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
IF (ErrStat >= AbortErrLev) RETURN
CALL CD_VarsPackOutput( Vars, m%y_lin, m%Jac%y_neg )
CALL pack_lin_outputs( m%CDInst, Vars, m%y_lin, m%Jac%y_neg )
CALL CD_VarsPackContStateDeriv( Vars, m%dxdt_lin, m%Jac%x_neg )
IF (PRESENT(dYdx)) CALL MV_ComputeCentralDiff( Vars%y, Vars%x(i)%Perturb, m%Jac%y_pos, m%Jac%y_neg, &
dYdx(:, iCol) )
Expand Down
Loading