Skip to content

Commit

Permalink
Catenary solver status message changes per conversation with Matt
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanDavies19 committed Sep 19, 2023
1 parent 3cdf383 commit 7e52a67
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
17 changes: 8 additions & 9 deletions modules/moordyn/src/MoorDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ MODULE MoorDyn

PRIVATE

TYPE(ProgDesc), PARAMETER :: MD_ProgDesc = ProgDesc( 'MoorDyn', 'v2.0.0', '2022-12-08' )
TYPE(ProgDesc), PARAMETER :: MD_ProgDesc = ProgDesc( 'MoorDyn', 'v2.0.0', '2023-09-18' )

INTEGER(IntKi), PARAMETER :: wordy = 0 ! verbosity level. >1 = more console output

Expand Down Expand Up @@ -164,7 +164,7 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
InitOut%Ver = MD_ProgDesc

CALL WrScr(' This is MoorDyn v2, with significant input file changes from v1.')
CALL WrScr(' Copyright: (C) 2022 National Renewable Energy Laboratory, (C) 2019 Matt Hall')
CALL WrScr(' Copyright: (C) 2023 National Renewable Energy Laboratory, (C) 2019 Matt Hall')


!---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -362,7 +362,7 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
Line = NextLine(i)
END DO

else if (INDEX(Line, "CONTROL") > 0) then ! if failure conditions header
else if (INDEX(Line, "CONTROL") > 0) then ! if control conditions header

IF (wordy > 1) print *, " Reading control channels: ";

Expand Down Expand Up @@ -1972,7 +1972,6 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
CALL Line_Initialize( m%LineList(l), m%LineTypeList(m%LineList(l)%PropsIdNum), p%rhoW , ErrStat2, ErrMsg2)
CALL CheckError( ErrStat2, ErrMsg2 )
IF (ErrStat >= AbortErrLev) RETURN
IF (ErrStat >= ErrId_Warn) CALL WrScr(' Catenary solve of Line '//trim(Num2LStr(m%LineList(l)%IdNum))//' unsuccessful. Initializing as linear.')

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)
Expand Down Expand Up @@ -2142,11 +2141,11 @@ SUBROUTINE MD_Init(InitInp, u, p, x, xd, z, other, y, m, DTcoupling, InitOut, Er
END DO


! ! provide status message
! ! bjj: putting this in a string so we get blanks to cover up previous values (if current string is shorter than previous one)
! Message = ' t='//trim(Num2LStr(t))//' FairTen 1: '//trim(Num2LStr(FairTensIC(1,1)))// &
! ', '//trim(Num2LStr(FairTensIC(1,2)))//', '//trim(Num2LStr(FairTensIC(1,3)))
! CALL WrOver( Message )
! provide status message
! bjj: putting this in a string so we get blanks to cover up previous values (if current string is shorter than previous one)
Message = ' t='//trim(Num2LStr(t))//' FairTen 1: '//trim(Num2LStr(FairTensIC(1,1)))// &
', '//trim(Num2LStr(FairTensIC(1,2)))//', '//trim(Num2LStr(FairTensIC(1,3)))
CALL WrOver( Message )

! check for convergence (compare current tension at each fairlead with previous 9 values)
IF (I > 9) THEN
Expand Down
32 changes: 16 additions & 16 deletions modules/moordyn/src/MoorDyn_Line.f90
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,6 @@ SUBROUTINE Line_Initialize (Line, LineProp, rhoW, ErrStat, ErrMsg)
WetWeight , SeabedCD, Tol, (N+1) , &
LSNodes, LNodesX, LNodesZ , ErrStat2, ErrMsg2)

IF ((abs(LNodesZ(N+1) - ZF) > Tol) .AND. (ErrStat2 == ErrID_None)) THEN
! Check fairlead node z position is same as z distance between fairlead and anchor
ErrStat2 = ErrID_Warn
ErrMsg2 = ' Wrong catenary initial profile. Fairlead and anchor vertical seperation has changed. '
ENDIF

IF (ErrStat2 == ErrID_None) THEN ! if it worked, use it
! Transform the positions of each node on the current line from the local
! coordinate system of the current line to the inertial frame coordinate
Expand All @@ -369,8 +363,11 @@ SUBROUTINE Line_Initialize (Line, LineProp, rhoW, ErrStat, ErrMsg)
ENDDO ! J - All nodes per line where the line position and tension can be output

ELSE ! if there is a problem with the catenary approach, just stretch the nodes linearly between fairlead and anchor
CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, ' Line_Initialize: Line '//trim(Num2LStr(Line%IdNum))//' ')

! CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, ' Line_Initialize: Line '//trim(Num2LStr(Line%IdNum))//' ')
CALL WrScr(' Catenary solve of Line '//trim(Num2LStr(Line%IdNum))//' unsuccessful. Initializing as linear.')
IF (wordy == 1) THEN
CALL WrScr(' Message from catenary solver: '//ErrMsg2)
ENDIF
! print *, "Node positions: "

DO J = 0,N ! Loop through all nodes per line where the line position and tension can be output
Expand Down Expand Up @@ -590,8 +587,7 @@ SUBROUTINE Catenary ( XF_In, ZF_In, L_In , EA_In, &

ELSEIF ( W == 0.0_DbKi ) THEN ! .TRUE. when the weight of the line in fluid is zero so that catenary solution is ill-conditioned
ErrStat = ErrID_Warn
ErrMsg = ' The weight of the line in fluid must not be zero. '// &
'Routine Catenary() cannot solve quasi-static mooring line solution.'
ErrMsg = ' The weight of the line in fluid must not be zero in routine Catenary().'
RETURN


Expand All @@ -601,8 +597,7 @@ SUBROUTINE Catenary ( XF_In, ZF_In, L_In , EA_In, &

IF ( ( L >= LMax ) .AND. ( CB >= 0.0_DbKi ) ) then ! .TRUE. if the line is as long or longer than its maximum possible value with seabed interaction
ErrStat = ErrID_Warn
ErrMsg = ' Unstretched mooring line length too large. '// &
' Routine Catenary() cannot solve quasi-static mooring line solution.'
ErrMsg = ' Unstretched mooring line length too large in routine Catenary().'
RETURN
END IF

Expand Down Expand Up @@ -737,8 +732,7 @@ SUBROUTINE Catenary ( XF_In, ZF_In, L_In , EA_In, &
IF ( EqualRealNos( DET, 0.0_DbKi ) ) THEN
!bjj: there is a serious problem with the debugger here when DET = 0
ErrStat = ErrID_Warn
ErrMsg = ' Iteration not convergent (DET is 0). '// &
' Routine Catenary() cannot solve quasi-static mooring line solution.'
ErrMsg = ' Iteration not convergent (DET is 0) in routine Catenary().'
RETURN
ENDIF

Expand Down Expand Up @@ -793,8 +787,7 @@ SUBROUTINE Catenary ( XF_In, ZF_In, L_In , EA_In, &

ELSEIF ( ( I == MaxIter ) .AND. ( .NOT. FirstIter ) ) THEN ! .TRUE. if we've iterated as much as we can take without finding a solution; Abort
ErrStat = ErrID_Warn
ErrMsg = ' Iteration not convergent. '// &
' Routine Catenary() cannot solve quasi-static mooring line solution.'
ErrMsg = ' Iteration not convergent in routine Catenary().'
RETURN


Expand Down Expand Up @@ -968,6 +961,13 @@ SUBROUTINE Catenary ( XF_In, ZF_In, L_In , EA_In, &
ZF = -ZF ! Return to orginal value
ENDIF

IF (abs(Z(N+1) - ZF) > Tol) THEN
! Check fairlead node z position is same as z distance between fairlead and anchor
ErrStat2 = ErrID_Warn
ErrMsg2 = ' Wrong catenary initial profile. Fairlead and anchor vertical seperation has changed in routine Catenary().'
RETURN
ENDIF

! The Newton-Raphson iteration is only accurate in double precision, so
! convert the output arguments back into the default precision for real
! numbers:
Expand Down

0 comments on commit 7e52a67

Please sign in to comment.