From dc7052a1f54da72bde0606504d42729d1b192dde Mon Sep 17 00:00:00 2001 From: RyanDavies19 Date: Mon, 9 Oct 2023 18:10:29 -0600 Subject: [PATCH 1/8] Resolved issue with fixed body positions --- modules/moordyn/src/MoorDyn.f90 | 22 ++++++++++++++++++++++ modules/moordyn/src/MoorDyn_Types.f90 | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/modules/moordyn/src/MoorDyn.f90 b/modules/moordyn/src/MoorDyn.f90 index 3c6919ca45..f24c80f2dc 100644 --- a/modules/moordyn/src/MoorDyn.f90 +++ b/modules/moordyn/src/MoorDyn.f90 @@ -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 @@ -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) @@ -1977,6 +1985,10 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er IF (wordy > 2) print *, "Line ", l, " with NumSegs =", N IF (wordy > 2) print *, "its states range from index ", m%LineStateIs1(l), " to ", m%LineStateIsN(l) + PRINT*, 'Line ', l + PRINT*, 'Line anch poisition', m%LineList(l)%r(:,0) + PRINT*, 'Line Fair poisition', m%LineList(l)%r(:,m%LineList(l)%N) + ! assign the resulting internal node positions to the integrator initial state vector! (velocities leave at 0) DO I = 1, N-1 ! print *, "I=", I @@ -1998,6 +2010,16 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er END DO !l = 1, p%NLines + PRINT*, 'Number of lines on point', m%PointList(1)%IdNum, ' is ', m%PointList(1)%nAttached + PRINT*, 'Number of lines on point', m%PointList(2)%IdNum, ' is ', m%PointList(2)%nAttached + PRINT*, 'Number of lines on point', m%PointList(3)%IdNum, ' is ', m%PointList(3)%nAttached + PRINT*, 'Point ', m%PointList(1)%IdNum, ' location ', m%PointList(1)%r + PRINT*, 'Point ', m%PointList(2)%IdNum, ' location ', m%PointList(2)%r + PRINT*, 'Point ', m%PointList(3)%IdNum, ' location ', m%PointList(3)%r + PRINT*, 'Body ', m%BodyList(1)%IdNum, ' location ', m%BodyList(1)%r6 + PRINT*, 'Body ', m%BodyList(2)%IdNum, ' location ', m%BodyList(2)%r6 + PRINT*, 'Body ', m%BodyList(1)%IdNum, ' attached points ', m%BodyList(1)%AttachedC(1:3) + PRINT*, 'Body ', m%BodyList(2)%IdNum, ' attached points ', m%BodyList(2)%AttachedC(1:3) ! -------------------------------------------------------------------- diff --git a/modules/moordyn/src/MoorDyn_Types.f90 b/modules/moordyn/src/MoorDyn_Types.f90 index 6d00b2a689..4f77bb0d57 100644 --- a/modules/moordyn/src/MoorDyn_Types.f90 +++ b/modules/moordyn/src/MoorDyn_Types.f90 @@ -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 [-] From b323e20e8d0e49caa7bc07c6c420fce04ed18118 Mon Sep 17 00:00:00 2001 From: RyanDavies19 Date: Wed, 11 Oct 2023 13:33:54 -0600 Subject: [PATCH 2/8] Removed print statements from debugging --- modules/moordyn/src/MoorDyn.f90 | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/modules/moordyn/src/MoorDyn.f90 b/modules/moordyn/src/MoorDyn.f90 index f24c80f2dc..0e4cb165fc 100644 --- a/modules/moordyn/src/MoorDyn.f90 +++ b/modules/moordyn/src/MoorDyn.f90 @@ -1985,10 +1985,6 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er IF (wordy > 2) print *, "Line ", l, " with NumSegs =", N IF (wordy > 2) print *, "its states range from index ", m%LineStateIs1(l), " to ", m%LineStateIsN(l) - PRINT*, 'Line ', l - PRINT*, 'Line anch poisition', m%LineList(l)%r(:,0) - PRINT*, 'Line Fair poisition', m%LineList(l)%r(:,m%LineList(l)%N) - ! assign the resulting internal node positions to the integrator initial state vector! (velocities leave at 0) DO I = 1, N-1 ! print *, "I=", I @@ -2010,16 +2006,6 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er END DO !l = 1, p%NLines - PRINT*, 'Number of lines on point', m%PointList(1)%IdNum, ' is ', m%PointList(1)%nAttached - PRINT*, 'Number of lines on point', m%PointList(2)%IdNum, ' is ', m%PointList(2)%nAttached - PRINT*, 'Number of lines on point', m%PointList(3)%IdNum, ' is ', m%PointList(3)%nAttached - PRINT*, 'Point ', m%PointList(1)%IdNum, ' location ', m%PointList(1)%r - PRINT*, 'Point ', m%PointList(2)%IdNum, ' location ', m%PointList(2)%r - PRINT*, 'Point ', m%PointList(3)%IdNum, ' location ', m%PointList(3)%r - PRINT*, 'Body ', m%BodyList(1)%IdNum, ' location ', m%BodyList(1)%r6 - PRINT*, 'Body ', m%BodyList(2)%IdNum, ' location ', m%BodyList(2)%r6 - PRINT*, 'Body ', m%BodyList(1)%IdNum, ' attached points ', m%BodyList(1)%AttachedC(1:3) - PRINT*, 'Body ', m%BodyList(2)%IdNum, ' attached points ', m%BodyList(2)%AttachedC(1:3) ! -------------------------------------------------------------------- From 134dcea7966551d96520b652a67c7313879e1c6f Mon Sep 17 00:00:00 2001 From: RyanDavies19 Date: Mon, 16 Oct 2023 12:30:54 -0600 Subject: [PATCH 3/8] Fixes indexing error in dynamic relaxation --- modules/moordyn/src/MoorDyn.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/moordyn/src/MoorDyn.f90 b/modules/moordyn/src/MoorDyn.f90 index 0e4cb165fc..e2501e818c 100644 --- a/modules/moordyn/src/MoorDyn.f90 +++ b/modules/moordyn/src/MoorDyn.f90 @@ -2165,7 +2165,7 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er DO l = 1, p%nLines DO K = 1,9 - IF ( abs( FairTensIC(l,K)/FairTensIC(l,K+1) - 1.0 ) > InputFileDat%threshIC ) THEN + IF ( abs( FairTensIC(l,1)/FairTensIC(l,K+1) - 1.0 ) > InputFileDat%threshIC ) THEN Converged = 0 EXIT END IF @@ -2175,6 +2175,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)))) From c38c55bb7e6a15974d81178b74ae4e4935e80850 Mon Sep 17 00:00:00 2001 From: RyanDavies19 Date: Mon, 16 Oct 2023 16:32:37 -0600 Subject: [PATCH 4/8] ICdt adjustment --- modules/moordyn/src/MoorDyn.f90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/moordyn/src/MoorDyn.f90 b/modules/moordyn/src/MoorDyn.f90 index e2501e818c..8339b4e483 100644 --- a/modules/moordyn/src/MoorDyn.f90 +++ b/modules/moordyn/src/MoorDyn.f90 @@ -2093,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 From 6422a8861c973ac356612ada24642ad37e70a25f Mon Sep 17 00:00:00 2001 From: RyanDavies19 Date: Tue, 17 Oct 2023 11:59:22 -0600 Subject: [PATCH 5/8] Cleaner looking output formatting --- modules/moordyn/src/MoorDyn.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/moordyn/src/MoorDyn.f90 b/modules/moordyn/src/MoorDyn.f90 index 8339b4e483..a8e5bad50f 100644 --- a/modules/moordyn/src/MoorDyn.f90 +++ b/modules/moordyn/src/MoorDyn.f90 @@ -2177,7 +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('') ! 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)))) @@ -2188,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' From c77b2fb22e4ca116eb254cded7872075460017dd Mon Sep 17 00:00:00 2001 From: RyanDavies19 Date: Tue, 17 Oct 2023 12:55:08 -0600 Subject: [PATCH 6/8] Adjust loop indexing --- modules/moordyn/src/MoorDyn.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/moordyn/src/MoorDyn.f90 b/modules/moordyn/src/MoorDyn.f90 index a8e5bad50f..e58f5f2949 100644 --- a/modules/moordyn/src/MoorDyn.f90 +++ b/modules/moordyn/src/MoorDyn.f90 @@ -2166,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,1)/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 From 95d82dab8894e4ca89d846bedbd4b51ec488a6de Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Tue, 17 Oct 2023 17:37:29 -0600 Subject: [PATCH 7/8] MD dynamic relaxation: update regression tests --- reg_tests/r-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reg_tests/r-test b/reg_tests/r-test index a9480d7119..0dc62bf91a 160000 --- a/reg_tests/r-test +++ b/reg_tests/r-test @@ -1 +1 @@ -Subproject commit a9480d711900341ab82542bf57d38565aaf436cf +Subproject commit 0dc62bf91a86b9013f61e9c15a2e6c98a658934e From 567bc9cd8aa2269b0bceb58c64c6ca069f4f0c82 Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Wed, 18 Oct 2023 10:19:42 -0600 Subject: [PATCH 8/8] MD: update py_md_5MW_OC4Semi regression test --- reg_tests/r-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reg_tests/r-test b/reg_tests/r-test index 0dc62bf91a..7923e7ab0b 160000 --- a/reg_tests/r-test +++ b/reg_tests/r-test @@ -1 +1 @@ -Subproject commit 0dc62bf91a86b9013f61e9c15a2e6c98a658934e +Subproject commit 7923e7ab0bbf2fc7c9ebc7957f788a2cb3b4f884