Skip to content

Commit

Permalink
Merge pull request OpenFAST#19 from andrew-platt/f/SeaState+
Browse files Browse the repository at this point in the history
seastate: change WtrDpth to ReKi so double precision will compile
  • Loading branch information
HaymanConsulting authored Feb 2, 2022
2 parents 4baac0b + 78c3849 commit 8d914b1
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion modules/hydrodyn/src/WAMIT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ param WAMIT/WAMIT unused INTEGER
typedef ^ 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]" -
typedef ^ ^ ReKi Gravity - - - "Supplied by Driver: Gravitational acceleration" "(m/s^2)"
typedef ^ ^ SiKi WtrDpth - - - "Water depth (positive-valued)" m
typedef ^ ^ ReKi WtrDpth - - - "Water depth (positive-valued)" m
typedef ^ ^ ReKi PtfmVol0 {:} - - "" -
typedef ^ ^ LOGICAL HasWAMIT - - - ".TRUE. if using WAMIT model, .FALSE. otherwise" -
typedef ^ ^ ReKi WAMITULEN - - - "" -
Expand Down
2 changes: 1 addition & 1 deletion modules/hydrodyn/src/WAMIT2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef ^ ^ INTEGER NStepWave2
typedef ^ ^ ReKi WaveDOmega - - - "Frequency step for incident wave calculations" (rad/s)
typedef ^ ^ ReKi WtrDens - - - "Water density" (kg/m^3)
typedef ^ ^ ReKi Gravity - - - "Supplied by Driver: Gravitational acceleration" (m/s^2)
typedef ^ ^ SiKi WtrDpth - - - "Water depth (positive-valued)" (m)
typedef ^ ^ ReKi WtrDpth - - - "Water depth (positive-valued)" (m)

typedef ^ ^ SiKi WaveElevC0 {*}{*} - - "Discrete Fourier transform of the instantaneous elevation of incident waves at the platform reference point. First column is real part, second column is imaginary part" (meters)
typedef ^ ^ SiKi WaveDir - - - "Mean incident wave propagation heading direction" (degrees)
Expand Down
4 changes: 2 additions & 2 deletions modules/hydrodyn/src/WAMIT2_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ MODULE WAMIT2_Types
REAL(ReKi) :: WaveDOmega !< Frequency step for incident wave calculations [(rad/s)]
REAL(ReKi) :: WtrDens !< Water density [(kg/m^3)]
REAL(ReKi) :: Gravity !< Supplied by Driver: Gravitational acceleration [(m/s^2)]
REAL(SiKi) :: WtrDpth !< Water depth (positive-valued) [(m)]
REAL(ReKi) :: WtrDpth !< Water depth (positive-valued) [(m)]
REAL(SiKi) , DIMENSION(:,:), POINTER :: WaveElevC0 => NULL() !< Discrete Fourier transform of the instantaneous elevation of incident waves at the platform reference point. First column is real part, second column is imaginary part [(meters)]
REAL(SiKi) :: WaveDir !< Mean incident wave propagation heading direction [(degrees)]
LOGICAL :: WaveMultiDir !< Indicates the waves are multidirectional -- set by HydroDyn_Input [-]
Expand Down Expand Up @@ -710,7 +710,7 @@ SUBROUTINE WAMIT2_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat,
Re_Xferred = Re_Xferred + 1
OutData%Gravity = ReKiBuf(Re_Xferred)
Re_Xferred = Re_Xferred + 1
OutData%WtrDpth = REAL(ReKiBuf(Re_Xferred), SiKi)
OutData%WtrDpth = ReKiBuf(Re_Xferred)
Re_Xferred = Re_Xferred + 1
IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! WaveElevC0 not allocated
Int_Xferred = Int_Xferred + 1
Expand Down
4 changes: 2 additions & 2 deletions modules/hydrodyn/src/WAMIT_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MODULE WAMIT_Types
INTEGER(IntKi) :: 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] [-]
INTEGER(IntKi) :: 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] [-]
REAL(ReKi) :: Gravity !< Supplied by Driver: Gravitational acceleration [(m/s^2)]
REAL(SiKi) :: WtrDpth !< Water depth (positive-valued) [m]
REAL(ReKi) :: WtrDpth !< Water depth (positive-valued) [m]
REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: PtfmVol0 !< [-]
LOGICAL :: HasWAMIT !< .TRUE. if using WAMIT model, .FALSE. otherwise [-]
REAL(ReKi) :: WAMITULEN !< [-]
Expand Down Expand Up @@ -997,7 +997,7 @@ SUBROUTINE WAMIT_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat,
Int_Xferred = Int_Xferred + 1
OutData%Gravity = ReKiBuf(Re_Xferred)
Re_Xferred = Re_Xferred + 1
OutData%WtrDpth = REAL(ReKiBuf(Re_Xferred), SiKi)
OutData%WtrDpth = ReKiBuf(Re_Xferred)
Re_Xferred = Re_Xferred + 1
IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! PtfmVol0 not allocated
Int_Xferred = Int_Xferred + 1
Expand Down
34 changes: 17 additions & 17 deletions modules/seastate/src/Waves.f90
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ FUNCTION WaveNumber ( Omega, g, h )
! Passed Variables:

REAL(ReKi), INTENT(IN ) :: g ! Gravitational acceleration (m/s^2)
REAL(SiKi), INTENT(IN ) :: h ! Water depth (meters)
REAL(ReKi), INTENT(IN ) :: h ! Water depth (meters)
REAL(SiKi), INTENT(IN ) :: Omega ! Wave frequency (rad/s)
REAL(SiKi) :: WaveNumber ! This function = wavenumber, k (1/m)

Expand Down Expand Up @@ -328,7 +328,7 @@ FUNCTION WaveNumber ( Omega, g, h )
ELSE ! Omega > 0.0; solve for the wavenumber as usual.


C = Omega*Omega*h/REAL(g,SiKi)
C = Omega*Omega*REAL(h,SiKi)/REAL(g,SiKi)
CC = C*C


Expand All @@ -355,11 +355,11 @@ FUNCTION WaveNumber ( Omega, g, h )
A = 1.0/( C - C2 )
B = A*( ( 0.5*LOG( ( X0 + C )/( X0 - C ) ) ) - X0 )

WaveNumber = ( X0 - ( B*C2*( 1.0 + (A*B*C*X0) ) ) )/h
WaveNumber = ( X0 - ( B*C2*( 1.0 + (A*B*C*X0) ) ) )/REAL(h,SiKi)

ELSE

WaveNumber = X0/h
WaveNumber = X0/REAL(h,SiKi)

END IF

Expand Down Expand Up @@ -389,7 +389,7 @@ FUNCTION COSHNumOvrCOSHDen ( k, h, z )
! Passed Variables:

REAL(SiKi) :: COSHNumOvrCOSHDen ! This function = COSH( k*( z + h ) )/COSH( k*h ) (-)
REAL(SiKi), INTENT(IN ) :: h ! Water depth ( h > 0 ) (meters)
REAL(ReKi), INTENT(IN ) :: h ! Water depth ( h > 0 ) (meters)
REAL(SiKi), INTENT(IN ) :: k ! Wave number ( k >= 0 ) (1/m)
REAL(SiKi), INTENT(IN ) :: z ! Elevation (-h <= z <= 0 ) (meters)

Expand All @@ -399,11 +399,11 @@ FUNCTION COSHNumOvrCOSHDen ( k, h, z )

IF ( k*h > 89.4_SiKi ) THEN ! When .TRUE., the shallow water formulation will trigger a floating point overflow error; however, COSH( k*( z + h ) )/COSH( k*h ) = EXP( k*z ) + EXP( -k*( z + 2*h ) ) for large k*h. This equals the deep water formulation, EXP( k*z ), except near z = -h, because h > 14.23*wavelength (since k = 2*Pi/wavelength) in this case.

COSHNumOvrCOSHDen = EXP( k*z ) + EXP( -k*( z + 2.0_SiKi*h ) )
COSHNumOvrCOSHDen = EXP( k*z ) + EXP( -k*( z + 2.0_SiKi*REAL(h,SiKi) ) )

ELSE ! 0 < k*h <= 89.4; use the shallow water formulation.

COSHNumOvrCOSHDen =REAL( COSH( k*( z + h ) ),R8Ki)/COSH( k*h )
COSHNumOvrCOSHDen =REAL( COSH( k*( z + REAL(h,SiKi) ) ),R8Ki)/COSH( k*REAL(h,SiKi) )

END IF

Expand Down Expand Up @@ -431,7 +431,7 @@ FUNCTION COSHNumOvrSINHDen ( k, h, z )
! Passed Variables:

REAL(SiKi) :: COSHNumOvrSINHDen ! This function = COSH( k*( z + h ) )/SINH( k*h ) (-)
REAL(SiKi), INTENT(IN ) :: h ! Water depth ( h > 0 ) (meters)
REAL(ReKi), INTENT(IN ) :: h ! Water depth ( h > 0 ) (meters)
REAL(SiKi), INTENT(IN ) :: k ! Wave number ( k >= 0 ) (1/m)
REAL(SiKi), INTENT(IN ) :: z ! Elevation (-h <= z <= 0 ) (meters)

Expand All @@ -444,13 +444,13 @@ FUNCTION COSHNumOvrSINHDen ( k, h, z )

COSHNumOvrSINHDen = HUGE( k )

ELSEIF ( k*h > 89.4_SiKi ) THEN ! When .TRUE., the shallow water formulation will trigger a floating point overflow error; however, COSH( k*( z + h ) )/SINH( k*h ) = EXP( k*z ) + EXP( -k*( z + 2*h ) ) for large k*h. This equals the deep water formulation, EXP( k*z ), except near z = -h, because h > 14.23*wavelength (since k = 2*Pi/wavelength) in this case.
ELSEIF ( k*REAL(h,SiKi) > 89.4_SiKi ) THEN ! When .TRUE., the shallow water formulation will trigger a floating point overflow error; however, COSH( k*( z + h ) )/SINH( k*h ) = EXP( k*z ) + EXP( -k*( z + 2*h ) ) for large k*h. This equals the deep water formulation, EXP( k*z ), except near z = -h, because h > 14.23*wavelength (since k = 2*Pi/wavelength) in this case.

COSHNumOvrSINHDen = EXP( k*z ) + EXP( -k*( z + 2*h ) )
COSHNumOvrSINHDen = EXP( k*z ) + EXP( -k*( z + 2*REAL(h,SiKi) ) )

ELSE ! 0 < k*h <= 89.4; use the shallow water formulation.

COSHNumOvrSINHDen = COSH( k*( z + h ) )/SINH( k*h )
COSHNumOvrSINHDen = COSH( k*( z + REAL(h,SiKi) ) )/SINH( k*REAL(h,SiKi) )

END IF

Expand Down Expand Up @@ -515,7 +515,7 @@ FUNCTION SINHNumOvrSINHDen ( k, h, z )
! Passed Variables:

REAL(SiKi) :: SINHNumOvrSINHDen ! This function = SINH( k*( z + h ) )/SINH( k*h ) (-)
REAL(SiKi), INTENT(IN ) :: h ! Water depth ( h > 0 ) (meters)
REAL(ReKi), INTENT(IN ) :: h ! Water depth ( h > 0 ) (meters)
REAL(SiKi), INTENT(IN ) :: k ! Wave number ( k >= 0 ) (1/m)
REAL(SiKi), INTENT(IN ) :: z ! Elevation (-h <= z <= 0 ) (meters)

Expand All @@ -527,13 +527,13 @@ FUNCTION SINHNumOvrSINHDen ( k, h, z )

SINHNumOvrSINHDen = 1.0

ELSEIF ( k*h > 89.4_SiKi ) THEN ! When .TRUE., the shallow water formulation will trigger a floating point overflow error; however, SINH( k*( z + h ) )/SINH( k*h ) = EXP( k*z ) - EXP( -k*( z + 2*h ) ) for large k*h. This equals the deep water formulation, EXP( k*z ), except near z = -h, because h > 14.23*wavelength (since k = 2*Pi/wavelength) in this case.
ELSEIF ( k*REAL(h,SiKi) > 89.4_SiKi ) THEN ! When .TRUE., the shallow water formulation will trigger a floating point overflow error; however, SINH( k*( z + h ) )/SINH( k*h ) = EXP( k*z ) - EXP( -k*( z + 2*h ) ) for large k*h. This equals the deep water formulation, EXP( k*z ), except near z = -h, because h > 14.23*wavelength (since k = 2*Pi/wavelength) in this case.

SINHNumOvrSINHDen = EXP( k*z ) - EXP( -k*( z + 2.0_SiKi*h ) )

ELSE ! 0 < k*h <= 89.4; use the shallow water formulation.

SINHNumOvrSINHDen = SINH( k*( z + h ) )/SINH( k*h )
SINHNumOvrSINHDen = SINH( k*( z + REAL(h,SiKi) ) )/SINH( k*REAL(h,SiKi) )

END IF

Expand Down Expand Up @@ -2405,7 +2405,7 @@ FUNCTION WheelerStretching ( zOrzPrime, Zeta, h, ForwardOrBackward, ErrStat, Err

! Passed Variables:

REAL(SiKi), INTENT(IN ) :: h ! Water depth (meters)
REAL(ReKi), INTENT(IN ) :: h ! Water depth (meters)
REAL(SiKi) :: WheelerStretching ! This function = zPrime [forward] or z [backward] (meters)
REAL(SiKi), INTENT(IN ) :: Zeta ! Instantaneous elevation of incident waves (meters)
REAL(SiKi), INTENT(IN ) :: zOrzPrime ! Elevations where the wave kinematics are to be applied using Wheeler stretching, z, [forward] or elevations where the wave kinematics are computed before applying Wheeler stretching, zPrime, [backward] (meters)
Expand All @@ -2425,12 +2425,12 @@ FUNCTION WheelerStretching ( zOrzPrime, Zeta, h, ForwardOrBackward, ErrStat, Err

CASE ( 'F' ) ! Forward

WheelerStretching = ( 1.0 + Zeta/h )*zOrzPrime + Zeta
WheelerStretching = ( 1.0 + Zeta/REAL(h,SiKi) )*zOrzPrime + Zeta


CASE ( 'B' ) ! Backward

WheelerStretching = ( zOrzPrime - Zeta )/( 1.0 + Zeta/h )
WheelerStretching = ( zOrzPrime - Zeta )/( 1.0 + Zeta/REAL(h,SiKi) )


CASE DEFAULT
Expand Down
2 changes: 1 addition & 1 deletion modules/seastate/src/Waves2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ typedef Waves2/Waves2 InitInputType INTEGER UnSum

typedef ^ ^ ReKi Gravity - - - "Gravitational acceleration" (m/s^2)
typedef ^ ^ ReKi WtrDens - - - "Water density" (kg/m^3)
typedef ^ ^ SiKi WtrDpth - - - "Water depth" (meters)
typedef ^ ^ ReKi WtrDpth - - - "Water depth" (meters)

typedef ^ ^ INTEGER NStepWave - - - "Total number of frequency components = total number of time steps in the incident wave" -
typedef ^ ^ INTEGER NStepWave2 - - - "NStepWave / 2" -
Expand Down
4 changes: 2 additions & 2 deletions modules/seastate/src/Waves2_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ MODULE Waves2_Types
INTEGER(IntKi) :: UnSum !< The unit number for the HydroDyn summary file [-]
REAL(ReKi) :: Gravity !< Gravitational acceleration [(m/s^2)]
REAL(ReKi) :: WtrDens !< Water density [(kg/m^3)]
REAL(SiKi) :: WtrDpth !< Water depth [(meters)]
REAL(ReKi) :: WtrDpth !< Water depth [(meters)]
INTEGER(IntKi) :: NStepWave !< Total number of frequency components = total number of time steps in the incident wave [-]
INTEGER(IntKi) :: NStepWave2 !< NStepWave / 2 [-]
REAL(SiKi) :: WaveDOmega !< Frequency step for incident wave calculations [(rad/s)]
Expand Down Expand Up @@ -661,7 +661,7 @@ SUBROUTINE Waves2_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat,
Re_Xferred = Re_Xferred + 1
OutData%WtrDens = ReKiBuf(Re_Xferred)
Re_Xferred = Re_Xferred + 1
OutData%WtrDpth = REAL(ReKiBuf(Re_Xferred), SiKi)
OutData%WtrDpth = ReKiBuf(Re_Xferred)
Re_Xferred = Re_Xferred + 1
OutData%NStepWave = IntKiBuf(Int_Xferred)
Int_Xferred = Int_Xferred + 1
Expand Down

0 comments on commit 8d914b1

Please sign in to comment.