Skip to content
Merged
27 changes: 8 additions & 19 deletions modules/hydrodyn/src/Morison.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3482,7 +3482,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
REAL(ReKi) :: sinBeta, sinBeta1, sinBeta2
REAL(ReKi) :: cosBeta, cosBeta1, cosBeta2
REAL(ReKi) :: CMatrix(3,3), CMatrix1(3,3), CMatrix2(3,3), CTrans(3,3) ! Direction cosine matrix for element, and its transpose
REAL(ReKi) :: l, z1, z2, zMid, r1, r2, r1b, r2b, r1In, r2In, rMidIn, rn, rn1, rn2, z_hi, zFillGroup
REAL(ReKi) :: l, z1, z2, zMid, r1, r2, r1b, r2b, r1In, r2In, rMidIn, z_hi, zFillGroup
REAL(ReKi) :: Sa1, Sa2, Sa1b, Sa2b, SaMidb, Sa1In, Sa2In, SaMidIn
REAL(ReKi) :: Sb1, Sb2, Sb1b, Sb2b, SbMidb, Sb1In, Sb2In, SbMidIn
REAL(ReKi) :: dRdl_mg, dSadl_mg, dSbdl_mg ! shorthand for taper including marine growth of element i
Expand Down Expand Up @@ -3779,16 +3779,10 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
ELSE IF (mem%MHstLMod == 2) THEN ! Alternative hydrostatic load calculation
! Get free surface elevation and normal at the element midpoint (both assumed constant over the element)
posMid = 0.5 * (pos1+pos2)
! rn is only used to estimate free surface normal numerically
IF (mem%MSecGeom == MSecGeom_Cyl) THEN
rn = 0.5 * (r1b +r2b )
ELSE IF (mem%MSecGeom == MSecGeom_Rec) THEN
rn = MAX( 0.5*(Sa1b+Sa2b), 0.5*(Sb1b+Sb2b) )
END IF
IF (p%WaveField%WaveStMod > 0) THEN
CALL GetTotalWaveElev( Time, posMid, ZetaMid, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
CALL GetFreeSurfaceNormal( Time, posMid, rn, n_hat, ErrStat2, ErrMsg2 )
CALL GetFreeSurfaceNormal( Time, posMid, n_hat, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/posMid(1),posMid(2),ZetaMid/) ! Reference point on the free surface
ELSE
Expand Down Expand Up @@ -4563,22 +4557,18 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
if (mem%MSecGeom==MSecGeom_Cyl) then
r1 = mem%RMGB( 1)
r2 = mem%RMGB(N+1)
rn1 = r1
rn2 = r2
else if (mem%MSecGeom==MSecGeom_Rec) then
Sa1 = mem%SaMGB( 1)
Sa2 = mem%SaMGB(N+1)
Sb1 = mem%SbMGB( 1)
Sb2 = mem%SbMGB(N+1)
rn1 = MAX(Sa1,Sb1)
rn2 = MAX(Sa2,Sb2)
end if
if (mem%i_floor == 0) then ! both ends above or at seabed
! Compute loads on the end plate of node 1
IF (p%WaveField%WaveStMod > 0) THEN
CALL GetTotalWaveElev( Time, pos1, Zeta1, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
CALL GetFreeSurfaceNormal( Time, pos1, rn1, n_hat, ErrStat2, ErrMsg2 )
CALL GetFreeSurfaceNormal( Time, pos1, n_hat, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/pos1(1),pos1(2),Zeta1/) ! Reference point on the free surface
ELSE
Expand Down Expand Up @@ -4606,7 +4596,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
IF (p%WaveField%WaveStMod > 0) THEN
CALL GetTotalWaveElev( Time, pos2, Zeta2, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
CALL GetFreeSurfaceNormal( Time, pos2, rn2, n_hat, ErrStat2, ErrMsg2 )
CALL GetFreeSurfaceNormal( Time, pos2, n_hat, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/pos2(1),pos2(2),Zeta2/) ! Reference point on the free surface
ELSE
Expand Down Expand Up @@ -4635,7 +4625,7 @@ SUBROUTINE Morison_CalcOutput( Time, u, p, x, xd, z, OtherState, y, m, errStat,
IF (p%WaveField%WaveStMod > 0) THEN
CALL GetTotalWaveElev( Time, pos2, Zeta2, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
CALL GetFreeSurfaceNormal( Time, pos2, rn2, n_hat, ErrStat2, ErrMsg2 )
CALL GetFreeSurfaceNormal( Time, pos2, n_hat, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
FSPt = (/pos2(1),pos2(2),Zeta2/) ! Reference point on the free surface
ELSE
Expand Down Expand Up @@ -4769,10 +4759,9 @@ SUBROUTINE GetTotalWaveElev( Time, pos, Zeta, ErrStat, ErrMsg )

END SUBROUTINE GetTotalWaveElev

SUBROUTINE GetFreeSurfaceNormal( Time, pos, r, n, ErrStat, ErrMsg)
SUBROUTINE GetFreeSurfaceNormal( Time, pos, n, ErrStat, ErrMsg)
REAL(DbKi), INTENT( In ) :: Time
REAL(ReKi), INTENT( In ) :: pos(*) ! Position at which free-surface normal is to be calculated. Third entry ignored if present.
REAL(ReKi), INTENT( In ) :: r ! Distance for central differencing
REAL(ReKi), INTENT( OUT ) :: n(3) ! Free-surface normal vector
INTEGER(IntKi), INTENT( OUT ) :: ErrStat ! Error status of the operation
CHARACTER(*), INTENT( OUT ) :: ErrMsg ! Error message if errStat /= ErrID_None
Expand All @@ -4782,7 +4771,7 @@ SUBROUTINE GetFreeSurfaceNormal( Time, pos, r, n, ErrStat, ErrMsg)
ErrStat = ErrID_None
ErrMsg = ""

CALL WaveField_GetNodeWaveNormal( p%WaveField, m%WaveField_m, Time, pos, r, n, ErrStat2, ErrMsg2 )
CALL WaveField_GetNodeWaveNormal( p%WaveField, m%WaveField_m, Time, pos, n, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )

END SUBROUTINE GetFreeSurfaceNormal
Expand Down Expand Up @@ -5716,7 +5705,7 @@ SUBROUTINE getElementHstLds_Mod1( Time, pos1, pos2, Zeta1, Zeta2, k_hat, r1, r2,
rh = r1 + h0*dRdl
! Estimate the free-surface normal at the free-surface intersection, n_hat
IF ( p%WaveField%WaveStMod > 0_IntKi ) THEN ! If wave stretching is enabled, compute free surface normal
CALL GetFreeSurfaceNormal( Time, FSInt, rh, n_hat, ErrStat2, ErrMsg2 )
CALL GetFreeSurfaceNormal( Time, FSInt, n_hat, ErrStat2, ErrMsg2 )
CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName )
ELSE ! Without wave stretching, use the normal of the SWL
n_hat = (/0.0_ReKi,0.0_ReKi,1.0_ReKi/)
Expand Down
2 changes: 1 addition & 1 deletion modules/hydrodyn/src/Morison.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ typedef ^ ^ ReKi
typedef ^ ^ ReKi V_rel_n_HiPass {:} - - "High-pass filtered normal relative flow velocity at joints" m/s
typedef ^ ^ ReKi zFillGroup {:} - - "Instantaneous highest point of each filled group" m
typedef ^ ^ MeshMapType VisMeshMap - - - "Mesh mapping for visualization mesh" -
typedef ^ ^ SeaSt_WaveField_MiscVarType WaveField_m - - - "misc var information from the SeaState Interpolation module" -
typedef ^ ^ GridInterp_MiscVarType WaveField_m - - - "misc var information from the Grid Interpolation module" -

# ..... Parameters ................................................................................................................
# Define parameters here:
Expand Down
10 changes: 5 additions & 5 deletions modules/hydrodyn/src/Morison_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ MODULE Morison_Types
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: V_rel_n_HiPass !< High-pass filtered normal relative flow velocity at joints [m/s]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: zFillGroup !< Instantaneous highest point of each filled group [m]
TYPE(MeshMapType) :: VisMeshMap !< Mesh mapping for visualization mesh [-]
TYPE(SeaSt_WaveField_MiscVarType) :: WaveField_m !< misc var information from the SeaState Interpolation module [-]
TYPE(GridInterp_MiscVarType) :: WaveField_m !< misc var information from the Grid Interpolation module [-]
END TYPE Morison_MiscVarType
! =======================
! ========= Morison_ParameterType =======
Expand Down Expand Up @@ -4693,7 +4693,7 @@ subroutine Morison_CopyMisc(SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg)
call NWTC_Library_CopyMeshMapType(SrcMiscData%VisMeshMap, DstMiscData%VisMeshMap, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
call SeaSt_WaveField_CopyMisc(SrcMiscData%WaveField_m, DstMiscData%WaveField_m, CtrlCode, ErrStat2, ErrMsg2)
call GridInterp_CopyMisc(SrcMiscData%WaveField_m, DstMiscData%WaveField_m, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
end subroutine
Expand Down Expand Up @@ -4780,7 +4780,7 @@ subroutine Morison_DestroyMisc(MiscData, ErrStat, ErrMsg)
end if
call NWTC_Library_DestroyMeshMapType(MiscData%VisMeshMap, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
call SeaSt_WaveField_DestroyMisc(MiscData%WaveField_m, ErrStat2, ErrMsg2)
call GridInterp_DestroyMisc(MiscData%WaveField_m, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
end subroutine

Expand Down Expand Up @@ -4821,7 +4821,7 @@ subroutine Morison_PackMisc(RF, Indata)
call RegPackAlloc(RF, InData%V_rel_n_HiPass)
call RegPackAlloc(RF, InData%zFillGroup)
call NWTC_Library_PackMeshMapType(RF, InData%VisMeshMap)
call SeaSt_WaveField_PackMisc(RF, InData%WaveField_m)
call GridInterp_PackMisc(RF, InData%WaveField_m)
if (RegCheckErr(RF, RoutineName)) return
end subroutine

Expand Down Expand Up @@ -4868,7 +4868,7 @@ subroutine Morison_UnPackMisc(RF, OutData)
call RegUnpackAlloc(RF, OutData%V_rel_n_HiPass); if (RegCheckErr(RF, RoutineName)) return
call RegUnpackAlloc(RF, OutData%zFillGroup); if (RegCheckErr(RF, RoutineName)) return
call NWTC_Library_UnpackMeshMapType(RF, OutData%VisMeshMap) ! VisMeshMap
call SeaSt_WaveField_UnpackMisc(RF, OutData%WaveField_m) ! WaveField_m
call GridInterp_UnpackMisc(RF, OutData%WaveField_m) ! WaveField_m
end subroutine

subroutine Morison_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg)
Expand Down
2 changes: 1 addition & 1 deletion modules/hydrodyn/src/SS_Excitation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef ^ ^ SS_Exc_ContinuousStateType
# Define any data that are used only for efficiency purposes (these variables are not associated with time):
# e.g. indices for searching in an array, large arrays that are local variables in any routine called multiple times, etc.
typedef ^ MiscVarType INTEGER LastIndWave - 1 - "last used index in the WaveTime array" -
typedef ^ ^ SeaSt_WaveField_MiscVarType WaveField_m - - - "misc var information from the SeaState Interpolation module" -
typedef ^ ^ GridInterp_MiscVarType WaveField_m - - - "misc var information from the Grid Interpolation module" -


# ..... Parameters .........................
Expand Down
10 changes: 5 additions & 5 deletions modules/hydrodyn/src/SS_Excitation_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ MODULE SS_Excitation_Types
! ========= SS_Exc_MiscVarType =======
TYPE, PUBLIC :: SS_Exc_MiscVarType
INTEGER(IntKi) :: LastIndWave = 1 !< last used index in the WaveTime array [-]
TYPE(SeaSt_WaveField_MiscVarType) :: WaveField_m !< misc var information from the SeaState Interpolation module [-]
TYPE(GridInterp_MiscVarType) :: WaveField_m !< misc var information from the Grid Interpolation module [-]
END TYPE SS_Exc_MiscVarType
! =======================
! ========= SS_Exc_ParameterType =======
Expand Down Expand Up @@ -494,7 +494,7 @@ subroutine SS_Exc_CopyMisc(SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg)
ErrStat = ErrID_None
ErrMsg = ''
DstMiscData%LastIndWave = SrcMiscData%LastIndWave
call SeaSt_WaveField_CopyMisc(SrcMiscData%WaveField_m, DstMiscData%WaveField_m, CtrlCode, ErrStat2, ErrMsg2)
call GridInterp_CopyMisc(SrcMiscData%WaveField_m, DstMiscData%WaveField_m, CtrlCode, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
end subroutine
Expand All @@ -508,7 +508,7 @@ subroutine SS_Exc_DestroyMisc(MiscData, ErrStat, ErrMsg)
character(*), parameter :: RoutineName = 'SS_Exc_DestroyMisc'
ErrStat = ErrID_None
ErrMsg = ''
call SeaSt_WaveField_DestroyMisc(MiscData%WaveField_m, ErrStat2, ErrMsg2)
call GridInterp_DestroyMisc(MiscData%WaveField_m, ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
end subroutine

Expand All @@ -518,7 +518,7 @@ subroutine SS_Exc_PackMisc(RF, Indata)
character(*), parameter :: RoutineName = 'SS_Exc_PackMisc'
if (RF%ErrStat >= AbortErrLev) return
call RegPack(RF, InData%LastIndWave)
call SeaSt_WaveField_PackMisc(RF, InData%WaveField_m)
call GridInterp_PackMisc(RF, InData%WaveField_m)
if (RegCheckErr(RF, RoutineName)) return
end subroutine

Expand All @@ -528,7 +528,7 @@ subroutine SS_Exc_UnPackMisc(RF, OutData)
character(*), parameter :: RoutineName = 'SS_Exc_UnPackMisc'
if (RF%ErrStat /= ErrID_None) return
call RegUnpack(RF, OutData%LastIndWave); if (RegCheckErr(RF, RoutineName)) return
call SeaSt_WaveField_UnpackMisc(RF, OutData%WaveField_m) ! WaveField_m
call GridInterp_UnpackMisc(RF, OutData%WaveField_m) ! WaveField_m
end subroutine

subroutine SS_Exc_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg)
Expand Down
3 changes: 1 addition & 2 deletions modules/hydrodyn/src/WAMIT.f90
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS

! Set up wave excitation grid - Can no longer use the WaveField parameters due to different headings
! Copy WaveField grid parameters
call SeaSt_WaveField_CopyParam(p%WaveField%GridParams, p%ExctnGridParams, 0, ErrStat2, ErrMsg2); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
call GridInterp_CopyParam(p%WaveField%VolGridParams, p%ExctnGridParams, 0, ErrStat2, ErrMsg2); CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if ( p%ExctnDisp == 0 ) then
p%ExctnGridParams%n(2:3) = 1_IntKi
p%ExctnGridParams%delta(2:3) = 0.0_SiKi
Expand All @@ -257,7 +257,6 @@ SUBROUTINE WAMIT_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, ErrS
p%ExctnGridParams%pZero(4) = -Pi
end if
p%ExctnGridParams%n(4) = p%NExctnHdg+1
p%ExctnGridParams%Z_depth = -1.0 ! Set to Z_depth to a negative value to indicate uniform "z" grid for platform heading

! This module's implementation requires that if NBodyMod = 2 or 3, then there is one instance of a WAMIT module for each body, therefore, HydroDyn may have NBody > 1, but this WAMIT module will have NBody = 1
if ( (p%NBodyMod > 1) .and. (p%NBody > 1) ) then
Expand Down
5 changes: 3 additions & 2 deletions modules/hydrodyn/src/WAMIT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ usefrom Conv_Radiation.txt
usefrom SS_Radiation.txt
usefrom SS_Excitation.txt
usefrom SeaSt_WaveField.txt
usefrom GridInterp.txt

typedef WAMIT/WAMIT InitInputType INTEGER NBody - - - "[>=1; only used when PotMod=1. If NBodyMod=1, the WAMIT data contains a vector of size 6*NBody x 1 and matrices of size 6*NBody x 6*NBody; if NBodyMod>1, there are NBody sets of WAMIT data each with a vector of size 6 x 1 and matrices of size 6 x 6]" -
typedef ^ ^ INTEGER NBodyMod - - - "Body coupling model {1: include coupling terms between each body and NBody in HydroDyn equals NBODY in WAMIT, 2: neglect coupling terms between each body and NBODY=1 with XBODY=0 in WAMIT, 3: Neglect coupling terms between each body and NBODY=1 with XBODY=/0 in WAMIT} (switch) [only used when PotMod=1]" -
Expand Down Expand Up @@ -95,7 +96,7 @@ typedef ^ ^ SS_Exc_Outp
typedef ^ ^ Conv_Rdtn_MiscVarType Conv_Rdtn - - - "" -
typedef ^ ^ Conv_Rdtn_InputType Conv_Rdtn_u - - - "" -
typedef ^ ^ Conv_Rdtn_OutputType Conv_Rdtn_y - - - "" -
typedef ^ ^ SeaSt_WaveField_MiscVarType WaveField_m - - - "misc var information from the SeaState Interpolation module" -
typedef ^ ^ GridInterp_MiscVarType WaveField_m - - - "misc var information from the Grid Interpolation module" -

# ..... Parameters ................................................................................................................
# Define parameters here:
Expand All @@ -120,7 +121,7 @@ typedef ^ ^ SS_Exc_Para
typedef ^ ^ DbKi DT - - - "" -
typedef ^ ^ SeaSt_WaveFieldType *WaveField - - - "Pointer to wave field"
typedef ^ ^ INTEGER PtfmYMod - - - "Large yaw model" -
typedef ^ ^ SeaSt_WaveField_ParameterType ExctnGridParams - - - "Parameters of WaveExctnGrid" -
typedef ^ ^ GridInterp_ParameterType ExctnGridParams - - - "Parameters of WaveExctnGrid" -
#
#
# ..... Inputs ....................................................................................................................
Expand Down
3 changes: 1 addition & 2 deletions modules/hydrodyn/src/WAMIT2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2646,7 +2646,7 @@ SUBROUTINE CheckInitInput( InitInp, p, MnDriftData, NewmanAppData, DiffQTFData,

! Set up 2nd-order wave excitation grid
! Copy WaveField grid parameters
call SeaSt_WaveField_CopyParam(InitInp%WaveField%GridParams, p%Exctn2GridParams, 0, ErrStatTmp, ErrMsgTmp); CALL SetErrStat( ErrStatTmp, ErrMsgTmp, ErrStat, ErrMsg, RoutineName)
call GridInterp_CopyParam(InitInp%WaveField%VolGridParams, p%Exctn2GridParams, 0, ErrStatTmp, ErrMsgTmp); CALL SetErrStat( ErrStatTmp, ErrMsgTmp, ErrStat, ErrMsg, RoutineName)
! x and y grids are currently not used for second-order wave excitation
p%Exctn2GridParams%n(2:3) = 1_IntKi
p%Exctn2GridParams%delta(2:3) = 0.0_SiKi
Expand All @@ -2662,7 +2662,6 @@ SUBROUTINE CheckInitInput( InitInp, p, MnDriftData, NewmanAppData, DiffQTFData,
p%Exctn2GridParams%pZero(4) = -Pi
end if
p%Exctn2GridParams%n(4) = p%NExctnHdg+1
p%Exctn2GridParams%Z_depth = -1.0 ! Set to Z_depth to a negative value to indicate uniform "z" grid for platform heading


!> 1. Check that we only specified one of MnDrift, NewmanApp, or DiffQTF
Expand Down
Loading