Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MoorDyn dynamic relaxation and fixed bodies #1815

Merged
merged 11 commits into from
Oct 18, 2023
16 changes: 14 additions & 2 deletions modules/moordyn/src/MoorDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
if ((let1 == "ANCHOR") .or. (let1 == "FIXED") .or. (let1 == "FIX")) then ! if a fixed body (this would just be used if someone wanted to temporarly fix a body that things were attached to)

m%BodyList(l)%typeNum = 1
m%BodyList(l)%r6 = tempArray ! set initial body position and orientation

else if ((let1 == "COUPLED") .or. (let1 == "VESSEL") .or. (let1 == "CPLD") .or. (let1 == "VES")) then ! if a coupled body

Expand Down Expand Up @@ -1947,6 +1948,13 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
CALL Body_Initialize(m%BodyList(m%FreeBodyIs(l)), x%states(m%BodyStateIs1(l) : m%BodyStateIsN(l)), m)
END DO

! Set up points, lines, and rods attached to a fixed body
DO l = 1,p%nBodies
IF (m%BodyList(l)%typeNum == 1) THEN
CALL Body_InitializeUnfree(m%BodyList(l), m)
ENDIF
END DO

! Go through independent (including pinned) Rods and write the coordinates to the state vector
DO l = 1,p%nFreeRods
CALL Rod_Initialize(m%RodList(m%FreeRodIs(l)), x%states(m%RodStateIs1(l):m%RodStateIsN(l)), m)
Expand Down Expand Up @@ -2085,6 +2093,8 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
END DO
END DO

! dtIC set to fraction of input so convergence is over dtIC
InputFileDat%dtIC = InputFileDat%dtIC / 10

! round dt to integer number of time steps
NdtM = ceiling(InputFileDat%dtIC/p%dtM0) ! get number of mooring time steps to do based on desired time step size
Expand Down Expand Up @@ -2156,8 +2166,8 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
! check for non-convergence

DO l = 1, p%nLines
DO K = 1,9
IF ( abs( FairTensIC(l,K)/FairTensIC(l,K+1) - 1.0 ) > InputFileDat%threshIC ) THEN
DO K = 2,10
IF ( abs( FairTensIC(l,1)/FairTensIC(l,K) - 1.0 ) > InputFileDat%threshIC ) THEN
Converged = 0
EXIT
END IF
Expand All @@ -2167,6 +2177,7 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
END DO

IF (Converged == 1) THEN ! if we made it with all cases satisfying the threshold
CALL WrScr('') ! serves as line break from write over command in previous printed line
CALL WrScr(' Fairlead tensions converged to '//trim(Num2LStr(100.0*InputFileDat%threshIC))//'% after '//trim(Num2LStr(t))//' seconds.')
DO l = 1, p%nLines
CALL WrScr(' Fairlead tension: '//trim(Num2LStr(FairTensIC(l,1))))
Expand All @@ -2177,6 +2188,7 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
END IF

IF (I == ceiling(InputFileDat%TMaxIC/InputFileDat%dtIC) ) THEN
CALL WrScr('') ! serves as line break from write over command in previous printed line
CALL WrScr(' Fairlead tensions did not converge within TMaxIC='//trim(Num2LStr(InputFileDat%TMaxIC))//' seconds.')
!ErrStat = ErrID_Warn
!ErrMsg = ' MD_Init: ran dynamic convergence to TMaxIC without convergence'
Expand Down
4 changes: 2 additions & 2 deletions modules/moordyn/src/MoorDyn_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ MODULE MoorDyn_Types
REAL(DbKi) :: CdEnd !< drag coefficient for rod end [[-]]
REAL(DbKi) :: CaEnd !< added mass coefficient for rod end [[-]]
REAL(DbKi) :: time !< current time [[s]]
REAL(DbKi) :: roll !< roll relative to vertical [deg]
REAL(DbKi) :: pitch !< pitch relative to vertical [deg]
REAL(DbKi) :: roll !< roll relative to vertical [rad]
REAL(DbKi) :: pitch !< pitch relative to vertical [rad]
REAL(DbKi) :: h0 !< submerged length of rod axis, distance along rod centerline from end A to the waterplane (0 <= h0 <= L) [m]
REAL(DbKi) , DIMENSION(:,:), ALLOCATABLE :: r !< node positions [-]
REAL(DbKi) , DIMENSION(:,:), ALLOCATABLE :: rd !< node velocities [-]
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/r-test
Submodule r-test updated 30 files
+1 −1 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.AD.sum
+1 −1 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.ED.sum
+2 −2 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.HD.sum
+4,802 −4,802 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.MD.out
+2 −2 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.SrvD.sum
+1 −1 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.UA.sum
+18 −11 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.log
+4,802 −4,802 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.out
+ glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.outb
+1 −1 glue-codes/openfast/5MW_OC4Semi_WSt_WavesWN/5MW_OC4Semi_WSt_WavesWN.sum
+1 −1 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.AD.sum
+1 −1 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.ED.sum
+2 −2 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.HD.sum
+2 −2 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.IfW.sum
+2,002 −2,002 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.MD.out
+24 −11 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.log
+202 −202 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.out
+ glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.outb
+1 −1 glue-codes/openfast/MHK_RM1_Floating/MHK_RM1_Floating.sum
+1 −1 glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.ED.sum
+2 −2 glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.HD.sum
+7,202 −7,202 glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.MD.out
+2 −2 glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.SrvD.sum
+19 −18 glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.log
+1,802 −1,802 glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.out
+ glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.outb
+1 −1 glue-codes/openfast/StC_test_OC4Semi/StC_test_OC4Semi.sum
+4,802 −4,802 modules/moordyn/md_5MW_OC4Semi/driver.MD.out
+4,801 −4,801 modules/moordyn/py_md_5MW_OC4Semi/MD.out
+4,801 −4,801 modules/moordyn/py_md_5MW_OC4Semi/MDroot.MD.out